diff --git a/distrib/sets/lists/tests/mi b/distrib/sets/lists/tests/mi index a95f479d54fd..0d59a73d1164 100644 --- a/distrib/sets/lists/tests/mi +++ b/distrib/sets/lists/tests/mi @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1025 2021/03/06 17:56:33 rillig Exp $ +# $NetBSD: mi,v 1.1026 2021/03/07 19:42:54 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -6730,6 +6730,8 @@ ./usr/tests/usr.bin/xlint/lint1/msg_338.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/msg_339.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/msg_339.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/msg_340.c tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/msg_340.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/t_integration tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/ztest tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/ztest/Atffile tests-usr.bin-tests compattestfile,atf diff --git a/tests/usr.bin/xlint/lint1/Makefile b/tests/usr.bin/xlint/lint1/Makefile index 30f4313c4095..2c730538af36 100644 --- a/tests/usr.bin/xlint/lint1/Makefile +++ b/tests/usr.bin/xlint/lint1/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.34 2021/02/28 22:12:16 rillig Exp $ +# $NetBSD: Makefile,v 1.35 2021/03/07 19:42:54 rillig Exp $ NOMAN= # defined @@ -96,7 +96,7 @@ FILES+= d_type_question_colon.c FILES+= d_typefun.c FILES+= d_typename_as_var.c FILES+= d_zero_sized_arrays.c -FILES+= ${:U0 ${:U:range=339}:C,^.$,0&,:C,^..$,0&,:@msg@msg_${msg}.c msg_${msg}.exp@} +FILES+= ${:U0 ${:U:range=340}:C,^.$,0&,:C,^..$,0&,:@msg@msg_${msg}.c msg_${msg}.exp@} # Note: only works for adding tests. # To remove a test, the $$mi file must be edited manually. diff --git a/tests/usr.bin/xlint/lint1/msg_340.c b/tests/usr.bin/xlint/lint1/msg_340.c new file mode 100644 index 000000000000..715f7dc889f0 --- /dev/null +++ b/tests/usr.bin/xlint/lint1/msg_340.c @@ -0,0 +1,19 @@ +/* $NetBSD: msg_340.c,v 1.1 2021/03/07 19:42:54 rillig Exp $ */ +# 3 "msg_340.c" + +// Test for message: initialization with '[a...b]' is a GNU extension [340] + +/* + * In strict C mode, GNU extensions are flagged as such. + */ + +/* lint1-flags: -Ssw */ + +int +example(void) +{ + int numbers[] = { + [2 ... 3] = 12 /* expect: 340 */ + }; + return numbers[0]; +} diff --git a/tests/usr.bin/xlint/lint1/msg_340.exp b/tests/usr.bin/xlint/lint1/msg_340.exp new file mode 100644 index 000000000000..b4ea08683597 --- /dev/null +++ b/tests/usr.bin/xlint/lint1/msg_340.exp @@ -0,0 +1 @@ +msg_340.c(16): initialization with '[a...b]' is a GNU extension [340] diff --git a/tests/usr.bin/xlint/lint1/t_integration.sh b/tests/usr.bin/xlint/lint1/t_integration.sh index 4e197c99bf28..836f9b29b7d2 100644 --- a/tests/usr.bin/xlint/lint1/t_integration.sh +++ b/tests/usr.bin/xlint/lint1/t_integration.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_integration.sh,v 1.32 2021/02/28 22:12:16 rillig Exp $ +# $NetBSD: t_integration.sh,v 1.33 2021/03/07 19:42:54 rillig Exp $ # # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc. # All rights reserved. @@ -187,7 +187,7 @@ all_messages_body() srcdir="$(atf_get_srcdir)" ok="true" - for msg in $(seq 0 339); do + for msg in $(seq 0 340); do base="$(printf '%s/msg_%03d' "${srcdir}" "${msg}")" flags="$(extract_flags "${base}.c")" diff --git a/usr.bin/xlint/lint1/cgram.y b/usr.bin/xlint/lint1/cgram.y index b51837f8c3c4..e0c33ac8151d 100644 --- a/usr.bin/xlint/lint1/cgram.y +++ b/usr.bin/xlint/lint1/cgram.y @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.165 2021/03/07 18:02:45 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.166 2021/03/07 19:42:54 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: cgram.y,v 1.165 2021/03/07 18:02:45 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.166 2021/03/07 19:42:54 rillig Exp $"); #endif #include @@ -1353,6 +1353,8 @@ range: | constant T_ELLIPSIS constant { $$.lo = toicon($1, 1); $$.hi = toicon($3, 1); + /* initialization with '[a...b]' is a GNU extension */ + gnuism(340); } ; diff --git a/usr.bin/xlint/lint1/err.c b/usr.bin/xlint/lint1/err.c index 85d141e51489..69498ebc932b 100644 --- a/usr.bin/xlint/lint1/err.c +++ b/usr.bin/xlint/lint1/err.c @@ -1,4 +1,4 @@ -/* $NetBSD: err.c,v 1.86 2021/02/28 02:45:37 rillig Exp $ */ +/* $NetBSD: err.c,v 1.87 2021/03/07 19:42:54 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: err.c,v 1.86 2021/02/28 02:45:37 rillig Exp $"); +__RCSID("$NetBSD: err.c,v 1.87 2021/03/07 19:42:54 rillig Exp $"); #endif #include @@ -399,6 +399,7 @@ const char *msgs[] = { "right operand of '%s' must not be bool", /* 337 */ "option '%c' should be handled in the switch", /* 338 */ "option '%c' should be listed in the options string", /* 339 */ + "initialization with '[a...b]' is a GNU extension", /* 340 */ }; /*