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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |preprocessor
           Keywords|                            |needs-bisection
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2024-12-10

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>C++ front-end handles this as expected.
Well no it does not, just the definition of assert is different between the 2.



With this definition of assert we get the warning twice for both the C and C++
front-ends starting in GCC 12:
```
void m1(const char*,...);

#define assert(expr) ((void) sizeof ((expr)), \
 __extension__ ({ (expr) ; }))

#define SPI1_HOST 1
#define SPI_HOST  _Pragma ("GCC warning \"222\"")  SPI1_HOST


int foo(int host_id);

void m(void) {
    assert(foo(SPI_HOST));
}
```

Though I am not 100% sure if getting it twice is wrong since expr is listed
twice only in the sizeof expression and once inside the statement expression.

Reply via email to