Issue 171461
Summary [PAC] `ptrauth.h` triggers `-Wgnu-statement-_expression_-from-macro-expansion`
Labels new issue
Assignees
Reporter EliaGeretto
    When including `ptrauth.h` without using `-fptrauth-intrinsics`, `-Wgnu-statement-_expression_-from-macro-expansion` is triggered. That warning is part of `-Wpedantic`.

The issue is caused by the use of GNU statement expressions in the following macro:
https://github.com/llvm/llvm-project/blob/6b58449b2c813588f9c251d4f0963762d6746881/clang/lib/Headers/ptrauth.h#L329-L333

A possible fix is relying on the comma operator:
```c
 #define ptrauth_strip(__value, __key)                                          \ 
 ( \ 
     (void)__key, \ 
     __value \ 
   ) 
```

Reproducer:
```c
#include <ptrauth.h>

int main(void) {
    ptrauth_strip(&main, ptrauth_key_function_pointer);
    return 0;
}
```

Build with: `clang -Wpedantic repro.c`
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to