More system.h cutover patches:

* 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.
        * Makefile.in (c-parse.o, cccp.o, cexp.o, protoize.o, unprotoize.o):
        Depend on system.h.
        * objc/Make-lang.in (objc-parse.o): Likewise.

From-SVN: r19020
This commit is contained in:
Kaveh R. Ghazi 1998-04-06 14:01:33 +00:00 committed by Kaveh Ghazi
parent 3286ab5736
commit 944fc8abef
12 changed files with 123 additions and 272 deletions

View File

@ -1,3 +1,15 @@
Mon Apr 6 16:08:04 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.
* Makefile.in (c-parse.o, cccp.o, cexp.o, protoize.o, unprotoize.o):
Depend on system.h.
* objc/Make-lang.in (objc-parse.o): Likewise.
Mon Apr 6 14:59:58 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* gansidecl.h: Check if compiler supports __attribute__. Provide

View File

@ -1223,7 +1223,7 @@ s-crt0: $(CRT0_S) $(MCRT0_S) $(GCC_PASSES) $(CONFIG_H)
# C language specific files.
c-parse.o : $(srcdir)/c-parse.c $(CONFIG_H) $(TREE_H) c-lex.h \
$(srcdir)/c-parse.h c-tree.h input.h flags.h
$(srcdir)/c-parse.h c-tree.h input.h flags.h system.h
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/c-parse.c
$(srcdir)/c-parse.h: $(srcdir)/c-parse.c
$(srcdir)/c-parse.c: $(srcdir)/c-parse.y
@ -1751,12 +1751,12 @@ cpp$(exeext): $(CCCP)$(exeext)
cccp$(exeext): cccp.o cexp.o version.o prefix.o $(LIBDEPS)
$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ cccp.o cexp.o prefix.o \
version.o $(LIBS)
cexp.o: $(srcdir)/cexp.c $(CONFIG_H)
cexp.o: $(srcdir)/cexp.c $(CONFIG_H) system.h
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/cexp.c
$(srcdir)/cexp.c: $(srcdir)/cexp.y
cd $(srcdir); $(BISON) -o cexp.c cexp.y
cccp.o: cccp.c $(CONFIG_H) pcp.h version.c config.status
cccp.o: cccp.c $(CONFIG_H) pcp.h version.c config.status system.h
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
-DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
-DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
@ -1808,7 +1808,7 @@ unprotoize$(exeext): unprotoize.o getopt.o getopt1.o getpwd.o version.o \
unprotoize.o getopt.o getopt1.o getpwd.o version.o \
pexecute.o choose-temp.o $(LIBS)
protoize.o: protoize.c getopt.h $(CONFIG_H)
protoize.o: protoize.c getopt.h $(CONFIG_H) system.h
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
-DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
-DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
@ -1818,7 +1818,7 @@ protoize.o: protoize.c getopt.h $(CONFIG_H)
-DSTD_PROTO_DIR=\"$(libsubdir)\" \
$(srcdir)/protoize.c
unprotoize.o: unprotoize.c protoize.c getopt.h $(CONFIG_H)
unprotoize.o: unprotoize.c protoize.c getopt.h $(CONFIG_H) system.h
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
-DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
-DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \

View File

@ -68,9 +68,7 @@
#line 56 "c-parse.y"
#include "config.h"
#include <stdio.h>
#include <errno.h>
#include "system.h"
#include <setjmp.h>
#include "tree.h"
@ -81,7 +79,6 @@
#include "output.h"
#ifdef MULTIBYTE_CHARS
#include <stdlib.h>
#include <locale.h>
#endif
@ -90,10 +87,6 @@
definition here. */
char *language_string = "GNU C";
#ifndef errno
extern int errno;
#endif
/* Like YYERROR but do call yyerror. */
#define YYERROR1 { yyerror ("syntax error"); YYERROR; }

View File

@ -59,9 +59,7 @@ end ifc
%{
#include "config.h"
#include <stdio.h>
#include <errno.h>
#include "system.h"
#include <setjmp.h>
#include "tree.h"
@ -72,7 +70,6 @@ end ifc
#include "output.h"
#ifdef MULTIBYTE_CHARS
#include <stdlib.h>
#include <locale.h>
#endif
@ -89,10 +86,6 @@ 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; }

View File

