This is the mail archive of the
mailing list for the GCC project.
Re: Generate string.h and time.h if nonexistent; kill POSIX
- To: zackw at Stanford dot EDU
- Subject: Re: Generate string.h and time.h if nonexistent; kill POSIX
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Date: Tue, 1 May 2001 11:50:11 -0400 (EDT)
- Cc: gcc-patches at gcc dot gnu dot org
> This patch augments the existing fixproto logic to create missing C89
> headers, so it can do string.h and time.h too. Then tsystem.h can
> include them unconditionally, and we don't need to check POSIX
> I caused fixproto to generate the headers in question and read them.
> They look sane. However, all the machines I have access to are far
> too modern to test this stuff properly. The patch needs a test on a
> system with a K+R libc. I'm particularly worried about what happens
> with time.h.
> * fixproto (required_stdlib_h, required_unistd_h): Kill, not used.
> (file generation loop): Add logic for time.h and string.h.
> Rearrange for comprehensibility.
> * tsystem.h: Include string.h and time.h unconditionally.
> * config.gcc (all systems): Don't define POSIX.
> (*-*-linux): Remove block, now empty.
Zack, great stuff thanks!
IIRC, some platform's sys/time.h required including sys/types.h
beforehand. I would stick types.h in the constructed time.h. No need
to check for it, all platforms apparently have one. It doesn't hurt
to forward declare "struct tm" in that clause too, even if it already
comes on a platform. Something like this:
> # It does, so include it and hope it has the appropriate
> # type declarations.
> echo '#include <sys/types.h>' >>tmp.h
> echo '#include <sys/time.h>' >>tmp.h
> echo 'struct tm;' >>tmp.h
Kaveh R. Ghazi Engagement Manager / Project Services
email@example.com Qwest Internet Solutions