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.
This commit is contained in:
rillig 2021-01-02 11:12:34 +00:00
parent a0a15c1464
commit 5281bfe656
3 changed files with 25 additions and 9 deletions

View File

@ -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";

View File

@ -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]

View File

@ -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 confusion of 'long double' with" \
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}"