@ -55,9 +55,7 @@ State 434 contains 2 shift/reduce conflicts. (Four ways to parse this.) */
%{
#include "config.h"
#include <stdio.h>
#include <errno.h>
#include "system.h"
#include <setjmp.h>
#include "tree.h"
@ -68,7 +66,6 @@ State 434 contains 2 shift/reduce conflicts. (Four ways to parse this.) */
#include "output.h"
#ifdef MULTIBYTE_CHARS
#include <stdlib.h>
#include <locale.h>
#endif
@ -77,10 +74,6 @@ State 434 contains 2 shift/reduce conflicts. (Four ways to parse this.) */
definition here. */
char *language_string = "GNU C";
#ifndef errno
extern int errno;
#endif
/* Like YYERROR but do call yyerror. */
#define YYERROR1 { yyerror ("syntax error"); YYERROR; }

View File

@ -19,94 +19,6 @@ Foundation, 59 Temple Place - Suite 330,
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;
#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
#ifndef GET_ENVIRONMENT
#define GET_ENVIRONMENT(ENV_VALUE,ENV_NAME) ENV_VALUE = getenv (ENV_NAME)
#endif
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
# define __attribute__(x)
#endif
#ifndef STANDARD_INCLUDE_DIR
# define STANDARD_INCLUDE_DIR "/usr/include"
#endif
/* By default, colon separates directories in a path. */
#ifndef PATH_SEPARATOR
# define PATH_SEPARATOR ':'
#endif
/* By default, the suffix for object files is ".o". */
#ifdef OBJECT_SUFFIX
# define HAVE_OBJECT_SUFFIX
#else
# define OBJECT_SUFFIX ".o"
#endif
#if defined (__STDC__) && defined (HAVE_VPRINTF)
# include <stdarg.h>
# define PRINTF_ALIST(msg) char *msg, ...
@ -132,6 +44,43 @@ extern char *getenv ();
#define PRINTF_PROTO_3(ARGS) PRINTF_PROTO(ARGS, 3, 4)
#define PRINTF_PROTO_4(ARGS) PRINTF_PROTO(ARGS, 4, 5)
#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;
#include "gansidecl.h"
#include "pcp.h"
#ifndef GET_ENVIRONMENT
#define GET_ENVIRONMENT(ENV_VALUE,ENV_NAME) ENV_VALUE = getenv (ENV_NAME)
#endif
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
# define __attribute__(x)
#endif
#ifndef STANDARD_INCLUDE_DIR
# define STANDARD_INCLUDE_DIR "/usr/include"
#endif
/* By default, colon separates directories in a path. */
#ifndef PATH_SEPARATOR
# define PATH_SEPARATOR ':'
#endif
/* By default, the suffix for object files is ".o". */
#ifdef OBJECT_SUFFIX
# define HAVE_OBJECT_SUFFIX
#else
# define OBJECT_SUFFIX ".o"
#endif
/* VMS-specific definitions */
#ifdef VMS
#include <descrip.h>
@ -221,10 +170,6 @@ char *strerror (int,...);
#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. */

View File

@ -22,28 +22,38 @@
#line 27 "cexp.y"
#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 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. */
@ -117,30 +127,6 @@ struct arglist {
# 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));
static int yylex PROTO((void));

View File

@ -1,5 +1,5 @@
/* Parse C expressions for CCCP.
Copyright (C) 1987, 1992, 1994, 1995, 1996, 1997 Free Software Foundation.
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
@ -26,28 +26,38 @@ Boston, MA 02111-1307, USA.
%{
#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 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. */
@ -121,30 +131,6 @@ struct arglist {
# 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));
static int yylex PROTO((void));

View File

@ -71,7 +71,7 @@ cc1obj$(exeext): $(P) $(OBJC_OBJS) $(OBJS) $(LIBDEPS)
objc-parse.o : $(srcdir)/objc/objc-parse.c \
$(CONFIG_H) $(TREE_H) \
$(srcdir)/c-lex.h $(srcdir)/c-tree.h $(srcdir)/input.h \
$(srcdir)/flags.h $(srcdir)/output.h $(srcdir)/objc/objc-act.h
$(srcdir)/flags.h $(srcdir)/output.h $(srcdir)/objc/objc-act.h system.h
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/objc \
-c $(srcdir)/objc/objc-parse.c

View File

@ -68,9 +68,7 @@
#line 33 "objc-parse.y"
#include "config.h"
#include <stdio.h>
#include <errno.h>
#include "system.h"
#include <setjmp.h>
#include "tree.h"
@ -81,7 +79,6 @@
#include "output.h"
#ifdef MULTIBYTE_CHARS
#include <stdlib.h>
#include <locale.h>
#endif
@ -91,10 +88,6 @@
definition here. */
char *language_string = "GNU Obj-C";
#ifndef errno
extern int errno;
#endif
/* Like YYERROR but do call yyerror. */
#define YYERROR1 { yyerror ("syntax error"); YYERROR; }

View File

@ -32,9 +32,7 @@ Boston, MA 02111-1307, USA. */
%{
#include "config.h"
#include <stdio.h>
#include <errno.h>
#include "system.h"
#include <setjmp.h>
#include "tree.h"
@ -45,7 +43,6 @@ Boston, MA 02111-1307, USA. */
#include "output.h"
#ifdef MULTIBYTE_CHARS
#include <stdlib.h>
#include <locale.h>
#endif
@ -55,10 +52,6 @@ Boston, MA 02111-1307, USA. */
definition here. */
char *language_string = "GNU Obj-C";
#ifndef errno
extern int errno;
#endif
/* Like YYERROR but do call yyerror. */
#define YYERROR1 { yyerror ("syntax error"); YYERROR; }

View File

@ -57,20 +57,12 @@ Boston, MA 02111-1307, USA. */
#define _POSIX_SOURCE
#endif
#ifdef HAVE_VARARGS_H
#include <varargs.h>
#ifdef __STDC__
#include <stdarg.h>
#else
#ifdef HAVE_SYS_VARARGS_H
#include <sys/varargs.h>
#include <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 "system.h"
#include <sys/stat.h>
#if ! defined (_WIN32) || defined (__CYGWIN32__)
#if defined(POSIX) || defined(CONCURRENT)
@ -80,23 +72,6 @@ Boston, MA 02111-1307, USA. */
#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.
@ -106,10 +81,6 @@ Boston, MA 02111-1307, USA. */
#include "getopt.h"
#undef getopt
#ifndef errno
extern int errno;
#endif
#ifndef HAVE_STRERROR
extern int sys_nerr;
extern char *sys_errlist[];
@ -161,23 +132,6 @@ typedef char * pointer_type;
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
@ -186,6 +140,13 @@ typedef char * const_pointer_type;
#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
@ -232,17 +193,13 @@ extern size_t strlen ()
#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__
#if defined(HAVE_CPP_STRINGIFY) || (defined(__GNUC__) && defined(__STDC__))
#define STRINGIFY(STRING) #STRING
#else
#define STRINGIFY(STRING) "STRING"