NetBSD Problem Report #52285

From www@NetBSD.org  Thu Jun  8 15:01:23 2017
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 8FC717A16D
	for <gnats-bugs@gnats.NetBSD.org>; Thu,  8 Jun 2017 15:01:23 +0000 (UTC)
Message-Id: <20170608150122.63F6E7A28C@mollari.NetBSD.org>
Date: Thu,  8 Jun 2017 15:01:22 +0000 (UTC)
From: n54@gmx.com
Reply-To: n54@gmx.com
To: gnats-bugs@NetBSD.org
Subject: <pthread_types.h> requires C99
X-Send-Pr-Version: www-1.0

>Number:         52285
>Category:       bin
>Synopsis:       <pthread_types.h> requires C99
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jun 08 15:05:01 +0000 2017
>Closed-Date:    Sat Sep 09 23:36:11 +0000 2017
>Last-Modified:  Sat Sep 09 23:36:11 +0000 2017
>Originator:     Kamil Rytarowski
>Release:        NetBSD 8.99.1 amd64
>Organization:
TNF
>Environment:
NetBSD chieftec 8.99.1 NetBSD 8.99.1 (GENERIC) #3: Thu Jun  8 12:59:05 UTC 2017  root@chieftec:/public/netbsd-root/sys/arch/amd64/compile/GENERIC amd64
>Description:
<pthread_types.h> requires C99 in C code:

#ifdef __cplusplus
#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

--- src/libuv_la-threadpool.lo ---
src/threadpool.c:44:25: warning: designated initializers are a C99 feature [-Wc99-extensions]
static uv_once_t once = UV_ONCE_INIT;
                        ^~~~~~~~~~~~
./include/uv-unix.h:136:22: note: expanded from macro 'UV_ONCE_INIT'
#define UV_ONCE_INIT PTHREAD_ONCE_INIT
                     ^~~~~~~~~~~~~~~~~
/usr/include/pthread.h:292:28: note: expanded from macro 'PTHREAD_ONCE_INIT'
#define PTHREAD_ONCE_INIT               _PTHREAD_ONCE_INIT
                                        ^~~~~~~~~~~~~~~~~~
/usr/include/pthread_types.h:204:30: note: expanded from macro '_PTHREAD_ONCE_INIT'
#define _PTHREAD_ONCE_INIT      { PTHREAD_MUTEX_INITIALIZER, 0 }
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/pthread.h:291:35: note: expanded from macro 'PTHREAD_MUTEX_INITIALIZER'
#define PTHREAD_MUTEX_INITIALIZER       _PTHREAD_MUTEX_INITIALIZER
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/pthread_types.h:150:2: note: expanded from macro '_PTHREAD_MUTEX_INITIALIZER'
        _PTHREAD_MUTEX_INI(ptm_magic, _PT_MUTEX_MAGIC),                 \
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/pthread_types.h:145:34: note: expanded from macro '_PTHREAD_MUTEX_INI'
#define _PTHREAD_MUTEX_INI(a, b) .a = b
                                 ^~~~~~

>How-To-Repeat:
Use Clang as your base system compiler.
Build pkgsrc packages.

PKGSRC_COMPILER=        clang
PKG_CC=                 clang
PKG_CXX=                clang++
CLANGBASE=              /usr/local
>Fix:
Convert designated initializers to ANSI C 1989.

>Release-Note:

>Audit-Trail:
From: Joerg Sonnenberger <joerg@bec.de>
To: gnats-bugs@NetBSD.org
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: bin/52285: <pthread_types.h> requires C99
Date: Thu, 8 Jun 2017 17:09:41 +0200

 On Thu, Jun 08, 2017 at 03:05:01PM +0000, n54@gmx.com wrote:
 > >Synopsis:       <pthread_types.h> requires C99

 I consider this a case of "*shrug* won't fix". C99 and newer is the
 default for clang and I see no big reason to cater to ancient language
 versions. It has never been a problem for a correctly configured system
 so far.

 Joerg

