This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[Bug translator/10300] New: Provide more macros for embedded-C functions
- From: "jistone at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: systemtap at sources dot redhat dot com
- Date: 19 Jun 2009 00:39:00 -0000
- Subject: [Bug translator/10300] New: Provide more macros for embedded-C functions
- Reply-to: sourceware-bugzilla at sourceware dot org
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.