Message ID | e5d9700d6ca237aed64ad11a9025a71a6fd3e792.1693228255.git.simone.ballarin@bugseng.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | address violations of MISRA C:2012 Directive 4.10 | expand |
On Mon, 28 Aug 2023, Simone Ballarin wrote: > Add 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"). > > Mechanical change. > > Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> > --- > xen/arch/x86/efi/efi-boot.h | 6 ++++++ > xen/arch/x86/efi/runtime.h | 5 +++++ > 2 files changed, 11 insertions(+) > > diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h > index 92f4cfe8bd..2c6be062cc 100644 > --- a/xen/arch/x86/efi/efi-boot.h > +++ b/xen/arch/x86/efi/efi-boot.h > @@ -3,6 +3,10 @@ > * is intended to be included by common/efi/boot.c _only_, and > * therefore can define arch specific global variables. > */ > + > +#ifndef __X86_EFI_EFI_BOOT_H__ > +#define __X86_EFI_EFI_BOOT_H__ > + > #include <xen/vga.h> > #include <asm/e820.h> > #include <asm/edd.h> > @@ -913,6 +917,8 @@ void __init efi_multiboot2(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable > efi_exit_boot(ImageHandle, SystemTable); > } > > +#endif /* __X86_EFI_EFI_BOOT_H__ */ > + > /* > * Local variables: > * mode: C > diff --git a/xen/arch/x86/efi/runtime.h b/xen/arch/x86/efi/runtime.h > index 77866c5f21..10b36bcb89 100644 > --- a/xen/arch/x86/efi/runtime.h > +++ b/xen/arch/x86/efi/runtime.h > @@ -1,3 +1,6 @@ > +#ifndef __X86_EFI_RUNTIME_H__ > +#define __X86_EFI_RUNTIME_H__ > + > #include <xen/domain_page.h> > #include <xen/mm.h> > #include <asm/atomic.h> > @@ -17,3 +20,5 @@ void efi_update_l4_pgtable(unsigned int l4idx, l4_pgentry_t l4e) > } > } > #endif > + > +#endif /* __X86_EFI_RUNTIME_H__ */ > -- > 2.34.1 >
On 28.08.2023 15:20, Simone Ballarin wrote: > Add 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"). > > Mechanical change. > > Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com> > --- > xen/arch/x86/efi/efi-boot.h | 6 ++++++ > xen/arch/x86/efi/runtime.h | 5 +++++ > 2 files changed, 11 insertions(+) > > diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h > index 92f4cfe8bd..2c6be062cc 100644 > --- a/xen/arch/x86/efi/efi-boot.h > +++ b/xen/arch/x86/efi/efi-boot.h > @@ -3,6 +3,10 @@ > * is intended to be included by common/efi/boot.c _only_, and > * therefore can define arch specific global variables. > */ > + > +#ifndef __X86_EFI_EFI_BOOT_H__ > +#define __X86_EFI_EFI_BOOT_H__ Considering the comment, I find the need for a guard here quite "interesting", to be honest. Jan
On 29/08/23 15:27, Jan Beulich wrote: > On 28.08.2023 15:20, Simone Ballarin wrote: >> Add 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"). >> >> Mechanical change. >> >> Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com> >> --- >> xen/arch/x86/efi/efi-boot.h | 6 ++++++ >> xen/arch/x86/efi/runtime.h | 5 +++++ >> 2 files changed, 11 insertions(+) >> >> diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h >> index 92f4cfe8bd..2c6be062cc 100644 >> --- a/xen/arch/x86/efi/efi-boot.h >> +++ b/xen/arch/x86/efi/efi-boot.h >> @@ -3,6 +3,10 @@ >> * is intended to be included by common/efi/boot.c _only_, and >> * therefore can define arch specific global variables. >> */ >> + >> +#ifndef __X86_EFI_EFI_BOOT_H__ >> +#define __X86_EFI_EFI_BOOT_H__ > > Considering the comment, I find the need for a guard here quite > "interesting", to be honest. > > Jan I don't think a simple comment is enough to say that "precautions have been taken". For the moment, I will drop this change to keep this patch going.
diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h index 92f4cfe8bd..2c6be062cc 100644 --- a/xen/arch/x86/efi/efi-boot.h +++ b/xen/arch/x86/efi/efi-boot.h @@ -3,6 +3,10 @@ * is intended to be included by common/efi/boot.c _only_, and * therefore can define arch specific global variables. */ + +#ifndef __X86_EFI_EFI_BOOT_H__ +#define __X86_EFI_EFI_BOOT_H__ + #include <xen/vga.h> #include <asm/e820.h> #include <asm/edd.h> @@ -913,6 +917,8 @@ void __init efi_multiboot2(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable efi_exit_boot(ImageHandle, SystemTable); } +#endif /* __X86_EFI_EFI_BOOT_H__ */ + /* * Local variables: * mode: C diff --git a/xen/arch/x86/efi/runtime.h b/xen/arch/x86/efi/runtime.h index 77866c5f21..10b36bcb89 100644 --- a/xen/arch/x86/efi/runtime.h +++ b/xen/arch/x86/efi/runtime.h @@ -1,3 +1,6 @@ +#ifndef __X86_EFI_RUNTIME_H__ +#define __X86_EFI_RUNTIME_H__ + #include <xen/domain_page.h> #include <xen/mm.h> #include <asm/atomic.h> @@ -17,3 +20,5 @@ void efi_update_l4_pgtable(unsigned int l4idx, l4_pgentry_t l4e) } } #endif + +#endif /* __X86_EFI_RUNTIME_H__ */
Add 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"). Mechanical change. Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com> --- xen/arch/x86/efi/efi-boot.h | 6 ++++++ xen/arch/x86/efi/runtime.h | 5 +++++ 2 files changed, 11 insertions(+)