]> git.ipfire.org Git - thirdparty/gcc.git/commit
testsuite: Verify -fshort-enums and -fno-short-enums in pr33738.C
authorTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Fri, 16 Aug 2024 12:43:41 +0000 (14:43 +0200)
committerTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Fri, 16 Aug 2024 14:50:24 +0000 (16:50 +0200)
commit479dab62b828f93d6be48241178dbf654bdd33e7
treea8ff5923ae92e2926e838ec24e23c2484b1488b5
parent10bf0357750972e20dc702997f2930eab1c1be17
testsuite: Verify -fshort-enums and -fno-short-enums in pr33738.C

For some targets, like Cortex-M on arm-none-eabi, the -fshort-enums is
enabled by default. For these targets, the test case fails as
sizeof(Alpha) < sizeof(int).
To make the test case behave identical for targets that does enable
-fshort-enums and those that does not, add -fno-short-enums in the test
case and verify that the warning is not emitted. Then also create a copy
and run the test with -fshort-enums and verify that the warning is
emitted.

Regtested on x86_64-pc-linux-gnu and arm-none-eabi.

gcc/testsuite/ChangeLog:

* g++.dg/warn/pr33738.C: Added -fno-short-enums.
* g++.dg/warn/pr33738-2.C: Duplicate g++.dg/warn/pr33738.C with
-fshort-enums and removed xfail.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
gcc/testsuite/g++.dg/warn/pr33738-2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/warn/pr33738.C