This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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]

[PATCH] machine/setjmp.h: Use __extension__ keyword for gcc's braced-groups


Description:

In libc/include/machine/setjmp.h sigsetjmp and siglongjmp are implemented
using gcc's "({ ... })" extension when __GNUC__ is defined. When compiling
with -pedantic this generates a warning message. Putting the __extension__
keyword before the parenthesis suppresses the warning.

How-To-Repeat:

Compiling the following code with "cc -c -pedantic"

#include <setjmp.h>

int main(int argc, char **argv)
{
 sigjmp_buf buf;

 sigsetjmp(buf, 1);
 siglongjmp(buf, 1);
 return 0;
}

generates the following warnings:

foo.c:7: warning: ISO C forbids braced-groups within expressions
foo.c:8: warning: ISO C forbids braced-groups within expressions

Fix:


2006-10-11 Yang Tse <yangsita@gmail.com>


* setjmp.h: Use __extension__ keyword for gcc's braced-groups.


Index: newlib/libc/include/machine/setjmp.h =================================================================== RCS file: /cvs/src/src/newlib/libc/include/machine/setjmp.h,v retrieving revision 1.28 diff -u -r1.28 setjmp.h --- newlib/libc/include/machine/setjmp.h 16 Aug 2006 21:39:43 -0000 1.28 +++ newlib/libc/include/machine/setjmp.h 11 Oct 2006 03:20:33 -0000 @@ -257,6 +257,7 @@ #if defined(__GNUC__)

#define sigsetjmp(env, savemask) \
+            __extension__ \
            ({ \
              sigjmp_buf *_sjbuf = &(env); \
              ((*_sjbuf)[_SAVEMASK] = savemask,\
@@ -265,6 +266,7 @@
            })

#define siglongjmp(env, val) \
+            __extension__ \
            ({ \
              sigjmp_buf *_sjbuf = &(env); \
              ((((*_sjbuf)[_SAVEMASK]) ? \


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