Module Name:    src
Committed By:   rillig
Date:           Sun Jul 25 11:19:51 UTC 2021

Modified Files:
        src/tests/usr.bin/xlint/lint1: gcc_typeof.c gcc_typeof.exp

Log Message:
tests/lint: document parse error for GCC typeof


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/gcc_typeof.c \
    src/tests/usr.bin/xlint/lint1/gcc_typeof.exp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/xlint/lint1/gcc_typeof.c
diff -u src/tests/usr.bin/xlint/lint1/gcc_typeof.c:1.1 src/tests/usr.bin/xlint/lint1/gcc_typeof.c:1.2
--- src/tests/usr.bin/xlint/lint1/gcc_typeof.c:1.1	Sun Jul 25 10:57:38 2021
+++ src/tests/usr.bin/xlint/lint1/gcc_typeof.c	Sun Jul 25 11:19:51 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: gcc_typeof.c,v 1.1 2021/07/25 10:57:38 rillig Exp $	*/
+/*	$NetBSD: gcc_typeof.c,v 1.2 2021/07/25 11:19:51 rillig Exp $	*/
 # 3 "gcc_typeof.c"
 
 /*
@@ -10,6 +10,13 @@
 void take_double(typeof(0.0));
 
 void take_function_double_returning_double(
+    /*
+     * FIXME: lint's grammar uses 'typeof cast_expression', while GCC's
+     *  c_parser_typeof_specifier uses 'typeof ( expression )'.  The crucial
+     *  difference is that lint parses the following expression as 'typeof
+     *  ((0.0)(typeof(0.0))', that is, it tries to call the function 0.0,
+     *  which of course is nonsense.
+     */
     typeof(0.0)(
 	/* FIXME: GCC can parse this */
 	/* expect+1: error: syntax error 'typeof' [249] */
Index: src/tests/usr.bin/xlint/lint1/gcc_typeof.exp
diff -u src/tests/usr.bin/xlint/lint1/gcc_typeof.exp:1.1 src/tests/usr.bin/xlint/lint1/gcc_typeof.exp:1.2
--- src/tests/usr.bin/xlint/lint1/gcc_typeof.exp:1.1	Sun Jul 25 10:57:38 2021
+++ src/tests/usr.bin/xlint/lint1/gcc_typeof.exp	Sun Jul 25 11:19:51 2021
@@ -1,2 +1,2 @@
-gcc_typeof.c(16): error: syntax error 'typeof' [249]
-gcc_typeof.c(26): warning: passing 'pointer to function(double) returning double' to incompatible 'double', arg #1 [155]
+gcc_typeof.c(23): error: syntax error 'typeof' [249]
+gcc_typeof.c(33): warning: passing 'pointer to function(double) returning double' to incompatible 'double', arg #1 [155]

Reply via email to