In commit 6440385b17def888544c2454ffba58384b929a22 (https://github.com/tianocore/edk2/commit/6440385b17def888544c2454ffba58384b929a22) enum size checks were added.

However, according to gcc, ISO C restricts the size of enum values to int; building with -std=c11 -pedantic results in the error:

MdePkg/Include/Base.h:812:28: error: ISO C restricts enumerator values to range of ‘int’ [-Werror=pedantic]
  812 |   __VerifyInt32EnumValue = 0xffffffff

Replacing 0xffffffff with 0x7fffffff fixes the problem.

It looks like this might change in C23, but since the use of _Static_assert in Base.h we require at least C11 (and I suspect most compilers aren't C23 compliant) which states:

"The expression that defines the value of an enumeration constant shall be an integer constant expression that has a value representable as an int.
[Section 6.7.2.2]"

The UEFI Specification appears to say we require an INT32 (i.e. a signed int) so is the existing code wrong?

--
Rebecca Cran


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#99845): https://edk2.groups.io/g/devel/message/99845
Mute This Topic: https://groups.io/mt/96845703/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to