Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/usr.bin/xlint/lint1 tests/lint: document parse error f...



details:   https://anonhg.NetBSD.org/src/rev/38748a6ca7b6
branches:  trunk
changeset: 984841:38748a6ca7b6
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jul 25 11:19:51 2021 +0000

description:
tests/lint: document parse error for GCC typeof

diffstat:

 tests/usr.bin/xlint/lint1/gcc_typeof.c   |  9 ++++++++-
 tests/usr.bin/xlint/lint1/gcc_typeof.exp |  4 ++--
 2 files changed, 10 insertions(+), 3 deletions(-)

diffs (31 lines):

diff -r 57ad5e08a73a -r 38748a6ca7b6 tests/usr.bin/xlint/lint1/gcc_typeof.c
--- a/tests/usr.bin/xlint/lint1/gcc_typeof.c    Sun Jul 25 11:14:15 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/gcc_typeof.c    Sun Jul 25 11:19:51 2021 +0000
@@ -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] */
diff -r 57ad5e08a73a -r 38748a6ca7b6 tests/usr.bin/xlint/lint1/gcc_typeof.exp
--- a/tests/usr.bin/xlint/lint1/gcc_typeof.exp  Sun Jul 25 11:14:15 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/gcc_typeof.exp  Sun Jul 25 11:19:51 2021 +0000
@@ -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]



Home | Main Index | Thread Index | Old Index