This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug translator/10300] New: Provide more macros for embedded-C functions


It might be nice to have a convenience macro in embedded-C functions which sets
the return value and exits the function.  This would be specialized to the
return type of the function, basically:

  long:
  #define RETURN(val) THIS->__retvalue = (val), goto out

  string:
  #define RETURN(val) strlcpy(THIS->__retvalue, (val), MAXSTRINGLEN), goto out

  no return value:
  #define RETURN() goto out


Similarly, for signaling errors/warnings we may want:

  #define ERROR(...) \
    snprintf(CONTEXT->error_buffer, MAXSTRINGLEN, __VA_ARGS__), \
    CONTEXT->last_error = CONTEXT->error_buffer, goto out

  #define WARN(...) \
    snprintf(CONTEXT->error_buffer, MAXSTRINGLEN, __VA_ARGS__), \
    _stp_warn(CONTEXT->error_buffer)


Thoughts?

-- 
           Summary: Provide more macros for embedded-C functions
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: translator
        AssignedTo: systemtap at sources dot redhat dot com
        ReportedBy: jistone at redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=10300

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]