Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src tests/lint: add test for _Noreturn from C11
details: https://anonhg.NetBSD.org/src/rev/ac988a285f34
branches: trunk
changeset: 377457:ac988a285f34
user: rillig <rillig%NetBSD.org@localhost>
date: Wed Jul 12 18:13:39 2023 +0000
description:
tests/lint: add test for _Noreturn from C11
diffstat:
distrib/sets/lists/tests/mi | 3 +-
tests/usr.bin/xlint/lint1/c11.c | 46 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 48 insertions(+), 1 deletions(-)
diffs (67 lines):
diff -r 736641d39381 -r ac988a285f34 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi Wed Jul 12 16:07:52 2023 +0000
+++ b/distrib/sets/lists/tests/mi Wed Jul 12 18:13:39 2023 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1275 2023/07/07 00:20:39 rillig Exp $
+# $NetBSD: mi,v 1.1276 2023/07/12 18:13:39 rillig Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -6506,6 +6506,7 @@
./usr/tests/usr.bin/xlint/lint1 tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/xlint/lint1/Atffile tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/xlint/lint1/Kyuafile tests-usr.bin-tests compattestfile,atf,kyua
+./usr/tests/usr.bin/xlint/lint1/c11.c tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/xlint/lint1/c11_atomic.c tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/xlint/lint1/c11_generic_expression.c tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/xlint/lint1/c11_generic_expression.exp tests-obsolete obsolete,atf
diff -r 736641d39381 -r ac988a285f34 tests/usr.bin/xlint/lint1/c11.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/xlint/lint1/c11.c Wed Jul 12 18:13:39 2023 +0000
@@ -0,0 +1,46 @@
+/* $NetBSD: c11.c,v 1.1 2023/07/12 18:13:39 rillig Exp $ */
+# 3 "c11.c"
+
+/*
+ * Test the language level C11, which adds _Generic expressions, _Noreturn
+ * functions, anonymous struct/union members, and several more.
+ */
+
+/* lint1-flags: -Ac11 -w -X 236 -X 351 */
+
+_Noreturn void exit(int);
+void _Noreturn exit(int);
+
+/* XXX: Syntactically invalid, yet lint accepts it. */
+void _Noreturn exit(int) _Noreturn;
+
+_Noreturn void
+noreturn_before_type(void)
+{
+ exit(0);
+}
+
+void _Noreturn
+noreturn_after_type(void)
+{
+ exit(0);
+}
+
+static _Noreturn void
+noreturn_after_storage_class(void)
+{
+ exit(0);
+}
+
+_Noreturn static void
+noreturn_before_storage_class(void)
+{
+ exit(0);
+}
+
+/* C11 6.7.4p5: A function specifier may appear more than once. */
+_Noreturn _Noreturn _Noreturn void
+three_times(void)
+{
+ exit(0);
+}
Home |
Main Index |
Thread Index |
Old Index