(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
c99-bool-4.c
       1  /* Test macro expansions in <stdbool.h> in C99.  */
       2  /* { dg-do run } */
       3  /* { dg-options "-std=c99 -pedantic-errors" } */
       4  
       5  #include <stdbool.h>
       6  
       7  #define str(x) xstr(x)
       8  #define xstr(x) #x
       9  
      10  extern void abort (void);
      11  extern void exit (int);
      12  extern int strcmp (const char *, const char *);
      13  
      14  #if false - 1 >= 0
      15  #error "false unsigned in #if"
      16  #endif
      17  
      18  #if false != 0
      19  #error "false not 0 in #if"
      20  #endif
      21  
      22  #if true - 2 >= 0
      23  #error "true unsigned in #if"
      24  #endif
      25  
      26  #if true != 1
      27  #error "true not 1 in #if"
      28  #endif
      29  
      30  int
      31  main (void)
      32  {
      33    if (strcmp (str (bool), "_Bool") != 0)
      34      abort ();
      35    if (true != 1)
      36      abort ();
      37    if (strcmp (str (true), "1") != 0)
      38      abort ();
      39    if (false != 0)
      40      abort ();
      41    if (strcmp (str (false), "0") != 0)
      42      abort ();
      43    if (strcmp (str (__bool_true_false_are_defined), "1") != 0)
      44      abort ();
      45    exit (0);
      46  }