Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src tests/lint: merge duplicate tests for C11 _Atomic



details:   https://anonhg.NetBSD.org/src/rev/89437e1daa14
branches:  trunk
changeset: 377307:89437e1daa14
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Jul 07 00:20:39 2023 +0000

description:
tests/lint: merge duplicate tests for C11 _Atomic

diffstat:

 distrib/sets/lists/tests/mi                        |   4 +-
 tests/usr.bin/xlint/lint1/c11_atomic.c             |   3 +-
 tests/usr.bin/xlint/lint1/c11_generic_expression.c |   5 ++-
 tests/usr.bin/xlint/lint1/c99_atomic.c             |  25 ----------------------
 tests/usr.bin/xlint/lint1/msg_350.c                |  20 ++++++++++++++++-
 5 files changed, 26 insertions(+), 31 deletions(-)

diffs (125 lines):

diff -r c8d678e2f75f -r 89437e1daa14 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Thu Jul 06 21:10:15 2023 +0000
+++ b/distrib/sets/lists/tests/mi       Fri Jul 07 00:20:39 2023 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1274 2023/07/05 11:36:56 rillig Exp $
+# $NetBSD: mi,v 1.1275 2023/07/07 00:20:39 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -6512,7 +6512,7 @@
 ./usr/tests/usr.bin/xlint/lint1/c23.c                          tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/c90.c                          tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/c90.exp                                tests-obsolete          obsolete,atf
-./usr/tests/usr.bin/xlint/lint1/c99_atomic.c                   tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/c99_atomic.c                   tests-obsolete          obsolete,atf
 ./usr/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.c   tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/c99_bool_strict_suppressed.exp tests-obsolete          obsolete
 ./usr/tests/usr.bin/xlint/lint1/c99_init_array.c               tests-obsolete          obsolete,atf
diff -r c8d678e2f75f -r 89437e1daa14 tests/usr.bin/xlint/lint1/c11_atomic.c
--- a/tests/usr.bin/xlint/lint1/c11_atomic.c    Thu Jul 06 21:10:15 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/c11_atomic.c    Fri Jul 07 00:20:39 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: c11_atomic.c,v 1.3 2023/01/21 13:48:40 rillig Exp $    */
+/*     $NetBSD: c11_atomic.c,v 1.4 2023/07/07 00:20:39 rillig Exp $    */
 # 3 "c11_atomic.c"
 
 /*
@@ -8,6 +8,7 @@
  * See also:
  *     C11 6.7.3 Type qualifiers
  *     C11 6.7.2.4 Atomic type specifiers
+ *     msg_350.c
  */
 
 /* lint1-extra-flags: -Ac11 */
diff -r c8d678e2f75f -r 89437e1daa14 tests/usr.bin/xlint/lint1/c11_generic_expression.c
--- a/tests/usr.bin/xlint/lint1/c11_generic_expression.c        Thu Jul 06 21:10:15 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/c11_generic_expression.c        Fri Jul 07 00:20:39 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: c11_generic_expression.c,v 1.15 2023/03/28 14:44:34 rillig Exp $       */
+/*     $NetBSD: c11_generic_expression.c,v 1.16 2023/07/07 00:20:39 rillig Exp $       */
 # 3 "c11_generic_expression.c"
 
 /*
@@ -11,7 +11,7 @@
  * C11 6.5.1.1 "Generic selection"
  */
 
-/* lint1-extra-flags: -Ac11 -X 351 */
+/* lint1-extra-flags: -Ac11 */
 
 /*
  * The type of 'var' is not compatible with any of the types from the
@@ -101,6 +101,7 @@ primary_expression(void)
  * which is then silently ignored by init_expr.  This situation is already
  * covered by the compilers, so there is no need for lint to double-check it.
  */
+/* expect+1: warning: missing 'extern' header declaration for 'x' [351] */
 const char *x = _Generic(
     1ULL + 1.0f,
     int: 1
diff -r c8d678e2f75f -r 89437e1daa14 tests/usr.bin/xlint/lint1/c99_atomic.c
--- a/tests/usr.bin/xlint/lint1/c99_atomic.c    Thu Jul 06 21:10:15 2023 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*     $NetBSD: c99_atomic.c,v 1.3 2023/01/21 13:48:40 rillig Exp $    */
-# 3 "c99_atomic.c"
-
-/*
- * The keyword '_Atomic' was added in C11.  This test ensures that in C99
- * mode, the parser recognizes the keyword but flags it.
- */
-
-/* expect+1: error: '_Atomic' requires C11 or later [350] */
-typedef _Atomic int atomic_int;
-
-/* expect+1: error: '_Atomic' requires C11 or later [350] */
-typedef _Atomic struct {
-       int field;
-} atomic_struct;
-
-/* expect+3: error: '_Atomic' requires C11 or later [350] */
-/* expect+2: error: '_Atomic' requires C11 or later [350] */
-double *
-atomic_ptr_cmpexch(_Atomic(double *)*ptr_var, _Atomic(double *) new_value)
-{
-       double *old = *ptr_var;
-       *ptr_var = new_value;
-       return old;
-}
diff -r c8d678e2f75f -r 89437e1daa14 tests/usr.bin/xlint/lint1/msg_350.c
--- a/tests/usr.bin/xlint/lint1/msg_350.c       Thu Jul 06 21:10:15 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_350.c       Fri Jul 07 00:20:39 2023 +0000
@@ -1,8 +1,16 @@
-/*     $NetBSD: msg_350.c,v 1.1 2023/01/21 13:07:22 rillig Exp $       */
+/*     $NetBSD: msg_350.c,v 1.2 2023/07/07 00:20:39 rillig Exp $       */
 # 3 "msg_350.c"
 
 // Test for message 350: '_Atomic' requires C11 or later [350]
 
+/*
+ * The keyword '_Atomic' was added in C11.  This test ensures that in C99
+ * mode, the parser recognizes the keyword but flags it.
+ *
+ * See also:
+ *     c11_atomic.c
+ */
+
 /* expect+1: error: '_Atomic' requires C11 or later [350] */
 typedef _Atomic int atomic_int;
 
@@ -10,3 +18,13 @@ typedef _Atomic int atomic_int;
 typedef _Atomic struct {
        int field;
 } atomic_struct;
+
+/* expect+3: error: '_Atomic' requires C11 or later [350] */
+/* expect+2: error: '_Atomic' requires C11 or later [350] */
+double *
+atomic_ptr_cmpexch(_Atomic(double *)*ptr_var, _Atomic(double *)new_value)
+{
+       double *old = *ptr_var;
+       *ptr_var = new_value;
+       return old;
+}



Home | Main Index | Thread Index | Old Index