https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78539

            Bug ID: 78539
           Summary: feature request: __noextension__
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jim at meyering dot net
  Target Milestone: ---

Please consider adding a __noextension__(...) operator.

If we had a __noextension__(...) operator to counteract the effect of a
preceding __extension__(...), I could write this in glibc's definition of
assert:

     #define assert(expr) \
        __extension__ ({ \
            if (__noextension__ (expr)) \
               ; \
            else
               __assert_failed (...); \
            (void)0; \
       })

Without that, I have to resort to using two cases: one for __STRICT_ANSI__
and one without, so that gcc -Wpedantic can still reliably diagnose "assert(
({1;}) );"

This was first suggested in https://gcc.gnu.org/ml/gcc/2001-04/msg00642.html

If you do add this, please ensure that the __noextension__(...) parentheses do
not end up suppressing the detection performed by gcc's -Wparentheses.

For reference, this came up recently in the following thread:
https://sourceware.org/ml/libc-alpha/2016-11/msg00866.html

Reply via email to