MISRA and -Wextra-semi
Hi,
Based on a call a long while back, I experimented with -Wextra-semi. This is what lead to 8e36c668ca107 "xen: Drop superfluous semi-colons".
However, there are a number of problems with getting this working fully. First, we need workarounds like this:
xen/include/xen/config.h +0 -0
@@ -26,7 +26,7 @@
#include <asm/config.h>
-#define EXPORT_SYMBOL(var)
+#define EXPORT_SYMBOL(var) typedef int var##_ignore_t
/*
* The following log levels are as follows:
to avoid a failure for users, which do legitimately have a semi-colon. It occurs to me that we could swap the typedef for as asm("") which might be a little less unpleasant.
But with the simple cases taken care of, we then hit:
In file included from common/grant_table.c:3813:common/compat/grant_table.c:10:1: error: extra ';' outside of a function [-Werror,-Wextra-semi]CHECK_grant_entry_v1;
^
which is quickly starting to unravel.
Finally, while Clang does have -Wextra-semi working properly for C, GCC does this:
cc1: warning: command-line option ‘-Wextra-semi’ is valid for C++/ObjC++ but not for C
instead, which passes the cc-option-add check (which doesn't contain -Werror), but causes the real build to fail.
So, while -Wextra-semi is definitely useful to find some hidden problems, it seems like using it fully might be very complicated. How much do we care?
~Andrew
Quoted 3 lines · Andrew Cooper
So, while -Wextra-semi is definitely useful to find some hidden problems, it seems like using it fully might be very complicated. How much do we care?
I'll let Roberto confirm, but I wouldn't think -Wextra-semi is high priority
Quoted 16 lines · Andrew Cooper
Hi,
Based on a call a long while back, I experimented with -Wextra-semi. This is what lead to
8e36c668ca107"xen: Drop superfluous semi-colons".However, there are a number of problems with getting this working fully. First, we need workarounds like this:
xen/include/xen/config.h +0
-0@@ -26,7 +26,7 @@
#include <asm/config.h>
xen/include/xen/config.h
Quoted 2 lines
xen/include/xen/config.h +1
-1-#define EXPORT_SYMBOL (var) +#define EXPORT_SYMBOL (var) typedef int var##_ignore_t
For this specifically, could we perhaps finally get rid of most (all?) EXPORT_SYMBOL()? If not all, then at least as far as permitting the stub #define to be moved to linux-compat.h?
Jan