https://github.com/EliaGeretto created 
https://github.com/llvm/llvm-project/pull/183107

This commit ensures that `-Wgnu-statement-expression-from-macro-expansion` is 
not triggered when `ptrauth.h` is included, but pointer authentication is not 
available.

>From 6030db67db89cc06cbb1e90eef7e5ffa4ba25fbc Mon Sep 17 00:00:00 2001
From: Elia Geretto <[email protected]>
Date: Tue, 24 Feb 2026 18:15:17 +0100
Subject: [PATCH] [PAC][Headers] Silence warnings in ptrauth.h macro expansions

This commit ensures that -Wgnu-statement-expression-from-macro-expansion
is not triggered when ptrauth.h is included, but pointer authentication
is not available.
---
 clang/lib/Headers/ptrauth.h | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/clang/lib/Headers/ptrauth.h b/clang/lib/Headers/ptrauth.h
index 4650fb4722a8c..af94168c35fb7 100644
--- a/clang/lib/Headers/ptrauth.h
+++ b/clang/lib/Headers/ptrauth.h
@@ -352,27 +352,27 @@ typedef __UINTPTR_TYPE__ ptrauth_generic_signature_t;
 #else
 
 #define ptrauth_strip(__value, __key)                                          
\
-  ({                                                                           
\
+  __extension__({                                                              
\
     (void)__key;                                                               
\
     __value;                                                                   
\
   })
 
 #define ptrauth_blend_discriminator(__pointer, __integer)                      
\
-  ({                                                                           
\
+  __extension__({                                                              
\
     (void)__pointer;                                                           
\
     (void)__integer;                                                           
\
     ((ptrauth_extra_data_t)0);                                                 
\
   })
 
 #define ptrauth_sign_constant(__value, __key, __data)                          
\
-  ({                                                                           
\
+  __extension__({                                                              
\
     (void)__key;                                                               
\
     (void)__data;                                                              
\
     __value;                                                                   
\
   })
 
 #define ptrauth_sign_unauthenticated(__value, __key, __data)                   
\
-  ({                                                                           
\
+  __extension__({                                                              
\
     (void)__key;                                                               
\
     (void)__data;                                                              
\
     __value;                                                                   
\
@@ -380,7 +380,7 @@ typedef __UINTPTR_TYPE__ ptrauth_generic_signature_t;
 
 #define ptrauth_auth_and_resign(__value, __old_key, __old_data, __new_key,     
\
                                 __new_data)                                    
\
-  ({                                                                           
\
+  __extension__({                                                              
\
     (void)__old_key;                                                           
\
     (void)__old_data;                                                          
\
     (void)__new_key;                                                           
\
@@ -390,7 +390,7 @@ typedef __UINTPTR_TYPE__ ptrauth_generic_signature_t;
 
 #define ptrauth_auth_load_relative_and_sign(__value, __old_key, __old_data,    
\
                                             __new_key, __new_data, __offset)   
\
-  ({                                                                           
\
+  __extension__({                                                              
\
     (void)__old_key;                                                           
\
     (void)__old_data;                                                          
\
     (void)__new_key;                                                           
\
@@ -400,21 +400,21 @@ typedef __UINTPTR_TYPE__ ptrauth_generic_signature_t;
   })
 
 #define ptrauth_auth_function(__value, __old_key, __old_data)                  
\
-  ({                                                                           
\
+  __extension__({                                                              
\
     (void)__old_key;                                                           
\
     (void)__old_data;                                                          
\
     __value;                                                                   
\
   })
 
 #define ptrauth_auth_data(__value, __old_key, __old_data)                      
\
-  ({                                                                           
\
+  __extension__({                                                              
\
     (void)__old_key;                                                           
\
     (void)__old_data;                                                          
\
     __value;                                                                   
\
   })
 
 #define ptrauth_string_discriminator(__string)                                 
\
-  ({                                                                           
\
+  __extension__({                                                              
\
     (void)__string;                                                            
\
     ((ptrauth_extra_data_t)0);                                                 
\
   })
@@ -424,13 +424,12 @@ typedef __UINTPTR_TYPE__ ptrauth_generic_signature_t;
   ((ptrauth_extra_data_t)0)
 
 #define ptrauth_sign_generic_data(__value, __data)                             
\
-  ({                                                                           
\
+  __extension__({                                                              
\
     (void)__value;                                                             
\
     (void)__data;                                                              
\
     ((ptrauth_generic_signature_t)0);                                          
\
   })
 
-
 #define ptrauth_cxx_vtable_pointer(key, address_discrimination,                
\
                                    extra_discrimination...)
 

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to