Fri Apr 17 14:59:23 2020 UTC ()
Don't use typedef at all for __CTASSERT1.


(joerg)
diff -r1.152 -r1.153 src/sys/sys/cdefs.h

cvs diff -r1.152 -r1.153 src/sys/sys/cdefs.h (expand / switch to unified diff)

--- src/sys/sys/cdefs.h 2020/04/17 14:33:42 1.152
+++ src/sys/sys/cdefs.h 2020/04/17 14:59:23 1.153
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: cdefs.h,v 1.152 2020/04/17 14:33:42 kamil Exp $ */ 1/* $NetBSD: cdefs.h,v 1.153 2020/04/17 14:59:23 joerg Exp $ */
2 2
3/* * Copyright (c) 1991, 1993 3/* * Copyright (c) 1991, 1993
4 * The Regents of the University of California. All rights reserved. 4 * The Regents of the University of California. All rights reserved.
5 * 5 *
6 * This code is derived from software contributed to Berkeley by 6 * This code is derived from software contributed to Berkeley by
7 * Berkeley Software Design, Inc. 7 * Berkeley Software Design, Inc.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -162,30 +162,30 @@ @@ -162,30 +162,30 @@
162#endif 162#endif
163 163
164/* 164/*
165 * Compile Time Assertion. 165 * Compile Time Assertion.
166 */ 166 */
167#ifdef __COUNTER__ 167#ifdef __COUNTER__
168#define __CTASSERT(x) __CTASSERT0(x, __ctassert, __COUNTER__) 168#define __CTASSERT(x) __CTASSERT0(x, __ctassert, __COUNTER__)
169#else 169#else
170#define __CTASSERT(x) __CTASSERT99(x, __INCLUDE_LEVEL__, __LINE__) 170#define __CTASSERT(x) __CTASSERT99(x, __INCLUDE_LEVEL__, __LINE__)
171#define __CTASSERT99(x, a, b) __CTASSERT0(x, __CONCAT(__ctassert,a), \ 171#define __CTASSERT99(x, a, b) __CTASSERT0(x, __CONCAT(__ctassert,a), \
172 __CONCAT(_,b)) 172 __CONCAT(_,b))
173#endif 173#endif
174#define __CTASSERT0(x, y, z) __CTASSERT1(x, y, z) 174#define __CTASSERT0(x, y, z) __CTASSERT1(x, y, z)
175#define __CTASSERT1(x, y, z) \ 175#define __CTASSERT1(x, y, z) \
176 typedef struct y ## z ## _struct __unused { \ 176 struct y ## z ## _struct { \
177 unsigned int y ## z : /*CONSTCOND*/(x) ? 1 : -1; \ 177 unsigned int y ## z : /*CONSTCOND*/(x) ? 1 : -1; \
178 } y ## z ## _struct __unused 178 }
179 179
180/* 180/*
181 * The following macro is used to remove const cast-away warnings 181 * The following macro is used to remove const cast-away warnings
182 * from gcc -Wcast-qual; it should be used with caution because it 182 * from gcc -Wcast-qual; it should be used with caution because it
183 * can hide valid errors; in particular most valid uses are in 183 * can hide valid errors; in particular most valid uses are in
184 * situations where the API requires it, not to cast away string 184 * situations where the API requires it, not to cast away string
185 * constants. We don't use *intptr_t on purpose here and we are 185 * constants. We don't use *intptr_t on purpose here and we are
186 * explicit about unsigned long so that we don't have additional 186 * explicit about unsigned long so that we don't have additional
187 * dependencies. 187 * dependencies.
188 */ 188 */
189#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a)) 189#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a))
190 190
191/* 191/*