Generate string.h and time.h if nonexistent; kill POSIX
Kaveh R. Ghazi
ghazi@caip.rutgers.edu
Tue May 8 08:31:00 GMT 2001
> From: "Zack Weinberg" <zackw@Stanford.EDU>
>
> On Tue, May 01, 2001 at 11:50:11AM -0400, Kaveh R. Ghazi wrote:
> >
> > 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
>
> I'm nervous about this. This header will be used by tsystem.h
> which already includes sys/types.h. What if it's not safe to
> include sys/types.h twice? I don't think fixincludes/fixproto try
> to add MI guards to headers that lack them.
Well, I can offer examples where we include it twice and have not seen
any problems in practice. E.g. system.h + cpplib.h both include
sys/types.h, so IMHO its safe.
Do you have access to any system that is actually missing time.h where
this would come up? We might be wasting time over a moot point. :-)
--Kaveh
--
Kaveh R. Ghazi Engagement Manager / Project Services
ghazi@caip.rutgers.edu Qwest Internet Solutions
More information about the Gcc-patches
mailing list