-
Notifications
You must be signed in to change notification settings - Fork 15.6k
Open
Labels
clang:headersHeaders provided by Clang, e.g. for intrinsicsHeaders provided by Clang, e.g. for intrinsicscode-quality
Description
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:
llvm-project/clang/lib/Headers/ptrauth.h
Lines 329 to 333 in 6b58449
| #define ptrauth_strip(__value, __key) \ | |
| ({ \ | |
| (void)__key; \ | |
| __value; \ | |
| }) |
A possible fix is relying on the comma operator:
#define ptrauth_strip(__value, __key) \
( \
(void)__key, \
__value \
)Reproducer:
#include <ptrauth.h>
int main(void) {
ptrauth_strip(&main, ptrauth_key_function_pointer);
return 0;
}Build with: clang -Wpedantic repro.c
Metadata
Metadata
Assignees
Labels
clang:headersHeaders provided by Clang, e.g. for intrinsicsHeaders provided by Clang, e.g. for intrinsicscode-quality