summaryrefslogtreecommitdiff
path: root/lib/libpthread
diff options
context:
space:
mode:
authorkamil <kamil@NetBSD.org>2017-09-09 23:21:45 +0000
committerkamil <kamil@NetBSD.org>2017-09-09 23:21:45 +0000
commit176f48c5ce4c6e51bebde5b50a7231d17471707d (patch)
treee11be21bcefa7495abf4f4ab9692c621df94a6d3 /lib/libpthread
parent4edb2d53908a39e34563eb5de14fbce5eaeca620 (diff)
Support <pthread_typs.h> on C89 compilers
Clang 5.0.0(svn) reports warnings on <pthread_types.h> for C99 constructs when used with strict -std=c89. Restrict designated initializers usage to C99 or newer code. C89 and C++ will share the same code without extension of designated initializers. PR 52285
Diffstat (limited to 'lib/libpthread')
-rw-r--r--lib/libpthread/pthread_types.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/libpthread/pthread_types.h b/lib/libpthread/pthread_types.h
index 797c84877e6..9714c8e5f68 100644
--- a/lib/libpthread/pthread_types.h
+++ b/lib/libpthread/pthread_types.h
@@ -1,4 +1,4 @@
-/* $NetBSD: pthread_types.h,v 1.22 2016/07/20 21:02:04 christos Exp $ */
+/* $NetBSD: pthread_types.h,v 1.23 2017/09/09 23:21:45 kamil Exp $ */
/*-
* Copyright (c) 2001, 2008 The NetBSD Foundation, Inc.
@@ -114,10 +114,10 @@ struct __pthread_mutex_st {
__pthread_spin_t ptm_errorcheck;
#ifdef __CPU_SIMPLE_LOCK_PAD
uint8_t ptm_pad1[3];
-#ifdef __cplusplus
-#define _PTHREAD_MUTEX_PAD(a) { 0, 0, 0 },
-#else
+#if (__STDC_VERSION__ - 0) >= 199901L
#define _PTHREAD_MUTEX_PAD(a) .a = { 0, 0, 0 },
+#else
+#define _PTHREAD_MUTEX_PAD(a) { 0, 0, 0 },
#endif
#else
#define _PTHREAD_MUTEX_PAD(a)
@@ -138,12 +138,12 @@ struct __pthread_mutex_st {
#define _PT_MUTEX_MAGIC 0x33330003
#define _PT_MUTEX_DEAD 0xDEAD0003
-#ifdef __cplusplus
-#define _PTHREAD_MUTEX_INI(a, b) b
-#define _PTHREAD_MUTEX_UNI(a) { 0 }
-#else
+#if (__STDC_VERSION__ - 0) >= 199901L
#define _PTHREAD_MUTEX_INI(a, b) .a = b
#define _PTHREAD_MUTEX_UNI(a) .a = 0
+#else
+#define _PTHREAD_MUTEX_INI(a, b) b
+#define _PTHREAD_MUTEX_UNI(a) { 0 }
#endif
#define _PTHREAD_MUTEX_INITIALIZER { \