Source-Changes-HG archive

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

[src/trunk]: src/lib/libpthread Support <pthread_typs.h> on C89 compilers



details:   https://anonhg.NetBSD.org/src/rev/220394fb6c3b
branches:  trunk
changeset: 356216:220394fb6c3b
user:      kamil <kamil%NetBSD.org@localhost>
date:      Sat Sep 09 23:21:45 2017 +0000

description:
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:

 lib/libpthread/pthread_types.h |  16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diffs (40 lines):

diff -r 73fd04eb6407 -r 220394fb6c3b lib/libpthread/pthread_types.h
--- a/lib/libpthread/pthread_types.h    Sat Sep 09 21:34:07 2017 +0000
+++ b/lib/libpthread/pthread_types.h    Sat Sep 09 23:21:45 2017 +0000
@@ -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 @@
        __pthread_spin_t ptm_errorcheck;
 #ifdef __CPU_SIMPLE_LOCK_PAD
        uint8_t         ptm_pad1[3];
-#ifdef __cplusplus
+#if (__STDC_VERSION__ - 0) >= 199901L
+#define _PTHREAD_MUTEX_PAD(a)  .a = { 0, 0, 0 },
+#else
 #define _PTHREAD_MUTEX_PAD(a)  { 0, 0, 0 },
-#else
-#define _PTHREAD_MUTEX_PAD(a)  .a = { 0, 0, 0 },
 #endif
 #else
 #define _PTHREAD_MUTEX_PAD(a)
@@ -138,12 +138,12 @@
 #define        _PT_MUTEX_MAGIC 0x33330003
 #define        _PT_MUTEX_DEAD  0xDEAD0003
 
-#ifdef __cplusplus
+#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 }
-#else
-#define _PTHREAD_MUTEX_INI(a, b) .a = b
-#define _PTHREAD_MUTEX_UNI(a) .a = 0
 #endif
 
 #define _PTHREAD_MUTEX_INITIALIZER {                                   \



Home | Main Index | Thread Index | Old Index