aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/analyzer/named-constants-Wunused-macros.c
blob: 0b31cc42d78fa23c33c8de10c70ad340b75dcc11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* Regression test for interaction of named constants in -fanalyzer with
   -Wunused-macros (PR analyzer/107711).  */

/* { dg-additional-options "-Wunused-macros" } */

#include "analyzer-decls.h"

/* Various constants used by the fd state machine.  */

#define O_ACCMODE 42   /* { dg-warning "-: macro \"O_ACCMODE\" is not used" } */
#define O_RDONLY  0x1  /* { dg-warning "-: macro \"O_RDONLY\" is not used" } */
#define O_WRONLY  010  /* { dg-warning "-: macro \"O_WRONLY\" is not used" } */

void test_sm_fd_constants (void)
{
  __analyzer_dump_named_constant ("O_ACCMODE"); /* { dg-warning "named constant 'O_ACCMODE' has value '42'" } */
  __analyzer_dump_named_constant ("O_RDONLY"); /* { dg-warning "named constant 'O_RDONLY' has value '1'" } */
  __analyzer_dump_named_constant ("O_WRONLY"); /* { dg-warning "named constant 'O_WRONLY' has value '8'" } */
}