Sat Jul 10 19:30:19 2021 UTC ()
tests/lint: test error handling in enum-specifier


(rillig)
diff -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/decl.c
diff -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/decl.exp

cvs diff -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/decl.c (expand / switch to unified diff)

--- src/tests/usr.bin/xlint/lint1/decl.c 2021/07/10 18:25:57 1.1
+++ src/tests/usr.bin/xlint/lint1/decl.c 2021/07/10 19:30:19 1.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: decl.c,v 1.1 2021/07/10 18:25:57 rillig Exp $ */ 1/* $NetBSD: decl.c,v 1.2 2021/07/10 19:30:19 rillig Exp $ */
2# 3 "decl.c" 2# 3 "decl.c"
3 3
4/* 4/*
5 * Tests for declarations, especially the distinction between the 5 * Tests for declarations, especially the distinction between the
6 * declaration-specifiers and the declarators. 6 * declaration-specifiers and the declarators.
7 */ 7 */
8 8
9/* 9/*
10 * Even though 'const' comes after 'char' and is therefore quite close to the 10 * Even though 'const' comes after 'char' and is therefore quite close to the
11 * first identifier, it applies to both identifiers. 11 * first identifier, it applies to both identifiers.
12 */ 12 */
13void 13void
14specifier_qualifier(void) 14specifier_qualifier(void)
@@ -61,13 +61,28 @@ void sink(double *); @@ -61,13 +61,28 @@ void sink(double *);
61 61
62void 62void
63declarators(void) 63declarators(void)
64{ 64{
65 char *pc = 0, c = 0, **ppc = 0; 65 char *pc = 0, c = 0, **ppc = 0;
66 66
67 /* expect+1: warning: converting 'pointer to char' to incompatible 'pointer to double' */ 67 /* expect+1: warning: converting 'pointer to char' to incompatible 'pointer to double' */
68 sink(pc); 68 sink(pc);
69 /* expect+1: warning: illegal combination of pointer (pointer to double) and integer (char) */ 69 /* expect+1: warning: illegal combination of pointer (pointer to double) and integer (char) */
70 sink(c); 70 sink(c);
71 /* expect+1: converting 'pointer to pointer to char' to incompatible 'pointer to double' */ 71 /* expect+1: converting 'pointer to pointer to char' to incompatible 'pointer to double' */
72 sink(ppc); 72 sink(ppc);
73} 73}
 74
 75_Bool
 76enum_error_handling(void)
 77{
 78 enum {
 79 /* expect+1: syntax error '"' [249] */
 80 "error 1"
 81 : /* still the same error */
 82 , /* back on track */
 83 A,
 84 B
 85 } x = A;
 86
 87 return x == B;
 88}

cvs diff -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/Attic/decl.exp (expand / switch to unified diff)

--- src/tests/usr.bin/xlint/lint1/Attic/decl.exp 2021/07/10 18:25:57 1.1
+++ src/tests/usr.bin/xlint/lint1/Attic/decl.exp 2021/07/10 19:30:19 1.2
@@ -1,10 +1,11 @@ @@ -1,10 +1,11 @@
1decl.c(19): warning: left operand of '=' must be modifiable lvalue [115] 1decl.c(19): warning: left operand of '=' must be modifiable lvalue [115]
2decl.c(21): warning: left operand of '=' must be modifiable lvalue [115] 2decl.c(21): warning: left operand of '=' must be modifiable lvalue [115]
3decl.c(34): warning: left operand of '=' must be modifiable lvalue [115] 3decl.c(34): warning: left operand of '=' must be modifiable lvalue [115]
4decl.c(36): warning: left operand of '=' must be modifiable lvalue [115] 4decl.c(36): warning: left operand of '=' must be modifiable lvalue [115]
5decl.c(43): error: syntax error 'const' [249] 5decl.c(43): error: syntax error 'const' [249]
6decl.c(47): error: 'b' undefined [99] 6decl.c(47): error: 'b' undefined [99]
7decl.c(54): error: syntax error 'const' [249] 7decl.c(54): error: syntax error 'const' [249]
8decl.c(68): warning: converting 'pointer to char' to incompatible 'pointer to double' for argument 1 [153] 8decl.c(68): warning: converting 'pointer to char' to incompatible 'pointer to double' for argument 1 [153]
9decl.c(70): warning: illegal combination of pointer (pointer to double) and integer (char), arg #1 [154] 9decl.c(70): warning: illegal combination of pointer (pointer to double) and integer (char), arg #1 [154]
10decl.c(72): warning: converting 'pointer to pointer to char' to incompatible 'pointer to double' for argument 1 [153] 10decl.c(72): warning: converting 'pointer to pointer to char' to incompatible 'pointer to double' for argument 1 [153]
 11decl.c(80): error: syntax error '"' [249]