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:
diff --git a/xen/include/xen/config.h b/xen/include/xen/config.h
index d888b2314daf..12e99c6dded4 100644
--- a/xen/include/xen/config.h
+++ b/xen/include/xen/config.h
@@ -26,7 +26,7 @@
#include
-#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