egcs, a few more system.h cutover patches ...

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Sat Apr 4 14:20:00 GMT 1998


	Here's more system.h stuff.  Okay to install?

		--Kaveh


PS: This'll require checking in objc/objc-parse.c, objc/objc-parse.y,
c-parse.c, c-parse.y and cexp.c (after regenerating them) in addition to
the files listed in the ChangeLog entry below, right?




Fri Apr  3 09:50:55 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * c-parse.in: Include system.h, and remove stuff now made redundant.
        * cccp.c: Likewise.
        * cexp.y: Likewise.
        * protoize.c: Likewise.  Properly check for cpp stringification.


diff -rcp orig/egcs-980328/gcc/c-parse.in egcs-980328/gcc/c-parse.in
*** orig/egcs-980328/gcc/c-parse.in	Mon Mar 23 17:59:14 1998
--- egcs-980328/gcc/c-parse.in	Thu Apr  2 16:21:38 1998
***************
*** 1,5 ****
  /* YACC parser for C syntax and for Objective C.  -*-c-*-
!    Copyright (C) 1987, 88, 89, 92-6, 1997 Free Software Foundation, Inc.
  
  This file is part of GNU CC.
  
--- 1,5 ----
  /* YACC parser for C syntax and for Objective C.  -*-c-*-
!    Copyright (C) 1987, 88, 89, 92-97, 1998 Free Software Foundation, Inc.
  
  This file is part of GNU CC.
  
*************** end ifc
*** 59,67 ****
  
  %{
  #include "config.h"
! 
! #include <stdio.h>
! #include <errno.h>
  #include <setjmp.h>
  
  #include "tree.h"
--- 59,65 ----
  
  %{
  #include "config.h"
! #include "system.h"
  #include <setjmp.h>
  
  #include "tree.h"
*************** end ifc
*** 72,78 ****
  #include "output.h"
  
  #ifdef MULTIBYTE_CHARS
- #include <stdlib.h>
  #include <locale.h>
  #endif
  
--- 70,75 ----
*************** end ifobjc
*** 88,97 ****
  ifc
  char *language_string = "GNU C";
  end ifc
- 
- #ifndef errno
- extern int errno;
- #endif
  
  /* Like YYERROR but do call yyerror.  */
  #define YYERROR1 { yyerror ("syntax error"); YYERROR; }
--- 85,90 ----
diff -rcp orig/egcs-980328/gcc/cccp.c egcs-980328/gcc/cccp.c
*** orig/egcs-980328/gcc/cccp.c	Thu Mar 12 09:49:30 1998
--- egcs-980328/gcc/cccp.c	Thu Apr  2 15:56:00 1998
***************
*** 1,5 ****
  /* C Compatible Compiler Preprocessor (CCCP)
!    Copyright (C) 1986, 87, 89, 92-96, 1997 Free Software Foundation, Inc.
     Written by Paul Rubin, June 1986
     Adapted to ANSI C, Richard Stallman, Jan 1987
  
--- 1,5 ----
  /* C Compatible Compiler Preprocessor (CCCP)
!    Copyright (C) 1986, 87, 89, 92-97, 1998 Free Software Foundation, Inc.
     Written by Paul Rubin, June 1986
     Adapted to ANSI C, Richard Stallman, Jan 1987
  
*************** Foundation, 59 Temple Place - Suite 330,
*** 19,69 ****
  Boston, MA 02111-1307, USA. */
  
  #include "config.h"
! #include <sys/types.h>
! #include <sys/stat.h>
! #include <ctype.h>
! #include <stdio.h>
! #include <signal.h>
! 
! #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_SYS_RESOURCE_H
! # include <sys/resource.h>
! #endif
! 
! #if HAVE_FCNTL_H
! # include <fcntl.h>
! #endif
! 
! #if HAVE_LIMITS_H
! # include <limits.h>
! #endif
! 
! #if HAVE_UNISTD_H
! # include <unistd.h>
  #endif
  
! #include <errno.h>
  
! #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
  
  typedef unsigned char U_CHAR;
--- 19,54 ----
  Boston, MA 02111-1307, USA. */
  
  #include "config.h"
! #if defined (__STDC__) && defined (HAVE_VPRINTF)
! # include <stdarg.h>
! # define PRINTF_ALIST(msg) char *msg, ...
! # define PRINTF_DCL(msg)
! # define PRINTF_PROTO(ARGS, m, n) PROTO (ARGS) __attribute__ ((format (__printf__, m, n)))
  #else
