diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2010-12-09 16:04:52 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2010-12-13 16:25:59 -0800 |
commit | e5604f04482350eb922a31ad4342aab91ab3b412 (patch) | |
tree | e5cfcf38271e977d8cae8f2be3e3f4e9aa10753a | |
parent | d25f90fe260f546cdea0ec2ebc84df446eef5f47 (diff) |
Enable gcc attribute(__format__) on gcc versions older than 4.0
Enabled on 2.3 and up, since that's where it's available according to
http://www.ohse.de/uwe/articles/gcc-attributes.html#func-format
Tested with gcc 3.4.3 on Solaris.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
-rw-r--r-- | Xfuncproto.h.in | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Xfuncproto.h.in b/Xfuncproto.h.in index 0177119..b624956 100644 --- a/Xfuncproto.h.in +++ b/Xfuncproto.h.in @@ -77,10 +77,8 @@ in this Software without prior written authorization from The Open Group. #if defined(__GNUC__) && (__GNUC__ >= 4) # define _X_SENTINEL(x) __attribute__ ((__sentinel__(x))) -# define _X_ATTRIBUTE_PRINTF(x,y) __attribute__((__format__(__printf__,x,y))) #else # define _X_SENTINEL(x) -# define _X_ATTRIBUTE_PRINTF(x,y) #endif /* GNUC >= 4 */ #if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__CYGWIN__) @@ -124,4 +122,10 @@ in this Software without prior written authorization from The Open Group. # define _X_NORETURN #endif /* GNUC */ +#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 203) +# define _X_ATTRIBUTE_PRINTF(x,y) __attribute__((__format__(__printf__,x,y))) +#else /* not gcc >= 2.3 */ +# define _X_ATTRIBUTE_PRINTF(x,y) +#endif + #endif /* _XFUNCPROTO_H_ */ |