This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Generate string.h and time.h if nonexistent; kill POSIX


 > 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
 > anymore.
 > 
 > 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.
 > 
 > zw
 > 
 >         * 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
--
Kaveh R. Ghazi			Engagement Manager / Project Services
ghazi@caip.rutgers.edu		Qwest Internet Solutions


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]