Debian Codegraph @

gcc/testsuite/gcc.dg/analyzer/named-constants-Wunused-macros.c

raw
1 /* Regression test for interaction of named constants in -fanalyzer with
2 -Wunused-macros (PR analyzer/107711). */
3
4 /* { dg-additional-options "-Wunused-macros" } */
5
6 #include "analyzer-decls.h"
7
8 /* Various constants used by the fd state machine. */
9
10 #define O_ACCMODE 42 /* { dg-warning "-: macro 'O_ACCMODE' is not used" } */
11 #define O_RDONLY 0x1 /* { dg-warning "-: macro 'O_RDONLY' is not used" } */
12 #define O_WRONLY 010 /* { dg-warning "-: macro 'O_WRONLY' is not used" } */
13
14 void test_sm_fd_constants (void)
15 {
16 __analyzer_dump_named_constant ("O_ACCMODE"); /* { dg-warning "named constant 'O_ACCMODE' has value '42'" } */
17 __analyzer_dump_named_constant ("O_RDONLY"); /* { dg-warning "named constant 'O_RDONLY' has value '1'" } */
18 __analyzer_dump_named_constant ("O_WRONLY"); /* { dg-warning "named constant 'O_WRONLY' has value '8'" } */
19 }