public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* system.h, gcc.c, toplev.c
@ 1998-02-18 17:37 John Carr
  1998-02-19  3:32 ` Jeffrey A Law
  0 siblings, 1 reply; 3+ messages in thread
From: John Carr @ 1998-02-18 17:37 UTC (permalink / raw)
  To: egcs

This patch reduces system.h to include a reasonable set of include
files, uses ANSI string functions when autoconf defines STDC_HEADERS,
makes corresponding changes to gcc.c, and converts toplev.c to use
system.h.

I don't think toplev.c needs <sys/stat.h>, but there might be a system
where it does.  Anyone remember?

Wed Feb 18 18:18:28 1998  John Carr  <jfc@mit.edu>

	* system.h: Do not include <sys/types.h>, <sys/stat.h>, <errno.h>,
	<unistd.h>, <sys/param.h>, <limit.h>, <time.h>, or <fcntl.h>.
	If STDC_HEADERS, use ANSI names for string functions.

	* gcc.c: Restore includes deleted from system.h.

	* toplev.c: Include <system.h> instead of <stdio.h>, <ctype.h>,
	<stdlib.h>, and <string.h>.  Do not include <sys/stat.h>.

Index: system.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/system.h,v
retrieving revision 1.2
diff -c -3 -p -r1.2 system.h
*** system.h	1998/02/15 20:36:23	1.2
--- system.h	1998/02/18 23:16:32
***************
*** 67,81 ****
     host does not conform to Posix.  */
  #define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
  
- 
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <errno.h>
- 
- #ifndef errno
- extern int errno;
- #endif
- 
  #ifdef HAVE_STRING_H
  # include <string.h>
  #else
--- 67,72 ----
*************** extern int errno;
*** 87,135 ****
  #ifdef HAVE_STDLIB_H
  # include <stdlib.h>
  #endif
- 
- #ifdef HAVE_UNISTD_H
- # include <unistd.h>
- #endif
- 
- #ifdef HAVE_SYS_PARAM_H
- # include <sys/param.h>
- #endif
- 
- #if HAVE_LIMITS_H
- # include <limits.h>
- #endif
  
! #ifdef TIME_WITH_SYS_TIME
! # include <sys/time.h>
! # include <time.h>
! #else
! # if HAVE_SYS_TIME_H
! # include <sys/time.h>
! # else
! #  include <time.h>
! #endif
! #endif
! 
! #ifdef HAVE_FCNTL_H
! # include <fcntl.h>
! #else
! # include <sys/file.h>
  #endif
! 
! #ifndef SEEK_SET
! # define SEEK_SET 0
! # define SEEK_CUR 1
! # define SEEK_END 2
! #endif
! #ifndef F_OK
! # define F_OK 0
! # define X_OK 1
! # define W_OK 2
! # define R_OK 4
! #endif
! 
! 
  
  #ifndef bcopy
  # ifdef HAVE_BCOPY
--- 78,96 ----
  #ifdef HAVE_STDLIB_H
  # include <stdlib.h>
  #endif
  
! /* Prefer ANSI functions when they are known to be available.  */
! #ifdef STDC_HEADERS
! #undef HAVE_BCOPY
! #undef HAVE_BCMP
! #undef HAVE_BZERO
! #undef HAVE_INDEX
! #undef HAVE_RINDEX
! #else /* STDC_HEADERS */
! #if __GNUC__ > 1
! #undef HAVE_BCOPY		/* Use compiler builtin memcpy */
  #endif
! #endif /* STDC_HEADERS */
  
  #ifndef bcopy
  # ifdef HAVE_BCOPY


Index: gcc.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/gcc.c,v
retrieving revision 1.13
diff -c -3 -p -r1.13 gcc.c
*** gcc.c	1998/02/15 20:41:09	1.13
--- gcc.c	1998/02/18 23:43:11
*************** compilation is specified by a string cal
*** 36,41 ****
--- 36,97 ----
  #include "gansidecl.h"
  #include "system.h"
  
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ 
+ #ifdef HAVE_UNISTD_H
+ # include <unistd.h>
+ #endif
+ 
+ #include <errno.h>
+ 
+ #ifndef errno
+ extern int errno;
+ #endif
+ 
+ #ifdef HAVE_FCNTL_H
+ # include <fcntl.h>
+ #else
+ # include <sys/file.h>
+ #endif
+ 
+ #ifdef HAVE_SYS_PARAM_H
+ # include <sys/param.h>
+ #endif
+ 
+ #if HAVE_LIMITS_H
+ # include <limits.h>
+ #endif
+ 
+ #ifdef TIME_WITH_SYS_TIME
+ # include <sys/time.h>
+ # include <time.h>
+ #else
+ # if HAVE_SYS_TIME_H
+ # include <sys/time.h>
+ # else
+ #  include <time.h>
+ #endif
+ #endif
+ 
+ #ifdef HAVE_FCNTL_H
+ # include <fcntl.h>
+ #else
+ # include <sys/file.h>
+ #endif
+ 
+ #ifndef SEEK_SET
+ # define SEEK_SET 0
+ # define SEEK_CUR 1
+ # define SEEK_END 2
+ #endif
+ #ifndef F_OK
+ # define F_OK 0
+ # define X_OK 1
+ # define W_OK 2
+ # define R_OK 4
+ #endif
+ 
  #include <signal.h>
  #ifdef __STDC__
  #include <stdarg.h>

Index: toplev.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/toplev.c,v
retrieving revision 1.43
diff -c -3 -p -r1.43 toplev.c
*** toplev.c	1998/02/15 22:28:32	1.43
--- toplev.c	1998/02/18 23:15:41
*************** Boston, MA 02111-1307, USA.  */
*** 29,53 ****
  #else
  #include <varargs.h>
  #endif
! #include <stdio.h>
  #include <signal.h>
  #include <setjmp.h>
  #include <sys/types.h>
! #include <ctype.h>
! #include <sys/stat.h>
  #undef FLOAT
  #ifdef HAVE_SYS_PARAM_H
  #include <sys/param.h>
- #endif
- #if HAVE_STDLIB_H
- #include <stdlib.h>
- #endif
- #ifdef HAVE_STRING_H
- #include <string.h>
- #else
- #ifdef HAVE_STRINGS_H
- #include <strings.h>
- #endif
  #endif
  #ifdef HAVE_UNISTD_H
  #include <unistd.h>
--- 29,42 ----
  #else
  #include <varargs.h>
  #endif
! #include "system.h"
  #include <signal.h>
  #include <setjmp.h>
  #include <sys/types.h>
! 
  #undef FLOAT
  #ifdef HAVE_SYS_PARAM_H
  #include <sys/param.h>
  #endif
  #ifdef HAVE_UNISTD_H
  #include <unistd.h>



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: system.h, gcc.c, toplev.c
  1998-02-18 17:37 system.h, gcc.c, toplev.c John Carr
@ 1998-02-19  3:32 ` Jeffrey A Law
  0 siblings, 0 replies; 3+ messages in thread
