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

Re: Address MISRA C:2012 Rule 8.4



3. Variables that are either extern or not, such as 'acpi_gbl_FADT' in
'xen/include/acpi/acglobal.h', depending on
    DEFINE_ACPI_GLOBALS

Below are the proposed resolution strategies:


3. One possible resolution pattern is including 'acglobal.h' twice
(either directly or indirectly trough acpi.h, if
    the latter does not cause other issues) like so:

    (assuming DEFINE_ACPI_GLOBALS is undefined here)
    #include "acglobal.h"
    #define DEFINE_ACPI_GLOBALS
    #include  "acglobal.h"

this way, the rule is followed properly, though it's not the prettiest
pattern and also clashes with the objectives
of D4.10 ("Precautions shall be taken in order to prevent the contents
of a header file being included
   more than once"), but then a motivated exception is allowed there.

Not really sure about this one.

Jan

If you can tell me more about why that header is defined the way it is (i.e. why it's used twice with DEFINE_ACPI_GLOBALS #defined and the other times without), maybe we can come up
with better alternatives.

--
Nicola Vetrini, BSc
Software Engineer, BUGSENG srl (https://bugseng.com)



 


Rackspace

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