! # include <varargs.h>
! # define PRINTF_ALIST(msg) msg, va_alist
! # define PRINTF_DCL(msg) char *msg; va_dcl
! # define PRINTF_PROTO(ARGS, m, n) () __attribute__ ((format (__printf__, m, n)))
! # define vfprintf(file, msg, args) \
!     { \
!       char *a0 = va_arg(args, char *); \
!       char *a1 = va_arg(args, char *); \
!       char *a2 = va_arg(args, char *); \
!       char *a3 = va_arg(args, char *); \
!       fprintf (file, msg, a0, a1, a2, a3); \
!     }
  #endif
  
! #define PRINTF_PROTO_1(ARGS) PRINTF_PROTO(ARGS, 1, 2)
! #define PRINTF_PROTO_2(ARGS) PRINTF_PROTO(ARGS, 2, 3)
! #define PRINTF_PROTO_3(ARGS) PRINTF_PROTO(ARGS, 3, 4)
  
! #include "system.h"
! #include <sys/stat.h>
! #include <signal.h>
  
! #ifdef HAVE_SYS_RESOURCE_H
! # include <sys/resource.h>
  #endif
  
  typedef unsigned char U_CHAR;
*************** typedef unsigned char U_CHAR;
*** 71,88 ****
  #include "gansidecl.h"
  #include "pcp.h"
  
- #ifdef NEED_DECLARATION_INDEX
- extern char *index ();
- #endif
- 
- #ifdef NEED_DECLARATION_RINDEX
- extern char *rindex ();
- #endif
- 
- #ifdef NEED_DECLARATION_GETENV
- extern char *getenv ();
- #endif
- 
  #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
  # define __attribute__(x)
  #endif
--- 56,61 ----
*************** extern char *getenv ();
*** 103,132 ****
  # define OBJECT_SUFFIX ".o"
  #endif
  
- #if defined (__STDC__) && defined (HAVE_VPRINTF)
- # include <stdarg.h>
- # define PRINTF_ALIST(msg) char *msg, ...
- # define PRINTF_DCL(msg)
- # define PRINTF_PROTO(ARGS, m, n) PROTO (ARGS) __attribute__ ((format (__printf__, m, n)))
- #else
- # include <varargs.h>
- # define PRINTF_ALIST(msg) msg, va_alist
- # define PRINTF_DCL(msg) char *msg; va_dcl
- # define PRINTF_PROTO(ARGS, m, n) () __attribute__ ((format (__printf__, m, n)))
- # define vfprintf(file, msg, args) \
-     { \
-       char *a0 = va_arg(args, char *); \
-       char *a1 = va_arg(args, char *); \
-       char *a2 = va_arg(args, char *); \
-       char *a3 = va_arg(args, char *); \
-       fprintf (file, msg, a0, a1, a2, a3); \
-     }
- #endif
- 
- #define PRINTF_PROTO_1(ARGS) PRINTF_PROTO(ARGS, 1, 2)
- #define PRINTF_PROTO_2(ARGS) PRINTF_PROTO(ARGS, 2, 3)
- #define PRINTF_PROTO_3(ARGS) PRINTF_PROTO(ARGS, 3, 4)
- 
  /* VMS-specific definitions */
  #ifdef VMS
  #include <descrip.h>
--- 76,81 ----
*************** char *strerror (int,...);
*** 216,225 ****
  #endif
  HOST_WIDE_INT parse_escape PROTO((char **, HOST_WIDE_INT));
  HOST_WIDE_INT parse_c_expression PROTO((char *, int));
- 
- #ifndef errno
- extern int errno;
- #endif
  
  /* Name under which this program was invoked.  */
  
--- 165,170 ----
diff -rcp orig/egcs-980328/gcc/cexp.y egcs-980328/gcc/cexp.y
*** orig/egcs-980328/gcc/cexp.y	Sat Dec  6 12:19:13 1997
--- egcs-980328/gcc/cexp.y	Thu Apr  2 15:55:41 1998
***************
*** 1,5 ****
  /* Parse C expressions for CCCP.
!    Copyright (C) 1987, 1992, 1994, 1995, 1996, 1997 Free Software Foundation.
  
  This program is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published by the
--- 1,5 ----
  /* Parse C expressions for CCCP.
!    Copyright (C) 1987, 1992, 94 - 97, 1998 Free Software Foundation.
  
  This program is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published by the
*************** Boston, MA 02111-1307, USA.
*** 26,53 ****
     
  %{
  #include "config.h"
! #include <setjmp.h>
! /* #define YYDEBUG 1 */
! 
! 
! #ifdef HAVE_STRING_H
! # include <string.h>
  #endif
  
