c/3297: fixincludes (?) removes pthread types from types.h
Grant Gould
ggould@intouchsys.com
Wed Jun 20 08:46:00 GMT 2001
>Number: 3297
>Category: c
>Synopsis: fixincludes (?) removes pthread types from types.h
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Wed Jun 20 08:46:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Grant Gould
>Release: 3.0
>Organization:
Comverse Network Systems (Voice Solutions)
>Environment:
System: SunOS curley.intouchsys.com 5.7 Generic_106541-15 sun4m sparc SUNW,SPARCstation-5
Architecture: sun4
host: sparc-sun-solaris2.5
build: sparc-sun-solaris2.5
target: sparc-sun-solaris2.5
configured with: ../gcc-3.0/configure
>Description:
/usr/local/lib/gcc-lib/sparc-sun-solaris2.5/3.0/include/sys/types.h
does not define pthreads-related types. Standard solaris headers in
/usr/include (such as /usr/include/time.h) rely on it doing so. This
results in parse errors when these headers use pthread_attr_t and it
has not been provided by the #include<sys/types.h>
>How-To-Repeat:
Here's a copy-and-paste of my demonstration. Note that hworld2.c is
legal, but will only compile if I explicitly force the use of the
headers in /usr/include rather than letting gcc use its fixed headers.
$ curley $ cat hworld.c
#include <stdio.h>
int main(int argc, char **argv)
{
printf("Hello, World!\n");
}
$ curley $ cat hworld2.c
#include <time.h>
#include <stdio.h>
int main(int argc, char **argv)
{
printf("Hello, World!\n");
}
$ curley $ gcc hworld.c -o hworld
$ curley $ ./hworld
Hello, World!
$ curley $ gcc hworld2.c -o hworld2
In file included from hworld2.c:1:
/usr/include/time.h:131: parse error before "pthread_attr_t"
/usr/include/time.h:133: parse error before '}' token
$ curley $ gcc hworld2.c -I/usr/include/ -o hworld2
$ curley $ ./hworld2
Hello, World!
>Fix:
Well, you could leave the pthreads definitions in the fixed types.h --
I don't see why it is excised.
As it is, gcc leaves a situation where no simple #include line will
get you the pthread types. That's no good.
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list