[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH 04/13] xen/x86: address violations of MISRA C:2012 Directive 4.10


  • To: Simone Ballarin <simone.ballarin@xxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 29 Aug 2023 15:21:36 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ADMBT2CfXTCS0oltmguZ2qFM0oHS+oAn1EJKZfafymw=; b=WCsrGv834X9hJDfl0DkNgA8qzTp/pXiQGS7plucB3pDYpcjQVyNzfAFRI/jF1KFmCa6EjYPfeYsw2GKfMO1LqdvKp6inEWrT34U68Q8fGt6ncM6oezRZjciaMvzFErmzE4HRqJFU23H6ahJYBmc11pf3o/Ij3NiuAN4t+qRdibsDvNabIqbG8qqDqDS8uUrvitS0CblD91cSvgNRLLw4mXcI/45xJKcIDX2dCpQH/mfCUwtl+vOM7vCGSb/08xeFUB+8lXHdkBj6zaQQCiWYiNWuPcNJgL2912tQkGlI9o3pb+24BDxf3ByL63d0dkJ02ugxdIO4eT4tnqSxPsk09A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BQc+kCELDBM4YQJLELNjrP5r5oJKvc93DI9/RtVICgW2DXyizuK08BwDK/fafvDu0lllDJqLsc9MYuXo2YnbJQA4rZmo5Fxu0g4tfvY0yiLskCvrvmbPl5UxeRz2p1Imbk1XCuTHb+byI9kxJqe/SlYT5dXkPMRvn1nIfFJHgyON7Npeq0NEzCGiNIqbW242Vdqe0BdtcTdXYbYIkHkfJR9AK17Zi8TSKlolRZdTPVz4jNlchuAo/G0VZnZNC5Q4OBrqwa2GQb8QLMP2YUdb+NslTgOoHxUM6d6G2g4F/7/v8HbwhiptI3BRtTXalH109v31DIGbOckSYniRk5qFhg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: consulting@xxxxxxxxxxx, sstabellini@xxxxxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 29 Aug 2023 13:21:45 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 28.08.2023 15:20, Simone Ballarin wrote:
> Add or move inclusion guards to address violations of
> MISRA C:2012 Directive 4.10 ("Precautions shall be taken in order
> to prevent the contents of a header file being included more than
> once").
> 
> Inclusion guards must appear at the beginning of the headers
> (comments are permitted anywhere).
> 
> Also C files, if included somewhere, need to comply with the guideline.
> 
> Mechanical change.
> 
> Signed-off-by: Simone Ballarin <simone.ballarin@xxxxxxxxxxx>
> ---
>  xen/arch/x86/Makefile                  | 8 ++++----
>  xen/arch/x86/cpu/cpu.h                 | 5 +++++
>  xen/arch/x86/physdev.c                 | 4 ++++
>  xen/arch/x86/platform_hypercall.c      | 5 +++++
>  xen/arch/x86/x86_64/compat/mm.c        | 5 +++++
>  xen/arch/x86/x86_64/mmconfig.h         | 5 +++++
>  xen/arch/x86/x86_emulate/private.h     | 5 +++++
>  xen/arch/x86/x86_emulate/x86_emulate.c | 5 +++++
>  8 files changed, 38 insertions(+), 4 deletions(-)

Considering that the description talks of header files alone, there's a
lot of non-header-file churn here.

> --- a/xen/arch/x86/Makefile
> +++ b/xen/arch/x86/Makefile
> @@ -259,17 +259,17 @@ $(objtree)/arch/x86/include/asm/asm-macros.h: 
> $(obj)/asm-macros.i $(src)/Makefil
>       $(call filechk,asm-macros.h)
>  
>  define filechk_asm-macros.h
> +    echo '#ifndef __ASM_MACROS_H__'; \
> +    echo '#define __ASM_MACROS_H__'; \
>      echo '#if 0'; \
>      echo '.if 0'; \
>      echo '#endif'; \
> -    echo '#ifndef __ASM_MACROS_H__'; \
> -    echo '#define __ASM_MACROS_H__'; \
>      echo 'asm ( ".include \"$@\"" );'; \
> -    echo '#endif /* __ASM_MACROS_H__ */'; \
>      echo '#if 0'; \
>      echo '.endif'; \
>      cat $<; \
> -    echo '#endif'
> +    echo '#endif'; \
> +    echo '#endif /* __ASM_MACROS_H__ */'
>  endef

Can you please explain why this needs adjustment? While I think things
are going to be okay with the adjustment, this dual C and assembler
construct would imo better be left alone. Plus as per context found in
patch 2, aren't generated headers excluded anyway?

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.