All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alessandro Zucchelli <alessandro.zucchelli@bugseng.com>
To: Stefano Stabellini <sstabellini@kernel.org>
Cc: xen-devel@lists.xenproject.org, consulting@bugseng.com,
	Maria Celeste Cesario <maria.celeste.cesario@bugseng.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Jan Beulich <jbeulich@suse.com>, Julien Grall <julien@xen.org>
Subject: Re: [XEN PATCH v5 12/17] xen: address violations of MISRA C:2012 Directive 4.10
Date: Wed, 24 Jul 2024 15:26:42 +0200	[thread overview]
Message-ID: <5350aa753d36f8fccc3bb32b30828f40@bugseng.com> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2407231528040.4857@ubuntu-linux-20-04-desktop>

On 2024-07-24 00:29, Stefano Stabellini wrote:
> On Tue, 23 Jul 2024, Alessandro Zucchelli wrote:
>> From: Maria Celeste Cesario <maria.celeste.cesario@bugseng.com>
>> 
>> Modify creation rule for asm-offsets.h to conform to
>> the new standard and to not generate conflicting guards
>> between architectures (which is a violation of the directive).
>> Modify generic-y creation rule to generate code without violations
>> and to conform to the new standard.
>> 
>> Mechanical change.
>> 
>> Signed-off-by: Maria Celeste Cesario  
>> <maria.celeste.cesario@bugseng.com>
>> Signed-off-by: Simone Ballarin  <simone.ballarin@bugseng.com>
>> Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
>> Signed-off-by: Alessandro Zucchelli <alessandro.zucchelli@bugseng.com>
> 
> I know I gave my Reviewed-by already but I have a question below...
> 
> 
>> ---
>> Changes in v5:
>> - edit inclusion guards of autogenerated files
>> Commit introduced in v3
>> ---
>>  xen/build.mk                     | 7 ++++---
>>  xen/scripts/Makefile.asm-generic | 8 +++++++-
>>  2 files changed, 11 insertions(+), 4 deletions(-)
>> 
>> diff --git a/xen/build.mk b/xen/build.mk
>> index 0f490ca71b..32624d3097 100644
>> --- a/xen/build.mk
>> +++ b/xen/build.mk
>> @@ -47,6 +47,7 @@ asm-offsets.s: arch/$(SRCARCH)/$(ARCH)/asm-offsets.c
>> 
>>  arch/$(SRCARCH)/include/asm/asm-offsets.h: asm-offsets.s
>>  	@(set -e; \
>> +	  guard=$$(echo ASM__${SRCARCH}__ASM_OFFSETS_H | tr a-z A-Z); \
>>  	  echo "/*"; \
>>  	  echo " * DO NOT MODIFY."; \
>>  	  echo " *"; \
>> @@ -54,12 +55,12 @@ arch/$(SRCARCH)/include/asm/asm-offsets.h: 
>> asm-offsets.s
>>  	  echo " *"; \
>>  	  echo " */"; \
>>  	  echo ""; \
>> -	  echo "#ifndef __ASM_OFFSETS_H__"; \
>> -	  echo "#define __ASM_OFFSETS_H__"; \
>> +	  echo "#ifndef $$guard"; \
>> +	  echo "#define $$guard"; \
>>  	  echo ""; \
>>  	  sed -rne "/^[^#].*==>/{s:.*==>(.*)<==.*:\1:; s: [\$$#]: :; p;}"; \
>>  	  echo ""; \
>> -	  echo "#endif") <$< >$@
>> +	  echo "#endif /* $$guard */") <$< >$@
>> 
>>  build-dirs := $(patsubst %/built_in.o,%,$(filter 
>> %/built_in.o,$(ALL_OBJS) $(ALL_LIBS)))
>> 
>> diff --git a/xen/scripts/Makefile.asm-generic 
>> b/xen/scripts/Makefile.asm-generic
>> index b0d356bfa3..2d2fd9f76e 100644
>> --- a/xen/scripts/Makefile.asm-generic
>> +++ b/xen/scripts/Makefile.asm-generic
>> @@ -32,7 +32,13 @@ old-headers := $(wildcard $(obj)/*.h)
>>  unwanted    := $(filter-out $(generic-y) 
>> $(generated-y),$(old-headers))
>> 
>>  quiet_cmd_wrap = WRAP    $@
>> -      cmd_wrap = echo "\#include <asm-generic/$*.h>" > $@
>> +cmd_wrap = \
>> +    guard=$$(echo ASM_GENERIC__${SRCARCH}__$*_H | tr a-z A-Z); \
> 
> Shouldn't this be: ASM_GENERIC__$*_H  according to the coding style?

Yes, you are right, this slipped through.

>> +    echo "\#ifndef $$guard" >$@.new; \
>> +    echo "\#define $$guard" >>$@.new; \
>> +    echo "\#include <asm-generic/$*.h>" >>$@.new; \
>> +    echo "\#endif /* $$guard */" >>$@.new; \
>> +    mv -f $@.new $@
>> 
>>  quiet_cmd_remove = REMOVE  $(unwanted)
>>        cmd_remove = rm -f $(unwanted)
>> --
>> 2.34.1
>> 

-- 
Alessandro Zucchelli, B.Sc.

Software Engineer, BUGSENG (https://bugseng.com)


  reply	other threads:[~2024-07-24 13:26 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-23  8:14 [XEN PATCH v5 00/17] xen: address violation of MISRA C:2012 Directive 4.10 Alessandro Zucchelli
2024-07-23  8:14 ` [XEN PATCH v5 01/17] misra: add deviation for headers that explicitly avoid guards Alessandro Zucchelli
2024-07-23 22:10   ` Stefano Stabellini
2024-07-23  8:14 ` [XEN PATCH v5 02/17] misra: modify deviations for empty and generated headers Alessandro Zucchelli
2024-07-23  8:14 ` [XEN PATCH v5 03/17] misra: add deviations for direct inclusion guards Alessandro Zucchelli
2024-07-23  8:14 ` [XEN PATCH v5 04/17] xen/arm: address violations of MISRA C:2012 Directive 4.10 Alessandro Zucchelli
2024-07-23  8:14 ` [XEN PATCH v5 05/17] xen/x86: " Alessandro Zucchelli
2024-07-24 15:53   ` Jan Beulich
2024-07-23  8:14 ` [XEN PATCH v5 06/17] x86/EFI: " Alessandro Zucchelli
2024-07-23  8:14 ` [XEN PATCH v5 07/17] xen/common: " Alessandro Zucchelli
2024-07-23  8:15 ` [XEN PATCH v5 08/17] xen/efi: " Alessandro Zucchelli
2024-07-23  8:15 ` [XEN PATCH v5 09/17] xen: " Alessandro Zucchelli
2024-07-24 15:55   ` Jan Beulich
2024-07-23  8:15 ` [XEN PATCH v5 10/17] x86/asm: " Alessandro Zucchelli
2024-07-23 22:19   ` Stefano Stabellini
2024-07-24 15:57   ` Jan Beulich
2024-07-23  8:15 ` [XEN PATCH v5 11/17] xen/arm: " Alessandro Zucchelli
2024-07-23  8:15 ` [XEN PATCH v5 12/17] xen: " Alessandro Zucchelli
2024-07-23 22:26   ` Stefano Stabellini
2024-07-23 22:29   ` Stefano Stabellini
2024-07-24 13:26     ` Alessandro Zucchelli [this message]
2024-07-23  8:15 ` [XEN PATCH v5 13/17] xen: add deviations for MISRA C 2012 Dir D4.10 Alessandro Zucchelli
2024-07-30  9:45   ` Jan Beulich
2024-07-30  9:54     ` Nicola Vetrini
2024-07-23  8:15 ` [XEN PATCH v5 14/17] xen/x86: rename inclusion guards for consistency Alessandro Zucchelli
2024-07-24 15:59   ` Jan Beulich
2024-07-23  8:15 ` [XEN PATCH v5 15/17] xen/build: address violation of MISRA C Directive 4.10 Alessandro Zucchelli
2024-07-23 22:31   ` Stefano Stabellini
2024-07-23  8:15 ` [XEN PATCH v5 16/17] CODING_STYLE: Add a section on header guards naming conventions Alessandro Zucchelli
2024-07-23  8:43   ` Jan Beulich
2024-07-23 22:40     ` Stefano Stabellini
2024-07-24  5:46       ` Jan Beulich
2024-07-24 22:14         ` Stefano Stabellini
2024-07-23  8:15 ` [XEN PATCH v5 17/17] include/asm-generic: rename inclusion guards for consistency Alessandro Zucchelli
2024-07-23 22:44   ` Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5350aa753d36f8fccc3bb32b30828f40@bugseng.com \
    --to=alessandro.zucchelli@bugseng.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=consulting@bugseng.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=maria.celeste.cesario@bugseng.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.