(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
cpp/
escape-1.c
       1  /* Copyright (C) 2001 Free Software Foundation, Inc.  */
       2  
       3  /* { dg-do compile } */
       4  
       5  /* This tests various diagnostics about escape sequences, for both
       6     the preprocessor and the compiler.
       7  
       8     Neil Booth, 22 May 2001.  */
       9  
      10  #if '\x'	/* { dg-error "no following" "\x with no digits" } */
      11  #endif
      12  #if '\x400'	/* { dg-error "out of range" "\x out of range" } */
      13  #endif
      14  #if '\x0ff'	/* { dg-bogus "out of range" "\x out of range" } */
      15  #endif
      16  #if '\400'	/* { dg-error "out of range" "\x out of range" } */
      17  #endif
      18  #if '\377'	/* { dg-bogus "out of range" "bogus \x out of range" } */
      19  #endif
      20  #if '\177' != 0x7f /* { dg-bogus "out of range" "bogus \x out of range" } */
      21  #error bad octal /* { dg-bogus "bad" "bad octal evaluation" } */
      22  #endif
      23  #if '\0377'	/* { dg-warning "multi" "too long octal" } */
      24  #endif
      25  #if '\p'	/* { dg-error "unknown escape" "unknown escape seq" } */
      26  #endif
      27  
      28  void foo ()
      29  {
      30    int c;
      31  
      32    c = '\x';	/* { dg-error "no following" "\x with no digits" } */
      33    c = '\x100';	/* { dg-error "out of range" "\x out of range" } */
      34    c = '\x0ff';	/* { dg-bogus "out of range" "\x out of range" } */
      35    c = '\400';	/* { dg-error "out of range" "\x out of range" } */
      36    c = '\377';	/* { dg-bogus "out of range" "bogus \x out of range" } */
      37    c = '\0377';	/* { dg-warning "multi" "too long octal" } */
      38    c = '\p';	/* { dg-error "unknown escape" "unknown escape seq" } */
      39  }