Module Name: src Committed By: rillig Date: Sat Jan 2 11:12:34 UTC 2021
Modified Files: src/tests/usr.bin/xlint/lint1: msg_219.c msg_219.exp t_integration.sh Log Message: lint: demonstrate that -t mode is practically unusable Since main1.c from 2014-04-18, running lint in -t mode produces strange warnings in lines 1 to 3 of no file at all. This is caused by the builtins that are parsed in main(). These builtins are incompatible with traditional mode because they use long double, which had not been known at that time. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_219.c \ src/tests/usr.bin/xlint/lint1/msg_219.exp cvs rdiff -u -r1.18 -r1.19 src/tests/usr.bin/xlint/lint1/t_integration.sh 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/msg_219.c diff -u src/tests/usr.bin/xlint/lint1/msg_219.c:1.1 src/tests/usr.bin/xlint/lint1/msg_219.c:1.2 --- src/tests/usr.bin/xlint/lint1/msg_219.c:1.1 Sat Jan 2 10:22:44 2021 +++ src/tests/usr.bin/xlint/lint1/msg_219.c Sat Jan 2 11:12:34 2021 @@ -1,7 +1,12 @@ -/* $NetBSD: msg_219.c,v 1.1 2021/01/02 10:22:44 rillig Exp $ */ +/* $NetBSD: msg_219.c,v 1.2 2021/01/02 11:12:34 rillig Exp $ */ # 3 "msg_219.c" -// Test for message: concatenated strings are illegal in traditional C [219] -TODO: "Add example code that triggers the above message." -TODO: "Add example code that almost triggers the above message." +/* Test for message: concatenated strings are illegal in traditional C [219] */ + +/* lint1-flags: -t -w */ + +char concat1[] = "one"; +char concat2[] = "one" "two"; +char concat3[] = "one" "two" "three"; +char concat4[] = "one" "two" "three" "four"; Index: src/tests/usr.bin/xlint/lint1/msg_219.exp diff -u src/tests/usr.bin/xlint/lint1/msg_219.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_219.exp:1.2 --- src/tests/usr.bin/xlint/lint1/msg_219.exp:1.1 Sat Jan 2 10:22:44 2021 +++ src/tests/usr.bin/xlint/lint1/msg_219.exp Sat Jan 2 11:12:34 2021 @@ -1 +1,10 @@ -msg_219.c(6): syntax error ':' [249] +(1): warning: 'long double' is illegal in traditional C [266] +(1): warning: function prototypes are illegal in traditional C [270] +(2): warning: 'long double' is illegal in traditional C [266] +(2): warning: function prototypes are illegal in traditional C [270] +(3): warning: 'long double' is illegal in traditional C [266] +(3): warning: 'long double' is illegal in traditional C [266] +(3): warning: function prototypes are illegal in traditional C [270] +msg_219.c(10): warning: concatenated strings are illegal in traditional C [219] +msg_219.c(11): warning: concatenated strings are illegal in traditional C [219] +msg_219.c(12): warning: concatenated strings are illegal in traditional C [219] Index: src/tests/usr.bin/xlint/lint1/t_integration.sh diff -u src/tests/usr.bin/xlint/lint1/t_integration.sh:1.18 src/tests/usr.bin/xlint/lint1/t_integration.sh:1.19 --- src/tests/usr.bin/xlint/lint1/t_integration.sh:1.18 Sat Jan 2 10:22:44 2021 +++ src/tests/usr.bin/xlint/lint1/t_integration.sh Sat Jan 2 11:12:34 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_integration.sh,v 1.18 2021/01/02 10:22:44 rillig Exp $ +# $NetBSD: t_integration.sh,v 1.19 2021/01/02 11:12:34 rillig Exp $ # # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc. # All rights reserved. @@ -147,17 +147,19 @@ test_case long_double_int "Checks for co test_case all_messages all_messages_body() { - local srcdir status msg base + local srcdir status msg base flags srcdir="$(atf_get_srcdir)" status="0" for msg in $(seq 0 329); do base="$(printf '%s/msg_%03d' "${srcdir}" "${msg}")" + flags="$(sed -n 's,^/\* lint1-flags: \(.*\) \*/$,\1,p' "${base}.c")" + flags="${flags:--g -S -w}" - # shellcheck disable=SC2154 + # shellcheck disable=SC2154 disable=SC2086 ${Atf_Check} -s not-exit:0 -o "file:${base}.exp" -e empty \ - ${LINT1} -g -S -w "${base}.c" /dev/null \ + ${LINT1} ${flags} "${base}.c" /dev/null \ || status="1" done return "${status}"