This is the mail archive of the gcc@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: #define POSIX, string.h and time.h


 > This is the only use of the POSIX macro in the entire source tree:
 > 
 > /* tsystem.h */
 > 
 > #if defined(POSIX) || defined(USG)
 > #include <string.h>
 > #endif
 > 
 > /* ... */
 > 
 > #if defined(POSIX) || defined(USG)
 > #include <time.h>
 > #endif
 > 
 > Both of those headers are required to exist by C89.  However, they
 > often do not exist - particularly <string.h> - in pre-C89 systems.
 > We're in the same boat with <stdlib.h>, but fixproto can fake that
 > header.  I am not sure it's feasible to fake string.h or time.h; 
 > their required contents include functions and typedefs that often 
 > do not exist in pre-C89 libcs.
 > 
 > Does anyone have a suggestion for how we might solve this problem?
 > zw

I think string.h is easier than time.h.  To your point about pre-c89
missing stuff, we probably don't need to worry about functions missing
from libc.  Many headers, e.g. stdlib.h will already get prototypes
for functions that some systems don't have (e.g. atexit.)

The only typedef I think we have to worry about in string.h is size_t
and that can be handled the same way fixproto does it for stdlib.h.

Creating time.h from scratch is more complicated cause it defines
time_t, clock_t, and various other structs and typedefs for which we
don't know the definition.  I think all uses of e.g. "struct tm" for
the functions inserted by fix-header are pointers, so we could get
away with just stating "struct tm;" at the beginning of our fabricated
time.h.  But I'm not sure how to handle the time_t/clock_t typedefs
and their associated uses in the prototypes unless we decided to
create a __TIME_TYPE__ and __CLOCK_TYPE__ like we already do for
__SIZE_TYPE__.

		--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]