Skip to contentSkip to conversation

xen/compiler: Clang 14 and later understands attribute((error))

PATCH In review Andrew Cooper 2 participants 2 messages Feb 23, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/compiler: Clang 14 and later understands attribute((error))

Adjust the ifdefary for nocall.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>

---
 xen/include/xen/compiler.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/include/xen/compiler.h +1 -1
index a5631303348b..7d7ae2e5e4d9 100644
@@ -31,7 +31,7 @@
 
 #define __weak        __attribute__((__weak__))
 
-#if !defined(__clang__)
+#if !CONFIG_CC_IS_CLANG || CONFIG_CLANG_VERSION >= 140000
 # define nocall       __attribute__((__error__("Nonstandard ABI")))
 #else
 # define nocall
Signature · 1 line
2.30.2
Reviewed-by on v1 1/1
#1 lore raw

xen/include/xen/compiler.h line 34

Quoted 8 lines · Andrew Cooper
xen/include/xen/compiler.h +1 -1
@@ -31,7 +31,7 @@
 
 #define __weak        __attribute__((__weak__))
 
-#if !defined(__clang__)
+#if !CONFIG_CC_IS_CLANG || CONFIG_CLANG_VERSION >= 140000

Hmm, for the sake of getting the functional change in,

but this clearly is against the Kconfig usage proposal: Following that, such conditionals should not reference CONFIG_*, as the .config may have been generated not only with a different Clang version, but also with gcc instead of Clang. While there were a couple of comments, no counter proposal appeared so far, there was one explicit agreement with the proposal, and the requested patch demonstrating the intentions wasn't commented on either. One might conclude that as per our lazy consensus approach the proposal holds, and no such new uses violating its principles should be introduced. The more that the same can easily be expressed differently.

Jan