From: Kamil Rytarowski <n54@gmx.com>
To: gnats-bugs@NetBSD.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Cc: 
Subject: Re: bin/52285: <pthread_types.h> requires C99
Date: Thu, 8 Jun 2017 17:04:06 +0200

 This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
 --OAGrCtGBub2rjkALpm4RtTHnnQDl6rRGM
 Content-Type: multipart/mixed; boundary="5lW9c7XRkgdsMPacKoiixaqOqL2CIiNiW";
  protected-headers="v1"
 From: Kamil Rytarowski <n54@gmx.com>
 To: gnats-bugs@NetBSD.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
 Message-ID: <6e997416-ee40-28e3-8733-eabeb1c96512@gmx.com>
 Subject: Re: bin/52285: <pthread_types.h> requires C99
 References: <pr-bin-52285@gnats.netbsd.org>
  <20170608150122.63F6E7A28C@mollari.NetBSD.org>
  <20170608151002.07CED7A2AD@mollari.NetBSD.org>
 In-Reply-To: <20170608151002.07CED7A2AD@mollari.NetBSD.org>

 --5lW9c7XRkgdsMPacKoiixaqOqL2CIiNiW
 Content-Type: text/plain; charset=windows-1252
 Content-Transfer-Encoding: quoted-printable

 On 08.06.2017 17:10, Joerg Sonnenberger wrote:
 > The following reply was made to PR bin/52285; it has been noted by GNAT=
 S.
 >=20
 > From: Joerg Sonnenberger <joerg@bec.de>
 > To: gnats-bugs@NetBSD.org
 > Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
 > Subject: Re: bin/52285: <pthread_types.h> requires C99
 > Date: Thu, 8 Jun 2017 17:09:41 +0200
 >=20
 >  On Thu, Jun 08, 2017 at 03:05:01PM +0000, n54@gmx.com wrote:
 >  > >Synopsis:       <pthread_types.h> requires C99
 > =20
 >  I consider this a case of "*shrug* won't fix". C99 and newer is the
 >  default for clang and I see no big reason to cater to ancient language=

 >  versions. It has never been a problem for a correctly configured syste=
 m
 >  so far.
 > =20
 >  Joerg
 > =20
 >=20

 We still want to build pedantic C89 software against our headers.
 -std=3Dc89 is popular and not going anywhere.


 --5lW9c7XRkgdsMPacKoiixaqOqL2CIiNiW--

 --OAGrCtGBub2rjkALpm4RtTHnnQDl6rRGM
 Content-Type: application/pgp-signature; name="signature.asc"
 Content-Description: OpenPGP digital signature
 Content-Disposition: attachment; filename="signature.asc"

 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2

 iQIcBAEBCAAGBQJZOWdnAAoJEEuzCOmwLnZse6cQAKh4uhOaaPiW/25hJAOyg47v
 O8hflaMnrLxI8XSJICnDrOlt43XRb8XyUXwYSOp2J6k8609p4uN2wlcIyouLfUsS
 xeARYHLGIs8HPBN5UUP+lUOW4vaX2pj/bkRBqgqI88cdd8Yo/9xG0PhwIPirNhxd
 owBwp4uvO4cX33XS+Ar6tYe65njisoITgWzO0d0cFV6o/ErsKvT1beie6SHSM5tk
 lGBT0KRIjTazhjHu4SsFuiirMfB5mwvOUfh2+d2Mtx0DQFliNy2LXLDE6CXvPKpm
 yoWycev0dOrV6RCubHMp71JvilekeljP4L2+iNOAvZoJ2Q9gRDWJ3N4X6rOqKdgi
 x0ncM7dKwBSw5GIH8OeN1ZlcM9g4ofNULiRU3/Rw18nV3s0nbKCsu3YC4T0WQ61J
 XhFwpIunfLr2O8CpCmAjGOEIdlI/1/H6p5EzeTQu/Gdg6wIKK2WhQUsrG/kTzuW1
 QoGFKtqLUa2m4sbrsor0d6PAYlTem21Ab8+5pJHlzu66n6Eej7Tqma2h9A2oy3Ks
 hdvdtGxfmzoiuIH+JTHfEe7IvlcktEAIwA+REdutdZ5GgyX97bu6QwMwNZeznXdG
 v9m49wOSP45SCgu3qSG0uRpdwKMqVQW0pUT/QTF42I92JGSWJ6p7TfVoNY6EjFEL
 YK6Ba1uvYtOQMNQRw/o+
 =vhod
 -----END PGP SIGNATURE-----

 --OAGrCtGBub2rjkALpm4RtTHnnQDl6rRGM--