! #ifdef HAVE_STDLIB_H
! # include <stdlib.h>
! #endif
  
! #ifdef HAVE_LIMITS_H
! # include <limits.h>
! #endif
  
  #ifdef MULTIBYTE_CHARS
  #include <locale.h>
  #endif
  
- #include <stdio.h>
- 
  typedef unsigned char U_CHAR;
  
  /* This is used for communicating lists of keywords with cccp.c.  */
--- 26,63 ----
     
  %{
  #include "config.h"
! #if defined (__STDC__) && defined (HAVE_VPRINTF)
! # include <stdarg.h>
! # define VA_START(va_list, var) va_start (va_list, var)
! # define PRINTF_ALIST(msg) char *msg, ...
! # define PRINTF_DCL(msg)
! # define PRINTF_PROTO(ARGS, m, n) PROTO (ARGS) __attribute__ ((format (__printf__, m, n)))
! #else
! # include <varargs.h>
! # define VA_START(va_list, var) va_start (va_list)
! # define PRINTF_ALIST(msg) msg, va_alist
! # define PRINTF_DCL(msg) char *msg; va_dcl
! # define PRINTF_PROTO(ARGS, m, n) () __attribute__ ((format (__printf__, m, n)))
! # define vfprintf(file, msg, args) \
!     { \
!       char *a0 = va_arg(args, char *); \
!       char *a1 = va_arg(args, char *); \
!       char *a2 = va_arg(args, char *); \
!       char *a3 = va_arg(args, char *); \
!       fprintf (file, msg, a0, a1, a2, a3); \
!     }
  #endif
  
! #define PRINTF_PROTO_1(ARGS) PRINTF_PROTO(ARGS, 1, 2)
  
! #include "system.h"
! #include <setjmp.h>
! /* #define YYDEBUG 1 */
  
  #ifdef MULTIBYTE_CHARS
  #include <locale.h>
  #endif
  
  typedef unsigned char U_CHAR;
  
  /* This is used for communicating lists of keywords with cccp.c.  */
*************** struct arglist {
*** 120,149 ****
  #  define PROTO(ARGS) ()
  # endif
  #endif
- 
- #if defined (__STDC__) && defined (HAVE_VPRINTF)
- # include <stdarg.h>
- # define VA_START(va_list, var) va_start (va_list, var)
- # define PRINTF_ALIST(msg) char *msg, ...
- # define PRINTF_DCL(msg)
- # define PRINTF_PROTO(ARGS, m, n) PROTO (ARGS) __attribute__ ((format (__printf__, m, n)))
- #else
- # include <varargs.h>
- # define VA_START(va_list, var) va_start (va_list)
- # define PRINTF_ALIST(msg) msg, va_alist
- # define PRINTF_DCL(msg) char *msg; va_dcl
- # define PRINTF_PROTO(ARGS, m, n) () __attribute__ ((format (__printf__, m, n)))
- # define vfprintf(file, msg, args) \
-     { \
-       char *a0 = va_arg(args, char *); \
-       char *a1 = va_arg(args, char *); \
-       char *a2 = va_arg(args, char *); \
-       char *a3 = va_arg(args, char *); \
-       fprintf (file, msg, a0, a1, a2, a3); \
-     }
- #endif
- 
- #define PRINTF_PROTO_1(ARGS) PRINTF_PROTO(ARGS, 1, 2)
  
  HOST_WIDE_INT parse_c_expression PROTO((char *, int));
  
--- 130,135 ----
diff -rcp orig/egcs-980328/gcc/protoize.c egcs-980328/gcc/protoize.c
*** orig/egcs-980328/gcc/protoize.c	Wed Mar 18 02:18:05 1998
--- egcs-980328/gcc/protoize.c	Thu Apr  2 15:19:33 1998
*************** Boston, MA 02111-1307, USA.  */
*** 57,76 ****
  #define _POSIX_SOURCE
  #endif
  
! #ifdef HAVE_VARARGS_H
! #include <varargs.h>
  #else
! #ifdef HAVE_SYS_VARARGS_H
! #include <sys/varargs.h>
! #endif
  #endif
! 
! /* On some systems stdio.h includes stdarg.h;
!    we must bring in varargs.h first.  */
! #include <stdio.h>
! #include <ctype.h>
! #include <errno.h>
! #include <sys/types.h>
  #include <sys/stat.h>
  #if ! defined (_WIN32) || defined (__CYGWIN32__)
  #if defined(POSIX) || defined(CONCURRENT)
--- 57,68 ----
  #define _POSIX_SOURCE
  #endif
  
! #ifdef __STDC__
! #include <stdarg.h>
  #else
! #include <varargs.h>
  #endif
! #include "system.h"
  #include <sys/stat.h>
  #if ! defined (_WIN32) || defined (__CYGWIN32__)
  #if defined(POSIX) || defined(CONCURRENT)
*************** Boston, MA 02111-1307, USA.  */
*** 80,102 ****
  #endif
  #endif
  #include <setjmp.h>
- 
- #ifdef HAVE_STDLIB_H
- #include <stdlib.h>
- #endif
- 
- #ifdef HAVE_UNISTD_H
- #include <unistd.h>
- #endif
- 
- #ifdef HAVE_STRING_H
- #include <string.h>
- #else
- #ifdef HAVE_STRINGS_H
- #include <strings.h>
- #endif
- #endif
- 
  #include "gansidecl.h"
  
  /* Include getopt.h for the sake of getopt_long.
--- 72,77 ----
*************** Boston, MA 02111-1307, USA.  */
*** 106,115 ****
  #include "getopt.h"
  #undef getopt
  
- #ifndef errno
- extern int errno;
- #endif
- 
  #ifndef HAVE_STRERROR
  extern int sys_nerr;
  extern char *sys_errlist[];
--- 81,86 ----
*************** typedef char * pointer_type;
*** 157,179 ****
  typedef char * const_pointer_type;
  #endif
  
- #if defined(POSIX)
- 
- #include <stdlib.h>
- #include <unistd.h>
- #include <signal.h>
- #include <fcntl.h>
- #include <sys/wait.h>
- 
- #else /* !defined(POSIX) */
- 
- #ifndef F_OK
- #define R_OK    4       /* Test for Read permission */
- #define W_OK    2       /* Test for Write permission */
- #define X_OK    1       /* Test for eXecute permission */
- #define F_OK    0       /* Test for existence of File */
- #endif
- 
  #ifndef O_RDONLY
  #define O_RDONLY        0
  #endif
--- 128,133 ----
*************** typedef char * const_pointer_type;
*** 182,187 ****
--- 136,148 ----
  #define O_WRONLY        1
  #endif
  
+ #if defined(POSIX)
+ 
+ #include <signal.h>
+ #include <sys/wait.h>
+ 
+ #else /* !defined(POSIX) */
+ 
  #ifndef WIFSIGNALED
  #define WIFSIGNALED(S) (((S) & 0xff) != 0 && ((S) & 0xff) != 0x7f)
  #endif
*************** extern size_t   strlen ()
*** 231,247 ****
  
  #endif /* !defined (POSIX) */
  
- #ifdef NEED_DECLARATION_RINDEX
- extern char *rindex ();
- #endif
- 
  /* Look for these where the `const' qualifier is intentionally cast aside.  */
  
  #define NONCONST
  
  /* Define a STRINGIFY macro that's right for ANSI or traditional C.  */
  
! #ifdef __STDC__
  #define STRINGIFY(STRING) #STRING
  #else
  #define STRINGIFY(STRING) "STRING"
--- 192,204 ----
  
  #endif /* !defined (POSIX) */
  
  /* Look for these where the `const' qualifier is intentionally cast aside.  */
  
  #define NONCONST
  
  /* Define a STRINGIFY macro that's right for ANSI or traditional C.  */
  
! #if defined(HAVE_CPP_STRINGIFY) || (defined(__GNUC__) && defined(__STDC__))

  #define STRINGIFY(STRING) #STRING
  #else
  #define STRINGIFY(STRING) "STRING"
--
Kaveh R. Ghazi			Project Manager / Custom Development
ghazi@caip.rutgers.edu		Icon CMT Corp.



More information about the Gcc mailing list