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

Re: [PATCH 14/17] xen: add SAF deviation for MISRA C Dir 4.10



On Wed, 3 Jul 2024, Jan Beulich wrote:
> public/x86: don't include common xen.h from arch-specific one
> 
> No other arch-*.h does so, and arch-x86/xen.h really just takes the role
> of arch-x86_32.h and arch-x86_64.h (by those two forwarding there). With
> xen.h itself including the per-arch headers, doing so is also kind of
> backwards anyway, and just calling for problems. There's exactly one
> place where arch-x86/xen.h is included when really xen.h is meant (for
> wanting XEN_GUEST_HANDLE_64() to be made available, the default
> definition of which lives in the common xen.h).
> 
> This then addresses a violation 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").
> 
> Reported-by: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>


> --- a/xen/include/public/arch-x86/xen.h
> +++ b/xen/include/public/arch-x86/xen.h
> @@ -7,8 +7,6 @@
>   * Copyright (c) 2004-2006, K A Fraser
>   */
>  
> -#include "../xen.h"
> -
>  #ifndef __XEN_PUBLIC_ARCH_X86_XEN_H__
>  #define __XEN_PUBLIC_ARCH_X86_XEN_H__
>  
> --- a/xen/include/xen/lib/x86/cpu-policy.h
> +++ b/xen/include/xen/lib/x86/cpu-policy.h
> @@ -525,7 +525,7 @@ void x86_cpu_policy_bound_max_leaves(str
>  void x86_cpu_policy_shrink_max_leaves(struct cpu_policy *p);
>  
>  #ifdef __XEN__
> -#include <public/arch-x86/xen.h>
> +#include <public/xen.h>
>  typedef XEN_GUEST_HANDLE_64(xen_cpuid_leaf_t) cpuid_leaf_buffer_t;
>  typedef XEN_GUEST_HANDLE_64(xen_msr_entry_t) msr_entry_buffer_t;
>  #else
> 
> 



 


Rackspace

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