Message ID | 20240816125804.2978072-1-torbjorn.svensson@foss.st.com |
---|---|
State | New |
Headers | show |
Series | testsuite: Add -fshort-enums to pr33738.C | expand |
On Fri, Aug 16, 2024 at 02:58:05PM +0200, Torbjörn SVENSSON wrote: > Ok for trunk and releases/gcc-14? > > -- > > 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 bahave identical for targets that does enable > -fshort-enums and those that does not, force the option in the test > case 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 -fshort-enums and removed xfail. That looks wrong, what the test tested is no longer tested on most arches. Better would be to use -fno-short-enums explicitly, and add another test which #includes (or copies over) this test and has -fshort-enums and tests what happens in that case. > > Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com> Jakub
diff --git a/gcc/testsuite/g++.dg/warn/pr33738.C b/gcc/testsuite/g++.dg/warn/pr33738.C index 73e98d5e083..84bbdaeecc7 100644 --- a/gcc/testsuite/g++.dg/warn/pr33738.C +++ b/gcc/testsuite/g++.dg/warn/pr33738.C @@ -1,5 +1,5 @@ // { dg-do run } -// { dg-options "-O2 -Wtype-limits -fstrict-enums" } +// { dg-options "-O2 -Wtype-limits -fstrict-enums -fshort-enums" } extern void link_error (void); enum Alpha { @@ -15,11 +15,11 @@ int GetM1() { int main() { a2 = static_cast<Alpha>(GetM1()); - if (a2 == -1) { // { dg-warning "always false due" "" { xfail *-*-* } } */ + if (a2 == -1) { // { dg-warning "always false due" } */ link_error (); } a2 = static_cast<Alpha>(GetM1()); - if (-1 == a2) { // { dg-warning "always false due" "" { xfail *-*-* } } */ + if (-1 == a2) { // { dg-warning "always false due" } */ link_error (); } return 0;
Ok for trunk and releases/gcc-14? -- 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 bahave identical for targets that does enable -fshort-enums and those that does not, force the option in the test case 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 -fshort-enums and removed xfail. Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com> --- gcc/testsuite/g++.dg/warn/pr33738.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)