qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Headers without multiple inclusion guards


From: Laszlo Ersek
Subject: Re: [Qemu-devel] Headers without multiple inclusion guards
Date: Mon, 3 Jun 2019 12:55:01 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

Hi Markus,

(sorry about the late reply, I've been away.)

On 05/28/19 20:12, Markus Armbruster wrote:

> EDK2 Firmware
> M: Laszlo Ersek <address@hidden>
> M: Philippe Mathieu-Daudé <address@hidden>
> tests/uefi-test-tools/UefiTestToolsPkg/Include/Guid/BiosTablesTest.h

This header file does have a multiple inclusion guard:

> /** @file
>   Expose the address(es) of the ACPI RSD PTR table(s) and the SMBIOS entry
>   point(s) in a MB-aligned structure to the hypervisor.
>
>   [...]
> **/
>
> #ifndef __BIOS_TABLES_TEST_H__
> #define __BIOS_TABLES_TEST_H__
>
> [...]
>
> #endif // __BIOS_TABLES_TEST_H__

It's possible that "scripts/clean-header-guards.pl" does not recognize
the guard.

According to the ISO C standard, "All identifiers that begin with an
underscore and either an uppercase letter or another underscore are
always reserved for any use". Therefore, technically speaking, the above
inclusion guard implies undefined behavior. In practice, this particular
style for header guards is extremely common in the edk2 codebase:

$ git grep '^#ifndef __' -- '*.h'  | wc -l
1012

And, "tests/uefi-test-tools/UefiTestToolsPkg" follows the edk2 coding
style.

That said, if you'd like to remove the leading "__" from the macro name,
I'd be fully OK with that.

Thank you!
Laszlo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]