From: Jeffrey A Law @ 1998-02-19  3:32 UTC (permalink / raw)
  To: John Carr; +Cc: egcs

  In message < 199802182344.SAA28809@jfc. >you write:
  > 
  > This patch reduces system.h to include a reasonable set of include
  > files, uses ANSI string functions when autoconf defines STDC_HEADERS,
  > makes corresponding changes to gcc.c, and converts toplev.c to use
  > system.h.
  > 
  > I don't think toplev.c needs <sys/stat.h>, but there might be a system
  > where it does.  Anyone remember?
  > 
  > Wed Feb 18 18:18:28 1998  John Carr  <jfc@mit.edu>
  > 
  > 	* system.h: Do not include <sys/types.h>, <sys/stat.h>, <errno.h>,
  > 	<unistd.h>, <sys/param.h>, <limit.h>, <time.h>, or <fcntl.h>.
  > 	If STDC_HEADERS, use ANSI names for string functions.
  > 
  > 	* gcc.c: Restore includes deleted from system.h.
  > 
  > 	* toplev.c: Include <system.h> instead of <stdio.h>, <ctype.h>,
  > 	<stdlib.h>, and <string.h>.  Do not include <sys/stat.h>.
Do you and Kaveh agree on this patch (since you seem to be the folks
most interested in this issue).

jeff

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re:  system.h, gcc.c, toplev.c
@ 1998-02-19 10:47 Kaveh R. Ghazi
  0 siblings, 0 replies; 3+ messages in thread
From: Kaveh R. Ghazi @ 1998-02-19 10:47 UTC (permalink / raw)
  To: egcs, jfc

 > From: John Carr <jfc@mit.edu>
 > 
 > This patch reduces system.h to include a reasonable set of include
 > files, uses ANSI string functions when autoconf defines STDC_HEADERS,
 > makes corresponding changes to gcc.c, and converts toplev.c to use
 > system.h.

John,

	I think your proposed patch goes too far.  To date, you've
only given a rationale for removing stat.h (because on some SVR4
platforms it may cause some code bloat with static functions.)

	Centralized maintenance is a reason to keep everything else,
the extra compilation time is not large.

	How about we start with removing just stat.h and see if any
other headers cause problems?  Can we agree on that?

		--Kaveh

PS: I like your bcopy (etc) undef stuff, but just to be extra safe I
would check ifdef HAVE_MEM* in addition to or instead of STDC_HEADERS
before undef'ing the HAVE_B* functions.  Imagine using gcc for stage1 on
an old bsd system (without the mem* style functions,) it would pass the
STDC_HEADERS test by autoconf (because fixincludes would add the missing
headers, wouldn't it?)

--
Kaveh R. Ghazi			Project Manager / Custom Development
ghazi@caip.rutgers.edu		ICon CMT Corp.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1998-02-19 10:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-02-18 17:37 system.h, gcc.c, toplev.c John Carr
1998-02-19  3:32 ` Jeffrey A Law
1998-02-19 10:47 Kaveh R. Ghazi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).