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 <[email protected]>
---
gcc/testsuite/g++.dg/warn/pr33738.C | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
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;
--
2.25.1