1999-09-07 01:49:18 -04:00
|
|
|
/* Get common system includes and various definitions and declarations based
|
|
|
|
on autoconf macros.
|
2000-01-04 03:10:30 -05:00
|
|
|
Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
|
1998-02-12 19:22:24 -05:00
|
|
|
|
1999-01-06 15:51:20 -05:00
|
|
|
This file is part of GNU CC.
|
|
|
|
|
|
|
|
GNU CC is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
GNU CC is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with GNU CC; see the file COPYING. If not, write to
|
|
|
|
the Free Software Foundation, 59 Temple Place - Suite 330,
|
|
|
|
Boston, MA 02111-1307, USA. */
|
1998-02-12 19:22:24 -05:00
|
|
|
|
1999-09-07 01:49:18 -04:00
|
|
|
|
1998-02-12 19:22:24 -05:00
|
|
|
#ifndef __GCC_SYSTEM_H__
|
|
|
|
#define __GCC_SYSTEM_H__
|
|
|
|
|
2000-02-18 07:26:50 -05:00
|
|
|
/* This is the location of the online document giving information how
|
|
|
|
to report bugs. If you change this string, also check for strings
|
|
|
|
not under control of the preprocessor. */
|
|
|
|
#define GCCBUGURL "<URL:http://www.gnu.org/software/gcc/bugs.html>"
|
|
|
|
|
1998-08-26 04:11:47 -04:00
|
|
|
/* We must include stdarg.h/varargs.h before stdio.h. */
|
gansidecl.h: Prepend a "G" to the macro wrapping this file (to distinguish it from the macro...
* gansidecl.h: Prepend a "G" to the macro wrapping this file
(to distinguish it from the macro wrapping ansidecl.h.)
Include libiberty's ansidecl.h. Remove all redundant definitions.
Define the PROTO() style macros in terms of the PARAMS() ones.
* calls.c (emit_library_call): Switch on ANSI_PROTOTYPES, not
__STDC__, when deciding whether to use ANSI variable args.
(emit_library_call_value): Likewise.
* cccp.c (error): Likewise.
(warning): Likewise.
(error_with_line): Likewise.
(warning_with_line): Likewise.
(pedwarn): Likewise.
(pedwarn_with_line): Likewise.
(pedwarn_with_file_and_line): Likewise.
(fatal): Likewise.
* cexp.y (error): Likewise.
(pedwarn): Likewise.
(warning): Likewise.
* collect2.c (fatal_perror): Likewise.
(fatal): Likewise.
(error): Likewise.
* combine.c (gen_rtx_combine): Likewise.
* cpperror.c (cpp_message): Likewise.
(cpp_fatal): Likewise.
* cpplib.c (cpp_error): Likewise.
(cpp_warning): Likewise.
(cpp_pedwarn): Likewise.
(cpp_error_with_line): Likewise.
(cpp_warning_with_line): Likewise.
(cpp_pedwarn_with_line): Likewise.
(cpp_pedwarn_with_file_and_line): Likewise.
* cpplib.h: Don't define PARAMS() macro.
* demangle.h: Likewise.
* doprint.c (checkit): Switch on ANSI_PROTOTYPES, not __STDC__,
when deciding whether to use ANSI variable args.
* emit-rtl.c (gen_rtx): Likewise.
(gen_rtvec): Likewise.
* final.c (asm_fprintf): Likewise.
* fix-header.c (cpp_message): Likewise.
(fatal): Likewise.
(cpp_fatal): Likewise.
* gcc.c (concat): Likewise.
(fatal): Likewise.
(error): Likewise.
* genattr.c (fatal): Likewise.
* genattrtab.c (attr_rtx): Likewise.
(attr_printf): Likewise.
(fatal): Likewise.
* gencodes.c (fatal): Likewise.
* genconfig.c (fatal): Likewise.
* genemit.c (fatal): Likewise.
* genextract.c (fatal): Likewise.
* genflags.c (fatal): Likewise.
* genopinit.c (fatal): Likewise.
* genoutput.c (fatal): Likewise.
(error): Likewise.
* genpeep.c (fatal): Likewise.
* genrecog.c (fatal): Likewise.
* halfpic.h: Switch on ANSI_PROTOTYPES, not __STDC__, when
deciding whether to declare `tree_node' and `rtx_def'.
* hash.h: Don't define stuff we get from gansidecl.h.
* mips-tfile.c: Likewise. Define __proto() in terms of PARAMS().
(fatal): Switch on ANSI_PROTOTYPES, not __STDC__, when deciding
whether to use ANSI variable args.
(error): Likewise.
* prefix.c (concat): Likewise.
* scan.h: Likewise.
* system.h: Likewise.
* toplev.c (error_with_file_and_line): Likewise.
(error_with_decl): Likewise.
(error_for_asm): Likewise.
(error): Likewise.
(fatal): Likewise.
(warning_with_file_and_line): Likewise.
(warning_with_decl): Likewise.
(warning_for_asm): Likewise.
(warning): Likewise.
(pedwarn): Likewise.
(pedwarn_with_decl): Likewise.
(pedwarn_with_file_and_line): Likewise.
(sorry): Likewise.
(really_sorry): Likewise.
* toplev.h: Switch on ANSI_PROTOTYPES, not __STDC__, when deciding
whether to declare `tree_node' and `rtx_def'.
* tree.c (build): Switch on ANSI_PROTOTYPES, not __STDC__, when
deciding whether to use ANSI variable args.
(build_nt): Likewise.
(build_parse_node): Likewise.
From-SVN: r23577
1998-11-08 10:10:24 -05:00
|
|
|
#ifdef ANSI_PROTOTYPES
|
1998-08-26 04:11:47 -04:00
|
|
|
#include <stdarg.h>
|
|
|
|
#else
|
|
|
|
#include <varargs.h>
|
|
|
|
#endif
|
|
|
|
|
2000-04-22 14:41:05 -04:00
|
|
|
#ifndef va_copy
|
|
|
|
# ifdef __va_copy
|
|
|
|
# define va_copy(d,s) __va_copy((d),(s))
|
|
|
|
# else
|
|
|
|
# define va_copy(d,s) ((d) = (s))
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
1998-02-12 19:22:24 -05:00
|
|
|
#include <stdio.h>
|
1998-06-30 02:11:43 -04:00
|
|
|
|
|
|
|
/* Define a generic NULL if one hasn't already been defined. */
|
|
|
|
#ifndef NULL
|
|
|
|
#define NULL 0
|
|
|
|
#endif
|
|
|
|
|
1998-12-07 18:40:19 -05:00
|
|
|
/* The compiler is not a multi-threaded application and therefore we
|
1999-03-18 19:47:41 -05:00
|
|
|
do not have to use the locking functions.
|
|
|
|
|
2000-05-23 13:42:19 -04:00
|
|
|
HAVE_DECL_PUTC_UNLOCKED actually indicates whether or not the IO
|
|
|
|
code is multi-thread safe by default. If it is set to 0, then do
|
|
|
|
not worry about using the _unlocked functions.
|
1999-03-18 19:47:41 -05:00
|
|
|
|
|
|
|
fputs_unlocked is an extension and needs to be prototyped specially. */
|
|
|
|
|
2000-05-23 13:42:19 -04:00
|
|
|
#if defined HAVE_PUTC_UNLOCKED && (defined (HAVE_DECL_PUTC_UNLOCKED) && HAVE_DECL_PUTC_UNLOCKED)
|
1998-12-07 18:40:19 -05:00
|
|
|
# undef putc
|
|
|
|
# define putc(C, Stream) putc_unlocked (C, Stream)
|
|
|
|
#endif
|
2000-05-23 13:42:19 -04:00
|
|
|
#if defined HAVE_FPUTC_UNLOCKED && (defined (HAVE_DECL_PUTC_UNLOCKED) && HAVE_DECL_PUTC_UNLOCKED)
|
1998-12-07 18:40:19 -05:00
|
|
|
# undef fputc
|
|
|
|
# define fputc(C, Stream) fputc_unlocked (C, Stream)
|
|
|
|
#endif
|
2000-05-23 13:42:19 -04:00
|
|
|
#if defined HAVE_FPUTS_UNLOCKED && (defined (HAVE_DECL_PUTC_UNLOCKED) && HAVE_DECL_PUTC_UNLOCKED)
|
1998-12-07 18:40:19 -05:00
|
|
|
# undef fputs
|
|
|
|
# define fputs(String, Stream) fputs_unlocked (String, Stream)
|
2000-05-23 13:42:19 -04:00
|
|
|
# if defined (HAVE_DECL_FPUTS_UNLOCKED) && !HAVE_DECL_FPUTS_UNLOCKED
|
2000-01-17 10:47:29 -05:00
|
|
|
extern int fputs_unlocked PARAMS ((const char *, FILE *));
|
1999-03-18 19:47:41 -05:00
|
|
|
# endif
|
1998-12-07 18:40:19 -05:00
|
|
|
#endif
|
|
|
|
|
safe-ctype.h: New file.
include:
* safe-ctype.h: New file.
libiberty:
* safe-ctype.c: New file.
* Makefile.in (CFILES): Add safe-ctype.c.
(REQUIRED_OFILES): Add safe-ctype.o.
* argv.c: Define ISBLANK and use it, not isspace.
* basename.c, cplus-dem.c, fnmatch.c, pexecute.c, strtod.c,
strtol.c, strtoul.c: Include safe-ctype.h, not ctype.h. Use
uppercase ctype macros. Don't test ISUPPER(c)/ISLOWER(c)
before calling TOLOWER(c)/TOUPPER(c).
gcc:
* Makefile.in (HOST_RTL): Add safe-ctype.o.
(safe-ctype.o): New rule.
* system.h: Include safe-ctype.h, not ctype.h. No need to
wrap ctype macros.
* cpphash.h: Zap IStable and related macros. Define is_* in
terms of safe-ctype.h macros.
* cppinit.c: Delete the IStable and all related code.
* tradcpp.c: Delete is_idchar, is_idstart, is_hor_space, and
is_space arrays. Delete initialize_char_syntax. Change all
references to the above arrays to use macros instead.
* tradcpp.h: Define is_idchar, is_idstart, is_space, and
is_nvspace in terms of safe_ctype.h's macros.
* tradcif.y: is_idchar, is_idstart are macros not arrays.
* config/i370/i370.c, config/winnt/dirent.c,
config/winnt/fixinc-nt.c, config/winnt/ld.c:
Use uppercase ctype macros. If we included ctype.h,
include safe-ctype.h instead.
* fixinc/fixfixes.c: Use uppercase ctype macros. Don't test
ISLOWER(c) before calling TOUPPER(c).
* fixinc/fixincl.c (extract_quoted_files): Simplify out some gunk.
* fixinc/gnu-regex.c: Include safe-ctype.h, not ctype.h. No need to
wrap ctype macros. Don't test ISUPPER(x) before calling TOLOWER(x).
gcc/ch:
* lex.c: Don't bother checking whether ISUPPER(c) before
calling TOLOWER(c). Don't bother checking whether isascii(c)
before testing ISSPACE(c); ISSPACE(c) includes '\n'.
gcc/f:
* Make-lang.in: Link f/fini with safe-ctype.o.
* bad.c: Don't test ISUPPER(c) || ISLOWER(c) before calling TOUPPER(c).
* com.c: Use TOUPPER, not ffesrc_toupper.
* fini.c: Don't test ISALPHA(c) before calling TOUPPER(c)/TOLOWER(c).
* intrin.c: Don't test IN_CTYPE_DOMAIN(c).
* src.c: Delete ffesrc_toupper_ and ffesrc_tolower_ and their
initializing code; use TOUPPER and TOLOWER instead of
ffesrc_toupper and ffesrc_tolower.
* src.h: Don't declare ffesrc_toupper_ or ffesrc_tolower_.
Don't define ffesrc_toupper or ffesrc_tolower.
gcc/java:
* jvgenmain.c: Use ISPRINT not isascii.
From-SVN: r38124
2000-12-07 22:00:26 -05:00
|
|
|
/* There are an extraordinary number of issues with <ctype.h>.
|
|
|
|
The last straw is that it varies with the locale. Use libiberty's
|
|
|
|
replacement instead. */
|
|
|
|
#include <safe-ctype.h>
|
1998-02-12 19:22:24 -05:00
|
|
|
|
safe-ctype.h: New file.
include:
* safe-ctype.h: New file.
libiberty:
* safe-ctype.c: New file.
* Makefile.in (CFILES): Add safe-ctype.c.
(REQUIRED_OFILES): Add safe-ctype.o.
* argv.c: Define ISBLANK and use it, not isspace.
* basename.c, cplus-dem.c, fnmatch.c, pexecute.c, strtod.c,
strtol.c, strtoul.c: Include safe-ctype.h, not ctype.h. Use
uppercase ctype macros. Don't test ISUPPER(c)/ISLOWER(c)
before calling TOLOWER(c)/TOUPPER(c).
gcc:
* Makefile.in (HOST_RTL): Add safe-ctype.o.
(safe-ctype.o): New rule.
* system.h: Include safe-ctype.h, not ctype.h. No need to
wrap ctype macros.
* cpphash.h: Zap IStable and related macros. Define is_* in
terms of safe-ctype.h macros.
* cppinit.c: Delete the IStable and all related code.
* tradcpp.c: Delete is_idchar, is_idstart, is_hor_space, and
is_space arrays. Delete initialize_char_syntax. Change all
references to the above arrays to use macros instead.
* tradcpp.h: Define is_idchar, is_idstart, is_space, and
is_nvspace in terms of safe_ctype.h's macros.
* tradcif.y: is_idchar, is_idstart are macros not arrays.
* config/i370/i370.c, config/winnt/dirent.c,
config/winnt/fixinc-nt.c, config/winnt/ld.c:
Use uppercase ctype macros. If we included ctype.h,
include safe-ctype.h instead.
* fixinc/fixfixes.c: Use uppercase ctype macros. Don't test
ISLOWER(c) before calling TOUPPER(c).
* fixinc/fixincl.c (extract_quoted_files): Simplify out some gunk.
* fixinc/gnu-regex.c: Include safe-ctype.h, not ctype.h. No need to
wrap ctype macros. Don't test ISUPPER(x) before calling TOLOWER(x).
gcc/ch:
* lex.c: Don't bother checking whether ISUPPER(c) before
calling TOLOWER(c). Don't bother checking whether isascii(c)
before testing ISSPACE(c); ISSPACE(c) includes '\n'.
gcc/f:
* Make-lang.in: Link f/fini with safe-ctype.o.
* bad.c: Don't test ISUPPER(c) || ISLOWER(c) before calling TOUPPER(c).
* com.c: Use TOUPPER, not ffesrc_toupper.
* fini.c: Don't test ISALPHA(c) before calling TOUPPER(c)/TOLOWER(c).
* intrin.c: Don't test IN_CTYPE_DOMAIN(c).
* src.c: Delete ffesrc_toupper_ and ffesrc_tolower_ and their
initializing code; use TOUPPER and TOLOWER instead of
ffesrc_toupper and ffesrc_tolower.
* src.h: Don't declare ffesrc_toupper_ or ffesrc_tolower_.
Don't define ffesrc_toupper or ffesrc_tolower.
gcc/java:
* jvgenmain.c: Use ISPRINT not isascii.
From-SVN: r38124
2000-12-07 22:00:26 -05:00
|
|
|
/* Define a default escape character; it's different for EBCDIC. */
|
1999-09-08 03:01:41 -04:00
|
|
|
#ifndef TARGET_ESC
|
|
|
|
#define TARGET_ESC 033
|
|
|
|
#endif
|
|
|
|
|
1998-02-12 19:22:24 -05:00
|
|
|
#include <sys/types.h>
|
1999-09-07 01:49:18 -04:00
|
|
|
|
1998-02-12 19:22:24 -05:00
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
#ifndef errno
|
|
|
|
extern int errno;
|
|
|
|
#endif
|
|
|
|
|
1998-09-03 02:52:00 -04:00
|
|
|
#ifdef STRING_WITH_STRINGS
|
1998-02-12 19:22:24 -05:00
|
|
|
# include <string.h>
|
1998-09-03 02:52:00 -04:00
|
|
|
# include <strings.h>
|
1998-02-12 19:22:24 -05:00
|
|
|
#else
|
1998-09-03 02:52:00 -04:00
|
|
|
# ifdef HAVE_STRING_H
|
|
|
|
# include <string.h>
|
|
|
|
# else
|
|
|
|
# ifdef HAVE_STRINGS_H
|
|
|
|
# include <strings.h>
|
|
|
|
# endif
|
1998-02-12 19:22:24 -05:00
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_STDLIB_H
|
|
|
|
# include <stdlib.h>
|
configure.in (i?86-*-beos{pe,elf,}*): Recognize.
* configure.in (i?86-*-beos{pe,elf,}*): Recognize.
* i386/t-beos, i386/x-beos, i386/xm-beos.h: New files.
* i386/beos-elf.h, i386/beos-pe.h: New files.
* Makefile.in (CROSS_SYSTEM_HEADER_DIR): New.
* cross-make (SYSTEM_HEADER_DIR): Define using
CROSS_SYSTEM_HEADER_DIR.
* gcc.c (LIBRARY_PATH_ENV): Provide default.
(process_command): Use it.
(main): Likewise. Kill trailing = from env vars.
(build_search_list): Put it back.
* collect2.c (main): Use LIBRARY_PATH_ENV.
* configure.in (GCC_NEED_DECLARATIONS): Add environ.
* toplev.c: Use NEED_DECLARATION_ENVIRON.
* tm.texi (Frame Layout): Document SMALL_STACK.
* c-common.c (c_common_nodes_and_builtins): Check it.
* system.h: Undef alloca after including glibc's <stdlib.h>,
if USE_C_ALLOCA is defined.
* gcc.c (set_input): New fn.
(main): After all input files are compiled, reset the input file
info to the first.
* aclocal.m4 (rindex, index): If already defined, don't attempt
to redefine.
* ginclude/varargs.h: (__va_list__): Define ifndef.
* ginclude/stdarg.h: Likewise.
* ginclude/stddef.h (__WCHAR_TYPE__) [BEOS]: Use int
instead of unsigned char.
* hash.h (true, false, boolean): Undef before enum.
From-SVN: r31366
2000-01-12 19:37:06 -05:00
|
|
|
# ifdef USE_C_ALLOCA
|
|
|
|
/* Note that systems that use glibc have a <stdlib.h> that includes
|
|
|
|
<alloca.h> that defines alloca, so let USE_C_ALLOCA override this. */
|
|
|
|
# undef alloca
|
|
|
|
#endif
|
1998-02-12 19:22:24 -05:00
|
|
|
#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
|
|
|
|
|
1999-02-12 01:32:36 -05:00
|
|
|
/* Find HOST_WIDEST_INT and set its bit size, type and print macros.
|
|
|
|
It will be the largest integer mode supported by the host which may
|
|
|
|
(or may not) be larger than HOST_WIDE_INT. This must appear after
|
|
|
|
<limits.h> since we only use `long long' if its bigger than a
|
|
|
|
`long' and also if it is supported by macros in limits.h. For old
|
|
|
|
hosts which don't have a limits.h (and thus won't include it in
|
|
|
|
stage2 cause we don't rerun configure) we assume gcc supports long
|
|
|
|
long.) Note, you won't get these defined if you don't include
|
|
|
|
{ht}config.h before this file to set the HOST_BITS_PER_* macros. */
|
|
|
|
|
|
|
|
#ifndef HOST_WIDEST_INT
|
|
|
|
# if defined (HOST_BITS_PER_LONG) && defined (HOST_BITS_PER_LONGLONG)
|
|
|
|
# if (HOST_BITS_PER_LONGLONG > HOST_BITS_PER_LONG) && (defined (LONG_LONG_MAX) || defined (LONGLONG_MAX) || defined (LLONG_MAX) || defined (__GNUC__))
|
|
|
|
# define HOST_BITS_PER_WIDEST_INT HOST_BITS_PER_LONGLONG
|
|
|
|
# define HOST_WIDEST_INT long long
|
|
|
|
# define HOST_WIDEST_INT_PRINT_DEC "%lld"
|
|
|
|
# define HOST_WIDEST_INT_PRINT_UNSIGNED "%llu"
|
|
|
|
# define HOST_WIDEST_INT_PRINT_HEX "0x%llx"
|
|
|
|
# else
|
|
|
|
# define HOST_BITS_PER_WIDEST_INT HOST_BITS_PER_LONG
|
|
|
|
# define HOST_WIDEST_INT long
|
|
|
|
# define HOST_WIDEST_INT_PRINT_DEC "%ld"
|
|
|
|
# define HOST_WIDEST_INT_PRINT_UNSIGNED "%lu"
|
|
|
|
# define HOST_WIDEST_INT_PRINT_HEX "0x%lx"
|
|
|
|
# endif /*(long long>long) && (LONG_LONG_MAX||LONGLONG_MAX||LLONG_MAX||GNUC)*/
|
|
|
|
# endif /* defined(HOST_BITS_PER_LONG) && defined(HOST_BITS_PER_LONGLONG) */
|
|
|
|
#endif /* ! HOST_WIDEST_INT */
|
|
|
|
|
2000-05-27 18:05:01 -04:00
|
|
|
/* Infrastructure for defining missing _MAX and _MIN macros. Note that
|
|
|
|
macros defined with these cannot be used in #if. */
|
|
|
|
|
|
|
|
/* The extra casts work around common compiler bugs. */
|
|
|
|
#define INTTYPE_SIGNED(t) (! ((t) 0 < (t) -1))
|
|
|
|
/* The outer cast is needed to work around a bug in Cray C 5.0.3.0.
|
|
|
|
It is necessary at least when t == time_t. */
|
|
|
|
#define INTTYPE_MINIMUM(t) ((t) (INTTYPE_SIGNED (t) \
|
|
|
|
? ~ (t) 0 << (sizeof(t) * CHAR_BIT - 1) : (t) 0))
|
|
|
|
#define INTTYPE_MAXIMUM(t) ((t) (~ (t) 0 - INTTYPE_MINIMUM (t)))
|
|
|
|
|
|
|
|
/* Use that infrastructure to provide a few constants. */
|
|
|
|
#ifndef UCHAR_MAX
|
|
|
|
# define UCHAR_MAX INTTYPE_MAXIMUM (unsigned char)
|
|
|
|
#endif
|
|
|
|
|
1998-02-12 19:22:24 -05:00
|
|
|
#ifdef TIME_WITH_SYS_TIME
|
|
|
|
# include <sys/time.h>
|
|
|
|
# include <time.h>
|
|
|
|
#else
|
|
|
|
# if HAVE_SYS_TIME_H
|
1998-05-06 03:58:27 -04:00
|
|
|
# include <sys/time.h>
|
1998-02-12 19:22:24 -05:00
|
|
|
# else
|
1998-05-06 03:58:27 -04:00
|
|
|
# ifdef HAVE_TIME_H
|
|
|
|
# include <time.h>
|
|
|
|
# endif
|
|
|
|
# endif
|
1998-02-12 19:22:24 -05:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_FCNTL_H
|
|
|
|
# include <fcntl.h>
|
|
|
|
#else
|
1998-05-06 03:58:27 -04:00
|
|
|
# ifdef HAVE_SYS_FILE_H
|
|
|
|
# include <sys/file.h>
|
|
|
|
# endif
|
1998-02-12 19:22:24 -05:00
|
|
|
#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
|
1998-05-06 03:58:27 -04:00
|
|
|
#ifndef O_RDONLY
|
|
|
|
# define O_RDONLY 0
|
|
|
|
#endif
|
|
|
|
#ifndef O_WRONLY
|
|
|
|
# define O_WRONLY 1
|
|
|
|
#endif
|
1998-02-12 19:22:24 -05:00
|
|
|
|
1998-12-16 04:34:57 -05:00
|
|
|
/* Some systems define these in, e.g., param.h. We undefine these names
|
|
|
|
here to avoid the warnings. We prefer to use our definitions since we
|
|
|
|
know they are correct. */
|
|
|
|
|
|
|
|
#undef MIN
|
|
|
|
#undef MAX
|
|
|
|
#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
|
|
|
|
#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
|
|
|
|
|
2000-01-02 14:38:36 -05:00
|
|
|
/* Returns the least number N such that N * Y >= X. */
|
|
|
|
#define CEIL(x,y) (((x) + (y) - 1) / (y))
|
|
|
|
|
1998-11-19 05:13:46 -05:00
|
|
|
#ifdef HAVE_SYS_WAIT_H
|
|
|
|
#include <sys/wait.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef WIFSIGNALED
|
|
|
|
#define WIFSIGNALED(S) (((S) & 0xff) != 0 && ((S) & 0xff) != 0x7f)
|
|
|
|
#endif
|
|
|
|
#ifndef WTERMSIG
|
|
|
|
#define WTERMSIG(S) ((S) & 0x7f)
|
|
|
|
#endif
|
|
|
|
#ifndef WIFEXITED
|
|
|
|
#define WIFEXITED(S) (((S) & 0xff) == 0)
|
|
|
|
#endif
|
|
|
|
#ifndef WEXITSTATUS
|
|
|
|
#define WEXITSTATUS(S) (((S) & 0xff00) >> 8)
|
|
|
|
#endif
|
1999-06-21 01:21:34 -04:00
|
|
|
#ifndef WSTOPSIG
|
|
|
|
#define WSTOPSIG WEXITSTATUS
|
|
|
|
#endif
|
1998-11-19 05:13:46 -05:00
|
|
|
|
2000-05-23 13:42:19 -04:00
|
|
|
/* The HAVE_DECL_* macros are three-state, undefined, 0 or 1. If they
|
|
|
|
are defined to 0 then we must provide the relevant declaration
|
|
|
|
here. These checks will be in the undefined state while configure
|
|
|
|
is running so be careful to test "defined (HAVE_DECL_*)". */
|
1998-02-12 19:22:24 -05:00
|
|
|
|
|
|
|
#ifndef bcopy
|
|
|
|
# ifdef HAVE_BCOPY
|
2000-05-23 13:42:19 -04:00
|
|
|
# if defined (HAVE_DECL_BCOPY) && !HAVE_DECL_BCOPY
|
system.h (bcopy, [...]): Add prototype arguments.
* system.h (bcopy, bcmp, bzero, index, rindex, atof, atol, free,
getcwd, getenv, getwd, sbrk, strstr, malloc, calloc, realloc,
strerror, getrlimit, setrlimit, abort): Add prototype arguments.
From-SVN: r31139
1999-12-30 08:48:51 -05:00
|
|
|
extern void bcopy PARAMS ((const PTR, PTR, size_t));
|
1998-02-12 19:22:24 -05:00
|
|
|
# endif
|
|
|
|
# else /* ! HAVE_BCOPY */
|
1999-01-17 16:06:36 -05:00
|
|
|
# define bcopy(src,dst,len) memmove((dst),(src),(len))
|
1998-02-12 19:22:24 -05:00
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2000-05-23 13:42:19 -04:00
|
|
|
#if defined (HAVE_DECL_ATOF) && !HAVE_DECL_ATOF
|
system.h (bcopy, [...]): Add prototype arguments.
* system.h (bcopy, bcmp, bzero, index, rindex, atof, atol, free,
getcwd, getenv, getwd, sbrk, strstr, malloc, calloc, realloc,
strerror, getrlimit, setrlimit, abort): Add prototype arguments.
From-SVN: r31139
1999-12-30 08:48:51 -05:00
|
|
|
extern double atof PARAMS ((const char *));
|
1998-05-06 04:36:04 -04:00
|
|
|
#endif
|
|
|
|
|
2000-05-23 13:42:19 -04:00
|
|
|
#if defined (HAVE_DECL_ATOL) && !HAVE_DECL_ATOL
|
system.h (bcopy, [...]): Add prototype arguments.
* system.h (bcopy, bcmp, bzero, index, rindex, atof, atol, free,
getcwd, getenv, getwd, sbrk, strstr, malloc, calloc, realloc,
strerror, getrlimit, setrlimit, abort): Add prototype arguments.
From-SVN: r31139
1999-12-30 08:48:51 -05:00
|
|
|
extern long atol PARAMS ((const char *));
|
1998-05-06 04:36:04 -04:00
|
|
|
#endif
|
|
|
|
|
2000-05-23 13:42:19 -04:00
|
|
|
#if defined (HAVE_DECL_FREE) && !HAVE_DECL_FREE
|
system.h (bcopy, [...]): Add prototype arguments.
* system.h (bcopy, bcmp, bzero, index, rindex, atof, atol, free,
getcwd, getenv, getwd, sbrk, strstr, malloc, calloc, realloc,
strerror, getrlimit, setrlimit, abort): Add prototype arguments.
From-SVN: r31139
1999-12-30 08:48:51 -05:00
|
|
|
extern void free PARAMS ((PTR));
|
1998-02-12 19:22:24 -05:00
|
|
|
#endif
|
|
|
|
|
2000-05-23 13:42:19 -04:00
|
|
|
#if defined (HAVE_DECL_GETCWD) && !HAVE_DECL_GETCWD
|
system.h (bcopy, [...]): Add prototype arguments.
* system.h (bcopy, bcmp, bzero, index, rindex, atof, atol, free,
getcwd, getenv, getwd, sbrk, strstr, malloc, calloc, realloc,
strerror, getrlimit, setrlimit, abort): Add prototype arguments.
From-SVN: r31139
1999-12-30 08:48:51 -05:00
|
|
|
extern char *getcwd PARAMS ((char *, size_t));
|
1998-06-28 02:09:57 -04:00
|
|
|
#endif
|
|
|
|
|
2000-05-23 13:42:19 -04:00
|
|
|
#if defined (HAVE_DECL_GETENV) && !HAVE_DECL_GETENV
|
system.h (bcopy, [...]): Add prototype arguments.
* system.h (bcopy, bcmp, bzero, index, rindex, atof, atol, free,
getcwd, getenv, getwd, sbrk, strstr, malloc, calloc, realloc,
strerror, getrlimit, setrlimit, abort): Add prototype arguments.
From-SVN: r31139
1999-12-30 08:48:51 -05:00
|
|
|
extern char *getenv PARAMS ((const char *));
|
1998-02-15 15:36:23 -05:00
|
|
|
#endif
|
|
|
|
|
2000-10-20 15:17:41 -04:00
|
|
|
#if defined (HAVE_DECL_GETOPT) && !HAVE_DECL_GETOPT
|
2000-12-22 07:27:36 -05:00
|
|
|
extern int getopt PARAMS ((int, char * const *, const char *));
|
2000-10-20 15:17:41 -04:00
|
|
|
#endif
|
|
|
|
|
2000-05-23 13:42:19 -04:00
|
|
|
#if defined (HAVE_DECL_GETWD) && !HAVE_DECL_GETWD
|
system.h (bcopy, [...]): Add prototype arguments.
* system.h (bcopy, bcmp, bzero, index, rindex, atof, atol, free,
getcwd, getenv, getwd, sbrk, strstr, malloc, calloc, realloc,
strerror, getrlimit, setrlimit, abort): Add prototype arguments.
From-SVN: r31139
1999-12-30 08:48:51 -05:00
|
|
|
extern char *getwd PARAMS ((char *));
|
1998-06-28 02:09:57 -04:00
|
|
|
#endif
|
|
|
|
|
2000-05-23 13:42:19 -04:00
|
|
|
#if defined (HAVE_DECL_SBRK) && !HAVE_DECL_SBRK
|
system.h (bcopy, [...]): Add prototype arguments.
* system.h (bcopy, bcmp, bzero, index, rindex, atof, atol, free,
getcwd, getenv, getwd, sbrk, strstr, malloc, calloc, realloc,
strerror, getrlimit, setrlimit, abort): Add prototype arguments.
From-SVN: r31139
1999-12-30 08:48:51 -05:00
|
|
|
extern PTR sbrk PARAMS ((int));
|
1998-05-06 04:36:04 -04:00
|
|
|
#endif
|
|
|
|
|
2000-05-23 13:42:19 -04:00
|
|
|
#if defined (HAVE_DECL_STRSTR) && !HAVE_DECL_STRSTR
|
system.h (bcopy, [...]): Add prototype arguments.
* system.h (bcopy, bcmp, bzero, index, rindex, atof, atol, free,
getcwd, getenv, getwd, sbrk, strstr, malloc, calloc, realloc,
strerror, getrlimit, setrlimit, abort): Add prototype arguments.
From-SVN: r31139
1999-12-30 08:48:51 -05:00
|
|
|
extern char *strstr PARAMS ((const char *, const char *));
|
1999-06-24 17:48:29 -04:00
|
|
|
#endif
|
|
|
|
|
1999-09-07 01:49:18 -04:00
|
|
|
#ifdef HAVE_MALLOC_H
|
|
|
|
#include <malloc.h>
|
|
|
|
#endif
|
|
|
|
|
2000-05-23 13:42:19 -04:00
|
|
|
#if defined (HAVE_DECL_MALLOC) && !HAVE_DECL_MALLOC
|
system.h (bcopy, [...]): Add prototype arguments.
* system.h (bcopy, bcmp, bzero, index, rindex, atof, atol, free,
getcwd, getenv, getwd, sbrk, strstr, malloc, calloc, realloc,
strerror, getrlimit, setrlimit, abort): Add prototype arguments.
From-SVN: r31139
1999-12-30 08:48:51 -05:00
|
|
|
extern PTR malloc PARAMS ((size_t));
|
1999-09-07 01:49:18 -04:00
|
|
|
#endif
|
|
|
|
|
2000-05-23 13:42:19 -04:00
|
|
|
#if defined (HAVE_DECL_CALLOC) && !HAVE_DECL_CALLOC
|
system.h (bcopy, [...]): Add prototype arguments.
* system.h (bcopy, bcmp, bzero, index, rindex, atof, atol, free,
getcwd, getenv, getwd, sbrk, strstr, malloc, calloc, realloc,
strerror, getrlimit, setrlimit, abort): Add prototype arguments.
From-SVN: r31139
1999-12-30 08:48:51 -05:00
|
|
|
extern PTR calloc PARAMS ((size_t, size_t));
|
1999-09-07 01:49:18 -04:00
|
|
|
#endif
|
|
|
|
|
2000-05-23 13:42:19 -04:00
|
|
|
#if defined (HAVE_DECL_REALLOC) && !HAVE_DECL_REALLOC
|
system.h (bcopy, [...]): Add prototype arguments.
* system.h (bcopy, bcmp, bzero, index, rindex, atof, atol, free,
getcwd, getenv, getwd, sbrk, strstr, malloc, calloc, realloc,
strerror, getrlimit, setrlimit, abort): Add prototype arguments.
From-SVN: r31139
1999-12-30 08:48:51 -05:00
|
|
|
extern PTR realloc PARAMS ((PTR, size_t));
|
1999-09-07 01:49:18 -04:00
|
|
|
#endif
|
|
|
|
|
1999-12-27 10:39:39 -05:00
|
|
|
/* If the system doesn't provide strsignal, we get it defined in
|
|
|
|
libiberty but no declaration is supplied. */
|
2000-09-25 18:54:04 -04:00
|
|
|
#ifndef HAVE_STRSIGNAL
|
1999-12-27 10:39:39 -05:00
|
|
|
# ifndef strsignal
|
|
|
|
extern const char *strsignal PARAMS ((int));
|
1998-09-13 02:17:31 -04:00
|
|
|
# endif
|
1999-12-27 10:39:39 -05:00
|
|
|
#endif
|
1998-09-13 02:17:31 -04:00
|
|
|
|
1998-06-30 07:10:55 -04:00
|
|
|
#ifdef HAVE_GETRLIMIT
|
2000-05-23 13:42:19 -04:00
|
|
|
# if defined (HAVE_DECL_GETRLIMIT) && !HAVE_DECL_GETRLIMIT
|
1998-06-30 07:10:55 -04:00
|
|
|
# ifndef getrlimit
|
system.h (bcopy, [...]): Add prototype arguments.
* system.h (bcopy, bcmp, bzero, index, rindex, atof, atol, free,
getcwd, getenv, getwd, sbrk, strstr, malloc, calloc, realloc,
strerror, getrlimit, setrlimit, abort): Add prototype arguments.
From-SVN: r31139
1999-12-30 08:48:51 -05:00
|
|
|
# ifdef ANSI_PROTOTYPES
|
|
|
|
struct rlimit;
|
|
|
|
# endif
|
|
|
|
extern int getrlimit PARAMS ((int, struct rlimit *));
|
1998-06-30 07:10:55 -04:00
|
|
|
# endif
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_SETRLIMIT
|
2000-05-23 13:42:19 -04:00
|
|
|
# if defined (HAVE_DECL_SETRLIMIT) && !HAVE_DECL_SETRLIMIT
|
1998-06-30 07:10:55 -04:00
|
|
|
# ifndef setrlimit
|
system.h (bcopy, [...]): Add prototype arguments.
* system.h (bcopy, bcmp, bzero, index, rindex, atof, atol, free,
getcwd, getenv, getwd, sbrk, strstr, malloc, calloc, realloc,
strerror, getrlimit, setrlimit, abort): Add prototype arguments.
From-SVN: r31139
1999-12-30 08:48:51 -05:00
|
|
|
# ifdef ANSI_PROTOTYPES
|
|
|
|
struct rlimit;
|
|
|
|
# endif
|
|
|
|
extern int setrlimit PARAMS ((int, const struct rlimit *));
|
1998-06-30 07:10:55 -04:00
|
|
|
# endif
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
1998-05-09 21:27:49 -04:00
|
|
|
/* HAVE_VOLATILE only refers to the stage1 compiler. We also check
|
|
|
|
__STDC__ and assume gcc sets it and has volatile in stage >=2. */
|
|
|
|
#if !defined(HAVE_VOLATILE) && !defined(__STDC__) && !defined(volatile)
|
|
|
|
#define volatile
|
|
|
|
#endif
|
|
|
|
|
2000-05-23 13:42:19 -04:00
|
|
|
#if defined (HAVE_DECL_ABORT) && !HAVE_DECL_ABORT
|
system.h (bcopy, [...]): Add prototype arguments.
* system.h (bcopy, bcmp, bzero, index, rindex, atof, atol, free,
getcwd, getenv, getwd, sbrk, strstr, malloc, calloc, realloc,
strerror, getrlimit, setrlimit, abort): Add prototype arguments.
From-SVN: r31139
1999-12-30 08:48:51 -05:00
|
|
|
extern void abort PARAMS ((void));
|
system.h: Always prototype abort.
1999-04-16 22:44 -0400 Zack Weinberg <zack@rabi.columbia.edu>
* system.h: Always prototype abort. Prototype fatal. Define
abort to call fatal, not fprintf/exit. Define a stub macro
for trim_filename.
* toplev.c: Define DIR_SEPARATOR. (trim_filename): New
function.
* toplev.h: Prototype trim_filename, and #undef system.h's stub.
* gcc.c, genattr.c, genattrtab.c, gencodes.c, genconfig.c,
genemit.c, genextract.c, genflags.c, genopinit.c, genoutput.c,
genpeep.c, genrecog.c: Make fatal non-static.
* gcov.c, gengenrtl.c, protoize.c: #undef abort after
including system.h.
* config/i386/dgux.h, config/m68k/xm-amix.h: Remove stale code
relating to abort.
From-SVN: r26511
1999-04-16 15:52:44 -04:00
|
|
|
#endif
|
1998-05-12 03:36:02 -04:00
|
|
|
|
2000-08-18 13:35:58 -04:00
|
|
|
/* 1 if we have C99 designated initializers. */
|
2000-11-20 22:02:09 -05:00
|
|
|
#if !defined(HAVE_DESIGNATED_INITIALIZERS)
|
2000-08-18 13:35:58 -04:00
|
|
|
#define HAVE_DESIGNATED_INITIALIZERS \
|
|
|
|
((GCC_VERSION >= 2007) || (__STDC_VERSION__ >= 199901L))
|
2000-11-20 22:02:09 -05:00
|
|
|
#endif
|
2000-08-18 13:35:58 -04:00
|
|
|
|
1998-05-12 03:36:02 -04:00
|
|
|
/* Define a STRINGIFY macro that's right for ANSI or traditional C.
|
|
|
|
Note: if the argument passed to STRINGIFY is itself a macro, eg
|
|
|
|
#define foo bar, STRINGIFY(foo) will produce "foo", not "bar".
|
|
|
|
Although the __STDC__ case could be made to expand this via a layer
|
|
|
|
of indirection, the traditional C case can not do so. Therefore
|
|
|
|
this behavior is not supported. */
|
|
|
|
#ifndef STRINGIFY
|
1999-09-22 10:23:22 -04:00
|
|
|
# ifdef HAVE_STRINGIZE
|
1998-05-12 03:36:02 -04:00
|
|
|
# define STRINGIFY(STRING) #STRING
|
|
|
|
# else
|
|
|
|
# define STRINGIFY(STRING) "STRING"
|
|
|
|
# endif
|
|
|
|
#endif /* ! STRINGIFY */
|
|
|
|
|
1998-11-23 11:39:37 -05:00
|
|
|
#if HAVE_SYS_STAT_H
|
|
|
|
# include <sys/stat.h>
|
|
|
|
#endif
|
1998-11-23 04:20:35 -05:00
|
|
|
|
|
|
|
/* Test if something is a normal file. */
|
|
|
|
#ifndef S_ISREG
|
|
|
|
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Test if something is a directory. */
|
|
|
|
#ifndef S_ISDIR
|
|
|
|
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
|
|
|
#endif
|
|
|
|
|
1999-02-09 08:48:34 -05:00
|
|
|
/* Test if something is a character special file. */
|
|
|
|
#ifndef S_ISCHR
|
|
|
|
#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
|
|
|
|
#endif
|
|
|
|
|
2000-05-05 12:27:45 -04:00
|
|
|
/* Test if something is a block special file. */
|
|
|
|
#ifndef S_ISBLK
|
|
|
|
#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
|
|
|
|
#endif
|
|
|
|
|
1999-02-09 08:48:34 -05:00
|
|
|
/* Test if something is a socket. */
|
|
|
|
#ifndef S_ISSOCK
|
|
|
|
# ifdef S_IFSOCK
|
|
|
|
# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
|
|
|
|
# else
|
|
|
|
# define S_ISSOCK(m) 0
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Test if something is a FIFO. */
|
|
|
|
#ifndef S_ISFIFO
|
|
|
|
# ifdef S_IFIFO
|
|
|
|
# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
|
|
|
|
# else
|
|
|
|
# define S_ISFIFO(m) 0
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Approximate O_NONBLOCK. */
|
|
|
|
#ifndef O_NONBLOCK
|
|
|
|
#define O_NONBLOCK O_NDELAY
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Approximate O_NOCTTY. */
|
|
|
|
#ifndef O_NOCTTY
|
|
|
|
#define O_NOCTTY 0
|
|
|
|
#endif
|
|
|
|
|
1999-03-24 18:35:34 -05:00
|
|
|
/* Define well known filenos if the system does not define them. */
|
|
|
|
#ifndef STDIN_FILENO
|
|
|
|
# define STDIN_FILENO 0
|
|
|
|
#endif
|
|
|
|
#ifndef STDOUT_FILENO
|
|
|
|
# define STDOUT_FILENO 1
|
|
|
|
#endif
|
1999-03-30 19:40:29 -05:00
|
|
|
#ifndef STDERR_FILENO
|
1999-03-24 18:35:34 -05:00
|
|
|
# define STDERR_FILENO 2
|
|
|
|
#endif
|
|
|
|
|
1999-04-14 21:50:52 -04:00
|
|
|
/* Some systems have mkdir that takes a single argument. */
|
|
|
|
#ifdef MKDIR_TAKES_ONE_ARG
|
|
|
|
# define mkdir(a,b) mkdir(a)
|
|
|
|
#endif
|
|
|
|
|
1999-09-21 18:31:29 -04:00
|
|
|
/* Provide a way to print an address via printf. */
|
|
|
|
#ifndef HOST_PTR_PRINTF
|
|
|
|
# ifdef HAVE_PRINTF_PTR
|
|
|
|
# define HOST_PTR_PRINTF "%p"
|
|
|
|
# else
|
|
|
|
# define HOST_PTR_PRINTF \
|
|
|
|
(sizeof (int) == sizeof (char *) ? "%x" \
|
|
|
|
: sizeof (long) == sizeof (char *) ? "%lx" : "%llx")
|
|
|
|
# endif
|
|
|
|
#endif /* ! HOST_PTR_PRINTF */
|
|
|
|
|
2000-01-06 19:16:51 -05:00
|
|
|
/* By default, colon separates directories in a path. */
|
|
|
|
#ifndef PATH_SEPARATOR
|
|
|
|
#define PATH_SEPARATOR ':'
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef DIR_SEPARATOR
|
|
|
|
#define DIR_SEPARATOR '/'
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Define IS_DIR_SEPARATOR. */
|
|
|
|
#ifndef DIR_SEPARATOR_2
|
2000-11-28 09:58:08 -05:00
|
|
|
# define IS_DIR_SEPARATOR(CH) ((CH) == DIR_SEPARATOR)
|
2000-01-06 19:16:51 -05:00
|
|
|
#else /* DIR_SEPARATOR_2 */
|
2000-11-28 09:58:08 -05:00
|
|
|
# define IS_DIR_SEPARATOR(CH) \
|
|
|
|
(((CH) == DIR_SEPARATOR) || ((CH) == DIR_SEPARATOR_2))
|
2000-01-06 19:16:51 -05:00
|
|
|
#endif /* DIR_SEPARATOR_2 */
|
|
|
|
|
2000-11-28 09:58:08 -05:00
|
|
|
/* Say how to test for an absolute pathname. On Unix systems, this is if
|
|
|
|
it starts with a leading slash or a '$', the latter meaning the value of
|
|
|
|
an environment variable is to be used. On machien with DOS-based
|
|
|
|
file systems, it is also absolute if it starts with a drive identifier. */
|
|
|
|
#ifdef HAVE_DOS_BASED_FILE_SYSTEM
|
|
|
|
#define IS_ABSOLUTE_PATHNAME(STR) \
|
|
|
|
(IS_DIR_SEPARATOR ((STR)[0]) || (STR)[0] == '$' \
|
|
|
|
|| ((STR)[0] != '\0' && (STR)[1] == ':' && IS_DIR_SEPARATOR ((STR)[2])))
|
|
|
|
#else
|
|
|
|
#define IS_ABSOLUTE_PATHNAME(STR) \
|
|
|
|
(IS_DIR_SEPARATOR ((STR)[0]) || (STR)[0] == '$')
|
|
|
|
#endif
|
|
|
|
|
1998-11-27 05:09:17 -05:00
|
|
|
/* Get libiberty declarations. */
|
|
|
|
#include "libiberty.h"
|
|
|
|
|
2000-04-19 12:43:44 -04:00
|
|
|
/* Make sure that ONLY_INT_FIELDS has an integral value. */
|
|
|
|
#ifdef ONLY_INT_FIELDS
|
|
|
|
#undef ONLY_INT_FIELDS
|
|
|
|
#define ONLY_INT_FIELDS 1
|
|
|
|
#else
|
|
|
|
#define ONLY_INT_FIELDS 0
|
|
|
|
#endif
|
|
|
|
|
2000-08-21 14:01:51 -04:00
|
|
|
/* Provide a default for the HOST_BIT_BUCKET.
|
|
|
|
This suffices for POSIX-like hosts. */
|
|
|
|
|
|
|
|
#ifndef HOST_BIT_BUCKET
|
|
|
|
#define HOST_BIT_BUCKET "/dev/null"
|
|
|
|
#endif
|
|
|
|
|
2000-04-18 15:42:30 -04:00
|
|
|
/* Enumerated bitfields are safe to use unless we've been explictly told
|
2000-04-25 07:21:13 -04:00
|
|
|
otherwise or if they are signed. */
|
2000-04-18 15:42:30 -04:00
|
|
|
|
2000-04-19 12:43:44 -04:00
|
|
|
#define USE_ENUM_BITFIELDS (__GNUC__ || (!ONLY_INT_FIELDS && ENUM_BITFIELDS_ARE_UNSIGNED))
|
2000-04-18 15:42:30 -04:00
|
|
|
|
|
|
|
#if USE_ENUM_BITFIELDS
|
|
|
|
#define ENUM_BITFIELD(TYPE) enum TYPE
|
|
|
|
#else
|
|
|
|
#define ENUM_BITFIELD(TYPE) unsigned int
|
|
|
|
#endif
|
|
|
|
|
2000-05-17 11:21:11 -04:00
|
|
|
#ifndef offsetof
|
|
|
|
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
|
|
|
|
#endif
|
2000-04-18 15:42:30 -04:00
|
|
|
|
2000-07-07 10:29:03 -04:00
|
|
|
/* Traditional C cannot initialize union members of structs. Provide
|
|
|
|
a macro which expands appropriately to handle it. This only works
|
|
|
|
if you intend to initalize the union member to zero since it relies
|
|
|
|
on default initialization to zero in the traditional C case. */
|
|
|
|
#ifdef __STDC__
|
|
|
|
#define UNION_INIT_ZERO , {0}
|
|
|
|
#else
|
|
|
|
#define UNION_INIT_ZERO
|
|
|
|
#endif
|
|
|
|
|
2000-07-13 15:09:23 -04:00
|
|
|
/* GCC now gives implicit declaration warnings for undeclared builtins. */
|
|
|
|
#if defined(__GNUC__) && defined (__SIZE_TYPE__)
|
|
|
|
extern void *alloca (__SIZE_TYPE__);
|
|
|
|
#endif
|
|
|
|
|
2000-07-21 03:10:36 -04:00
|
|
|
/* Various error reporting routines want to use __FUNCTION__. */
|
|
|
|
#if (GCC_VERSION < 2007)
|
2000-07-22 10:12:38 -04:00
|
|
|
#ifndef __FUNCTION__
|
2000-07-21 03:10:36 -04:00
|
|
|
#define __FUNCTION__ "?"
|
2000-07-22 10:12:38 -04:00
|
|
|
#endif /* ! __FUNCTION__ */
|
2000-07-21 03:10:36 -04:00
|
|
|
#endif
|
|
|
|
|
1998-02-12 19:22:24 -05:00
|
|
|
#endif /* __GCC_SYSTEM_H__ */
|