Bug 59401

Summary: <pthread.h> cannot declare pthread_rwlock_t
Product: [Retired] Red Hat Linux Reporter: Eric Fallon <eric.fallon>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: fweimer
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-02-07 02:13:45 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Very short program used to produce error. none

Description Eric Fallon 2002-02-07 02:11:08 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.77 [en] (X11; U; Linux 2.4.2-2 i686)

Description of problem:
When attempting to compile a program declaring pthread_rwlock_t from <pthread.h>
gcc will issue an error and fail.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Obtain the program simple.c
2.  Invoke gcc -c simple.c
	

Actual Results:  Upon compilation gcc will issue the following error messages:

simple.c:16: parse error before 'rwlock'
simple.c:16: warning: data definition has no type or storage class

Expected Results:  gcc should allow you to declare this type.

Without being able to declare this type you will not be able to utalize any of
the rwlock methods included in <pthread.h> as they all utalize a variable of
type pthread_rwlock_t.

Additional info:

I am using glibc version 2.2.4-19.3.

This program will compile without error on Solaris.

Comment 1 Eric Fallon 2002-02-07 02:13:40 UTC
Created attachment 44798 [details]
Very short program used to produce error.

Comment 2 Jakub Jelinek 2002-02-07 10:19:29 UTC
pthread_rwlock_t is only available in Unix98 and later standards.
So, you need to choose such feature set if you want to use it.
One of -D_XOPEN_SOURCE=500, -D_XOPEN_SOURCE=600 or -D_GNU_SOURCE will do.
See info libc on "Feature Test Macros".