xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* MISRA and -Wextra-semi
@ 2024-04-26 11:33 Andrew Cooper
  2024-04-26 19:21 ` Stefano Stabellini
  2024-04-29  7:19 ` Jan Beulich
  0 siblings, 2 replies; 3+ messages in thread
From: Andrew Cooper @ 2024-04-26 11:33 UTC (permalink / raw)
  To: xen-devel
  Cc: Jan Beulich, Roger Pau Monné,
	Stefano Stabellini, Roberto Bagnara, consulting

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 <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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: MISRA and -Wextra-semi
  2024-04-26 11:33 MISRA and -Wextra-semi Andrew Cooper
@ 2024-04-26 19:21 ` Stefano Stabellini
  2024-04-29  7:19 ` Jan Beulich
  1 sibling, 0 replies; 3+ messages in thread
From: Stefano Stabellini @ 2024-04-26 19:21 UTC (permalink / raw)
  To: Andrew Cooper
  Cc: xen-devel, Jan Beulich, Roger Pau Monné,
	Stefano Stabellini, Roberto Bagnara, consulting

[-- Attachment #1: Type: text/plain, Size: 278 bytes --]

On Fri, 26 Apr 2024, Andrew Cooper wrote:
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: MISRA and -Wextra-semi
  2024-04-26 11:33 MISRA and -Wextra-semi Andrew Cooper
  2024-04-26 19:21 ` Stefano Stabellini
@ 2024-04-29  7:19 ` Jan Beulich
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Beulich @ 2024-04-29  7:19 UTC (permalink / raw)
  To: Andrew Cooper
  Cc: Roger Pau Monné,
	Stefano Stabellini, Roberto Bagnara, consulting, xen-devel

On 26.04.2024 13:33, Andrew Cooper wrote:
> 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 <asm/config.h>
>  
> -#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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-04-29  7:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-26 11:33 MISRA and -Wextra-semi Andrew Cooper
2024-04-26 19:21 ` Stefano Stabellini
2024-04-29  7:19 ` Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).