Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/xlint/lint1 lint: allow 'extern' and 'thread_local' ...



details:   https://anonhg.NetBSD.org/src/rev/60b285df080d
branches:  trunk
changeset: 377520:60b285df080d
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Jul 15 16:17:37 2023 +0000

description:
lint: allow 'extern' and 'thread_local' to be combined

diffstat:

 tests/usr.bin/xlint/lint1/c23.c |  8 +++-----
 usr.bin/xlint/lint1/decl.c      |  7 +++++--
 2 files changed, 8 insertions(+), 7 deletions(-)

diffs (49 lines):

diff -r 309afda60c22 -r 60b285df080d tests/usr.bin/xlint/lint1/c23.c
--- a/tests/usr.bin/xlint/lint1/c23.c   Sat Jul 15 16:11:32 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/c23.c   Sat Jul 15 16:17:37 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: c23.c,v 1.4 2023/07/15 16:11:32 rillig Exp $   */
+/*     $NetBSD: c23.c,v 1.5 2023/07/15 16:17:38 rillig Exp $   */
 # 3 "c23.c"
 
 // Tests for the option -Ac23, which allows features from C23 and all earlier
@@ -40,9 +40,7 @@ function(void)
        thread_local int function_scoped_thread_local;
 }
 
-/* FIXME: 'thread_local' and 'extern' can be combined. */
-/* expect+1: error: only one storage class allowed [7] */
+// 'extern' and 'thread_local' can be combined.  The other storage classes
+// cannot be combined.
 extern thread_local int extern_thread_local_1;
-/* FIXME: 'thread_local' and 'extern' can be combined. */
-/* expect+1: error: only one storage class allowed [7] */
 thread_local extern int extern_thread_local_2;
diff -r 309afda60c22 -r 60b285df080d usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Sat Jul 15 16:11:32 2023 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Sat Jul 15 16:17:37 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.359 2023/07/15 15:38:03 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.360 2023/07/15 16:17:37 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: decl.c,v 1.359 2023/07/15 15:38:03 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.360 2023/07/15 16:17:37 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -227,6 +227,9 @@ dcs_add_storage_class(scl_t sc)
 
        if (dcs->d_scl == NOSCL)
                dcs->d_scl = sc;
+       else if ((dcs->d_scl == EXTERN && sc == THREAD_LOCAL)
+           || (dcs->d_scl == THREAD_LOCAL && sc == EXTERN))
+               dcs->d_scl = EXTERN;    /* ignore thread_local */
        else
                dcs->d_multiple_storage_classes = true;
 }



Home | Main Index | Thread Index | Old Index