From: Joerg Sonnenberger <joerg@bec.de>
To: gnats-bugs@NetBSD.org
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, n54@gmx.com
Subject: Re: bin/52285: <pthread_types.h> requires C99
Date: Thu, 8 Jun 2017 17:24:52 +0200

 On Thu, Jun 08, 2017 at 03:15:00PM +0000, Kamil Rytarowski wrote:
 >  We still want to build pedantic C89 software against our headers.
 >  -std=c89 is popular and not going anywhere.

 Actually, it is not. There is practically no reason for forcing C89
 except a misguided attempt to ensure portability. Even then, the last
 big reason for wanting to stay with C89 is gone now that even Microsoft
 supports newer C.

 Joerg

From: Kamil Rytarowski <n54@gmx.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/52285: <pthread_types.h> requires C99
Date: Fri, 9 Jun 2017 04:30:56 +0200

 This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
 --LpuJ6lbUfAWMmtWvNO1vRJLmitQgs9v4G
 Content-Type: multipart/mixed; boundary="WGXo4pUXKuAT7R6cuBq1HIB0uaa49WOpT";
  protected-headers="v1"
 From: Kamil Rytarowski <n54@gmx.com>
 To: gnats-bugs@NetBSD.org
 Message-ID: <0e369696-b75b-e237-ca58-28ae0a4ea25a@gmx.com>
 Subject: Re: bin/52285: <pthread_types.h> requires C99
 References: <pr-bin-52285@gnats.netbsd.org>
  <20170608150122.63F6E7A28C@mollari.NetBSD.org>
  <20170608153001.CBA057A28C@mollari.NetBSD.org>
 In-Reply-To: <20170608153001.CBA057A28C@mollari.NetBSD.org>

 --WGXo4pUXKuAT7R6cuBq1HIB0uaa49WOpT
 Content-Type: text/plain; charset=windows-1252
 Content-Transfer-Encoding: quoted-printable

 On 08.06.2017 17:30, Joerg Sonnenberger wrote:
 > The following reply was made to PR bin/52285; it has been noted by GNAT=
 S.
 >=20
 > From: Joerg Sonnenberger <joerg@bec.de>
 > To: gnats-bugs@NetBSD.org
 > Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, n54@gmx.com
 > Subject: Re: bin/52285: <pthread_types.h> requires C99
 > Date: Thu, 8 Jun 2017 17:24:52 +0200
 >=20
 >  On Thu, Jun 08, 2017 at 03:15:00PM +0000, Kamil Rytarowski wrote:
 >  >  We still want to build pedantic C89 software against our headers.
 >  >  -std=3Dc89 is popular and not going anywhere.
 > =20
 >  Actually, it is not. There is practically no reason for forcing C89
 >  except a misguided attempt to ensure portability. Even then, the last
 >  big reason for wanting to stay with C89 is gone now that even Microsof=
 t
 >  supports newer C.
 > =20
 >  Joerg
 > =20
 >=20

 Lua, Perl, glib2 will stay with c89/gnu89 long time.

 There are also industry standards that enforce C89 like automotiv MISRA C=
 =2E


 --WGXo4pUXKuAT7R6cuBq1HIB0uaa49WOpT--

 --LpuJ6lbUfAWMmtWvNO1vRJLmitQgs9v4G
 Content-Type: application/pgp-signature; name="signature.asc"
 Content-Description: OpenPGP digital signature
 Content-Disposition: attachment; filename="signature.asc"

 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2

 iQIcBAEBCAAGBQJZOghnAAoJEEuzCOmwLnZsxHUP/Ry8XL9ZII9T60VwUhjZOHmL
 7dQ8HFu99zZa1wpzU9bOrfB4j6/vgUwvOLY/KtGrhjItsY5PTcavraZwuG5Bi745
 ec9qrAaGAceuB6yLcdZAL/pnlSOEP624xwO66q/cTSFNJtaLkAO5AnSh1KpsFTPT
 wmnen03cCLyPz2uj54DOWQg2jDK6S2eTpVd7ghJpxtbfpO7628v8nSyyzVMJ+OPn
 rHxP8gqdJgYNGEx6zClpCqbMaEMTCi7AqkbcpC+hGTxG1MjpBrhH0/X/LH1CJTjv
 o67sXRoubOnAzFmLB2khjPwbJ0RSnMi587QRo1UFtg4nMRoUevYwH8E12//BJGa9
 iibbOqI0XzLVfN9cgr4qPMUGUFOZOnbJ4cWqRp1Q/RFiWURVEpuP4FijE1oJTcx+
 k/sWJOPSAnva9inE0v8fRdRj9B/egLNJlQ3dpUxHvADwCUqWsdOLZcNmeRoqIIbT
 fGAzCd7m/Ly1oZNzsGnzpn8zS1DYyffd1ciFEI1EgjEh31GXQKVlSmdrlJ3hWe2/
 3Fvfycsrdf+oj91w0KkS7UB9oAY1Il3yeNaKscqG0mdBWb0BA+Ta2OF17cIV2nRq
 RAhYFybf8C9rcm2tJArROruUmCTFRKbLJiIbEvTzyOUDPKy2ZT0qRndfuoZGKZSP
 3JpnK9F0t2VI+I402Pjf
 =UhSe
 -----END PGP SIGNATURE-----

 --LpuJ6lbUfAWMmtWvNO1vRJLmitQgs9v4G--

