diff mbox series

[XEN,v2,06/10] x86/EFI: address violations of MISRA C:2012 Directive 4.10

Message ID eced0ebcd8f96d87ccab0e4008e0f752121273de.1694510856.git.simone.ballarin@bugseng.com (mailing list archive)
State New, archived
Headers show
Series address violations of MISRA C:2012 Directive 4.10 | expand

Commit Message

Simone Ballarin Sept. 12, 2023, 9:36 a.m. UTC
Add inclusion guard 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>

---
Changes in v2:
- remove changes in "xen/arch/x86/efi/efi-boot.h"

Note:
Changes in efi-boot.h have been removed since the file is
intenteded to be included by common/efi/boot.c only. This motivation
is not enough to raise a deviation record, so the violation is
still present.
---
 xen/arch/x86/efi/runtime.h | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Jan Beulich Sept. 12, 2023, 10 a.m. UTC | #1
On 12.09.2023 11:36, Simone Ballarin wrote:
> --- 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__ */

Leaving aside that I remain unconvinced of the usefulness of these in
(at least some) private headers, I think there's a naming issue to be
solved first: How do we distinguish guards of headers in xen/include/
and xen/arch/*/include/ from ones living elsewhere? If we don't set
forth a rule, the guard above might be re-used in a hypothetical
xen/arch/x86/include/asm/efi/runtime.h, with potentially interesting
effects. At a first glance it might work to simply omit "component"
identifiers, i.e. just use __RUNTIME_H__ here. Provided suitable
prefixes are used in all non-private headers. But I may of course be
overlooking pitfalls ...

Jan
diff mbox series

Patch

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__ */