From 6262bf18d36502757b82c1f4974bcf5e4a632911 Mon Sep 17 00:00:00 2001 From: rillig Date: Sun, 27 Feb 2022 18:57:16 +0000 Subject: [PATCH] tests/lint: test where exactly lint complains about concatenation This only applies to traditional C and ensures that the behavior is preserved when rearranging the C parser to evaluate string concatenation from left to right. --- tests/usr.bin/xlint/lint1/msg_219.c | 9 ++++++++- tests/usr.bin/xlint/lint1/msg_219.exp | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/usr.bin/xlint/lint1/msg_219.c b/tests/usr.bin/xlint/lint1/msg_219.c index b496637caf43..74d34b423667 100644 --- a/tests/usr.bin/xlint/lint1/msg_219.c +++ b/tests/usr.bin/xlint/lint1/msg_219.c @@ -1,4 +1,4 @@ -/* $NetBSD: msg_219.c,v 1.3 2021/01/31 11:12:07 rillig Exp $ */ +/* $NetBSD: msg_219.c,v 1.4 2022/02/27 18:57:16 rillig Exp $ */ # 3 "msg_219.c" @@ -10,3 +10,10 @@ char concat1[] = "one"; char concat2[] = "one" "two"; /* expect: 219 */ char concat3[] = "one" "two" "three"; /* expect: 219 */ char concat4[] = "one" "two" "three" "four"; /* expect: 219 */ + +char concat4lines[] = + "one" + /* expect+1: warning: concatenated strings are illegal in traditional C [219] */ + "two" + "three" + "four"; diff --git a/tests/usr.bin/xlint/lint1/msg_219.exp b/tests/usr.bin/xlint/lint1/msg_219.exp index 2f08a7fbbe1c..28a504af5efc 100644 --- a/tests/usr.bin/xlint/lint1/msg_219.exp +++ b/tests/usr.bin/xlint/lint1/msg_219.exp @@ -1,3 +1,4 @@ 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] +msg_219.c(17): warning: concatenated strings are illegal in traditional C [219]