Bug 915 - pthread.h empty initializer braces
Summary: pthread.h empty initializer braces
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: nptl (show other bugs)
Version: 2.3.5
: P2 normal
Target Milestone: ---
Assignee: Ulrich Drepper
URL:
Keywords:
Depends on:
Blocks: libc236
  Show dependency treegraph
 
Reported: 2005-05-02 15:20 UTC by Christian Thalinger
Modified: 2005-07-18 03:20 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
uses PTHREAD_MUTEX_INITIALIZER and PTHREAD_COND_INITIALIZER (140 bytes, text/plain)
2005-05-03 12:57 UTC, Christian Thalinger
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Thalinger 2005-05-02 15:20:38 UTC
Some defines in nptl/sysdeps/pthread/pthread.h have empty initializers. This
lead to problems compiling files with pthread.h included and -Wall -Werror, like
boehm-gc:

pthread_support.c:1495: warning: ISO C forbids empty initializer braces
pthread_support.c:1498: warning: ISO C forbids empty initializer braces
Comment 1 Ulrich Drepper 2005-05-02 17:15:14 UTC
And what is on the quoted lines in those files?  If I don't get a self-contained
test case I'll close the bug.
Comment 2 Christian Thalinger 2005-05-03 12:57:27 UTC
Created attachment 475 [details]
uses PTHREAD_MUTEX_INITIALIZER and PTHREAD_COND_INITIALIZER
Comment 3 Christian Thalinger 2005-05-03 12:58:57 UTC
Ok, the problem is -pedantic not -Wall.

$ gcc -pedantic -c test.c
test.c: In function `main':
test.c:5: warning: ISO C forbids empty initializer braces
test.c:6: warning: ISO C forbids empty initializer braces
Comment 4 Ulrich Drepper 2005-05-04 06:17:19 UTC
I've checked in a patch although the -pedantic option shouldn't be used.
Comment 5 Sourceware Commits 2005-07-18 03:20:20 UTC
Subject: Bug 915

CVSROOT:	/cvs/glibc
Module name:	libc
Branch: 	glibc-2_3-branch
Changes by:	roland@sources.redhat.com	2005-07-18 03:20:13

Modified files:
	nptl/sysdeps/pthread: pthread.h 

Log message:
	2005-07-11  Jakub Jelinek  <jakub@redhat.com>
	
	[BZ #1102]
	* sysdeps/pthread/pthread.h (PTHREAD_MUTEX_INITIALIZER,
	PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP,
	PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP,
	PTHREAD_MUTEX_ADAPTIVE_NP, PTHREAD_RWLOCK_INITIALIZER,
	PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP,
	PTHREAD_COND_INITIALIZER): Supply zeros for all fields
	in the structure.
	* Makefile (tests): Add tst-initializers1.
	(CFLAGS-tst-initializers1.c): Set.
	* tst-initializers1.c: New test.
	2005-05-03  Ulrich Drepper  <drepper@redhat.com>
	
	[BZ #915]
	* sysdeps/pthread/pthread.h: Avoid empty initializers.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/nptl/sysdeps/pthread/pthread.h.diff?cvsroot=glibc&only_with_tag=glibc-2_3-branch&r1=1.30.2.1&r2=1.30.2.2