aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>1998-04-06 14:01:33 +0000
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>1998-04-06 14:01:33 +0000
commit922479330da4e69c21f009c322c425bcf490715a (patch)
tree705fdf7fa2c894b86921a9d5b3c46a2bd38525cb
parentcd5ffd887e5678a166dc4cf1f1e3c76e26ec321d (diff)
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@19020 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog12
-rw-r--r--gcc/Makefile.in10
-rw-r--r--gcc/c-parse.c9
-rw-r--r--gcc/c-parse.in9
-rw-r--r--gcc/c-parse.y9
-rw-r--r--gcc/cccp.c107
-rw-r--r--gcc/cexp.c62
-rw-r--r--gcc/cexp.y64
-rw-r--r--gcc/objc/Make-lang.in2
-rw-r--r--gcc/objc/objc-parse.c9
-rw-r--r--gcc/objc/objc-parse.y9
-rw-r--r--gcc/protoize.c67
12 files changed, 110 insertions, 259 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3a6db44977b..d35f141f7e0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index ea37a4eaeb9..53749d6e02e 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -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)\" \
diff --git a/gcc/c-parse.c b/gcc/c-parse.c
index 9b473277fe7..8777295d248 100644
--- a/gcc/c-parse.c
+++ b/gcc/c-parse.c
@@ -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; }
diff --git a/gcc/c-parse.in b/gcc/c-parse.in
index 76e7ca9dcf1..fbfa994cd6e 100644
--- a/gcc/c-parse.in
+++ b/gcc/c-parse.in
@@ -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; }
diff --git a/gcc/c-parse.y b/gcc/c-parse.y
index ac9138df393..aba326d02b9 100644
--- a/gcc/c-parse.y
+++ b/gcc/c-parse.y
@@ -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; }
diff --git a/gcc/cccp.c b/gcc/cccp.c
index edaf5440b85..ebb42fbf0bc 100644
--- a/gcc/cccp.c
+++ b/gcc/cccp.c
@@ -19,51 +19,37 @@ 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>
+#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
-# 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>
+# 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
-#include <errno.h>
+#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)
+#define PRINTF_PROTO_4(ARGS) PRINTF_PROTO(ARGS, 4, 5)
-#if HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
+#include "system.h"
+#include <sys/stat.h>
+#include <signal.h>
-#ifdef HAVE_STRING_H
-# include <string.h>
-#else
-# ifdef HAVE_STRINGS_H
-# include <strings.h>
-#endif
+#ifdef HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
#endif
typedef unsigned char U_CHAR;
@@ -71,18 +57,6 @@ 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
@@ -107,31 +81,6 @@ extern char *getenv ();
# 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)
-#define PRINTF_PROTO_4(ARGS) PRINTF_PROTO(ARGS, 4, 5)
-
/* 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. */
diff --git a/gcc/cexp.c b/gcc/cexp.c
index de021e09559..4e3a1467d14 100644
--- a/gcc/cexp.c
+++ b/gcc/cexp.c
@@ -22,28 +22,38 @@
#line 27 "cexp.y"
#include "config.h"
-#include <setjmp.h>
-/* #define YYDEBUG 1 */
-
-
-#ifdef HAVE_STRING_H
-# include <string.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
-#ifdef HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
+#define PRINTF_PROTO_1(ARGS) PRINTF_PROTO(ARGS, 1, 2)
-#ifdef HAVE_LIMITS_H
-# include <limits.h>
-#endif
+#include "system.h"
+#include <setjmp.h>
+/* #define YYDEBUG 1 */
#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));
diff --git a/gcc/cexp.y b/gcc/cexp.y
index 5269c5bae7e..346f83e44cc 100644
--- a/gcc/cexp.y
+++ b/gcc/cexp.y
@@ -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"
-#include <setjmp.h>
-/* #define YYDEBUG 1 */
-
-
-#ifdef HAVE_STRING_H
-# include <string.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
-#ifdef HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
+#define PRINTF_PROTO_1(ARGS) PRINTF_PROTO(ARGS, 1, 2)
-#ifdef HAVE_LIMITS_H
-# include <limits.h>
-#endif
+#include "system.h"
+#include <setjmp.h>
+/* #define YYDEBUG 1 */
#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));
diff --git a/gcc/objc/Make-lang.in b/gcc/objc/Make-lang.in
index 4b41c9a1433..ebde9d0101b 100644
--- a/gcc/objc/Make-lang.in
+++ b/gcc/objc/Make-lang.in
@@ -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
diff --git a/gcc/objc/objc-parse.c b/gcc/objc/objc-parse.c
index cf3f3f70804..abb9099469a 100644
--- a/gcc/objc/objc-parse.c
+++ b/gcc/objc/objc-parse.c
@@ -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; }
diff --git a/gcc/objc/objc-parse.y b/gcc/objc/objc-parse.y
index 807ad5a952c..c216d438ae1 100644
--- a/gcc/objc/objc-parse.y
+++ b/gcc/objc/objc-parse.y
@@ -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; }
diff --git a/gcc/protoize.c b/gcc/protoize.c
index 8efad717662..e61e92e6be2 100644
--- a/gcc/protoize.c
+++ b/gcc/protoize.c
@@ -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>
-#endif
+#include <varargs.h>
#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"