Source-Changes-HG archive

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

[src/trunk]: src/sys/sys Fix __CTASSERT1() in sys/cdefs.h for recent Clang/LLVM



details:   https://anonhg.NetBSD.org/src/rev/e3576e823c81
branches:  trunk
changeset: 1009231:e3576e823c81
user:      kamil <kamil%NetBSD.org@localhost>
date:      Fri Apr 17 14:33:42 2020 +0000

description:
Fix __CTASSERT1() in sys/cdefs.h for recent Clang/LLVM

Clang now implements a restriction on giving non-C-compatible anonymous
structs a typedef name for linkage purposes, as described in C++ committee
paper `P1766R1 <http://wg21.link/p1766r1>'.

https://reviews.llvm.org/D74103

diffstat:

 sys/sys/cdefs.h |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (22 lines):

diff -r b75439edf023 -r e3576e823c81 sys/sys/cdefs.h
--- a/sys/sys/cdefs.h   Fri Apr 17 14:19:43 2020 +0000
+++ b/sys/sys/cdefs.h   Fri Apr 17 14:33:42 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cdefs.h,v 1.151 2020/03/21 22:45:47 kamil Exp $        */
+/*     $NetBSD: cdefs.h,v 1.152 2020/04/17 14:33:42 kamil Exp $        */
 
 /* * Copyright (c) 1991, 1993
  *     The Regents of the University of California.  All rights reserved.
@@ -172,9 +172,9 @@
                                               __CONCAT(_,b))
 #endif
 #define        __CTASSERT0(x, y, z)    __CTASSERT1(x, y, z)
-#define        __CTASSERT1(x, y, z)    \
-       typedef struct { \
-               unsigned int y ## z : /*CONSTCOND*/(x) ? 1 : -1; \
+#define        __CTASSERT1(x, y, z)                                            \
+       typedef struct y ## z ## _struct __unused {                     \
+               unsigned int y ## z : /*CONSTCOND*/(x) ? 1 : -1;        \
        } y ## z ## _struct __unused
 
 /*



Home | Main Index | Thread Index | Old Index