x86: Address violations of MISRA C:2012 and drop bool_t
PATCH 1/1 x86: Address violations of MISRA C:2012 and drop bool_t
Give a name to unnamed parameters to address violations of MISRA C:2012 Rule 8.2 ("Function types shall be in prototype form with named parameters").
Keep consistency between object and function declarations thus addressing violations of MISRA C:2012 Rule 8.3 ("All declarations of an object or function shall use the same names and type qualifiers"). Replace the occurrences of bool_t with bool.
No functional change.
--- xen/arch/x86/cpu/common.c | 6 +++--- xen/arch/x86/include/asm/processor.h | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-)
xen/arch/x86/cpu/common.c +3 -3
@@ -26,11 +26,11 @@bool __read_mostly opt_dom0_cpuid_faulting = true; -bool_t opt_arat =1 ; +bool opt_arat =1 ;boolean_param ("arat" , opt_arat);/* pku: Flag to enable Memory Protection Keys (default on). */ -static bool_t opt_pku =1 ; +static bool opt_pku =1 ;boolean_param ("pku" , opt_pku);unsigned int opt_cpuid_mask_ecx = ~0u ;
@@ -208,7 +208,7 @@ void ctxt_switch_levelling(const struct vcpu *next)alternative_vcall (ctxt_switch_masking, next); } -bool_t opt_cpu_info; +bool opt_cpu_info;boolean_param ("cpuinfo" , opt_cpu_info);int get_model_name (struct cpuinfo_x86 *c)
xen/arch/x86/include/asm/processor.h +8 -8
@@ -96,7 +96,7 @@ extern bool probe_cpuid_faulting(void);extern void ctxt_switch_levelling (const struct vcpu *next);extern void (*ctxt_switch_masking)(const struct vcpu *next); -extern bool_t opt_cpu_info; +extern bool opt_cpu_info;extern u32 trampoline_efer;extern u64 trampoline_misc_enable_off;
@@ -109,17 +109,17 @@ extern unsigned int vaddr_bits;extern const struct x86_cpu_id *x86_match_cpu (const struct x86_cpu_id table[]); -extern void identify_cpu (struct cpuinfo_x86 *); -extern void setup_clear_cpu_cap (unsigned int ); -extern void setup_force_cpu_cap (unsigned int ); -extern bool is_forced_cpu_cap (unsigned int ); +extern void identify_cpu (struct cpuinfo_x86 *c); +extern void setup_clear_cpu_cap (unsigned int cap); +extern void setup_force_cpu_cap (unsigned int cap); +extern bool is_forced_cpu_cap (unsigned int cap);extern void print_cpu_info (unsigned int cpu);extern void init_intel_cacheinfo (struct cpuinfo_x86 *c);#define cpu_to_core (_cpu) (cpu_data[_cpu].cpu_core_id)#define cpu_to_socket (_cpu) (cpu_data[_cpu].phys_proc_id) -unsigned int apicid_to_socket (unsigned int ); +unsigned int apicid_to_socket (unsigned int apicid);static inline int cpu_nr_siblings (unsigned int cpu) {
@@ -410,12 +410,12 @@ void show_registers(const struct cpu_user_regs *regs);#define dump_execution_state () \ run_in_exception_handler(show_execution_state_nonconst)void show_page_walk (unsigned long addr); -void noreturnfatal_trap (const struct cpu_user_regs *regs,bool_t show_remote); +void noreturnfatal_trap (const struct cpu_user_regs *regs,bool show_remote);extern void mtrr_ap_init (void );extern void mtrr_bp_init (void ); -void mcheck_init (struct cpuinfo_x86 *c,bool_t bsp); +void mcheck_init (struct cpuinfo_x86 *c,bool bsp);void do_nmi (const struct cpu_user_regs *regs);void do_machine_check (const struct cpu_user_regs *regs);
Signature · 1 line
2.34.1
Quoted 11 lines · Federico Serafini
Give a name to unnamed parameters to address violations of MISRA C:2012 Rule 8.2 ("Function types shall be in prototype form with named parameters").
Keep consistency between object and function declarations thus addressing violations of MISRA C:2012 Rule 8.3 ("All declarations of an object or function shall use the same names and type qualifiers"). Replace the occurrences ofbool_twith bool.No functional change.
Signed-off-by Federico Serafini <[email protected]>
Quoted 7 lines · Federico Serafini
Give a name to unnamed parameters to address violations of MISRA C:2012 Rule 8.2 ("Function types shall be in prototype form with named parameters").
Keep consistency between object and function declarations thus addressing violations of MISRA C:2012 Rule 8.3 ("All declarations of an object or function shall use the same names and type qualifiers"). Replace the occurrences ofbool_twith bool.
Hmm, I read the title as a promise that bool_t would be gone from the code base (which I couldn't really believe). Perhaps "... by replacing bool_t uses"?
Quoted 4 lines
xen/arch/x86/cpu/common.c +0
-0@@ -26,11 +26,11 @@
xen/arch/x86/cpu/common.c line 34
Quoted 10 lines
xen/arch/x86/cpu/common.c +2
-2bool __read_mostly opt_dom0_cpuid_faulting = true; -bool_t opt_arat =1 ; +bool opt_arat =1 ;boolean_param ("arat" , opt_arat);/* pku: Flag to enable Memory Protection Keys (default on). */ -static bool_t opt_pku =1 ; +static bool opt_pku =1 ;boolean_param ("pku" , opt_pku);
In both cases this also wants switching to "true". Happy to make that adjustment while committing (together with whatever adjustment to the title you'd prefer), at which point:
Jan
Quoted 9 lines · Jan Beulich
Quoted 7 lines · Federico Serafini
Give a name to unnamed parameters to address violations of MISRA C:2012 Rule 8.2 ("Function types shall be in prototype form with named parameters").
Keep consistency between object and function declarations thus addressing violations of MISRA C:2012 Rule 8.3 ("All declarations of an object or function shall use the same names and type qualifiers"). Replace the occurrences ofbool_twith bool.
Quoted 3 lines
Hmm, I read the title as a promise that
bool_twould be gone from the code base (which I couldn't really believe). Perhaps "... by replacingbool_tuses"?
Sounds good to me.
Signature · 3 lines
Federico Serafini, M.Sc. Software Engineer, BUGSENG (http://bugseng.com)
Quoted 21 lines · Federico Serafini
Give a name to unnamed parameters to address violations of MISRA C:2012 Rule 8.2 ("Function types shall be in prototype form with named parameters").
Keep consistency between object and function declarations thus addressing violations of MISRA C:2012 Rule 8.3 ("All declarations of an object or function shall use the same names and type qualifiers"). Replace the occurrences ofbool_twith bool.No functional change.
Signed-off-by Federico Serafini <[email protected]>--- xen/arch/x86/cpu/common.c | 6 +++--- xen/arch/x86/include/asm/processor.h | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-)xen/arch/x86/cpu/common.c +0
-0
xen/arch/x86/cpu/common.c line 30
Quoted 6 lines
xen/arch/x86/cpu/common.c +1
-1@@ -26,11 +26,11 @@bool __read_mostly opt_dom0_cpuid_faulting = true; -bool_t opt_arat =1 ; +bool opt_arat =1 ;boolean_param ("arat" , opt_arat);
I see this has been committed, but you do realise you've created a new violation of 8.3 by failing to change the declaration of opt_arat to be bool ?
Please everyone be more careful. There is an enormous amount of MISRA churn, and it's hard enough to deal with this when the patches are correct.
~Andrew
Quoted 33 lines · Andrew Cooper
Quoted 21 lines · Federico Serafini
Give a name to unnamed parameters to address violations of MISRA C:2012 Rule 8.2 ("Function types shall be in prototype form with named parameters").
Keep consistency between object and function declarations thus addressing violations of MISRA C:2012 Rule 8.3 ("All declarations of an object or function shall use the same names and type qualifiers"). Replace the occurrences ofbool_twith bool.No functional change.
Signed-off-by Federico Serafini <[email protected]>--- xen/arch/x86/cpu/common.c | 6 +++--- xen/arch/x86/include/asm/processor.h | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-)xen/arch/x86/cpu/common.c +0
-0xen/arch/x86/cpu/common.c line 30
Quoted 6 lines
xen/arch/x86/cpu/common.c +1
-1@@ -26,11 +26,11 @@bool __read_mostly opt_dom0_cpuid_faulting = true; -bool_t opt_arat =1 ; +bool opt_arat =1 ;boolean_param ("arat" , opt_arat);I see this has been committed, but you do realise you've created a new violation of 8.3 by failing to change the declaration of
opt_aratto be bool ?
Quoted 4 lines
Please everyone be more careful. There is an enormous amount of MISRA churn, and it's hard enough to deal with this when the patches are correct.
~Andrew
I'm sorry, I noticed too late.
I will submit a patch to address the new violations.
Signature · 3 lines
Federico Serafini, M.Sc. Software Engineer, BUGSENG (http://bugseng.com)