From: coypu@sdf.org
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/52285: <pthread_types.h> requires C99
Date: Fri, 9 Jun 2017 07:06:42 +0000

 I've previously had to force -std=c89 to allow old style inline
 functions IIRC. That one has its own compiler flag though.

 Do other examples exist?

From: Joerg Sonnenberger <joerg@bec.de>
To: gnats-bugs@NetBSD.org
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, n54@gmx.com
Subject: Re: bin/52285: <pthread_types.h> requires C99
Date: Fri, 9 Jun 2017 13:23:55 +0200

 On Fri, Jun 09, 2017 at 07:10:01AM +0000, coypu@sdf.org wrote:
 >  I've previously had to force -std=c89 to allow old style inline
 >  functions IIRC. That one has its own compiler flag though.

 That makes no sense since C89 has no inline. You might mean GNU89
 though.

 Joerg

From: Joerg Sonnenberger <joerg@bec.de>
To: gnats-bugs@NetBSD.org
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, n54@gmx.com
Subject: Re: bin/52285: <pthread_types.h> requires C99
Date: Fri, 9 Jun 2017 13:27:23 +0200

 On Fri, Jun 09, 2017 at 02:30:01AM +0000, Kamil Rytarowski wrote:
 >  >  Actually, it is not. There is practically no reason for forcing C89
 >  >  except a misguided attempt to ensure portability. Even then, the last
 >  >  big reason for wanting to stay with C89 is gone now that even
 >  >  Microsoft
 >  >  supports newer C.
 >  
 >  Lua, Perl, glib2 will stay with c89/gnu89 long time.
 >  
 >  There are also industry standards that enforce C89 like automotiv MISRA C

 POSIX 2008 requires C99, making the point pretty much irrelevant. C89
 compliant code builds just fine in C99 mode as such there is really no
 point in cattering to the most ancient denominator. There are even a
 couple if items where we want to explicitly break full C89
 compatibility. gets(3) for once.

 Joerg

From: "Kamil Rytarowski" <kamil@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52285 CVS commit: src/lib/libpthread
Date: Sat, 9 Sep 2017 23:21:45 +0000

 Module Name:	src
 Committed By:	kamil
 Date:		Sat Sep  9 23:21:45 UTC 2017

 Modified Files:
 	src/lib/libpthread: pthread_types.h

 Log Message:
 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


 To generate a diff of this commit:
 cvs rdiff -u -r1.22 -r1.23 src/lib/libpthread/pthread_types.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: kamil@NetBSD.org
State-Changed-When: Sun, 10 Sep 2017 01:36:11 +0200
State-Changed-Why:
src/lib/libpthread/pthread_types.h r. 1.23


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.