comparison gcc/testsuite/c-c++-common/pr69543-4.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* { dg-options "-Wuninitialized" } */
2
3 /* Verify disabling a warning, where both the _Pragma and the
4 affected code are within (different) macros. */
5
6 /* TODO: XFAIL: both C and C++ erroneously fail to suppress the warning
7 The warning is reported at the macro definition location, rather than
8 the macro expansion location. */
9
10 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
11 _Pragma ("GCC diagnostic push") \
12 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
13 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
14 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
15 _Pragma ("GCC diagnostic pop")
16
17 #define WARNABLE_CODE *++yyvsp = yylval; /* { dg-bogus "used uninitialized" "" { xfail *-*-* } } */
18
19 void test (char yylval)
20 {
21 char *yyvsp; /* { dg-bogus "declared here" "" { xfail *-*-* } } */
22 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
23 WARNABLE_CODE
24 YY_IGNORE_MAYBE_UNINITIALIZED_END
25 }