Home | History | Annotate | Line # | Download | only in lint1
      1 /*	$NetBSD: lex_string.c,v 1.6 2023/03/28 14:44:34 rillig Exp $	*/
      2 # 3 "lex_string.c"
      3 
      4 /*
      5  * Test lexical analysis of string constants.
      6  *
      7  * C99 6.4.5 "String literals"
      8  */
      9 
     10 /* lint1-extra-flags: -X 351 */
     11 
     12 void sink(const char *);
     13 
     14 void
     15 test(void)
     16 {
     17 	sink("");
     18 
     19 	sink("hello, world\n");
     20 
     21 	sink("\0");
     22 
     23 	sink("\0\0\0\0");
     24 
     25 	/* expect+1: error: no hex digits follow \x [74] */
     26 	sink("\x");		/* unfinished */
     27 
     28 	/* expect+1: warning: dubious escape \y [79] */
     29 	sink("\y");		/* unknown escape sequence */
     30 
     31 	sink("first" "second");
     32 
     33 	/* expect+1: error: cannot concatenate wide and regular string literals [292] */
     34 	sink("plain" L"wide");
     35 }
     36 
     37 /* TODO: test digraphs inside string literals */
     38 /* TODO: test trigraphs inside string literals */
     39