* 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
+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
# 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
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)\" \
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)\" \
-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)\" \
#line 56 "c-parse.y"
#include "config.h"
-
-#include <stdio.h>
-#include <errno.h>
+#include "system.h"
#include <setjmp.h>
#include "tree.h"
#include "output.h"
#ifdef MULTIBYTE_CHARS
-#include <stdlib.h>
#include <locale.h>
#endif
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; }
%{
#include "config.h"
-
-#include <stdio.h>
-#include <errno.h>
+#include "system.h"
#include <setjmp.h>
#include "tree.h"
#include "output.h"
#ifdef MULTIBYTE_CHARS
-#include <stdlib.h>
#include <locale.h>
#endif
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; }
%{
#include "config.h"
-
-#include <stdio.h>
-#include <errno.h>
+#include "system.h"
#include <setjmp.h>
#include "tree.h"
#include "output.h"
#ifdef MULTIBYTE_CHARS
-#include <stdlib.h>
#include <locale.h>
#endif
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; }
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;
#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
# 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>
#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
\f
/* Name under which this program was invoked. */
#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. */
# 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));
/* 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
%{
#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. */
# 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));
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
#line 33 "objc-parse.y"
#include "config.h"
-
-#include <stdio.h>
-#include <errno.h>
+#include "system.h"
#include <setjmp.h>
#include "tree.h"
#include "output.h"
#ifdef MULTIBYTE_CHARS
-#include <stdlib.h>
#include <locale.h>
#endif
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; }
%{
#include "config.h"
-
-#include <stdio.h>
-#include <errno.h>
+#include "system.h"
#include <setjmp.h>
#include "tree.h"
#include "output.h"
#ifdef MULTIBYTE_CHARS
-#include <stdlib.h>
#include <locale.h>
#endif
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; }
#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)
#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.
#include "getopt.h"
#undef getopt
-#ifndef errno
-extern int errno;
-#endif
-
#ifndef HAVE_STRERROR
extern int sys_nerr;
extern char *sys_errlist[];
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
#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
#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"