CFLAGS = $(CFLAGS) -I. -I./libiberty -DHAVE_CONFIG_H
-OBJECTS = cppmain.obj intl.obj \
+OBJECTS = cppmain.obj \
cpplib.obj cpplex.obj cppmacro.obj cppexp.obj cppfiles.obj \
cpphash.obj cpperror.obj cppinit.obj cppdefault.obj \
hashtable.obj mkdeps.obj prefix.obj version.obj mbchar.obj \
- safe-ctype.obj obstack.obj splay-tree.obj lbasename.obj
+ line-map.obj \
+ safe-ctype.obj obstack.obj splay-tree.obj lbasename.obj \
+ hex.obj concat.obj
TARGET = $(PRJDIR)/bin/sdcpp.exe
obstack.obj: libiberty\obstack.c
splay-tree.obj: libiberty\splay-tree.c
lbasename.obj: libiberty\lbasename.c
+hex.obj: libiberty\hex.c
+concat.obj: libiberty\concat.c
hashtable.o: hashtable.c hashtable.h $(CONFIG_H) $(SYSTEM_H) $(OBSTACK_H)
+line-map.o: line-map.c line-map.h intl.h $(CONFIG_H) $(SYSTEM_H)
+
+mbchar.o: mbchar.c mbchar.h $(CONFIG_H) $(SYSTEM_H)
+
prefix.o: prefix.c $(CONFIG_H) $(SYSTEM_H) Makefile prefix.h
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
-DPREFIX=\"$(prefix)\" \
-c $(srcdir)/prefix.c
-intl.o: intl.c intl.h Makefile
- $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- -DLOCALEDIR=\"$(localedir)\" \
- -c $(srcdir)/intl.c
-
#\f
# Remake cpp and protoize.
LIBCPP_OBJS = cpplib.o cpplex.o cppmacro.o cppexp.o cppfiles.o \
cpphash.o cpperror.o cppinit.o cppdefault.o \
- hashtable.o mkdeps.o prefix.o version.o mbchar.o
+ hashtable.o mkdeps.o prefix.o version.o mbchar.o \
+ line-map.o
LIBCPP_DEPS = cpplib.h cpphash.h hashtable.h intl.h $(OBSTACK_H) $(SYSTEM_H)
-$(RANLIB) libcpp.a
MY_LIBIBERTY_BITS = safe-ctype.o obstack.o splay-tree.o \
- lbasename.o
+ lbasename.o hex.o concat.o
-$(TARGET): cppmain.o intl.o $(MY_LIBIBERTY_BITS) libcpp.a $(LIBDEPS)
+$(TARGET): cppmain.o $(MY_LIBIBERTY_BITS) libcpp.a $(LIBDEPS)
mkdir -p $(dir $@)
$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ cppmain.o \
$(MY_LIBIBERTY_BITS) libcpp.a $(LIBS)
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
lbasename.o: $(LIBIBERTY_DIR)/lbasename.c $(CONFIG_H) $(LIBCPP_DEPS)
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
+hex.o: $(LIBIBERTY_DIR)/hex.c $(CONFIG_H) $(LIBCPP_DEPS)
+ $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
+concat.o: $(LIBIBERTY_DIR)/concat.c $(CONFIG_H) $(LIBCPP_DEPS)
+ $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
cppdefault.o: cppdefault.c $(CONFIG_H) $(SYSTEM_H) cppdefault.h Makefile
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
$(PREPROCESSOR_DEFINES) \
#undef HAVE_STPCPY
/* Define if your assembler supports specifying the maximum number
- of bytes to skip when using the GAS .p2align command. */
+ of bytes to skip when using the GAS .p2align command. */
#undef HAVE_GAS_MAX_SKIP_P2ALIGN
/* Define if your assembler supports .balign and .p2align. */
/* Define to `int' if <sys/types.h> doesn't define. */
#undef ssize_t
+/* Define if cpp should also search $prefix/include. */
+#undef PREFIX_INCLUDE_DIR
+
@BOTTOM@
/* Bison unconditionally undefines `const' if neither `__STDC__' nor
+dnl See if stdbool.h properly defines bool and true/false.
+AC_DEFUN(gcc_AC_HEADER_STDBOOL,
+[AC_CACHE_CHECK([for working stdbool.h],
+ ac_cv_header_stdbool_h,
+[AC_TRY_COMPILE([#include <stdbool.h>],
+[bool foo = false;],
+ac_cv_header_stdbool_h=yes, ac_cv_header_stdbool_h=no)])
+if test $ac_cv_header_stdbool_h = yes; then
+ AC_DEFINE(HAVE_STDBOOL_H, 1,
+ [Define if you have a working <stdbool.h> header file.])
+fi
+])
+
dnl See whether we can include both string.h and strings.h.
AC_DEFUN(gcc_AC_HEADER_STRING,
[AC_CACHE_CHECK([whether string.h and strings.h may both be included],
AC_SUBST(LN)dnl
])
+dnl Check whether _Bool is built-in.
+AC_DEFUN(gcc_AC_C__BOOL,
+[AC_CACHE_CHECK(for built-in _Bool, gcc_cv_c__bool,
+[AC_TRY_COMPILE(,
+[_Bool foo;],
+gcc_cv_c__bool=yes, gcc_cv_c__bool=no)
+])
+if test $gcc_cv_c__bool = yes; then
+ AC_DEFINE(HAVE__BOOL, 1, [Define if the \`_Bool' type is built-in.])
+fi
+])
+
dnl Define MKDIR_TAKES_ONE_ARG if mkdir accepts only one argument instead
dnl of the usual 2.
AC_DEFUN(gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG,
#endif
#ifdef HAVE_DIRECT_H
# include <direct.h>
-#endif], [mkdir ("foo", 0);],
+#endif], [mkdir ("foo", 0);],
gcc_cv_mkdir_takes_one_arg=no, gcc_cv_mkdir_takes_one_arg=yes)])
if test $gcc_cv_mkdir_takes_one_arg = yes ; then
AC_DEFINE(MKDIR_TAKES_ONE_ARG, 1, [Define if host mkdir takes a single argument.])
/*)
gcc_cv_path_$1="[$]$1" # Let the user override the test with a path.
;;
- ?:/*)
+ ?:/*)
gcc_cv_path_$1="[$]$1" # Let the user override the test with a dos path.
;;
*)
dnl POSIX.2 word splitting is done only on the output of word expansions,
dnl not every word. This closes a longstanding sh security hole.
ac_dummy="ifelse([$4], , $PATH, [$4])"
- for ac_dir in $ac_dummy; do
+ for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
gcc_cv_path_$1="$ac_dir/$ac_word"
x[0] = 1;
perror_exit ("test 3 no fault 1", 19);
}
-
+
signal (SIGSEGV, sigsegv);
if (setjmp (r) == 0)
{
])
# Check whether mmap can map a plain file, without MAP_FIXED.
-AC_DEFUN([AC_FUNC_MMAP_FILE],
+AC_DEFUN([AC_FUNC_MMAP_FILE],
[AC_CACHE_CHECK(for working mmap of a file, ac_cv_func_mmap_file,
[# Create a file one thousand bytes long.
for i in 1 2 3 4 5 6 7 8 9 0
fi
])
-dnl Determine if enumerated bitfields are unsigned. ISO C says they can
+dnl Determine if enumerated bitfields are unsigned. ISO C says they can
dnl be either signed or unsigned.
dnl
AC_DEFUN(gcc_AC_C_ENUM_BF_UNSIGNED,
enum t { BLAH = 128 } ;
struct s_t { enum t member : 8; } s ;
int main(void)
-{
+{
s.member = BLAH;
if (s.member < 0) exit(1);
exit(0);
[switch(0) {
case (unsigned char)((unsigned long)1 << $i) == ((unsigned long)1 << $i):
case (unsigned char)((unsigned long)1<<($i-1)) == ((unsigned long)1<<($i-1)):
- ; }],
+ ; }],
[gcc_cv_c_nbby=$i; break])
i=`expr $i + 1`
done
/* ANSI and traditional C compatability macros
- Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000
+ Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
This file is part of the GNU C Library.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* ANSI and traditional C compatibility macros
ANSI C is assumed if __STDC__ is #defined.
- Macro ANSI C definition Traditional C definition
- ----- ---- - ---------- ----------- - ----------
- PTR `void *' `char *'
- LONG_DOUBLE `long double' `double'
- VOLATILE `volatile' `'
- SIGNED `signed' `'
- PTRCONST `void *const' `char *'
- ANSI_PROTOTYPES 1 not defined
-
- CONST is also defined, but is obsolete. Just use const.
-
- obsolete -- DEFUN (name, arglist, args)
-
- Defines function NAME.
-
- ARGLIST lists the arguments, separated by commas and enclosed in
- parentheses. ARGLIST becomes the argument list in traditional C.
-
- ARGS list the arguments with their types. It becomes a prototype in
- ANSI C, and the type declarations in traditional C. Arguments should
- be separated with `AND'. For functions with a variable number of
- arguments, the last thing listed should be `DOTS'.
-
- obsolete -- DEFUN_VOID (name)
-
- Defines a function NAME, which takes no arguments.
-
- obsolete -- EXFUN (name, (prototype)) -- obsolete.
-
- Replaced by PARAMS. Do not use; will disappear someday soon.
- Was used in external function declarations.
- In ANSI C it is `NAME PROTOTYPE' (so PROTOTYPE should be enclosed in
- parentheses). In traditional C it is `NAME()'.
- For a function that takes no arguments, PROTOTYPE should be `(void)'.
-
- obsolete -- PROTO (type, name, (prototype) -- obsolete.
-
- This one has also been replaced by PARAMS. Do not use.
-
- PARAMS ((args))
-
- We could use the EXFUN macro to handle prototype declarations, but
- the name is misleading and the result is ugly. So we just define a
- simple macro to handle the parameter lists, as in:
-
- static int foo PARAMS ((int, char));
-
- This produces: `static int foo();' or `static int foo (int, char);'
-
- EXFUN would have done it like this:
-
- static int EXFUN (foo, (int, char));
-
- but the function is not external...and it's hard to visually parse
- the function name out of the mess. EXFUN should be considered
- obsolete; new code should be written to use PARAMS.
-
- DOTS is also obsolete.
-
- Examples:
-
- extern int printf PARAMS ((const char *format, ...));
-*/
+ Macro ANSI C definition Traditional C definition
+ ----- ---- - ---------- ----------- - ----------
+ ANSI_PROTOTYPES 1 not defined
+ PTR `void *' `char *'
+ PTRCONST `void *const' `char *'
+ LONG_DOUBLE `long double' `double'
+ const not defined `'
+ volatile not defined `'
+ signed not defined `'
+ VA_START(ap, var) va_start(ap, var) va_start(ap)
+
+ Note that it is safe to write "void foo();" indicating a function
+ with no return value, in all K+R compilers we have been able to test.
+
+ For declaring functions with prototypes, we also provide these:
+
+ PARAMS ((prototype))
+ -- for functions which take a fixed number of arguments. Use this
+ when declaring the function. When defining the function, write a
+ K+R style argument list. For example:
+
+ char *strcpy PARAMS ((char *dest, char *source));
+ ...
+ char *
+ strcpy (dest, source)
+ char *dest;
+ char *source;
+ { ... }
+
+
+ VPARAMS ((prototype, ...))
+ -- for functions which take a variable number of arguments. Use
+ PARAMS to declare the function, VPARAMS to define it. For example:
+
+ int printf PARAMS ((const char *format, ...));
+ ...
+ int
+ printf VPARAMS ((const char *format, ...))
+ {
+ ...
+ }
+
+ For writing functions which take variable numbers of arguments, we
+ also provide the VA_OPEN, VA_CLOSE, and VA_FIXEDARG macros. These
+ hide the differences between K+R <varargs.h> and C89 <stdarg.h> more
+ thoroughly than the simple VA_START() macro mentioned above.
+
+ VA_OPEN and VA_CLOSE are used *instead of* va_start and va_end.
+ Immediately after VA_OPEN, put a sequence of VA_FIXEDARG calls
+ corresponding to the list of fixed arguments. Then use va_arg
+ normally to get the variable arguments, or pass your va_list object
+ around. You do not declare the va_list yourself; VA_OPEN does it
+ for you.
+
+ Here is a complete example:
+
+ int
+ printf VPARAMS ((const char *format, ...))
+ {
+ int result;
+
+ VA_OPEN (ap, format);
+ VA_FIXEDARG (ap, const char *, format);
+
+ result = vfprintf (stdout, format, ap);
+ VA_CLOSE (ap);
+
+ return result;
+ }
+
+
+ You can declare variables either before or after the VA_OPEN,
+ VA_FIXEDARG sequence. Also, VA_OPEN and VA_CLOSE are the beginning
+ and end of a block. They must appear at the same nesting level,
+ and any variables declared after VA_OPEN go out of scope at
+ VA_CLOSE. Unfortunately, with a K+R compiler, that includes the
+ argument list. You can have multiple instances of VA_OPEN/VA_CLOSE
+ pairs in a single function in case you need to traverse the
+ argument list more than once.
+
+ For ease of writing code which uses GCC extensions but needs to be
+ portable to other compilers, we provide the GCC_VERSION macro that
+ simplifies testing __GNUC__ and __GNUC_MINOR__ together, and various
+ wrappers around __attribute__. Also, __extension__ will be #defined
+ to nothing if it doesn't work. See below.
+
+ This header also defines a lot of obsolete macros:
+ CONST, VOLATILE, SIGNED, PROTO, EXFUN, DEFUN, DEFUN_VOID,
+ AND, DOTS, NOARGS. Don't use them. */
#ifndef _ANSIDECL_H
-
-#define _ANSIDECL_H 1
-
+#define _ANSIDECL_H 1
/* Every source file includes this file,
so they will all get the switch for lint. */
/* LINTLIBRARY */
+/* Using MACRO(x,y) in cpp #if conditionals does not work with some
+ older preprocessors. Thus we can't define something like this:
-#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(_WIN32)
-/* All known AIX compilers implement these things (but don't always
- define __STDC__). The RISC/OS MIPS compiler defines these things
- in SVR4 mode, but does not define __STDC__. */
+#define HAVE_GCC_VERSION(MAJOR, MINOR) \
+ (__GNUC__ > (MAJOR) || (__GNUC__ == (MAJOR) && __GNUC_MINOR__ >= (MINOR)))
-#define PTR void *
-#define PTRCONST void *CONST
-#define LONG_DOUBLE long double
+and then test "#if HAVE_GCC_VERSION(2,7)".
-#ifndef IN_GCC
-#define AND ,
-#define NOARGS void
-#define VOLATILE volatile
-#define SIGNED signed
-#endif /* ! IN_GCC */
+So instead we use the macro below and test it against specific values. */
-#define PARAMS(paramlist) paramlist
-#define ANSI_PROTOTYPES 1
+/* This macro simplifies testing whether we are using gcc, and if it
+ is of a particular minimum version. (Both major & minor numbers are
+ significant.) This macro will evaluate to 0 if we are not using
+ gcc at all. */
+#ifndef GCC_VERSION
+#define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
+#endif /* GCC_VERSION */
+
+#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(_WIN32) || (defined(__alpha) && defined(__cplusplus))
+/* All known AIX compilers implement these things (but don't always
+ define __STDC__). The RISC/OS MIPS compiler defines these things
+ in SVR4 mode, but does not define __STDC__. */
+/* eraxxon@alumni.rice.edu: The Compaq C++ compiler, unlike many other
+ C++ compilers, does not define __STDC__, though it acts as if this
+ was so. (Verified versions: 5.7, 6.2, 6.3, 6.5) */
+
+#define ANSI_PROTOTYPES 1
+#define PTR void *
+#define PTRCONST void *const
+#define LONG_DOUBLE long double
+
+/* PARAMS is often defined elsewhere (e.g. by libintl.h), so wrap it in
+ a #ifndef. */
+#ifndef PARAMS
+#define PARAMS(ARGS) ARGS
+#endif
-#define VPARAMS(ARGS) ARGS
-#define VA_START(va_list,var) va_start(va_list,var)
+#define VPARAMS(ARGS) ARGS
+#define VA_START(VA_LIST, VAR) va_start(VA_LIST, VAR)
+
+/* variadic function helper macros */
+/* "struct Qdmy" swallows the semicolon after VA_OPEN/VA_FIXEDARG's
+ use without inhibiting further decls and without declaring an
+ actual variable. */
+#define VA_OPEN(AP, VAR) { va_list AP; va_start(AP, VAR); { struct Qdmy
+#define VA_CLOSE(AP) } va_end(AP); }
+#define VA_FIXEDARG(AP, T, N) struct Qdmy
+
+#undef const
+#undef volatile
+#undef signed
+
+/* inline requires special treatment; it's in C99, and GCC >=2.7 supports
+ it too, but it's not in C89. */
+#undef inline
+#if __STDC_VERSION__ > 199901L
+/* it's a keyword */
+#else
+# if GCC_VERSION >= 2007
+# define inline __inline__ /* __inline__ prevents -pedantic warnings */
+# else
+# define inline /* nothing */
+# endif
+#endif
/* These are obsolete. Do not use. */
#ifndef IN_GCC
-#define CONST const
-#define DOTS , ...
+#define CONST const
+#define VOLATILE volatile
+#define SIGNED signed
+
#define PROTO(type, name, arglist) type name arglist
#define EXFUN(name, proto) name proto
#define DEFUN(name, arglist, args) name(args)
#define DEFUN_VOID(name) name(void)
+#define AND ,
+#define DOTS , ...
+#define NOARGS void
#endif /* ! IN_GCC */
#else /* Not ANSI C. */
-#define PTR char *
-#define PTRCONST PTR
-#define LONG_DOUBLE double
-
-#ifndef IN_GCC
-#define AND ;
-#define NOARGS
-#define VOLATILE
-#define SIGNED
-#endif /* !IN_GCC */
-
-#ifndef const /* some systems define it in header files for non-ansi mode */
-#define const
-#endif
-
-#define PARAMS(paramlist) ()
+#undef ANSI_PROTOTYPES
+#define PTR char *
+#define PTRCONST PTR
+#define LONG_DOUBLE double
+
+#define PARAMS(args) ()
+#define VPARAMS(args) (va_alist) va_dcl
+#define VA_START(va_list, var) va_start(va_list)
+
+#define VA_OPEN(AP, VAR) { va_list AP; va_start(AP); { struct Qdmy
+#define VA_CLOSE(AP) } va_end(AP); }
+#define VA_FIXEDARG(AP, TYPE, NAME) TYPE NAME = va_arg(AP, TYPE)
+
+/* some systems define these in header files for non-ansi mode */
+#undef const
+#undef volatile
+#undef signed
+#undef inline
+#define const
+#define volatile
+#define signed
+#define inline
-#define VPARAMS(ARGS) (va_alist) va_dcl
-#define VA_START(va_list,var) va_start(va_list)
-
-/* These are obsolete. Do not use. */
#ifndef IN_GCC
#define CONST
-#define DOTS
+#define VOLATILE
+#define SIGNED
+
#define PROTO(type, name, arglist) type name ()
#define EXFUN(name, proto) name()
#define DEFUN(name, arglist, args) name arglist args;
#define DEFUN_VOID(name) name()
+#define AND ;
+#define DOTS
+#define NOARGS
#endif /* ! IN_GCC */
#endif /* ANSI C. */
-/* Using MACRO(x,y) in cpp #if conditionals does not work with some
- older preprocessors. Thus we can't define something like this:
-
-#define HAVE_GCC_VERSION(MAJOR, MINOR) \
- (__GNUC__ > (MAJOR) || (__GNUC__ == (MAJOR) && __GNUC_MINOR__ >= (MINOR)))
-
-and then test "#if HAVE_GCC_VERSION(2,7)".
-
-So instead we use the macro below and test it against specific values. */
-
-/* This macro simplifies testing whether we are using gcc, and if it
- is of a particular minimum version. (Both major & minor numbers are
- significant.) This macro will evaluate to 0 if we are not using
- gcc at all. */
-#ifndef GCC_VERSION
-#define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
-#endif /* GCC_VERSION */
-
/* Define macros for some gcc attributes. This permits us to use the
macros freely, and know that they will come into play for the
version of gcc in which they are supported. */
/* Attributes on labels were valid as of gcc 2.93. */
#ifndef ATTRIBUTE_UNUSED_LABEL
-# if (GCC_VERSION >= 2093)
+# if (!defined (__cplusplus) && GCC_VERSION >= 2093)
# define ATTRIBUTE_UNUSED_LABEL ATTRIBUTE_UNUSED
# else
# define ATTRIBUTE_UNUSED_LABEL
-# endif /* GNUC >= 2.93 */
+# endif /* !__cplusplus && GNUC >= 2.93 */
#endif /* ATTRIBUTE_UNUSED_LABEL */
#ifndef ATTRIBUTE_UNUSED
#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
#endif /* ATTRIBUTE_UNUSED */
+/* Before GCC 3.4, the C++ frontend couldn't parse attributes placed after the
+ identifier name. */
+#if ! defined(__cplusplus) || (GCC_VERSION >= 3004)
+# define ARG_UNUSED(NAME) NAME ATTRIBUTE_UNUSED
+#else /* !__cplusplus || GNUC >= 3.4 */
+# define ARG_UNUSED(NAME) NAME
+#endif /* !__cplusplus || GNUC >= 3.4 */
+
#ifndef ATTRIBUTE_NORETURN
#define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
#endif /* ATTRIBUTE_NORETURN */
+/* Attribute `nonnull' was valid as of gcc 3.3. */
+#ifndef ATTRIBUTE_NONNULL
+# if (GCC_VERSION >= 3003)
+# define ATTRIBUTE_NONNULL(m) __attribute__ ((__nonnull__ (m)))
+# else
+# define ATTRIBUTE_NONNULL(m)
+# endif /* GNUC >= 3.3 */
+#endif /* ATTRIBUTE_NONNULL */
+
+/* Attribute `pure' was valid as of gcc 3.0. */
+#ifndef ATTRIBUTE_PURE
+# if (GCC_VERSION >= 3000)
+# define ATTRIBUTE_PURE __attribute__ ((__pure__))
+# else
+# define ATTRIBUTE_PURE
+# endif /* GNUC >= 3.0 */
+#endif /* ATTRIBUTE_PURE */
+
+/* Use ATTRIBUTE_PRINTF when the format specifier must not be NULL.
+ This was the case for the `printf' format attribute by itself
+ before GCC 3.3, but as of 3.3 we need to add the `nonnull'
+ attribute to retain this behavior. */
#ifndef ATTRIBUTE_PRINTF
-#define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n)))
+#define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n))) ATTRIBUTE_NONNULL(m)
#define ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF(1, 2)
#define ATTRIBUTE_PRINTF_2 ATTRIBUTE_PRINTF(2, 3)
#define ATTRIBUTE_PRINTF_3 ATTRIBUTE_PRINTF(3, 4)
#define ATTRIBUTE_PRINTF_5 ATTRIBUTE_PRINTF(5, 6)
#endif /* ATTRIBUTE_PRINTF */
+/* Use ATTRIBUTE_FPTR_PRINTF when the format attribute is to be set on
+ a function pointer. Format attributes were allowed on function
+ pointers as of gcc 3.1. */
+#ifndef ATTRIBUTE_FPTR_PRINTF
+# if (GCC_VERSION >= 3001)
+# define ATTRIBUTE_FPTR_PRINTF(m, n) ATTRIBUTE_PRINTF(m, n)
+# else
+# define ATTRIBUTE_FPTR_PRINTF(m, n)
+# endif /* GNUC >= 3.1 */
+# define ATTRIBUTE_FPTR_PRINTF_1 ATTRIBUTE_FPTR_PRINTF(1, 2)
+# define ATTRIBUTE_FPTR_PRINTF_2 ATTRIBUTE_FPTR_PRINTF(2, 3)
+# define ATTRIBUTE_FPTR_PRINTF_3 ATTRIBUTE_FPTR_PRINTF(3, 4)
+# define ATTRIBUTE_FPTR_PRINTF_4 ATTRIBUTE_FPTR_PRINTF(4, 5)
+# define ATTRIBUTE_FPTR_PRINTF_5 ATTRIBUTE_FPTR_PRINTF(5, 6)
+#endif /* ATTRIBUTE_FPTR_PRINTF */
+
+/* Use ATTRIBUTE_NULL_PRINTF when the format specifier may be NULL. A
+ NULL format specifier was allowed as of gcc 3.3. */
+#ifndef ATTRIBUTE_NULL_PRINTF
+# if (GCC_VERSION >= 3003)
+# define ATTRIBUTE_NULL_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n)))
+# else
+# define ATTRIBUTE_NULL_PRINTF(m, n)
+# endif /* GNUC >= 3.3 */
+# define ATTRIBUTE_NULL_PRINTF_1 ATTRIBUTE_NULL_PRINTF(1, 2)
+# define ATTRIBUTE_NULL_PRINTF_2 ATTRIBUTE_NULL_PRINTF(2, 3)
+# define ATTRIBUTE_NULL_PRINTF_3 ATTRIBUTE_NULL_PRINTF(3, 4)
+# define ATTRIBUTE_NULL_PRINTF_4 ATTRIBUTE_NULL_PRINTF(4, 5)
+# define ATTRIBUTE_NULL_PRINTF_5 ATTRIBUTE_NULL_PRINTF(5, 6)
+#endif /* ATTRIBUTE_NULL_PRINTF */
+
+/* Attribute `sentinel' was valid as of gcc 3.5. */
+#ifndef ATTRIBUTE_SENTINEL
+# if (GCC_VERSION >= 3005)
+# define ATTRIBUTE_SENTINEL __attribute__ ((__sentinel__))
+# else
+# define ATTRIBUTE_SENTINEL
+# endif /* GNUC >= 3.5 */
+#endif /* ATTRIBUTE_SENTINEL */
+
+
+#ifndef ATTRIBUTE_ALIGNED_ALIGNOF
+# if (GCC_VERSION >= 3000)
+# define ATTRIBUTE_ALIGNED_ALIGNOF(m) __attribute__ ((__aligned__ (__alignof__ (m))))
+# else
+# define ATTRIBUTE_ALIGNED_ALIGNOF(m)
+# endif /* GNUC >= 3.0 */
+#endif /* ATTRIBUTE_ALIGNED_ALIGNOF */
+
/* We use __extension__ in some places to suppress -pedantic warnings
about GCC extensions. This feature didn't work properly before
gcc 2.8. */
#define __extension__
#endif
-/* Bootstrap support: Autoconf will possibly define the `inline' or
- `const' keywords as macros, however this is only valid for the
- stage1 compiler. If we detect a modern version of gcc,
- unconditionally reset the values. This makes sure the right thing
- happens in stage2 and later. We need to do this very early;
- i.e. before any header files that might use these keywords.
- Otherwise conflicts might occur. */
-
-#if (GCC_VERSION >= 2007)
-# ifdef __STDC__
-# undef const
-# endif
-# undef inline
-# define inline __inline__ /* __inline__ prevents -pedantic warnings */
-# ifndef HAVE_LONG_DOUBLE
-# define HAVE_LONG_DOUBLE 1
-# endif
-#endif /* GCC >= 2.7 */
-
#endif /* ansidecl.h */
#include "auto-host.h"
#include "sdcc.h"
+/* Provide three core typedefs used by everything, if we are compiling
+ GCC. These used to be found in rtl.h and tree.h, but this is no
+ longer practical. Providing these here rather that system.h allows
+ the typedefs to be used everywhere within GCC. */
+struct rtx_def;
+typedef struct rtx_def *rtx;
+struct rtvec_def;
+typedef struct rtvec_def *rtvec;
+union tree_node;
+typedef union tree_node *tree;
/* config.in. Generated automatically from configure.in by autoheader. */
+/* Define if using alloca.c. */
+#undef C_ALLOCA
+
/* Define to empty if the keyword does not work. */
#undef const
+/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
+ This function is required for alloca.c support on those systems. */
+#undef CRAY_STACKSEG_END
+
+/* Define if you have alloca, as a function or macro. */
+#undef HAVE_ALLOCA
+
+/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
+#undef HAVE_ALLOCA_H
+
/* Define if you have the ANSI # stringizing operator in cpp. */
#undef HAVE_STRINGIZE
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
+/* If using the C implementation of alloca, define if you know the
+ direction of stack growth for your system; otherwise it will be
+ automatically deduced at run-time.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown
+ */
+#undef STACK_DIRECTION
+
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define to `int' if <sys/types.h> doesn't define. */
#undef ssize_t
+/* Define if cpp should also search $prefix/include. */
+#undef PREFIX_INCLUDE_DIR
+
/* Define if you have the dcgettext function. */
#undef HAVE_DCGETTEXT
+/* Define if you have the dup2 function. */
+#undef HAVE_DUP2
+
+/* Define if you have the getegid function. */
+#undef HAVE_GETEGID
+
+/* Define if you have the geteuid function. */
+#undef HAVE_GETEUID
+
+/* Define if you have the getgid function. */
+#undef HAVE_GETGID
+
/* Define if you have the getpagesize function. */
#undef HAVE_GETPAGESIZE
+/* Define if you have the getuid function. */
+#undef HAVE_GETUID
+
/* Define if you have the kill function. */
#undef HAVE_KILL
/* Define if you have the lstat function. */
#undef HAVE_LSTAT
+/* Define if you have the mempcpy function. */
+#undef HAVE_MEMPCPY
+
/* Define if you have the munmap function. */
#undef HAVE_MUNMAP
/* Define if you have the strdup function. */
#undef HAVE_STRDUP
-/* Define if you have the strrchr function. */
-#undef HAVE_STRRCHR
-
-/* Define if you have the strstr function. */
-#undef HAVE_STRSTR
+/* Define if you have the tsearch function. */
+#undef HAVE_TSEARCH
/* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
-/* Define if you have the <iconv.h> header file. */
-#undef HAVE_ICONV_H
-
/* Define if you have the <langinfo.h> header file. */
#undef HAVE_LANGINFO_H
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
-/* Define if you have the i library (-li). */
-#undef HAVE_LIBI
-
/* Define to enable the use of a default linker. */
#undef DEFAULT_LINKER
/* Define if your compiler supports the `long double' type. */
#undef HAVE_LONG_DOUBLE
+/* Define if the `_Bool' type is built-in. */
+#undef HAVE__BOOL
+
/* The number of bytes in type short */
#undef SIZEOF_SHORT
/* Define if the host execution character set is EBCDIC. */
#undef HOST_EBCDIC
+/* Define if you have a working <stdbool.h> header file. */
+#undef HAVE_STDBOOL_H
+
/* Define if you can safely include both <string.h> and <strings.h>. */
#undef STRING_WITH_STRINGS
/* Define if read-only mmap of a plain file works. */
#undef HAVE_MMAP_FILE
+/* Define if you have the iconv() function. */
+#undef HAVE_ICONV
+
+/* Define as const if the declaration of iconv() needs const. */
+#undef ICONV_CONST
+
/* Define to 1 if we found this declaration otherwise define to 0. */
#undef HAVE_DECL_GETENV
/* Define if host mkdir takes a single argument. */
#undef MKDIR_TAKES_ONE_ARG
-/* Define to the name of the distribution. */
-#undef PACKAGE
+/* Define if you have the iconv() function. */
+#undef HAVE_ICONV
+
+/* Define as const if the declaration of iconv() needs const. */
+#undef ICONV_CONST
+
+/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
+#undef HAVE_LANGINFO_CODESET
+
+/* Define if your <locale.h> file defines LC_MESSAGES. */
+#undef HAVE_LC_MESSAGES
+
+/* Define to 1 if translation of program messages to the user's native language
+ is requested. */
+#undef ENABLE_NLS
+
+/* Define if you have the <libintl.h> header file. */
+#undef HAVE_LIBINTL_H
+
+/* Define if the GNU gettext() function is already present or preinstalled. */
+#undef HAVE_GETTEXT
-/* Define to the version of the distribution. */
-#undef VERSION
+/* Define to use the libintl included with this package instead of any
+ version in the system libraries. */
+#undef USE_INCLUDED_LIBINTL
/* Define to 1 if installation paths should be looked up in Windows32
Registry. Ignored on non windows32 hosts. */
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.54.
+# Generated by GNU Autoconf 2.60.
#
-# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
-# Free Software Foundation, Inc.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
## --------------------- ##
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
- set -o posix
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
fi
# Support unset when possible.
-if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
as_unset=unset
else
as_unset=false
fi
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+as_nl='
+'
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ { (exit 1); exit 1; }
+fi
+
# Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
-for as_var in LANG LANGUAGE LC_ALL LC_COLLATE LC_CTYPE LC_NUMERIC LC_MESSAGES LC_TIME
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
do
- if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
eval $as_var=C; export $as_var
else
- $as_unset $as_var
+ ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
fi
done
# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
-if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
# Name of the executable.
-as_me=`$as_basename "$0" ||
+as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)$' \| \
- . : '\(.\)' 2>/dev/null ||
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
- /^X\/\(\/\/\)$/{ s//\1/; q; }
- /^X\/\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+# CDPATH.
+$as_unset CDPATH
-# PATH needs CR, and LINENO needs CR and PATH.
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conftest.sh
- echo "exit 0" >>conftest.sh
- chmod +x conftest.sh
- if (PATH="/nonexistent;."; conftest.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conftest.sh
+if test "x$CONFIG_SHELL" = x; then
+ if (eval ":") 2>/dev/null; then
+ as_have_required=yes
+else
+ as_have_required=no
fi
+ if test $as_have_required = yes && (eval ":
+(as_func_return () {
+ (exit \$1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" || {
- # Find who we are. Look in the path if we contain no path at all
- # relative or not.
- case $0 in
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
- ;;
- esac
- # We did not find ourselves, most probably we were run as `sh COMMAND'
- # in which case we are not to be found in the path.
- if test "x$as_myself" = x; then
- as_myself=$0
- fi
- if test ! -f "$as_myself"; then
- { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
- { (exit 1); exit 1; }; }
- fi
- case $CONFIG_SHELL in
- '')
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0) || { (exit 1); exit 1; }
+
+(
+ as_lineno_1=\$LINENO
+ as_lineno_2=\$LINENO
+ test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
+ test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
+") 2> /dev/null; then
+ :
+else
+ as_candidate_shells=
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+for as_dir in /usr/bin/posix$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for as_base in sh bash ksh sh5; do
- case $as_dir in
+ case $as_dir in
/*)
- if ("$as_dir/$as_base" -c '
+ for as_base in sh bash ksh sh5; do
+ as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
+ done;;
+ esac
+done
+IFS=$as_save_IFS
+
+
+ for as_shell in $as_candidate_shells $SHELL; do
+ # Try only shells that exist, to save several forks.
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ { ("$as_shell") 2> /dev/null <<\_ASEOF
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+:
+_ASEOF
+}; then
+ CONFIG_SHELL=$as_shell
+ as_have_required=yes
+ if { "$as_shell" 2> /dev/null <<\_ASEOF
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+:
+(as_func_return () {
+ (exit $1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = "$1" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test $exitcode = 0) || { (exit 1); exit 1; }
+
+(
as_lineno_1=$LINENO
as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
- $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
- $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
- CONFIG_SHELL=$as_dir/$as_base
- export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$0" ${1+"$@"}
- fi;;
- esac
- done
-done
-;;
- esac
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
+
+_ASEOF
+}; then
+ break
+fi
+
+fi
+
+ done
+
+ if test "x$CONFIG_SHELL" != x; then
+ for as_var in BASH_ENV ENV
+ do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+ done
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+
+ if test $as_have_required = no; then
+ echo This script requires a shell more modern than all the
+ echo shells that I found on your system. Please install a
+ echo modern shell, or manually run the script under such a
+ echo shell if you do have one.
+ { (exit 1); exit 1; }
+fi
+
+
+fi
+
+fi
+
+
+
+(eval "as_func_return () {
+ (exit \$1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0") || {
+ echo No shell found that supports shell functions.
+ echo Please tell autoconf@gnu.org about your system,
+ echo including any error possibly output before this
+ echo message
+}
+
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
# Create $as_me.lineno as a copy of $as_myself, but with $LINENO
# uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line before each line; the second 'sed' does the real
- # work. The second script uses 'N' to pair each line-number line
- # with the numbered line, and appends trailing '-' during
- # substitution so that $LINENO is not a special case at line end.
+ # line-number line after each line using $LINENO; the second 'sed'
+ # does the real work. The second script uses 'N' to pair each
+ # line-number line with the line containing $LINENO, and appends
+ # trailing '-' during substitution so that $LINENO is not a special
+ # case at line end.
# (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
- sed '=' <$as_myself |
+ # scripts with optimization help from Paolo Bonzini. Blame Lee
+ # E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
N
- s,$,-,
- : loop
- s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
t loop
- s,-$,,
- s,^['$as_cr_digits']*\n,,
+ s/-\n.*//
' >$as_me.lineno &&
- chmod +x $as_me.lineno ||
+ chmod +x "$as_me.lineno" ||
{ echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
{ (exit 1); exit 1; }; }
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensible to this).
- . ./$as_me.lineno
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
# Exit status is that of the last command.
exit
}
-case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
- *c*,-n*) ECHO_N= ECHO_C='
-' ECHO_T=' ' ;;
- *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
- *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+ case `echo 'x\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ *) ECHO_C='\c';;
+ esac;;
+*)
+ ECHO_N='-n';;
esac
-if expr a : '\(a\)' >/dev/null 2>&1; then
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir
+fi
echo >conf$$.file
if ln -s conf$$.file conf$$ 2>/dev/null; then
- # We could just check for DJGPP; but this test a) works b) is more generic
- # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
- if test -f conf$$.exe; then
- # Don't use ln at all; we don't have any links
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
as_ln_s='cp -p'
- else
- as_ln_s='ln -s'
- fi
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -p'
fi
-rm -f conf$$ conf$$.exe conf$$.file
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
if mkdir -p . 2>/dev/null; then
as_mkdir_p=:
else
+ test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
-as_executable_p="test -f"
+# Find out whether ``test -x'' works. Don't use a zero-byte file, as
+# systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+ as_executable_p="test -x"
+else
+ as_executable_p=:
+fi
+rm -f conf$$.file
# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
# Sed expression to map a string onto a valid variable name.
-as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-# IFS
-# We need space, tab and new line, in precisely that order.
-as_nl='
-'
-IFS=" $as_nl"
-
-# CDPATH.
-$as_unset CDPATH
+exec 7<&0 </dev/null 6>&1
# Name of the host.
# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
# so uname gets run too.
ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
-exec 6>&1
-
#
# Initializations.
#
ac_default_prefix=/usr/local
+ac_clean_files=
ac_config_libobj_dir=.
+LIBOBJS=
cross_compiling=no
subdirs=
MFLAGS=
MAKEFLAGS=
SHELL=${CONFIG_SHELL-/bin/sh}
-# Maximum number of lines to put in a shell here document.
-# This variable seems obsolete. It should probably be removed, and
-# only ac_max_sed_lines should be used.
-: ${ac_max_here_lines=38}
-
# Identity of this package.
PACKAGE_NAME=
PACKAGE_TARNAME=
#endif
#if HAVE_INTTYPES_H
# include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-# include <stdint.h>
-# endif
+#endif
+#if HAVE_STDINT_H
+# include <stdint.h>
#endif
#if HAVE_UNISTD_H
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT NO_MINUS_C_MINUS_O OUTPUT_OPTION CPP EGREP warn_cflags SET_MAKE LN LN_S RANLIB ac_ct_RANLIB INSTALL INSTALL_PROGRAM INSTALL_DATA have_mktemp_command STRIP manext objext PACKAGE VERSION MAINT build_canonical host_canonical target_subdir objdir all_stagestuff build_exeext build_install_headers_dir build_xm_file_list build_xm_file build_xm_defines check_languages dep_host_xmake_file dep_tmake_file extra_c_flags extra_headers_list extra_objs extra_parts extra_passes extra_programs gcc_config_arguments gcc_version gcc_version_full gcc_version_trigger host_exeext host_extra_gcc_objs install lang_tree_files local_prefix md_file out_file out_object_file symbolic_link thread_file c_target_objs LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL
+PATH_SEPARATOR
+PACKAGE_NAME
+PACKAGE_TARNAME
+PACKAGE_VERSION
+PACKAGE_STRING
+PACKAGE_BUGREPORT
+exec_prefix
+prefix
+program_transform_name
+bindir
+sbindir
+libexecdir
+datarootdir
+datadir
+sysconfdir
+sharedstatedir
+localstatedir
+includedir
+oldincludedir
+docdir
+infodir
+htmldir
+dvidir
+pdfdir
+psdir
+libdir
+localedir
+mandir
+DEFS
+ECHO_C
+ECHO_N
+ECHO_T
+LIBS
+build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+CPPFLAGS
+ac_ct_CC
+EXEEXT
+OBJEXT
+NO_MINUS_C_MINUS_O
+OUTPUT_OPTION
+CPP
+GREP
+EGREP
+warn_cflags
+SET_MAKE
+LN
+LN_S
+RANLIB
+INSTALL
+INSTALL_PROGRAM
+INSTALL_DATA
+have_mktemp_command
+STRIP
+manext
+objext
+PACKAGE
+VERSION
+MAINT
+build_canonical
+host_canonical
+target_subdir
+objdir
+all_stagestuff
+build_exeext
+build_install_headers_dir
+build_xm_file_list
+build_xm_file
+build_xm_defines
+check_languages
+dep_host_xmake_file
+dep_tmake_file
+extra_c_flags
+extra_headers_list
+extra_objs
+extra_parts
+extra_passes
+extra_programs
+gcc_config_arguments
+gcc_version
+gcc_version_full
+gcc_version_trigger
+host_exeext
+host_extra_gcc_objs
+install
+lang_tree_files
+local_prefix
+md_file
+out_file
+out_object_file
+symbolic_link
+thread_file
+c_target_objs
+LIBOBJS
+LTLIBOBJS'
ac_subst_files=''
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+CPPFLAGS
+CPP'
+
# Initialize some variables set by options.
ac_init_help=
# and all the variables that are supposed to be based on exec_prefix
# by default will actually change.
# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
includedir='${prefix}/include'
oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
+docdir='${datarootdir}/doc/${PACKAGE}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
ac_prev=
+ac_dashdash=
for ac_option
do
# If the previous option needs an argument, assign it.
if test -n "$ac_prev"; then
- eval "$ac_prev=\$ac_option"
+ eval $ac_prev=\$ac_option
ac_prev=
continue
fi
- ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
+ case $ac_option in
+ *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *) ac_optarg=yes ;;
+ esac
# Accept the important Cygnus configure options, so we can diagnose typos.
- case $ac_option in
+ case $ac_dashdash$ac_option in
+ --)
+ ac_dashdash=yes ;;
-bindir | --bindir | --bindi | --bind | --bin | --bi)
ac_prev=bindir ;;
--config-cache | -C)
cache_file=config.cache ;;
- -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ -datadir | --datadir | --datadi | --datad)
ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
- | --da=*)
+ -datadir=* | --datadir=* | --datadi=* | --datad=*)
datadir=$ac_optarg ;;
+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+ | --dataroo | --dataro | --datar)
+ ac_prev=datarootdir ;;
+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+ datarootdir=$ac_optarg ;;
+
-disable-* | --disable-*)
ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
# Reject names that are not valid shell variable names.
{ echo "$as_me: error: invalid feature name: $ac_feature" >&2
{ (exit 1); exit 1; }; }
ac_feature=`echo $ac_feature | sed 's/-/_/g'`
- eval "enable_$ac_feature=no" ;;
+ eval enable_$ac_feature=no ;;
+
+ -docdir | --docdir | --docdi | --doc | --do)
+ ac_prev=docdir ;;
+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+ docdir=$ac_optarg ;;
+
+ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+ ac_prev=dvidir ;;
+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+ dvidir=$ac_optarg ;;
-enable-* | --enable-*)
ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
{ echo "$as_me: error: invalid feature name: $ac_feature" >&2
{ (exit 1); exit 1; }; }
ac_feature=`echo $ac_feature | sed 's/-/_/g'`
- case $ac_option in
- *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
- *) ac_optarg=yes ;;
- esac
- eval "enable_$ac_feature='$ac_optarg'" ;;
+ eval enable_$ac_feature=\$ac_optarg ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
-host=* | --host=* | --hos=* | --ho=*)
host_alias=$ac_optarg ;;
+ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+ ac_prev=htmldir ;;
+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+ | --ht=*)
+ htmldir=$ac_optarg ;;
+
-includedir | --includedir | --includedi | --included | --include \
| --includ | --inclu | --incl | --inc)
ac_prev=includedir ;;
| --libexe=* | --libex=* | --libe=*)
libexecdir=$ac_optarg ;;
+ -localedir | --localedir | --localedi | --localed | --locale)
+ ac_prev=localedir ;;
+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+ localedir=$ac_optarg ;;
+
-localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst \
- | --locals | --local | --loca | --loc | --lo)
+ | --localstate | --localstat | --localsta | --localst | --locals)
ac_prev=localstatedir ;;
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* \
- | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
localstatedir=$ac_optarg ;;
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
| --progr-tra=* | --program-tr=* | --program-t=*)
program_transform_name=$ac_optarg ;;
+ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+ ac_prev=pdfdir ;;
+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+ pdfdir=$ac_optarg ;;
+
+ -psdir | --psdir | --psdi | --psd | --ps)
+ ac_prev=psdir ;;
+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+ psdir=$ac_optarg ;;
+
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
{ echo "$as_me: error: invalid package name: $ac_package" >&2
{ (exit 1); exit 1; }; }
ac_package=`echo $ac_package| sed 's/-/_/g'`
- case $ac_option in
- *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
- *) ac_optarg=yes ;;
- esac
- eval "with_$ac_package='$ac_optarg'" ;;
+ eval with_$ac_package=\$ac_optarg ;;
-without-* | --without-*)
ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
{ echo "$as_me: error: invalid package name: $ac_package" >&2
{ (exit 1); exit 1; }; }
ac_package=`echo $ac_package | sed 's/-/_/g'`
- eval "with_$ac_package=no" ;;
+ eval with_$ac_package=no ;;
--x)
# Obsolete; use --with-x.
expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid variable name: $ac_envvar" >&2
{ (exit 1); exit 1; }; }
- ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
- eval "$ac_envvar='$ac_optarg'"
+ eval $ac_envvar=\$ac_optarg
export $ac_envvar ;;
*)
{ (exit 1); exit 1; }; }
fi
-# Be sure to have absolute paths.
-for ac_var in exec_prefix prefix
-do
- eval ac_val=$`echo $ac_var`
- case $ac_val in
- [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
- *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
- { (exit 1); exit 1; }; };;
- esac
-done
-
-# Be sure to have absolute paths.
-for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
- localstatedir libdir includedir oldincludedir infodir mandir
+# Be sure to have absolute directory names.
+for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
+ datadir sysconfdir sharedstatedir localstatedir includedir \
+ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+ libdir localedir mandir
do
- eval ac_val=$`echo $ac_var`
+ eval ac_val=\$$ac_var
case $ac_val in
- [\\/$]* | ?:[\\/]* ) ;;
- *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
- { (exit 1); exit 1; }; };;
+ [\\/$]* | ?:[\\/]* ) continue;;
+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
esac
+ { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; }
done
# There might be people who depend on the old broken behavior: `$host'
test "$silent" = yes && exec 6>/dev/null
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+ { echo "$as_me: error: Working directory cannot be determined" >&2
+ { (exit 1); exit 1; }; }
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+ { echo "$as_me: error: pwd does not report name of working directory" >&2
+ { (exit 1); exit 1; }; }
+
+
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
ac_srcdir_defaulted=yes
- # Try the directory containing this script, then its parent.
- ac_confdir=`(dirname "$0") 2>/dev/null ||
+ # Try the directory containing this script, then the parent directory.
+ ac_confdir=`$as_dirname -- "$0" ||
$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$0" : 'X\(//\)[^/]' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
+ X"$0" : 'X\(//\)[^/]' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$0" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
srcdir=$ac_confdir
- if test ! -r $srcdir/$ac_unique_file; then
+ if test ! -r "$srcdir/$ac_unique_file"; then
srcdir=..
fi
else
ac_srcdir_defaulted=no
fi
-if test ! -r $srcdir/$ac_unique_file; then
- if test "$ac_srcdir_defaulted" = yes; then
- { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+if test ! -r "$srcdir/$ac_unique_file"; then
+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
{ (exit 1); exit 1; }; }
- else
- { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
- { (exit 1); exit 1; }; }
- fi
fi
-(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
- { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+ cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2
{ (exit 1); exit 1; }; }
-srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
-ac_env_build_alias_set=${build_alias+set}
-ac_env_build_alias_value=$build_alias
-ac_cv_env_build_alias_set=${build_alias+set}
-ac_cv_env_build_alias_value=$build_alias
-ac_env_host_alias_set=${host_alias+set}
-ac_env_host_alias_value=$host_alias
-ac_cv_env_host_alias_set=${host_alias+set}
-ac_cv_env_host_alias_value=$host_alias
-ac_env_target_alias_set=${target_alias+set}
-ac_env_target_alias_value=$target_alias
-ac_cv_env_target_alias_set=${target_alias+set}
-ac_cv_env_target_alias_value=$target_alias
-ac_env_CC_set=${CC+set}
-ac_env_CC_value=$CC
-ac_cv_env_CC_set=${CC+set}
-ac_cv_env_CC_value=$CC
-ac_env_CFLAGS_set=${CFLAGS+set}
-ac_env_CFLAGS_value=$CFLAGS
-ac_cv_env_CFLAGS_set=${CFLAGS+set}
-ac_cv_env_CFLAGS_value=$CFLAGS
-ac_env_LDFLAGS_set=${LDFLAGS+set}
-ac_env_LDFLAGS_value=$LDFLAGS
-ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
-ac_cv_env_LDFLAGS_value=$LDFLAGS
-ac_env_CPPFLAGS_set=${CPPFLAGS+set}
-ac_env_CPPFLAGS_value=$CPPFLAGS
-ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
-ac_cv_env_CPPFLAGS_value=$CPPFLAGS
-ac_env_CPP_set=${CPP+set}
-ac_env_CPP_value=$CPP
-ac_cv_env_CPP_set=${CPP+set}
-ac_cv_env_CPP_value=$CPP
+ pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+ srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+ eval ac_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_env_${ac_var}_value=\$${ac_var}
+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
#
# Report the --help message.
-n, --no-create do not create output files
--srcdir=DIR find the sources in DIR [configure dir or \`..']
-_ACEOF
-
- cat <<_ACEOF
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
+ [$ac_default_prefix]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [PREFIX]
+ [PREFIX]
By default, \`make install' will install all the files in
\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data [PREFIX/share]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
- --infodir=DIR info documentation [PREFIX/info]
- --mandir=DIR man documentation [PREFIX/man]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
_ACEOF
cat <<\_ACEOF
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
- CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
- headers in a nonstandard directory <include dir>
+ CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+ you have headers in a nonstandard directory <include dir>
CPP C preprocessor
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
_ACEOF
+ac_status=$?
fi
if test "$ac_init_help" = "recursive"; then
# If there are subdirs, report their specific --help.
- ac_popdir=`pwd`
for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
- test -d $ac_dir || continue
+ test -d "$ac_dir" || continue
ac_builddir=.
-if test "$ac_dir" != .; then
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A "../" for each directory in $ac_dir_suffix.
- ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
- ac_dir_suffix= ac_top_builddir=
-fi
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
case $srcdir in
- .) # No --srcdir option. We are building in place.
+ .) # We are building in place.
ac_srcdir=.
- if test -z "$ac_top_builddir"; then
- ac_top_srcdir=.
- else
- ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
- fi ;;
- [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir ;;
- *) # Relative path.
- ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_builddir$srcdir ;;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
esac
-# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
-# absolute.
-ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
-ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
-ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
-ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
-
- cd $ac_dir
- # Check for guested configure; otherwise get Cygnus style configure.
- if test -f $ac_srcdir/configure.gnu; then
- echo
- $SHELL $ac_srcdir/configure.gnu --help=recursive
- elif test -f $ac_srcdir/configure; then
- echo
- $SHELL $ac_srcdir/configure --help=recursive
- elif test -f $ac_srcdir/configure.ac ||
- test -f $ac_srcdir/configure.in; then
- echo
- $ac_configure --help
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+ cd "$ac_dir" || { ac_status=$?; continue; }
+ # Check for guested configure.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure" --help=recursive
else
echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
- fi
- cd $ac_popdir
+ fi || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
done
fi
-test -n "$ac_init_help" && exit 0
+test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
+configure
+generated by GNU Autoconf 2.60
-Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
-Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
- exit 0
+ exit
fi
-exec 5>config.log
-cat >&5 <<_ACEOF
+cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by $as_me, which was
-generated by GNU Autoconf 2.54. Invocation command line was
+generated by GNU Autoconf 2.60. Invocation command line was
$ $0 $@
_ACEOF
+exec 5>>config.log
{
cat <<_ASUNAME
## --------- ##
/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
-hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
test -z "$as_dir" && as_dir=.
echo "PATH: $as_dir"
done
+IFS=$as_save_IFS
} >&5
# Keep a trace of the command line.
# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
ac_configure_args=
-ac_sep=
-for ac_arg
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
do
- case $ac_arg in
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c | -n ) continue ;;
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
- continue ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
- ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
- esac
- ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
- # Get rid of the leading space.
- ac_sep=" "
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *\'*)
+ ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+ 2)
+ ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ ac_configure_args="$ac_configure_args '$ac_arg'"
+ ;;
+ esac
+ done
done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
# When interrupted or exit'd, cleanup temporary files, and complete
# config.log. We remove comments because anyway the quotes in there
# would cause problems or look ugly.
-# WARNING: Be sure not to use single quotes in there, as some shells,
-# such as our DU 5.0 friend, will then `close' the trap.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
trap 'exit_status=$?
# Save into config.log some information that might help in debugging.
{
_ASBOX
echo
# The following way of writing the cache mishandles newlines in values,
-{
+(
+ for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ *) $as_unset $ac_var ;;
+ esac ;;
+ esac
+ done
(set) 2>&1 |
- case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
sed -n \
- "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
- ;;
+ "s/'\''/'\''\\\\'\'''\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+ ;; #(
*)
- sed -n \
- "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
;;
- esac;
-}
+ esac |
+ sort
+)
echo
cat <<\_ASBOX
echo
for ac_var in $ac_subst_vars
do
- eval ac_val=$`echo $ac_var`
- echo "$ac_var='"'"'$ac_val'"'"'"
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ echo "$ac_var='\''$ac_val'\''"
done | sort
echo
if test -n "$ac_subst_files"; then
cat <<\_ASBOX
-## ------------- ##
-## Output files. ##
-## ------------- ##
+## ------------------- ##
+## File substitutions. ##
+## ------------------- ##
_ASBOX
echo
for ac_var in $ac_subst_files
do
- eval ac_val=$`echo $ac_var`
- echo "$ac_var='"'"'$ac_val'"'"'"
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ echo "$ac_var='\''$ac_val'\''"
done | sort
echo
fi
## ----------- ##
_ASBOX
echo
- sed "/^$/d" confdefs.h | sort
+ cat confdefs.h
echo
fi
test "$ac_signal" != 0 &&
echo "$as_me: caught signal $ac_signal"
echo "$as_me: exit $exit_status"
} >&5
- rm -f core core.* *.core &&
- rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+ rm -f core *.core core.conftest.* &&
+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
exit $exit_status
- ' 0
+' 0
for ac_signal in 1 2 13 15; do
trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
done
ac_signal=0
# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo >confdefs.h
+rm -f -r conftest* confdefs.h
# Predefined preprocessor variables.
# Let the site file select an alternate cache file if it wants to.
# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
+if test -n "$CONFIG_SITE"; then
+ set x "$CONFIG_SITE"
+elif test "x$prefix" != xNONE; then
+ set x "$prefix/share/config.site" "$prefix/etc/config.site"
+else
+ set x "$ac_default_prefix/share/config.site" \
+ "$ac_default_prefix/etc/config.site"
fi
-for ac_site_file in $CONFIG_SITE; do
+shift
+for ac_site_file
+do
if test -r "$ac_site_file"; then
{ echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
echo "$as_me: loading site script $ac_site_file" >&6;}
{ echo "$as_me:$LINENO: loading cache $cache_file" >&5
echo "$as_me: loading cache $cache_file" >&6;}
case $cache_file in
- [\\/]* | ?:[\\/]* ) . $cache_file;;
- *) . ./$cache_file;;
+ [\\/]* | ?:[\\/]* ) . "$cache_file";;
+ *) . "./$cache_file";;
esac
fi
else
# Check that the precious variables saved in the cache have kept the same
# value.
ac_cache_corrupted=false
-for ac_var in `(set) 2>&1 |
- sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+for ac_var in $ac_precious_vars; do
eval ac_old_set=\$ac_cv_env_${ac_var}_set
eval ac_new_set=\$ac_env_${ac_var}_set
- eval ac_old_val="\$ac_cv_env_${ac_var}_value"
- eval ac_new_val="\$ac_env_${ac_var}_value"
+ eval ac_old_val=\$ac_cv_env_${ac_var}_value
+ eval ac_new_val=\$ac_env_${ac_var}_value
case $ac_old_set,$ac_new_set in
set,)
{ echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
,);;
*)
if test "x$ac_old_val" != "x$ac_new_val"; then
- { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+ { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
- { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
+ { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
echo "$as_me: former value: $ac_old_val" >&2;}
- { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
+ { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
echo "$as_me: current value: $ac_new_val" >&2;}
- ac_cache_corrupted=:
+ ac_cache_corrupted=:
fi;;
esac
# Pass precious variables to config.status.
if test "$ac_new_set" = set; then
case $ac_new_val in
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
- ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
*) ac_arg=$ac_var=$ac_new_val ;;
esac
case " $ac_configure_args " in
{ (exit 1); exit 1; }; }
fi
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
- ac_config_headers="$ac_config_headers auto-host.h:config.in"
+ac_config_headers="$ac_config_headers auto-host.h:config.in"
remove=rm
# With GNU ld
-# Check whether --with-gnu-ld or --without-gnu-ld was given.
+# Check whether --with-gnu-ld was given.
if test "${with_gnu_ld+set}" = set; then
- withval="$with_gnu_ld"
- gnu_ld_flag="$with_gnu_ld"
+ withval=$with_gnu_ld; gnu_ld_flag="$with_gnu_ld"
else
gnu_ld_flag=no
-fi;
+fi
+
# With pre-defined ld
-# Check whether --with-ld or --without-ld was given.
+# Check whether --with-ld was given.
if test "${with_ld+set}" = set; then
- withval="$with_ld"
- DEFAULT_LINKER="$with_ld"
-fi;
+ withval=$with_ld; DEFAULT_LINKER="$with_ld"
+fi
+
if test x"${DEFAULT_LINKER+set}" = x"set"; then
if test ! -x "$DEFAULT_LINKER"; then
{ echo "$as_me:$LINENO: WARNING: cannot execute: $DEFAULT_LINKER: check --with-ld or env. var. DEFAULT_LINKER" >&5
# With GNU as
-# Check whether --with-gnu-as or --without-gnu-as was given.
+# Check whether --with-gnu-as was given.
if test "${with_gnu_as+set}" = set; then
- withval="$with_gnu_as"
- gas_flag="$with_gnu_as"
+ withval=$with_gnu_as; gas_flag="$with_gnu_as"
else
gas_flag=no
-fi;
+fi
+
-# Check whether --with-as or --without-as was given.
+# Check whether --with-as was given.
if test "${with_as+set}" = set; then
- withval="$with_as"
- DEFAULT_ASSEMBLER="$with_as"
-fi;
+ withval=$with_as; DEFAULT_ASSEMBLER="$with_as"
+fi
+
if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then
if test ! -x "$DEFAULT_ASSEMBLER"; then
{ echo "$as_me:$LINENO: WARNING: cannot execute: $DEFAULT_ASSEMBLER: check --with-as or env. var. DEFAULT_ASSEMBLER" >&5
# With stabs
-# Check whether --with-stabs or --without-stabs was given.
+# Check whether --with-stabs was given.
if test "${with_stabs+set}" = set; then
- withval="$with_stabs"
- stabs="$with_stabs"
+ withval=$with_stabs; stabs="$with_stabs"
else
stabs=no
-fi;
+fi
+
# With ELF
-# Check whether --with-elf or --without-elf was given.
+# Check whether --with-elf was given.
if test "${with_elf+set}" = set; then
- withval="$with_elf"
- elf="$with_elf"
+ withval=$with_elf; elf="$with_elf"
else
elf=no
-fi;
+fi
+
# Specify the local prefix
local_prefix=
-# Check whether --with-local-prefix or --without-local-prefix was given.
+# Check whether --with-local-prefix was given.
if test "${with_local_prefix+set}" = set; then
- withval="$with_local_prefix"
- case "${withval}" in
+ withval=$with_local_prefix; case "${withval}" in
yes) { { echo "$as_me:$LINENO: error: bad value ${withval} given for local include directory prefix" >&5
echo "$as_me: error: bad value ${withval} given for local include directory prefix" >&2;}
{ (exit 1); exit 1; }; } ;;
no) ;;
*) local_prefix=$with_local_prefix ;;
esac
-fi;
+fi
+
# Default local prefix if it is empty
if test x$local_prefix = x; then
fi
test "$program_prefix" != NONE &&
- program_transform_name="s,^,$program_prefix,;$program_transform_name"
+ program_transform_name="s&^&$program_prefix&;$program_transform_name"
# Use a double $ so make ignores it.
test "$program_suffix" != NONE &&
- program_transform_name="s,\$,$program_suffix,;$program_transform_name"
+ program_transform_name="s&\$&$program_suffix&;$program_transform_name"
# Double any \ or $. echo might interpret backslashes.
# By default was `s,x,x', remove it if useless.
cat <<\_ACEOF >conftest.sed
s/[\\$]/&&/g;s/;s,x,x,$//
_ACEOF
program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
-rm conftest.sed
+rm -f conftest.sed
# Enable Multibyte Characters for C/C++
-# Check whether --enable-c-mbchar or --disable-c-mbchar was given.
+# Check whether --enable-c-mbchar was given.
if test "${enable_c_mbchar+set}" = set; then
- enableval="$enable_c_mbchar"
- if test x$enable_c_mbchar != xno; then
+ enableval=$enable_c_mbchar; if test x$enable_c_mbchar != xno; then
cat >>confdefs.h <<\_ACEOF
#define MULTIBYTE_CHARS 1
_ACEOF
fi
-fi;
+fi
+
# Find the native compiler
ac_ext=c
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
+IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
+
fi
if test -z "$ac_cv_prog_CC"; then
ac_ct_CC=$CC
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_ac_ct_CC="gcc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
+IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
- echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
+ { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
- CC=$ac_ct_CC
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
else
CC="$ac_cv_prog_CC"
fi
if test -z "$CC"; then
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
set dummy ${ac_tool_prefix}cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
+IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$ac_cv_prog_CC"; then
- ac_ct_CC=$CC
- # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$ac_ct_CC"; then
- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_CC="cc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
- echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
- CC=$ac_ct_CC
-else
- CC="$ac_cv_prog_CC"
-fi
+ fi
fi
if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
fi
done
done
+IFS=$as_save_IFS
if test $ac_prog_rejected = yes; then
# We found a bogon in the path, so make sure we never use it.
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
+
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
- for ac_prog in cl
+ for ac_prog in cl.exe
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
+IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
+
test -n "$CC" && break
done
fi
if test -z "$CC"; then
ac_ct_CC=$CC
- for ac_prog in cl
+ for ac_prog in cl.exe
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_ac_ct_CC="$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
+IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
- echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
+ { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
+
test -n "$ac_ct_CC" && break
done
- CC=$ac_ct_CC
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
fi
fi
-test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH" >&5
-echo "$as_me: error: no acceptable C compiler found in \$PATH" >&2;}
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
# Provide some information about the compiler.
-echo "$as_me:$LINENO:" \
- "checking for C compiler version" >&5
+echo "$as_me:$LINENO: checking for C compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
- (eval $ac_compiler --version </dev/null >&5) 2>&5
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler --version >&5") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
- (eval $ac_compiler -v </dev/null >&5) 2>&5
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler -v >&5") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
- (eval $ac_compiler -V </dev/null >&5) 2>&5
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler -V >&5") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
int
main ()
}
_ACEOF
ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.exe"
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
# Try to create an executable without -o first, disregard a.out.
# It will help us diagnose broken compilers, and finding out an intuition
# of exeext.
-echo "$as_me:$LINENO: checking for C compiler default output" >&5
-echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; }
ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
- (eval $ac_link_default) 2>&5
+#
+# List of possible output files, starting from the most likely.
+# The algorithm is not robust to junk in `.', hence go to wildcards (a.*)
+# only as a last resort. b.out is created by i960 compilers.
+ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out'
+#
+# The IRIX 6 linker writes into existing files which may not be
+# executable, retaining their permissions. Remove them first so a
+# subsequent execution test works.
+ac_rmfiles=
+for ac_file in $ac_files
+do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+ esac
+done
+rm -f $ac_rmfiles
+
+if { (ac_try="$ac_link_default"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link_default") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
- # Find the output, starting from the most likely. This scheme is
-# not robust to junk in `.', hence go to wildcards (a.*) only as a last
-# resort.
-
-# Be careful to initialize this variable, since it used to be cached.
-# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
-ac_cv_exeext=
-for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.*; do
+ # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile. We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files
+do
test -f "$ac_file" || continue
case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
- a.out ) # We found the default executable, but exeext='' is most
- # certainly right.
- break;;
- *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- # FIXME: I believe we export ac_cv_exeext for Libtool --akim.
- export ac_cv_exeext
- break;;
- * ) break;;
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj )
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+ then :; else
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ fi
+ # We set ac_cv_exeext here because the later test for it is not
+ # safe: cross compilers may not add the suffix if given an `-o'
+ # argument, so we may need to know it at that point already.
+ # Even if this section looks crufty: it has the advantage of
+ # actually working.
+ break;;
+ * )
+ break;;
esac
done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
-check \`config.log' for details." >&5
+See \`config.log' for more details." >&5
echo "$as_me: error: C compiler cannot create executables
-check \`config.log' for details." >&2;}
+See \`config.log' for more details." >&2;}
{ (exit 77); exit 77; }; }
fi
ac_exeext=$ac_cv_exeext
-echo "$as_me:$LINENO: result: $ac_file" >&5
-echo "${ECHO_T}$ac_file" >&6
+{ echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6; }
-# Check the compiler produces executables we can run. If not, either
+# Check that the compiler produces executables we can run. If not, either
# the compiler is broken, or we cross compile.
-echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; }
# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
# If not cross compiling, check that we can run a simple program.
if test "$cross_compiling" != yes; then
if { ac_try='./$ac_file'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
cross_compiling=yes
else
{ { echo "$as_me:$LINENO: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'." >&5
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
echo "$as_me: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'." >&2;}
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
fi
fi
fi
-echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
-rm -f a.out a.exe conftest$ac_cv_exeext
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
ac_clean_files=$ac_clean_files_save
-# Check the compiler produces executables we can run. If not, either
+# Check that the compiler produces executables we can run. If not, either
# the compiler is broken, or we cross compile.
-echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
-echo "$as_me:$LINENO: result: $cross_compiling" >&5
-echo "${ECHO_T}$cross_compiling" >&6
-
-echo "$as_me:$LINENO: checking for suffix of executables" >&5
-echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6; }
+
+{ echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; }
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
for ac_file in conftest.exe conftest conftest.*; do
test -f "$ac_file" || continue
case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
*.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- export ac_cv_exeext
- break;;
+ break;;
* ) break;;
esac
done
else
- { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link" >&5
-echo "$as_me: error: cannot compute suffix of executables: cannot compile and link" >&2;}
+ { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
fi
rm -f conftest$ac_cv_exeext
-echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
-echo "${ECHO_T}$ac_cv_exeext" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6; }
rm -f conftest.$ac_ext
EXEEXT=$ac_cv_exeext
ac_exeext=$EXEEXT
-echo "$as_me:$LINENO: checking for suffix of object files" >&5
-echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; }
if test "${ac_cv_objext+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
int
main ()
}
_ACEOF
rm -f conftest.o conftest.obj
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
- for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+ for ac_file in conftest.o conftest.obj conftest.*; do
+ test -f "$ac_file" || continue;
case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;;
*) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
break;;
esac
done
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile" >&5
-echo "$as_me: error: cannot compute suffix of object files: cannot compile" >&2;}
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
fi
rm -f conftest.$ac_cv_objext conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
-echo "${ECHO_T}$ac_cv_objext" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6; }
OBJEXT=$ac_cv_objext
ac_objext=$OBJEXT
-echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
if test "${ac_cv_c_compiler_gnu+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
int
main ()
}
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_compiler_gnu=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-ac_compiler_gnu=no
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_compiler_gnu=no
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_c_compiler_gnu=$ac_compiler_gnu
fi
-echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
GCC=`test $ac_compiler_gnu = yes && echo yes`
ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
-CFLAGS="-g"
-echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
-echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
if test "${ac_cv_prog_cc_g+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
int
main ()
}
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ CFLAGS=""
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_prog_cc_g=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-ac_cv_prog_cc_g=no
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag
fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
if test "$ac_test_CFLAGS" = set; then
CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
CFLAGS=
fi
fi
-echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
-echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
-if test "${ac_cv_prog_cc_stdc+set}" = set; then
+{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_cv_prog_cc_stdc=no
+ ac_cv_prog_cc_c89=no
ac_save_CC=$CC
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <stdarg.h>
#include <stdio.h>
#include <sys/types.h>
va_end (v);
return s;
}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
int test (int i, double x);
struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};
return 0;
}
_ACEOF
-# Don't try gcc -ansi; that turns off useful extensions and
-# breaks some systems' header files.
-# AIX -qlanglvl=ansi
-# Ultrix and OSF/1 -std1
-# HP-UX 10.20 and later -Ae
-# HP-UX older versions -Aa -D_HPUX_SOURCE
-# SVR4 -Xc -D__EXTENSIONS__
-for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_cv_prog_cc_stdc=$ac_arg
-break
+ ac_cv_prog_cc_c89=$ac_arg
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
fi
-rm -f conftest.$ac_objext
+
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
done
-rm -f conftest.$ac_ext conftest.$ac_objext
+rm -f conftest.$ac_ext
CC=$ac_save_CC
fi
-
-case "x$ac_cv_prog_cc_stdc" in
- x|xno)
- echo "$as_me:$LINENO: result: none needed" >&5
-echo "${ECHO_T}none needed" >&6 ;;
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6; } ;;
+ xno)
+ { echo "$as_me:$LINENO: result: unsupported" >&5
+echo "${ECHO_T}unsupported" >&6; } ;;
*)
- echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
- CC="$CC $ac_cv_prog_cc_stdc" ;;
+ CC="$CC $ac_cv_prog_cc_c89"
+ { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
esac
-# Some people use a C++ compiler to compile C. Since we use `exit',
-# in C++ we need to declare it. In case someone uses the same compiler
-# for both compiling C and C++ we need to have the C++ compiler decide
-# the declaration of exit, since it's the most demanding environment.
-cat >conftest.$ac_ext <<_ACEOF
-#ifndef __cplusplus
- choke me
-#endif
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+if test "x$CC" != xcc; then
+ { echo "$as_me:$LINENO: checking whether $CC and cc understand -c and -o together" >&5
+echo $ECHO_N "checking whether $CC and cc understand -c and -o together... $ECHO_C" >&6; }
+else
+ { echo "$as_me:$LINENO: checking whether cc understands -c and -o together" >&5
+echo $ECHO_N "checking whether cc understands -c and -o together... $ECHO_C" >&6; }
+fi
+set dummy $CC; ac_cc=`echo $2 |
+ sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
+if { as_var=ac_cv_prog_cc_${ac_cc}_c_o; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- for ac_declaration in \
- ''\
- '#include <stdlib.h>' \
- 'extern "C" void std::exit (int) throw (); using std::exit;' \
- 'extern "C" void std::exit (int); using std::exit;' \
- 'extern "C" void exit (int) throw ();' \
- 'extern "C" void exit (int);' \
- 'void exit (int);'
-do
- cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-$ac_declaration
-int
-main ()
-{
-exit (42);
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- :
-else
- echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-continue
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
- cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
-$ac_declaration
-int
-main ()
-{
-exit (42);
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- break
-else
- echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-done
-rm -f conftest*
-if test -n "$ac_declaration"; then
- echo '#ifdef __cplusplus' >>confdefs.h
- echo $ac_declaration >>confdefs.h
- echo '#endif' >>confdefs.h
-fi
-
-else
- echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-if test "x$CC" != xcc; then
- echo "$as_me:$LINENO: checking whether $CC and cc understand -c and -o together" >&5
-echo $ECHO_N "checking whether $CC and cc understand -c and -o together... $ECHO_C" >&6
-else
- echo "$as_me:$LINENO: checking whether cc understands -c and -o together" >&5
-echo $ECHO_N "checking whether cc understands -c and -o together... $ECHO_C" >&6
-fi
-set dummy $CC; ac_cc=`echo $2 |
- sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
-if eval "test \"\${ac_cv_prog_cc_${ac_cc}_c_o+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
int
main ()
# Make sure it works both with $CC and with simple cc.
# We do the test twice because some compilers refuse to overwrite an
# existing .o file with -o, though they will create one.
-ac_try='$CC -c conftest.$ac_ext -o conftest.$ac_objext >&5'
-if { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
+rm -f conftest2.*
+if { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- test -f conftest.$ac_objext && { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ test -f conftest2.$ac_objext && { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); };
if test "x$CC" != xcc; then
# Test first that cc exists at all.
if { ac_try='cc -c conftest.$ac_ext >&5'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_try='cc -c conftest.$ac_ext -o conftest.$ac_objext >&5'
- if { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
+ rm -f conftest2.*
+ if { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- test -f conftest.$ac_objext && { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ test -f conftest2.$ac_objext && { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); };
then
- # cc works too.
- :
+ # cc works too.
+ :
else
- # cc exists but doesn't like -o.
- eval ac_cv_prog_cc_${ac_cc}_c_o=no
+ # cc exists but doesn't like -o.
+ eval ac_cv_prog_cc_${ac_cc}_c_o=no
fi
fi
fi
else
eval ac_cv_prog_cc_${ac_cc}_c_o=no
fi
-rm -f conftest*
+rm -f core conftest*
fi
-if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = yes"; then
- echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
cat >>confdefs.h <<\_ACEOF
#define NO_MINUS_C_MINUS_O 1
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
-echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
-echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; }
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
do
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
-#include <assert.h>
- Syntax error
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
:
else
echo "$as_me: failed program was:" >&5
- cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
# Broken: fails on valid input.
continue
fi
+
rm -f conftest.err conftest.$ac_ext
- # OK, works on sane cases. Now check whether non-existent headers
+ # OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <ac_nonexistent.h>
_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
continue
else
echo "$as_me: failed program was:" >&5
- cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
# Passes both tests.
ac_preproc_ok=:
break
fi
+
rm -f conftest.err conftest.$ac_ext
done
else
ac_cv_prog_CPP=$CPP
fi
-echo "$as_me:$LINENO: result: $CPP" >&5
-echo "${ECHO_T}$CPP" >&6
+{ echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6; }
ac_preproc_ok=false
for ac_c_preproc_warn_flag in '' yes
do
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
-#include <assert.h>
- Syntax error
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
:
else
echo "$as_me: failed program was:" >&5
- cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
# Broken: fails on valid input.
continue
fi
+
rm -f conftest.err conftest.$ac_ext
- # OK, works on sane cases. Now check whether non-existent headers
+ # OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <ac_nonexistent.h>
_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
continue
else
echo "$as_me: failed program was:" >&5
- cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
# Passes both tests.
ac_preproc_ok=:
break
fi
+
rm -f conftest.err conftest.$ac_ext
done
if $ac_preproc_ok; then
:
else
- { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check" >&5
-echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;}
+ { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
fi
ac_compiler_gnu=$ac_cv_c_compiler_gnu
-echo "$as_me:$LINENO: checking for inline" >&5
-echo $ECHO_N "checking for inline... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for inline" >&5
+echo $ECHO_N "checking for inline... $ECHO_C" >&6; }
if test "${ac_cv_c_inline+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#ifndef __cplusplus
typedef int foo_t;
static $ac_kw foo_t static_foo () {return 0; }
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_cv_c_inline=$ac_kw; break
+ ac_cv_c_inline=$ac_kw
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ test "$ac_cv_c_inline" != no && break
done
fi
-echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
-echo "${ECHO_T}$ac_cv_c_inline" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
+echo "${ECHO_T}$ac_cv_c_inline" >&6; }
+
+
case $ac_cv_c_inline in
inline | yes) ;;
- no)
-cat >>confdefs.h <<\_ACEOF
-#define inline
+ *)
+ case $ac_cv_c_inline in
+ no) ac_val=;;
+ *) ac_val=$ac_cv_c_inline;;
+ esac
+ cat >>confdefs.h <<_ACEOF
+#ifndef __cplusplus
+#define inline $ac_val
+#endif
_ACEOF
- ;;
- *) cat >>confdefs.h <<_ACEOF
-#define inline $ac_cv_c_inline
+ ;;
+esac
+
+
+{ echo "$as_me:$LINENO: checking for built-in _Bool" >&5
+echo $ECHO_N "checking for built-in _Bool... $ECHO_C" >&6; }
+if test "${gcc_cv_c__bool+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
_ACEOF
- ;;
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+_Bool foo;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ gcc_cv_c__bool=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ gcc_cv_c__bool=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ echo "$as_me:$LINENO: result: $gcc_cv_c__bool" >&5
+echo "${ECHO_T}$gcc_cv_c__bool" >&6; }
+if test $gcc_cv_c__bool = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE__BOOL 1
+_ACEOF
+
+fi
# sizeof(char) is 1 by definition.
-echo "$as_me:$LINENO: checking size of short" >&5
-echo $ECHO_N "checking size of short... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking size of short" >&5
+echo $ECHO_N "checking size of short... $ECHO_C" >&6; }
if test "${ac_cv_sizeof_short+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
for ac_size in 4 8 1 2 16 ; do # List sizes in rough order of prevalence.
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include "confdefs.h"
#include <sys/types.h>
}
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_sizeof_short=$ac_size
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test x$ac_cv_sizeof_short != x ; then break; fi
done
echo "$as_me: error: cannot determine a size for short" >&2;}
{ (exit 1); exit 1; }; }
fi
-echo "$as_me:$LINENO: result: $ac_cv_sizeof_short" >&5
-echo "${ECHO_T}$ac_cv_sizeof_short" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_short" >&5
+echo "${ECHO_T}$ac_cv_sizeof_short" >&6; }
cat >>confdefs.h <<_ACEOF
#define SIZEOF_SHORT $ac_cv_sizeof_short
_ACEOF
-echo "$as_me:$LINENO: checking size of int" >&5
-echo $ECHO_N "checking size of int... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking size of int" >&5
+echo $ECHO_N "checking size of int... $ECHO_C" >&6; }
if test "${ac_cv_sizeof_int+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
for ac_size in 4 8 1 2 16 ; do # List sizes in rough order of prevalence.
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include "confdefs.h"
#include <sys/types.h>
}
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_sizeof_int=$ac_size
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test x$ac_cv_sizeof_int != x ; then break; fi
done
echo "$as_me: error: cannot determine a size for int" >&2;}
{ (exit 1); exit 1; }; }
fi
-echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5
-echo "${ECHO_T}$ac_cv_sizeof_int" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5
+echo "${ECHO_T}$ac_cv_sizeof_int" >&6; }
cat >>confdefs.h <<_ACEOF
#define SIZEOF_INT $ac_cv_sizeof_int
_ACEOF
-echo "$as_me:$LINENO: checking size of long" >&5
-echo $ECHO_N "checking size of long... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking size of long" >&5
+echo $ECHO_N "checking size of long... $ECHO_C" >&6; }
if test "${ac_cv_sizeof_long+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
for ac_size in 4 8 1 2 16 ; do # List sizes in rough order of prevalence.
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include "confdefs.h"
#include <sys/types.h>
}
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_sizeof_long=$ac_size
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test x$ac_cv_sizeof_long != x ; then break; fi
done
echo "$as_me: error: cannot determine a size for long" >&2;}
{ (exit 1); exit 1; }; }
fi
-echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5
-echo "${ECHO_T}$ac_cv_sizeof_long" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5
+echo "${ECHO_T}$ac_cv_sizeof_long" >&6; }
cat >>confdefs.h <<_ACEOF
#define SIZEOF_LONG $ac_cv_sizeof_long
-echo "$as_me:$LINENO: checking for egrep" >&5
-echo $ECHO_N "checking for egrep... $ECHO_C" >&6
-if test "${ac_cv_prog_egrep+set}" = set; then
+{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
+echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; }
+if test "${ac_cv_path_GREP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Extract the first word of "grep ggrep" to use in msg output
+if test -z "$GREP"; then
+set dummy grep ggrep; ac_prog_name=$2
+if test "${ac_cv_path_GREP+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if echo a | (grep -E '(a|b)') >/dev/null 2>&1
- then ac_cv_prog_egrep='grep -E'
- else ac_cv_prog_egrep='egrep'
+ ac_path_GREP_found=false
+# Loop through the user's path and test for each of PROGNAME-LIST
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in grep ggrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_GREP" && $as_executable_p "$ac_path_GREP"; } || continue
+ # Check for GNU ac_path_GREP and select it if it is found.
+ # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+ ac_count=0
+ echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ echo 'GREP' >> "conftest.nl"
+ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ ac_count=`expr $ac_count + 1`
+ if test $ac_count -gt ${ac_path_GREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_GREP="$ac_path_GREP"
+ ac_path_GREP_max=$ac_count
fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+
+ $ac_path_GREP_found && break 3
+ done
+done
+
+done
+IFS=$as_save_IFS
+
+
fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
-echo "${ECHO_T}$ac_cv_prog_egrep" >&6
- EGREP=$ac_cv_prog_egrep
+GREP="$ac_cv_path_GREP"
+if test -z "$GREP"; then
+ { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+ { (exit 1); exit 1; }; }
+fi
-echo "$as_me:$LINENO: checking execution character set" >&5
-echo $ECHO_N "checking execution character set... $ECHO_C" >&6
-if test "${ac_cv_c_charset+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
-#if '\n' == 0x0A && ' ' == 0x20 && '0' == 0x30 \
- && 'A' == 0x41 && 'a' == 0x61 && '!' == 0x21
-ASCII
-#endif
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "ASCII" >/dev/null 2>&1; then
- ac_cv_c_charset=ASCII
+ ac_cv_path_GREP=$GREP
fi
-rm -f conftest*
- if test x${ac_cv_c_charset+set} != xset; then
- cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
-#if '\n' == 0x15 && ' ' == 0x40 && '0' == 0xF0 \
- && 'A' == 0xC1 && 'a' == 0x81 && '!' == 0x5A
-EBCDIC
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
+echo "${ECHO_T}$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6; }
+if test "${ac_cv_path_EGREP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+ then ac_cv_path_EGREP="$GREP -E"
+ else
+ # Extract the first word of "egrep" to use in msg output
+if test -z "$EGREP"; then
+set dummy egrep; ac_prog_name=$2
+if test "${ac_cv_path_EGREP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_path_EGREP_found=false
+# Loop through the user's path and test for each of PROGNAME-LIST
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in egrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_EGREP" && $as_executable_p "$ac_path_EGREP"; } || continue
+ # Check for GNU ac_path_EGREP and select it if it is found.
+ # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+ ac_count=0
+ echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ echo 'EGREP' >> "conftest.nl"
+ "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ ac_count=`expr $ac_count + 1`
+ if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_EGREP="$ac_path_EGREP"
+ ac_path_EGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+
+ $ac_path_EGREP_found && break 3
+ done
+done
+
+done
+IFS=$as_save_IFS
+
+
+fi
+
+EGREP="$ac_cv_path_EGREP"
+if test -z "$EGREP"; then
+ { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+else
+ ac_cv_path_EGREP=$EGREP
+fi
+
+
+ fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
+echo "${ECHO_T}$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ echo "$as_me:$LINENO: checking execution character set" >&5
+echo $ECHO_N "checking execution character set... $ECHO_C" >&6; }
+if test "${ac_cv_c_charset+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#if '\n' == 0x0A && ' ' == 0x20 && '0' == 0x30 \
+ && 'A' == 0x41 && 'a' == 0x61 && '!' == 0x21
+ASCII
+#endif
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "ASCII" >/dev/null 2>&1; then
+ ac_cv_c_charset=ASCII
+fi
+rm -f conftest*
+
+ if test x${ac_cv_c_charset+set} != xset; then
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#if '\n' == 0x15 && ' ' == 0x40 && '0' == 0xF0 \
+ && 'A' == 0xC1 && 'a' == 0x81 && '!' == 0x5A
+EBCDIC
#endif
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
ac_cv_c_charset=unknown
fi
fi
-echo "$as_me:$LINENO: result: $ac_cv_c_charset" >&5
-echo "${ECHO_T}$ac_cv_c_charset" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_c_charset" >&5
+echo "${ECHO_T}$ac_cv_c_charset" >&6; }
if test $ac_cv_c_charset = unknown; then
{ { echo "$as_me:$LINENO: error: *** Cannot determine host character set." >&5
echo "$as_me: error: *** Cannot determine host character set." >&2;}
fi
-echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \${MAKE}" >&5
-echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6
-set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'`
-if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; }
+set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
all:
- @echo 'ac_maketemp="${MAKE}"'
+ @echo '@@@%%%=$(MAKE)=@@@%%%'
_ACEOF
# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
-if test -n "$ac_maketemp"; then
- eval ac_cv_prog_make_${ac_make}_set=yes
-else
- eval ac_cv_prog_make_${ac_make}_set=no
-fi
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+ *@@@%%%=?*=@@@%%%*)
+ eval ac_cv_prog_make_${ac_make}_set=yes;;
+ *)
+ eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
rm -f conftest.make
fi
-if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
- echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
SET_MAKE=
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
SET_MAKE="MAKE=${MAKE-make}"
fi
-echo "$as_me:$LINENO: checking whether a default assembler was specified" >&5
-echo $ECHO_N "checking whether a default assembler was specified... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether a default assembler was specified" >&5
+echo $ECHO_N "checking whether a default assembler was specified... $ECHO_C" >&6; }
if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then
if test x"$gas_flag" = x"no"; then
- echo "$as_me:$LINENO: result: yes ($DEFAULT_ASSEMBLER)" >&5
-echo "${ECHO_T}yes ($DEFAULT_ASSEMBLER)" >&6
+ { echo "$as_me:$LINENO: result: yes ($DEFAULT_ASSEMBLER)" >&5
+echo "${ECHO_T}yes ($DEFAULT_ASSEMBLER)" >&6; }
else
- echo "$as_me:$LINENO: result: yes ($DEFAULT_ASSEMBLER - GNU as)" >&5
-echo "${ECHO_T}yes ($DEFAULT_ASSEMBLER - GNU as)" >&6
+ { echo "$as_me:$LINENO: result: yes ($DEFAULT_ASSEMBLER - GNU as)" >&5
+echo "${ECHO_T}yes ($DEFAULT_ASSEMBLER - GNU as)" >&6; }
fi
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
-echo "$as_me:$LINENO: checking whether a default linker was specified" >&5
-echo $ECHO_N "checking whether a default linker was specified... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether a default linker was specified" >&5
+echo $ECHO_N "checking whether a default linker was specified... $ECHO_C" >&6; }
if test x"${DEFAULT_LINKER+set}" = x"set"; then
if test x"$gnu_ld_flag" = x"no"; then
- echo "$as_me:$LINENO: result: yes ($DEFAULT_LINKER)" >&5
-echo "${ECHO_T}yes ($DEFAULT_LINKER)" >&6
+ { echo "$as_me:$LINENO: result: yes ($DEFAULT_LINKER)" >&5
+echo "${ECHO_T}yes ($DEFAULT_LINKER)" >&6; }
else
- echo "$as_me:$LINENO: result: yes ($DEFAULT_LINKER - GNU ld)" >&5
-echo "${ECHO_T}yes ($DEFAULT_LINKER - GNU ld)" >&6
+ { echo "$as_me:$LINENO: result: yes ($DEFAULT_LINKER - GNU ld)" >&5
+echo "${ECHO_T}yes ($DEFAULT_LINKER - GNU ld)" >&6; }
fi
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
# Find some useful tools
-echo "$as_me:$LINENO: checking whether ln works" >&5
-echo $ECHO_N "checking whether ln works... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether ln works" >&5
+echo $ECHO_N "checking whether ln works... $ECHO_C" >&6; }
if test "${gcc_cv_prog_LN+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
fi
LN="$gcc_cv_prog_LN"
if test "$gcc_cv_prog_LN" = "ln"; then
- echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
else
if test "$gcc_cv_prog_LN" = "ln -s"; then
- echo "$as_me:$LINENO: result: no, using ln -s" >&5
-echo "${ECHO_T}no, using ln -s" >&6
+ { echo "$as_me:$LINENO: result: no, using ln -s" >&5
+echo "${ECHO_T}no, using ln -s" >&6; }
else
- echo "$as_me:$LINENO: result: no, and neither does ln -s, so using cp" >&5
-echo "${ECHO_T}no, and neither does ln -s, so using cp" >&6
+ { echo "$as_me:$LINENO: result: no, and neither does ln -s, so using cp" >&5
+echo "${ECHO_T}no, and neither does ln -s, so using cp" >&6; }
fi
fi
-echo "$as_me:$LINENO: checking whether ln -s works" >&5
-echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether ln -s works" >&5
+echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; }
if test "${gcc_cv_prog_LN_S+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
fi
LN_S="$gcc_cv_prog_LN_S"
if test "$gcc_cv_prog_LN_S" = "ln -s"; then
- echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
else
if test "$gcc_cv_prog_LN_S" = "ln"; then
- echo "$as_me:$LINENO: result: no, using ln" >&5
-echo "${ECHO_T}no, using ln" >&6
+ { echo "$as_me:$LINENO: result: no, using ln" >&5
+echo "${ECHO_T}no, using ln" >&6; }
else
- echo "$as_me:$LINENO: result: no, and neither does ln, so using cp" >&5
-echo "${ECHO_T}no, and neither does ln, so using cp" >&6
+ { echo "$as_me:$LINENO: result: no, and neither does ln, so using cp" >&5
+echo "${ECHO_T}no, and neither does ln, so using cp" >&6; }
fi
fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_RANLIB+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
+IFS=$as_save_IFS
fi
fi
RANLIB=$ac_cv_prog_RANLIB
if test -n "$RANLIB"; then
- echo "$as_me:$LINENO: result: $RANLIB" >&5
-echo "${ECHO_T}$RANLIB" >&6
+ { echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
+
fi
if test -z "$ac_cv_prog_RANLIB"; then
ac_ct_RANLIB=$RANLIB
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_ac_ct_RANLIB="ranlib"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
+IFS=$as_save_IFS
- test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
fi
fi
ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
if test -n "$ac_ct_RANLIB"; then
- echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
-echo "${ECHO_T}$ac_ct_RANLIB" >&6
+ { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
- RANLIB=$ac_ct_RANLIB
+ if test "x$ac_ct_RANLIB" = x; then
+ RANLIB=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ RANLIB=$ac_ct_RANLIB
+ fi
else
RANLIB="$ac_cv_prog_RANLIB"
fi
ac_aux_dir=
-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
- if test -f $ac_dir/install-sh; then
+for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
+ if test -f "$ac_dir/install-sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install-sh -c"
break
- elif test -f $ac_dir/install.sh; then
+ elif test -f "$ac_dir/install.sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install.sh -c"
break
- elif test -f $ac_dir/shtool; then
+ elif test -f "$ac_dir/shtool"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/shtool install -c"
break
fi
done
if test -z "$ac_aux_dir"; then
- { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
-echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
+ { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5
+echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;}
{ (exit 1); exit 1; }; }
fi
-ac_config_guess="$SHELL $ac_aux_dir/config.guess"
-ac_config_sub="$SHELL $ac_aux_dir/config.sub"
-ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
# AFS /usr/afsws/bin/install, which mishandles nonexistent args
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
-echo "$as_me:$LINENO: checking for a BSD compatible install" >&5
-echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for a BSD compatible install" >&5
+echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6; }
if test -z "$INSTALL"; then
if test "${ac_cv_path_install+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
INSTALL="$ac_install_sh"
fi
fi
-echo "$as_me:$LINENO: result: $INSTALL" >&5
-echo "${ECHO_T}$INSTALL" >&6
+{ echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6; }
# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
# It thinks the first close brace ends the variable substitution.
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
if test "${ac_cv_header_stdc+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <float.h>
+int
+main ()
+{
+
+ ;
+ return 0;
+}
_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_header_stdc=yes
else
echo "$as_me: failed program was:" >&5
- cat conftest.$ac_ext >&5
- ac_cv_header_stdc=no
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_header_stdc=no
fi
-rm -f conftest.err conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <string.h>
_ACEOF
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <stdlib.h>
_ACEOF
:
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <ctype.h>
+#include <stdlib.h>
#if ((' ' & 0x0FF) == 0x020)
# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
#else
-# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \
- || ('j' <= (c) && (c) <= 'r') \
- || ('s' <= (c) && (c) <= 'z'))
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
#endif
int i;
for (i = 0; i < 256; i++)
if (XOR (islower (i), ISLOWER (i))
- || toupper (i) != TOUPPER (i))
- exit(2);
- exit (0);
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
}
_ACEOF
rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
else
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
( exit $ac_status )
ac_cv_header_stdc=no
fi
-rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
+
+
fi
fi
-echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-echo "${ECHO_T}$ac_cv_header_stdc" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
if test $ac_cv_header_stdc = yes; then
cat >>confdefs.h <<\_ACEOF
fi
-echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
-echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
+echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6; }
if test "${ac_cv_header_time+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/types.h>
#include <sys/time.h>
#include <time.h>
}
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_header_time=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-ac_cv_header_time=no
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_header_time=no
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
-echo "${ECHO_T}$ac_cv_header_time" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
+echo "${ECHO_T}$ac_cv_header_time" >&6; }
if test $ac_cv_header_time = yes; then
cat >>confdefs.h <<\_ACEOF
fi
-echo "$as_me:$LINENO: checking whether string.h and strings.h may both be included" >&5
-echo $ECHO_N "checking whether string.h and strings.h may both be included... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for working stdbool.h" >&5
+echo $ECHO_N "checking for working stdbool.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_stdbool_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdbool.h>
+int
+main ()
+{
+bool foo = false;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_header_stdbool_h=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_header_stdbool_h=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_stdbool_h" >&5
+echo "${ECHO_T}$ac_cv_header_stdbool_h" >&6; }
+if test $ac_cv_header_stdbool_h = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_STDBOOL_H 1
+_ACEOF
+
+fi
+
+{ echo "$as_me:$LINENO: checking whether string.h and strings.h may both be included" >&5
+echo $ECHO_N "checking whether string.h and strings.h may both be included... $ECHO_C" >&6; }
if test "${gcc_cv_header_string+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <string.h>
#include <strings.h>
int
}
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
gcc_cv_header_string=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-gcc_cv_header_string=no
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ gcc_cv_header_string=no
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $gcc_cv_header_string" >&5
-echo "${ECHO_T}$gcc_cv_header_string" >&6
+{ echo "$as_me:$LINENO: result: $gcc_cv_header_string" >&5
+echo "${ECHO_T}$gcc_cv_header_string" >&6; }
if test $gcc_cv_header_string = yes; then
cat >>confdefs.h <<\_ACEOF
fi
-echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5
-echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6; }
if test "${ac_cv_header_sys_wait_h+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/types.h>
#include <sys/wait.h>
#ifndef WEXITSTATUS
-# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
+# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8)
#endif
#ifndef WIFEXITED
# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
}
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_header_sys_wait_h=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-ac_cv_header_sys_wait_h=no
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_header_sys_wait_h=no
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5
-echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6; }
if test $ac_cv_header_sys_wait_h = yes; then
cat >>confdefs.h <<\_ACEOF
for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
- inttypes.h stdint.h unistd.h
+ inttypes.h stdint.h unistd.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
$ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
eval "$as_ac_Header=yes"
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-eval "$as_ac_Header=no"
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Header=no"
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
direct.h malloc.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
else
# Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
$ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-ac_header_compiler=no
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <$ac_header>
_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
- cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_header_preproc=no
fi
+
rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc in
- yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
{ echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};;
- no:yes )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
{ echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};;
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+
+ ;;
esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- eval "$as_ac_Header=$ac_header_preproc"
+ eval "$as_ac_Header=\$ac_header_preproc"
fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
fi
if test `eval echo '${'$as_ac_Header'}'` = yes; then
# Check for thread headers.
# These tests can't be done till we know if we have limits.h.
-echo "$as_me:$LINENO: checking for CHAR_BIT" >&5
-echo $ECHO_N "checking for CHAR_BIT... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for CHAR_BIT" >&5
+echo $ECHO_N "checking for CHAR_BIT... $ECHO_C" >&6; }
if test "${gcc_cv_decl_char_bit+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
fi
-echo "$as_me:$LINENO: result: $gcc_cv_decl_char_bit" >&5
-echo "${ECHO_T}$gcc_cv_decl_char_bit" >&6
+{ echo "$as_me:$LINENO: result: $gcc_cv_decl_char_bit" >&5
+echo "${ECHO_T}$gcc_cv_decl_char_bit" >&6; }
if test $gcc_cv_decl_char_bit = no; then
- echo "$as_me:$LINENO: checking number of bits in a byte" >&5
-echo $ECHO_N "checking number of bits in a byte... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking number of bits in a byte" >&5
+echo $ECHO_N "checking number of bits in a byte... $ECHO_C" >&6; }
if test "${gcc_cv_c_nbby+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
gcc_cv_c_nbby=
while test $i -lt 65; do
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
int
main ()
}
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
gcc_cv_c_nbby=$i; break
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
i=`expr $i + 1`
done
test -z "$gcc_cv_c_nbby" && gcc_cv_c_nbby=failed
fi
-echo "$as_me:$LINENO: result: $gcc_cv_c_nbby" >&5
-echo "${ECHO_T}$gcc_cv_c_nbby" >&6
+{ echo "$as_me:$LINENO: result: $gcc_cv_c_nbby" >&5
+echo "${ECHO_T}$gcc_cv_c_nbby" >&6; }
if test $gcc_cv_c_nbby = failed; then
{ { echo "$as_me:$LINENO: error: cannot determine number of bits in a byte" >&5
echo "$as_me: error: cannot determine number of bits in a byte" >&2;}
fi
fi
-echo "$as_me:$LINENO: checking byte ordering" >&5
-echo $ECHO_N "checking byte ordering... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking byte ordering" >&5
+echo $ECHO_N "checking byte ordering... $ECHO_C" >&6; }
if test "${ac_cv_c_compile_endian+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_cv_c_compile_endian=unknown
-
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
cat > conftest.$ac_ext <<EOF
-#line 3687 "configure"
+#line 5126 "configure"
#include "confdefs.h"
#ifdef HAVE_LIMITS_H
fi
-echo "$as_me:$LINENO: result: $ac_cv_c_compile_endian" >&5
-echo "${ECHO_T}$ac_cv_c_compile_endian" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_c_compile_endian" >&5
+echo "${ECHO_T}$ac_cv_c_compile_endian" >&6; }
if test $ac_cv_c_compile_endian = unknown; then
{ { echo "$as_me:$LINENO: error: *** unable to determine endianness" >&5
echo "$as_me: error: *** unable to determine endianness" >&2;}
# See if we have the mktemp command.
# Extract the first word of "mktemp", so it can be a program name with args.
set dummy mktemp; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_have_mktemp_command+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_have_mktemp_command="yes"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
+IFS=$as_save_IFS
test -z "$ac_cv_prog_have_mktemp_command" && ac_cv_prog_have_mktemp_command="no"
fi
fi
have_mktemp_command=$ac_cv_prog_have_mktemp_command
if test -n "$have_mktemp_command"; then
- echo "$as_me:$LINENO: result: $have_mktemp_command" >&5
-echo "${ECHO_T}$have_mktemp_command" >&6
+ { echo "$as_me:$LINENO: result: $have_mktemp_command" >&5
+echo "${ECHO_T}$have_mktemp_command" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
+
# Extract the first word of "strip", so it can be a program name with args.
set dummy strip; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_STRIP+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_STRIP="strip"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
+IFS=$as_save_IFS
test -z "$ac_cv_prog_STRIP" && ac_cv_prog_STRIP=":"
fi
fi
STRIP=$ac_cv_prog_STRIP
if test -n "$STRIP"; then
- echo "$as_me:$LINENO: result: $STRIP" >&5
-echo "${ECHO_T}$STRIP" >&6
+ { echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6; }
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
+
# See if the stage1 system preprocessor understands the ANSI C
# preprocessor stringification operator. (Used by symcat.h.)
-echo "$as_me:$LINENO: checking for preprocessor stringizing operator" >&5
-echo $ECHO_N "checking for preprocessor stringizing operator... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for preprocessor stringizing operator" >&5
+echo $ECHO_N "checking for preprocessor stringizing operator... $ECHO_C" >&6; }
if test "${ac_cv_c_stringize+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#define x(y) #y
char *s = x(teststring);
rm -f conftest*
fi
-echo "$as_me:$LINENO: result: $ac_cv_c_stringize" >&5
-echo "${ECHO_T}$ac_cv_c_stringize" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_c_stringize" >&5
+echo "${ECHO_T}$ac_cv_c_stringize" >&6; }
if test $ac_cv_c_stringize = yes; then
cat >>confdefs.h <<\_ACEOF
for ac_func in clock strchr strrchr lstat
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
char $ac_func ();
-char (*f) ();
-
-int
-main ()
-{
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+#if defined __stub_$ac_func || defined __stub___$ac_func
choke me
-#else
-f = $ac_func;
#endif
+int
+main ()
+{
+return $ac_func ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
eval "$as_ac_var=yes"
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-eval "$as_ac_var=no"
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+ac_res=`eval echo '${'$as_ac_var'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
if test `eval echo '${'$as_ac_var'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
done
-echo "$as_me:$LINENO: checking for ssize_t" >&5
-echo $ECHO_N "checking for ssize_t... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for ssize_t" >&5
+echo $ECHO_N "checking for ssize_t... $ECHO_C" >&6; }
if test "${ac_cv_type_ssize_t+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
$ac_includes_default
+typedef ssize_t ac__type_new_;
int
main ()
{
-if ((ssize_t *) 0)
+if ((ac__type_new_ *) 0)
return 0;
-if (sizeof (ssize_t))
+if (sizeof (ac__type_new_))
return 0;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_type_ssize_t=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-ac_cv_type_ssize_t=no
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_ssize_t=no
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $ac_cv_type_ssize_t" >&5
-echo "${ECHO_T}$ac_cv_type_ssize_t" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_type_ssize_t" >&5
+echo "${ECHO_T}$ac_cv_type_ssize_t" >&6; }
if test $ac_cv_type_ssize_t = yes; then
:
else
for ac_func in getpagesize
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
char $ac_func ();
-char (*f) ();
-
-int
-main ()
-{
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+#if defined __stub_$ac_func || defined __stub___$ac_func
choke me
-#else
-f = $ac_func;
#endif
+int
+main ()
+{
+return $ac_func ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
eval "$as_ac_var=yes"
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-eval "$as_ac_var=no"
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+ac_res=`eval echo '${'$as_ac_var'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
if test `eval echo '${'$as_ac_var'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
}
EOF
-echo "$as_me:$LINENO: checking for working mmap from /dev/zero" >&5
-echo $ECHO_N "checking for working mmap from /dev/zero... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for working mmap from /dev/zero" >&5
+echo $ECHO_N "checking for working mmap from /dev/zero... $ECHO_C" >&6; }
if test "${ac_cv_func_mmap_dev_zero+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
esac
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include "ct-mmap.inc"
_ACEOF
rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
else
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
( exit $ac_status )
if test $? -lt 4
then ac_cv_func_mmap_dev_zero=no
else ac_cv_func_mmap_dev_zero=buggy
fi
fi
-rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
+
+
fi
-echo "$as_me:$LINENO: result: $ac_cv_func_mmap_dev_zero" >&5
-echo "${ECHO_T}$ac_cv_func_mmap_dev_zero" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_func_mmap_dev_zero" >&5
+echo "${ECHO_T}$ac_cv_func_mmap_dev_zero" >&6; }
if test $ac_cv_func_mmap_dev_zero = yes; then
cat >>confdefs.h <<\_ACEOF
fi
-echo "$as_me:$LINENO: checking for working mmap with MAP_ANON(YMOUS)" >&5
-echo $ECHO_N "checking for working mmap with MAP_ANON(YMOUS)... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for working mmap with MAP_ANON(YMOUS)" >&5
+echo $ECHO_N "checking for working mmap with MAP_ANON(YMOUS)... $ECHO_C" >&6; }
if test "${ac_cv_func_mmap_anon+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_cv_func_mmap_anon=no
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#define USE_MAP_ANON
#include "ct-mmap.inc"
_ACEOF
rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
else
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
( exit $ac_status )
if test $? -lt 4
then ac_cv_func_mmap_anon=no
else ac_cv_func_mmap_anon=buggy
fi
fi
-rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
+
+
fi
-echo "$as_me:$LINENO: result: $ac_cv_func_mmap_anon" >&5
-echo "${ECHO_T}$ac_cv_func_mmap_anon" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_func_mmap_anon" >&5
+echo "${ECHO_T}$ac_cv_func_mmap_anon" >&6; }
if test $ac_cv_func_mmap_anon = yes; then
cat >>confdefs.h <<\_ACEOF
fi
rm -f ct-mmap.inc
-echo "$as_me:$LINENO: checking for working mmap of a file" >&5
-echo $ECHO_N "checking for working mmap of a file... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for working mmap of a file" >&5
+echo $ECHO_N "checking for working mmap of a file... $ECHO_C" >&6; }
if test "${ac_cv_func_mmap_file+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_cv_func_mmap_file=no
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
/* Test by Zack Weinberg. Modified from MMAP_ANYWHERE test by
Richard Henderson and Alexandre Oliva.
}
_ACEOF
rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
else
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
( exit $ac_status )
ac_cv_func_mmap_file=no
fi
-rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
+
+
fi
-echo "$as_me:$LINENO: result: $ac_cv_func_mmap_file" >&5
-echo "${ECHO_T}$ac_cv_func_mmap_file" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_func_mmap_file" >&5
+echo "${ECHO_T}$ac_cv_func_mmap_file" >&6; }
if test $ac_cv_func_mmap_file = yes; then
cat >>confdefs.h <<\_ACEOF
malloc realloc calloc free clock
do
ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-echo "$as_me:$LINENO: checking whether $ac_func is declared" >&5
-echo $ECHO_N "checking whether $ac_func is declared... $ECHO_C" >&6
-if eval "test \"\${gcc_cv_have_decl_$ac_func+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking whether $ac_func is declared" >&5
+echo $ECHO_N "checking whether $ac_func is declared... $ECHO_C" >&6; }
+if { as_var=gcc_cv_have_decl_$ac_func; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#undef $ac_tr_decl
#define $ac_tr_decl 1
}
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
eval "gcc_cv_have_decl_$ac_func=yes"
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-eval "gcc_cv_have_decl_$ac_func=no"
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "gcc_cv_have_decl_$ac_func=no"
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if eval "test \"`echo '$gcc_cv_have_decl_'$ac_func`\" = yes"; then
- echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6 ; cat >>confdefs.h <<_ACEOF
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; } ; cat >>confdefs.h <<_ACEOF
#define $ac_tr_decl 1
_ACEOF
else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6 ; cat >>confdefs.h <<_ACEOF
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; } ; cat >>confdefs.h <<_ACEOF
#define $ac_tr_decl 0
_ACEOF
CFLAGS="$saved_CFLAGS"
# mkdir takes a single argument on some systems.
-echo "$as_me:$LINENO: checking if mkdir takes one argument" >&5
-echo $ECHO_N "checking if mkdir takes one argument... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking if mkdir takes one argument" >&5
+echo $ECHO_N "checking if mkdir takes one argument... $ECHO_C" >&6; }
if test "${gcc_cv_mkdir_takes_one_arg+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/types.h>
#ifdef HAVE_SYS_STAT_H
}
_ACEOF
rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
gcc_cv_mkdir_takes_one_arg=no
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-gcc_cv_mkdir_takes_one_arg=yes
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ gcc_cv_mkdir_takes_one_arg=yes
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $gcc_cv_mkdir_takes_one_arg" >&5
-echo "${ECHO_T}$gcc_cv_mkdir_takes_one_arg" >&6
+{ echo "$as_me:$LINENO: result: $gcc_cv_mkdir_takes_one_arg" >&5
+echo "${ECHO_T}$gcc_cv_mkdir_takes_one_arg" >&6; }
if test $gcc_cv_mkdir_takes_one_arg = yes ; then
cat >>confdefs.h <<\_ACEOF
out_object_file=`basename $out_file .c`.o
# Figure out what assembler we will be using.
-echo "$as_me:$LINENO: checking what assembler to use" >&5
-echo $ECHO_N "checking what assembler to use... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking what assembler to use" >&5
+echo $ECHO_N "checking what assembler to use... $ECHO_C" >&6; }
gcc_cv_as=
gcc_cv_gas_major_version=
gcc_cv_gas_minor_version=
done
fi
if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
- echo "$as_me:$LINENO: result: \"newly built gas\"" >&5
-echo "${ECHO_T}\"newly built gas\"" >&6
+ { echo "$as_me:$LINENO: result: \"newly built gas\"" >&5
+echo "${ECHO_T}\"newly built gas\"" >&6; }
else
- echo "$as_me:$LINENO: result: $gcc_cv_as" >&5
-echo "${ECHO_T}$gcc_cv_as" >&6
+ { echo "$as_me:$LINENO: result: $gcc_cv_as" >&5
+echo "${ECHO_T}$gcc_cv_as" >&6; }
fi
# Figure out what nm we will be using.
-echo "$as_me:$LINENO: checking what nm to use" >&5
-echo $ECHO_N "checking what nm to use... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking what nm to use" >&5
+echo $ECHO_N "checking what nm to use... $ECHO_C" >&6; }
if test -x nm$host_exeext; then
gcc_cv_nm=./nm$host_exeext
elif test x$host = x$target; then
# Native build.
gcc_cv_nm=nm$host_exeext
fi
-echo "$as_me:$LINENO: result: $gcc_cv_nm" >&5
-echo "${ECHO_T}$gcc_cv_nm" >&6
+{ echo "$as_me:$LINENO: result: $gcc_cv_nm" >&5
+echo "${ECHO_T}$gcc_cv_nm" >&6; }
-echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5
-echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6
- # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
+{ echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6; }
+ # Check whether --enable-maintainer-mode was given.
if test "${enable_maintainer_mode+set}" = set; then
- enableval="$enable_maintainer_mode"
- maintainer_mode=$enableval
+ enableval=$enable_maintainer_mode; maintainer_mode=$enableval
else
maintainer_mode=no
-fi;
+fi
-echo "$as_me:$LINENO: result: $maintainer_mode" >&5
-echo "${ECHO_T}$maintainer_mode" >&6
+
+{ echo "$as_me:$LINENO: result: $maintainer_mode" >&5
+echo "${ECHO_T}$maintainer_mode" >&6; }
if test "$maintainer_mode" = "yes"; then
MAINT=''
# Create the Makefile
# and configure language subdirectories
- ac_config_files="$ac_config_files $all_outputs"
- ac_config_commands="$ac_config_commands default"
+ac_config_files="$ac_config_files $all_outputs"
+
+ac_config_commands="$ac_config_commands default"
+
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# The following way of writing the cache mishandles newlines in values,
# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
+# So, we kill variables containing newlines.
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
-{
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ *) $as_unset $ac_var ;;
+ esac ;;
+ esac
+ done
+
(set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
# `set' does not quote correctly, so add quotes (double-quote
# substitution turns \\\\ into \\, and sed turns \\ into \).
sed -n \
- "s/'/'\\\\''/g;
- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
- ;;
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;; #(
*)
# `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n \
- "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
;;
- esac;
-} |
+ esac |
+ sort
+) |
sed '
+ /^ac_cv_env_/b end
t clear
- : clear
+ :clear
s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
t end
- /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
- : end' >>confcache
-if cmp -s $cache_file confcache; then :; else
- if test -w $cache_file; then
- test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
+ test "x$cache_file" != "x/dev/null" &&
+ { echo "$as_me:$LINENO: updating cache $cache_file" >&5
+echo "$as_me: updating cache $cache_file" >&6;}
cat confcache >$cache_file
else
- echo "not updating unwritable cache $cache_file"
+ { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+echo "$as_me: not updating unwritable cache $cache_file" >&6;}
fi
fi
rm -f confcache
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
-# trailing colons and then remove the whole line if VPATH becomes empty
-# (actually we leave an empty line to preserve line numbers).
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=/{
-s/:*\$(srcdir):*/:/;
-s/:*\${srcdir}:*/:/;
-s/:*@srcdir@:*/:/;
-s/^\([^=]*=[ ]*\):*/\1/;
-s/:*$//;
-s/^[^=]*=[ ]*$//;
-}'
-fi
-
DEFS=-DHAVE_CONFIG_H
ac_libobjs=
ac_ltlibobjs=
for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
# 1. Remove the extension, and $U if already installed.
- ac_i=`echo "$ac_i" |
- sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
- # 2. Add them.
- ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
- ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`echo "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
done
LIBOBJS=$ac_libobjs
# configure, is in config.log if it exists.
debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
SHELL=\${CONFIG_SHELL-$SHELL}
_ACEOF
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
- set -o posix
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
fi
# Support unset when possible.
-if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
as_unset=unset
else
as_unset=false
fi
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+as_nl='
+'
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ { (exit 1); exit 1; }
+fi
+
# Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
-for as_var in LANG LANGUAGE LC_ALL LC_COLLATE LC_CTYPE LC_NUMERIC LC_MESSAGES LC_TIME
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
do
- if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
eval $as_var=C; export $as_var
else
- $as_unset $as_var
+ ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
fi
done
# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
-if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
# Name of the executable.
-as_me=`$as_basename "$0" ||
+as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)$' \| \
- . : '\(.\)' 2>/dev/null ||
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
- /^X\/\(\/\/\)$/{ s//\1/; q; }
- /^X\/\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
-
-
-# PATH needs CR, and LINENO needs CR and PATH.
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conftest.sh
- echo "exit 0" >>conftest.sh
- chmod +x conftest.sh
- if (PATH="/nonexistent;."; conftest.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conftest.sh
-fi
+# CDPATH.
+$as_unset CDPATH
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" || {
- # Find who we are. Look in the path if we contain no path at all
- # relative or not.
- case $0 in
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
- ;;
- esac
- # We did not find ourselves, most probably we were run as `sh COMMAND'
- # in which case we are not to be found in the path.
- if test "x$as_myself" = x; then
- as_myself=$0
- fi
- if test ! -f "$as_myself"; then
- { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
-echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
- { (exit 1); exit 1; }; }
- fi
- case $CONFIG_SHELL in
- '')
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for as_base in sh bash ksh sh5; do
- case $as_dir in
- /*)
- if ("$as_dir/$as_base" -c '
as_lineno_1=$LINENO
as_lineno_2=$LINENO
- as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
- $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
- $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
- CONFIG_SHELL=$as_dir/$as_base
- export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$0" ${1+"$@"}
- fi;;
- esac
- done
-done
-;;
- esac
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
# Create $as_me.lineno as a copy of $as_myself, but with $LINENO
# uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line before each line; the second 'sed' does the real
- # work. The second script uses 'N' to pair each line-number line
- # with the numbered line, and appends trailing '-' during
- # substitution so that $LINENO is not a special case at line end.
+ # line-number line after each line using $LINENO; the second 'sed'
+ # does the real work. The second script uses 'N' to pair each
+ # line-number line with the line containing $LINENO, and appends
+ # trailing '-' during substitution so that $LINENO is not a special
+ # case at line end.
# (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
- sed '=' <$as_myself |
+ # scripts with optimization help from Paolo Bonzini. Blame Lee
+ # E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
N
- s,$,-,
- : loop
- s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
t loop
- s,-$,,
- s,^['$as_cr_digits']*\n,,
+ s/-\n.*//
' >$as_me.lineno &&
- chmod +x $as_me.lineno ||
- { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
-echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
+ chmod +x "$as_me.lineno" ||
+ { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
{ (exit 1); exit 1; }; }
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensible to this).
- . ./$as_me.lineno
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
# Exit status is that of the last command.
exit
}
-case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
- *c*,-n*) ECHO_N= ECHO_C='
-' ECHO_T=' ' ;;
- *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
- *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+ case `echo 'x\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ *) ECHO_C='\c';;
+ esac;;
+*)
+ ECHO_N='-n';;
esac
-if expr a : '\(a\)' >/dev/null 2>&1; then
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir
+fi
echo >conf$$.file
if ln -s conf$$.file conf$$ 2>/dev/null; then
- # We could just check for DJGPP; but this test a) works b) is more generic
- # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
- if test -f conf$$.exe; then
- # Don't use ln at all; we don't have any links
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
as_ln_s='cp -p'
- else
- as_ln_s='ln -s'
- fi
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -p'
fi
-rm -f conf$$ conf$$.exe conf$$.file
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
if mkdir -p . 2>/dev/null; then
as_mkdir_p=:
else
+ test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
-as_executable_p="test -f"
+# Find out whether ``test -x'' works. Don't use a zero-byte file, as
+# systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+ as_executable_p="test -x"
+else
+ as_executable_p=:
+fi
+rm -f conf$$.file
# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
# Sed expression to map a string onto a valid variable name.
-as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-# IFS
-# We need space, tab and new line, in precisely that order.
-as_nl='
-'
-IFS=" $as_nl"
-
-# CDPATH.
-$as_unset CDPATH
-
exec 6>&1
-# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# Save the log message, to keep $[0] and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
-# values after options handling. Logging --version etc. is OK.
-exec 5>>config.log
-{
- echo
- sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
-## Running $as_me. ##
-_ASBOX
-} >&5
-cat >&5 <<_CSEOF
-
+# values after options handling.
+ac_log="
This file was extended by $as_me, which was
-generated by GNU Autoconf 2.54. Invocation command line was
+generated by GNU Autoconf 2.60. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
CONFIG_COMMANDS = $CONFIG_COMMANDS
$ $0 $@
-_CSEOF
-echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
-echo >&5
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
# Files that config.status was made for.
-if test -n "$ac_config_files"; then
- echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
-fi
-
-if test -n "$ac_config_headers"; then
- echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
-fi
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
-if test -n "$ac_config_links"; then
- echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
-fi
-
-if test -n "$ac_config_commands"; then
- echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
-fi
+_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
-
ac_cs_usage="\
\`$as_me' instantiates files from templates according to the
current configuration.
-h, --help print this help, then exit
-V, --version print version number, then exit
+ -q, --quiet do not print progress messages
-d, --debug don't remove temporary files
--recheck update $as_me by reconfiguring in the same conditions
--file=FILE[:TEMPLATE]
- instantiate the configuration file FILE
+ instantiate the configuration file FILE
--header=FILE[:TEMPLATE]
- instantiate the configuration header FILE
+ instantiate the configuration header FILE
Configuration files:
$config_files
$config_commands
Report bugs to <bug-autoconf@gnu.org>."
-_ACEOF
+_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
config.status
-configured by $0, generated by GNU Autoconf 2.54,
- with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+configured by $0, generated by GNU Autoconf 2.60,
+ with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
-Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
-Free Software Foundation, Inc.
+Copyright (C) 2006 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
-srcdir=$srcdir
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
do
case $1 in
--*=*)
- ac_option=`expr "x$1" : 'x\([^=]*\)='`
- ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
ac_shift=:
;;
- -*)
+ *)
ac_option=$1
ac_optarg=$2
ac_shift=shift
;;
- *) # This is not an option, so the user has probably given explicit
- # arguments.
- ac_option=$1
- ac_need_defaults=false;;
esac
case $ac_option in
# Handling of the options.
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- echo "running $SHELL $0 " $ac_configure_args " --no-create --no-recursion"
- exec $SHELL $0 $ac_configure_args --no-create --no-recursion ;;
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
- --version | --vers* | -V )
- echo "$ac_cs_version"; exit 0 ;;
- --he | --h)
- # Conflict between --help and --header
- { { echo "$as_me:$LINENO: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&5
-echo "$as_me: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&2;}
- { (exit 1); exit 1; }; };;
- --help | --hel | -h )
- echo "$ac_cs_usage"; exit 0 ;;
- --debug | --d* | -d )
+ ac_cs_recheck=: ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ echo "$ac_cs_version"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
debug=: ;;
--file | --fil | --fi | --f )
$ac_shift
$ac_shift
CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
ac_need_defaults=false;;
+ --he | --h)
+ # Conflict between --help and --header
+ { echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; };;
+ --help | --hel | -h )
+ echo "$ac_cs_usage"; exit ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
# This is an error.
- -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&5
-echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2;}
+ -*) { echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2
{ (exit 1); exit 1; }; } ;;
- *) ac_config_targets="$ac_config_targets $1" ;;
+ *) ac_config_targets="$ac_config_targets $1"
+ ac_need_defaults=false ;;
esac
shift
done
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+ echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+ CONFIG_SHELL=$SHELL
+ export CONFIG_SHELL
+ exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ echo "$ac_log"
+} >&5
+_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
#
-# INIT-COMMANDS section.
+# INIT-COMMANDS
#
-
host='${host}'
build='${build}'
target='${target}'
_ACEOF
-
-
cat >>$CONFIG_STATUS <<\_ACEOF
+
+# Handling of arguments.
for ac_config_target in $ac_config_targets
do
- case "$ac_config_target" in
- # Handling of arguments.
- "$all_outputs" ) CONFIG_FILES="$CONFIG_FILES $all_outputs" ;;
- "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
- "auto-host.h" ) CONFIG_HEADERS="$CONFIG_HEADERS auto-host.h:config.in" ;;
+ case $ac_config_target in
+ "auto-host.h") CONFIG_HEADERS="$CONFIG_HEADERS auto-host.h:config.in" ;;
+ "$all_outputs") CONFIG_FILES="$CONFIG_FILES $all_outputs" ;;
+ "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
+
*) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
{ (exit 1); exit 1; }; };;
esac
done
+
# If the user did not use the arguments to specify the items to instantiate,
# then the envvar interface is used. Set only those that are not.
# We use the long form for the default assignment because of an extremely
test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
fi
-# Create a temporary directory, and hook for its removal unless debugging.
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
$debug ||
{
- trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+ tmp=
+ trap 'exit_status=$?
+ { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
trap '{ (exit 1); exit 1; }' 1 2 13 15
}
-
# Create a (secure) tmp directory for tmp files.
-: ${TMPDIR=/tmp}
+
{
- tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` &&
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
test -n "$tmp" && test -d "$tmp"
} ||
{
- tmp=$TMPDIR/cs$$-$RANDOM
- (umask 077 && mkdir $tmp)
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
} ||
{
- echo "$me: cannot create a temporary directory in $TMPDIR" >&2
+ echo "$me: cannot create a temporary directory in ." >&2
{ (exit 1); exit 1; }
}
-_ACEOF
-
-cat >>$CONFIG_STATUS <<_ACEOF
-
#
-# CONFIG_FILES section.
+# Set up the sed scripts for CONFIG_FILES section.
#
# No need to generate the scripts if there are no CONFIG_FILES.
# This happens for instance when ./config.status config.h
-if test -n "\$CONFIG_FILES"; then
- # Protect against being on the right side of a sed subst in config.status.
- sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
- s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
-s,@SHELL@,$SHELL,;t t
-s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
-s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
-s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
-s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
-s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
-s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
-s,@exec_prefix@,$exec_prefix,;t t
-s,@prefix@,$prefix,;t t
-s,@program_transform_name@,$program_transform_name,;t t
-s,@bindir@,$bindir,;t t
-s,@sbindir@,$sbindir,;t t
-s,@libexecdir@,$libexecdir,;t t
-s,@datadir@,$datadir,;t t
-s,@sysconfdir@,$sysconfdir,;t t
-s,@sharedstatedir@,$sharedstatedir,;t t
-s,@localstatedir@,$localstatedir,;t t
-s,@libdir@,$libdir,;t t
-s,@includedir@,$includedir,;t t
-s,@oldincludedir@,$oldincludedir,;t t
-s,@infodir@,$infodir,;t t
-s,@mandir@,$mandir,;t t
-s,@build_alias@,$build_alias,;t t
-s,@host_alias@,$host_alias,;t t
-s,@target_alias@,$target_alias,;t t
-s,@DEFS@,$DEFS,;t t
-s,@ECHO_C@,$ECHO_C,;t t
-s,@ECHO_N@,$ECHO_N,;t t
-s,@ECHO_T@,$ECHO_T,;t t
-s,@LIBS@,$LIBS,;t t
-s,@CC@,$CC,;t t
-s,@CFLAGS@,$CFLAGS,;t t
-s,@LDFLAGS@,$LDFLAGS,;t t
-s,@CPPFLAGS@,$CPPFLAGS,;t t
-s,@ac_ct_CC@,$ac_ct_CC,;t t
-s,@EXEEXT@,$EXEEXT,;t t
-s,@OBJEXT@,$OBJEXT,;t t
-s,@NO_MINUS_C_MINUS_O@,$NO_MINUS_C_MINUS_O,;t t
-s,@OUTPUT_OPTION@,$OUTPUT_OPTION,;t t
-s,@CPP@,$CPP,;t t
-s,@EGREP@,$EGREP,;t t
-s,@warn_cflags@,$warn_cflags,;t t
-s,@SET_MAKE@,$SET_MAKE,;t t
-s,@LN@,$LN,;t t
-s,@LN_S@,$LN_S,;t t
-s,@RANLIB@,$RANLIB,;t t
-s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
-s,@INSTALL@,$INSTALL,;t t
-s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
-s,@INSTALL_DATA@,$INSTALL_DATA,;t t
-s,@have_mktemp_command@,$have_mktemp_command,;t t
-s,@STRIP@,$STRIP,;t t
-s,@manext@,$manext,;t t
-s,@objext@,$objext,;t t
-s,@PACKAGE@,$PACKAGE,;t t
-s,@VERSION@,$VERSION,;t t
-s,@MAINT@,$MAINT,;t t
-s,@build_canonical@,$build_canonical,;t t
-s,@host_canonical@,$host_canonical,;t t
-s,@target_subdir@,$target_subdir,;t t
-s,@objdir@,$objdir,;t t
-s,@all_stagestuff@,$all_stagestuff,;t t
-s,@build_exeext@,$build_exeext,;t t
-s,@build_install_headers_dir@,$build_install_headers_dir,;t t
-s,@build_xm_file_list@,$build_xm_file_list,;t t
-s,@build_xm_file@,$build_xm_file,;t t
-s,@build_xm_defines@,$build_xm_defines,;t t
-s,@check_languages@,$check_languages,;t t
-s,@dep_host_xmake_file@,$dep_host_xmake_file,;t t
-s,@dep_tmake_file@,$dep_tmake_file,;t t
-s,@extra_c_flags@,$extra_c_flags,;t t
-s,@extra_headers_list@,$extra_headers_list,;t t
-s,@extra_objs@,$extra_objs,;t t
-s,@extra_parts@,$extra_parts,;t t
-s,@extra_passes@,$extra_passes,;t t
-s,@extra_programs@,$extra_programs,;t t
-s,@gcc_config_arguments@,$gcc_config_arguments,;t t
-s,@gcc_version@,$gcc_version,;t t
-s,@gcc_version_full@,$gcc_version_full,;t t
-s,@gcc_version_trigger@,$gcc_version_trigger,;t t
-s,@host_exeext@,$host_exeext,;t t
-s,@host_extra_gcc_objs@,$host_extra_gcc_objs,;t t
-s,@install@,$install,;t t
-s,@lang_tree_files@,$lang_tree_files,;t t
-s,@local_prefix@,$local_prefix,;t t
-s,@md_file@,$md_file,;t t
-s,@out_file@,$out_file,;t t
-s,@out_object_file@,$out_object_file,;t t
-s,@symbolic_link@,$symbolic_link,;t t
-s,@thread_file@,$thread_file,;t t
-s,@c_target_objs@,$c_target_objs,;t t
-s,@LIBOBJS@,$LIBOBJS,;t t
-s,@LTLIBOBJS@,$LTLIBOBJS,;t t
-CEOF
-
-_ACEOF
-
- cat >>$CONFIG_STATUS <<\_ACEOF
- # Split the substitutions into bite-sized pieces for seds with
- # small command number limits, like on Digital OSF/1 and HP-UX.
- ac_max_sed_lines=48
- ac_sed_frag=1 # Number of current file.
- ac_beg=1 # First line for current file.
- ac_end=$ac_max_sed_lines # Line after last line for current file.
- ac_more_lines=:
- ac_sed_cmds=
- while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
- else
- sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
- fi
- if test ! -s $tmp/subs.frag; then
- ac_more_lines=false
- else
- # The purpose of the label and of the branching condition is to
- # speed up the sed processing (if there are no `@' at all, there
- # is no need to browse any of the substitutions).
- # These are the two extra sed commands mentioned above.
- (echo ':t
- /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
- fi
- ac_sed_frag=`expr $ac_sed_frag + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_lines`
- fi
- done
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
+if test -n "$CONFIG_FILES"; then
+
+_ACEOF
+
+
+
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ cat >conf$$subs.sed <<_ACEOF
+SHELL!$SHELL$ac_delim
+PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
+PACKAGE_NAME!$PACKAGE_NAME$ac_delim
+PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim
+PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim
+PACKAGE_STRING!$PACKAGE_STRING$ac_delim
+PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim
+exec_prefix!$exec_prefix$ac_delim
+prefix!$prefix$ac_delim
+program_transform_name!$program_transform_name$ac_delim
+bindir!$bindir$ac_delim
+sbindir!$sbindir$ac_delim
+libexecdir!$libexecdir$ac_delim
+datarootdir!$datarootdir$ac_delim
+datadir!$datadir$ac_delim
+sysconfdir!$sysconfdir$ac_delim
+sharedstatedir!$sharedstatedir$ac_delim
+localstatedir!$localstatedir$ac_delim
+includedir!$includedir$ac_delim
+oldincludedir!$oldincludedir$ac_delim
+docdir!$docdir$ac_delim
+infodir!$infodir$ac_delim
+htmldir!$htmldir$ac_delim
+dvidir!$dvidir$ac_delim
+pdfdir!$pdfdir$ac_delim
+psdir!$psdir$ac_delim
+libdir!$libdir$ac_delim
+localedir!$localedir$ac_delim
+mandir!$mandir$ac_delim
+DEFS!$DEFS$ac_delim
+ECHO_C!$ECHO_C$ac_delim
+ECHO_N!$ECHO_N$ac_delim
+ECHO_T!$ECHO_T$ac_delim
+LIBS!$LIBS$ac_delim
+build_alias!$build_alias$ac_delim
+host_alias!$host_alias$ac_delim
+target_alias!$target_alias$ac_delim
+CC!$CC$ac_delim
+CFLAGS!$CFLAGS$ac_delim
+LDFLAGS!$LDFLAGS$ac_delim
+CPPFLAGS!$CPPFLAGS$ac_delim
+ac_ct_CC!$ac_ct_CC$ac_delim
+EXEEXT!$EXEEXT$ac_delim
+OBJEXT!$OBJEXT$ac_delim
+NO_MINUS_C_MINUS_O!$NO_MINUS_C_MINUS_O$ac_delim
+OUTPUT_OPTION!$OUTPUT_OPTION$ac_delim
+CPP!$CPP$ac_delim
+GREP!$GREP$ac_delim
+EGREP!$EGREP$ac_delim
+warn_cflags!$warn_cflags$ac_delim
+SET_MAKE!$SET_MAKE$ac_delim
+LN!$LN$ac_delim
+LN_S!$LN_S$ac_delim
+RANLIB!$RANLIB$ac_delim
+INSTALL!$INSTALL$ac_delim
+INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
+INSTALL_DATA!$INSTALL_DATA$ac_delim
+have_mktemp_command!$have_mktemp_command$ac_delim
+STRIP!$STRIP$ac_delim
+manext!$manext$ac_delim
+objext!$objext$ac_delim
+PACKAGE!$PACKAGE$ac_delim
+VERSION!$VERSION$ac_delim
+MAINT!$MAINT$ac_delim
+build_canonical!$build_canonical$ac_delim
+host_canonical!$host_canonical$ac_delim
+target_subdir!$target_subdir$ac_delim
+objdir!$objdir$ac_delim
+all_stagestuff!$all_stagestuff$ac_delim
+build_exeext!$build_exeext$ac_delim
+build_install_headers_dir!$build_install_headers_dir$ac_delim
+build_xm_file_list!$build_xm_file_list$ac_delim
+build_xm_file!$build_xm_file$ac_delim
+build_xm_defines!$build_xm_defines$ac_delim
+check_languages!$check_languages$ac_delim
+dep_host_xmake_file!$dep_host_xmake_file$ac_delim
+dep_tmake_file!$dep_tmake_file$ac_delim
+extra_c_flags!$extra_c_flags$ac_delim
+extra_headers_list!$extra_headers_list$ac_delim
+extra_objs!$extra_objs$ac_delim
+extra_parts!$extra_parts$ac_delim
+extra_passes!$extra_passes$ac_delim
+extra_programs!$extra_programs$ac_delim
+gcc_config_arguments!$gcc_config_arguments$ac_delim
+gcc_version!$gcc_version$ac_delim
+gcc_version_full!$gcc_version_full$ac_delim
+gcc_version_trigger!$gcc_version_trigger$ac_delim
+host_exeext!$host_exeext$ac_delim
+host_extra_gcc_objs!$host_extra_gcc_objs$ac_delim
+install!$install$ac_delim
+lang_tree_files!$lang_tree_files$ac_delim
+local_prefix!$local_prefix$ac_delim
+md_file!$md_file$ac_delim
+out_file!$out_file$ac_delim
+out_object_file!$out_object_file$ac_delim
+symbolic_link!$symbolic_link$ac_delim
+thread_file!$thread_file$ac_delim
+_ACEOF
+
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
+ break
+ elif $ac_last_try; then
+ { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
-fi # test -n "$CONFIG_FILES"
+done
+
+ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+if test -n "$ac_eof"; then
+ ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+ ac_eof=`expr $ac_eof + 1`
+fi
+
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+_ACEOF
+sed '
+s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+s/^/s,@/; s/!/@,|#_!!_#|/
+:n
+t n
+s/'"$ac_delim"'$/,g/; t
+s/$/\\/; p
+N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+' >>$CONFIG_STATUS <conf$$subs.sed
+rm -f conf$$subs.sed
+cat >>$CONFIG_STATUS <<_ACEOF
+CEOF$ac_eof
+_ACEOF
+
+
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ cat >conf$$subs.sed <<_ACEOF
+c_target_objs!$c_target_objs$ac_delim
+LIBOBJS!$LIBOBJS$ac_delim
+LTLIBOBJS!$LTLIBOBJS$ac_delim
+_ACEOF
+
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 3; then
+ break
+ elif $ac_last_try; then
+ { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+if test -n "$ac_eof"; then
+ ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+ ac_eof=`expr $ac_eof + 1`
+fi
+
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
_ACEOF
+sed '
+s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+s/^/s,@/; s/!/@,|#_!!_#|/
+:n
+t n
+s/'"$ac_delim"'$/,g/; t
+s/$/\\/; p
+N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+' >>$CONFIG_STATUS <conf$$subs.sed
+rm -f conf$$subs.sed
+cat >>$CONFIG_STATUS <<_ACEOF
+:end
+s/|#_!!_#|//g
+CEOF$ac_eof
+_ACEOF
+
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/
+s/:*\${srcdir}:*/:/
+s/:*@srcdir@:*/:/
+s/^\([^=]*=[ ]*\):*/\1/
+s/:*$//
+s/^[^=]*=[ ]*$//
+}'
+fi
+
cat >>$CONFIG_STATUS <<\_ACEOF
-for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case $ac_file in
- - | *:- | *:-:* ) # input from stdin
- cat >$tmp/stdin
- ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- * ) ac_file_in=$ac_file.in ;;
+fi # test -n "$CONFIG_FILES"
+
+
+for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
+echo "$as_me: error: Invalid tag $ac_tag." >&2;}
+ { (exit 1); exit 1; }; };;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
+
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be DOS-style,
+ # because $ac_f cannot contain `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
+echo "$as_me: error: cannot find input file: $ac_f" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+ ac_file_inputs="$ac_file_inputs $ac_f"
+ done
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input="Generated from "`IFS=:
+ echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+ fi
+
+ case $ac_tag in
+ *:-:* | *:-) cat >"$tmp/stdin";;
+ esac
+ ;;
esac
- # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
- ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+ ac_dir=`$as_dirname -- "$ac_file" ||
$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$ac_file" : 'X\(//\)[^/]' \| \
- X"$ac_file" : 'X\(//\)$' \| \
- X"$ac_file" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$ac_file" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- { if $as_mkdir_p; then
- mkdir -p "$ac_dir"
- else
- as_dir="$ac_dir"
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ { as_dir="$ac_dir"
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
as_dirs=
- while test ! -d "$as_dir"; do
- as_dirs="$as_dir $as_dirs"
- as_dir=`(dirname "$as_dir") 2>/dev/null ||
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_dir" : 'X\(//\)[^/]' \| \
- X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
done
- test ! -n "$as_dirs" || mkdir $as_dirs
- fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
-echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+echo "$as_me: error: cannot create directory $as_dir" >&2;}
{ (exit 1); exit 1; }; }; }
-
ac_builddir=.
-if test "$ac_dir" != .; then
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A "../" for each directory in $ac_dir_suffix.
- ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
- ac_dir_suffix= ac_top_builddir=
-fi
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
case $srcdir in
- .) # No --srcdir option. We are building in place.
+ .) # We are building in place.
ac_srcdir=.
- if test -z "$ac_top_builddir"; then
- ac_top_srcdir=.
- else
- ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
- fi ;;
- [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir ;;
- *) # Relative path.
- ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_builddir$srcdir ;;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
esac
-# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
-# absolute.
-ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
-ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
-ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
-ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
- if test x"$ac_file" != x-; then
- { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
- rm -f "$ac_file"
- fi
- # Let's still pretend it is `configure' which instantiates (i.e., don't
- # use $as_me), people would be surprised to read:
- # /* config.h. Generated by config.status. */
- if test x"$ac_file" = x-; then
- configure_input=
- else
- configure_input="$ac_file. "
- fi
- configure_input=$configure_input"Generated from `echo $ac_file_in |
- sed 's,.*/,,'` by configure."
-
- # First look for the input files in the build tree, otherwise in the
- # src tree.
- ac_file_inputs=`IFS=:
- for f in $ac_file_in; do
- case $f in
- -) echo $tmp/stdin ;;
- [\\/$]*)
- # Absolute (can't be DOS-style, as IFS=:)
- test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- echo $f;;
- *) # Relative
- if test -f "$f"; then
- # Build tree
- echo $f
- elif test -f "$srcdir/$f"; then
- # Source tree
- echo $srcdir/$f
- else
- # /dev/null tree
- { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- fi;;
- esac
- done` || { (exit 1); exit 1; }
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+
+case `sed -n '/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p
+' $ac_file_inputs` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
cat >>$CONFIG_STATUS <<_ACEOF
sed "$ac_vpsub
$extrasub
cat >>$CONFIG_STATUS <<\_ACEOF
:t
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s,@configure_input@,$configure_input,;t t
-s,@srcdir@,$ac_srcdir,;t t
-s,@abs_srcdir@,$ac_abs_srcdir,;t t
-s,@top_srcdir@,$ac_top_srcdir,;t t
-s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
-s,@builddir@,$ac_builddir,;t t
-s,@abs_builddir@,$ac_abs_builddir,;t t
-s,@top_builddir@,$ac_top_builddir,;t t
-s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
-" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
- rm -f $tmp/stdin
- if test x"$ac_file" != x-; then
- mv $tmp/out $ac_file
- else
- cat $tmp/out
- rm -f $tmp/out
- fi
-
-done
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-
-#
-# CONFIG_HEADER section.
-#
-
-# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
-# NAME is the cpp macro being defined and VALUE is the value it is being given.
-#
-# ac_d sets the value in "#define NAME VALUE" lines.
-ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)'
-ac_dB='[ ].*$,\1#\2'
-ac_dC=' '
-ac_dD=',;t'
-# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
-ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
-ac_uB='$,\1#\2define\3'
-ac_uC=' '
-ac_uD=',;t'
-
-for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+s&@configure_input@&$configure_input&;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+$ac_datarootdir_hack
+" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+ { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&5
+echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&2;}
+
+ rm -f "$tmp/stdin"
case $ac_file in
- - | *:- | *:-:* ) # input from stdin
- cat >$tmp/stdin
- ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
- * ) ac_file_in=$ac_file.in ;;
+ -) cat "$tmp/out"; rm -f "$tmp/out";;
+ *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
esac
+ ;;
+ :H)
+ #
+ # CONFIG_HEADER
+ #
+_ACEOF
- test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
-
- # First look for the input files in the build tree, otherwise in the
- # src tree.
- ac_file_inputs=`IFS=:
- for f in $ac_file_in; do
- case $f in
- -) echo $tmp/stdin ;;
- [\\/$]*)
- # Absolute (can't be DOS-style, as IFS=:)
- test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- echo $f;;
- *) # Relative
- if test -f "$f"; then
- # Build tree
- echo $f
- elif test -f "$srcdir/$f"; then
- # Source tree
- echo $srcdir/$f
- else
- # /dev/null tree
- { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
- { (exit 1); exit 1; }; }
- fi;;
- esac
- done` || { (exit 1); exit 1; }
- # Remove the trailing spaces.
- sed 's/[ ]*$//' $ac_file_inputs >$tmp/in
-
-_ACEOF
-
-# Transform confdefs.h into two sed scripts, `conftest.defines' and
-# `conftest.undefs', that substitutes the proper values into
-# config.h.in to produce config.h. The first handles `#define'
-# templates, and the second `#undef' templates.
-# And first: Protect against being on the right side of a sed subst in
-# config.status. Protect against being in an unquoted here document
-# in config.status.
-rm -f conftest.defines conftest.undefs
-# Using a here document instead of a string reduces the quoting nightmare.
-# Putting comments in sed scripts is not portable.
-#
-# `end' is used to avoid that the second main sed command (meant for
-# 0-ary CPP macros) applies to n-ary macro definitions.
-# See the Autoconf documentation for `clear'.
-cat >confdef2sed.sed <<\_ACEOF
-s/[\\&,]/\\&/g
-s,[\\$`],\\&,g
-t clear
-: clear
-s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
-t end
-s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
-: end
-_ACEOF
-# If some macros were called several times there might be several times
-# the same #defines, which is useless. Nevertheless, we may not want to
-# sort them, since we want the *last* AC-DEFINE to be honored.
-uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
-sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
-rm -f confdef2sed.sed
-
-# This sed command replaces #undef with comments. This is necessary, for
+# Transform confdefs.h into a sed script `conftest.defines', that
+# substitutes the proper values into config.h.in to produce config.h.
+rm -f conftest.defines conftest.tail
+# First, append a space to every undef/define line, to ease matching.
+echo 's/$/ /' >conftest.defines
+# Then, protect against being on the right side of a sed subst, or in
+# an unquoted here document, in config.status. If some macros were
+# called several times there might be several #defines for the same
+# symbol, which is useless. But do not sort them, since the last
+# AC_DEFINE must be honored.
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where
+# NAME is the cpp macro being defined, VALUE is the value it is being given.
+# PARAMS is the parameter list in the macro definition--in most cases, it's
+# just an empty string.
+ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*'
+ac_dB='\\)[ (].*,\\1define\\2'
+ac_dC=' '
+ac_dD=' ,'
+
+uniq confdefs.h |
+ sed -n '
+ t rset
+ :rset
+ s/^[ ]*#[ ]*define[ ][ ]*//
+ t ok
+ d
+ :ok
+ s/[\\&,]/\\&/g
+ s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p
+ s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p
+ ' >>conftest.defines
+
+# Remove the space that was appended to ease matching.
+# Then replace #undef with comments. This is necessary, for
# example, in the case of _POSIX_SOURCE, which is predefined and required
# on some systems where configure will not decide to define it.
-cat >>conftest.undefs <<\_ACEOF
-s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
-_ACEOF
-
-# Break up conftest.defines because some shells have a limit on the size
-# of here documents, and old seds have small limits too (100 cmds).
-echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
-echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
-echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
-echo ' :' >>$CONFIG_STATUS
-rm -f conftest.tail
-while grep . conftest.defines >/dev/null
+# (The regexp can be short, since the line contains either #define or #undef.)
+echo 's/ $//
+s,^[ #]*u.*,/* & */,' >>conftest.defines
+
+# Break up conftest.defines:
+ac_max_sed_lines=50
+
+# First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1"
+# Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2"
+# Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1"
+# et cetera.
+ac_in='$ac_file_inputs'
+ac_out='"$tmp/out1"'
+ac_nxt='"$tmp/out2"'
+
+while :
do
- # Write a limited-size here document to $tmp/defines.sed.
- echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
- # Speed up: don't consider the non `#define' lines.
- echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS
- # Work around the forget-to-reset-the-flag bug.
- echo 't clr' >>$CONFIG_STATUS
- echo ': clr' >>$CONFIG_STATUS
- sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
+ # Write a here document:
+ cat >>$CONFIG_STATUS <<_ACEOF
+ # First, check the format of the line:
+ cat >"\$tmp/defines.sed" <<\\CEOF
+/^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def
+/^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def
+b
+:def
+_ACEOF
+ sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS
echo 'CEOF
- sed -f $tmp/defines.sed $tmp/in >$tmp/out
- rm -f $tmp/in
- mv $tmp/out $tmp/in
-' >>$CONFIG_STATUS
- sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
+ sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS
+ ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in
+ sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail
+ grep . conftest.tail >/dev/null || break
rm -f conftest.defines
mv conftest.tail conftest.defines
done
-rm -f conftest.defines
-echo ' fi # grep' >>$CONFIG_STATUS
-echo >>$CONFIG_STATUS
-
-# Break up conftest.undefs because some shells have a limit on the size
-# of here documents, and old seds have small limits too (100 cmds).
-echo ' # Handle all the #undef templates' >>$CONFIG_STATUS
-rm -f conftest.tail
-while grep . conftest.undefs >/dev/null
-do
- # Write a limited-size here document to $tmp/undefs.sed.
- echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
- # Speed up: don't consider the non `#undef'
- echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS
- # Work around the forget-to-reset-the-flag bug.
- echo 't clr' >>$CONFIG_STATUS
- echo ': clr' >>$CONFIG_STATUS
- sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
- echo 'CEOF
- sed -f $tmp/undefs.sed $tmp/in >$tmp/out
- rm -f $tmp/in
- mv $tmp/out $tmp/in
-' >>$CONFIG_STATUS
- sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
- rm -f conftest.undefs
- mv conftest.tail conftest.undefs
-done
-rm -f conftest.undefs
+rm -f conftest.defines conftest.tail
+echo "ac_result=$ac_in" >>$CONFIG_STATUS
cat >>$CONFIG_STATUS <<\_ACEOF
- # Let's still pretend it is `configure' which instantiates (i.e., don't
- # use $as_me), people would be surprised to read:
- # /* config.h. Generated by config.status. */
- if test x"$ac_file" = x-; then
- echo "/* Generated by configure. */" >$tmp/config.h
- else
- echo "/* $ac_file. Generated by configure. */" >$tmp/config.h
- fi
- cat $tmp/in >>$tmp/config.h
- rm -f $tmp/in
if test x"$ac_file" != x-; then
- if cmp -s $ac_file $tmp/config.h 2>/dev/null; then
+ echo "/* $configure_input */" >"$tmp/config.h"
+ cat "$ac_result" >>"$tmp/config.h"
+ if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then
{ echo "$as_me:$LINENO: $ac_file is unchanged" >&5
echo "$as_me: $ac_file is unchanged" >&6;}
else
- ac_dir=`(dirname "$ac_file") 2>/dev/null ||
-$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$ac_file" : 'X\(//\)[^/]' \| \
- X"$ac_file" : 'X\(//\)$' \| \
- X"$ac_file" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$ac_file" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- { if $as_mkdir_p; then
- mkdir -p "$ac_dir"
- else
- as_dir="$ac_dir"
- as_dirs=
- while test ! -d "$as_dir"; do
- as_dirs="$as_dir $as_dirs"
- as_dir=`(dirname "$as_dir") 2>/dev/null ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_dir" : 'X\(//\)[^/]' \| \
- X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- done
- test ! -n "$as_dirs" || mkdir $as_dirs
- fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
-echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
- { (exit 1); exit 1; }; }; }
-
rm -f $ac_file
- mv $tmp/config.h $ac_file
+ mv "$tmp/config.h" $ac_file
fi
else
- cat $tmp/config.h
- rm -f $tmp/config.h
+ echo "/* $configure_input */"
+ cat "$ac_result"
fi
-done
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
+ rm -f "$tmp/out12"
+ ;;
-#
-# CONFIG_COMMANDS section.
-#
-for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
- ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
- ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
-$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$ac_dest" : 'X\(//\)[^/]' \| \
- X"$ac_dest" : 'X\(//\)$' \| \
- X"$ac_dest" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
-echo X"$ac_dest" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
- /^X\(\/\/\)[^/].*/{ s//\1/; q; }
- /^X\(\/\/\)$/{ s//\1/; q; }
- /^X\(\/\).*/{ s//\1/; q; }
- s/.*/./; q'`
- ac_builddir=.
+ :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5
+echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+ esac
-if test "$ac_dir" != .; then
- ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A "../" for each directory in $ac_dir_suffix.
- ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
- ac_dir_suffix= ac_top_builddir=
-fi
-case $srcdir in
- .) # No --srcdir option. We are building in place.
- ac_srcdir=.
- if test -z "$ac_top_builddir"; then
- ac_top_srcdir=.
- else
- ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
- fi ;;
- [\\/]* | ?:[\\/]* ) # Absolute path.
- ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir ;;
- *) # Relative path.
- ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_builddir$srcdir ;;
-esac
-# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
-# absolute.
-ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
-ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
-ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
-ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
-
-
- { echo "$as_me:$LINENO: executing $ac_dest commands" >&5
-echo "$as_me: executing $ac_dest commands" >&6;}
- case $ac_dest in
- default )
+ case $ac_file$ac_mode in
+ "default":C)
case x$CONFIG_HEADERS in
xauto-host.h:config.in)
echo > cstamp-h ;;
echo '#include "intl/libintl.h"' >libintl.h
fi
;;
+
esac
-done
-_ACEOF
+done # for ac_tag
-cat >>$CONFIG_STATUS <<\_ACEOF
{ (exit 0); exit 0; }
_ACEOF
# need to make the FD available again.
if test "$no_create" != yes; then
ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
exec 5>/dev/null
- $SHELL $CONFIG_STATUS || ac_cs_success=false
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
exec 5>>config.log
# Use ||, not &&, to avoid exiting from the if with $? = 1, which
# would make configure fail if this is the last instruction.
-# configure.in for GNU CC
+# configure.in for GCC
# Process this file with autoconf to generate a configuration script.
-# Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+# Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
-#This file is part of GNU CC.
+#This file is part of GCC.
-#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.
+#GCC 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.
+#GCC 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.
+#along with GCC; see the file COPYING. If not, write to the Free
+#Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+#02111-1307, USA.
# Initialization and defaults
AC_PREREQ(2.13)
[Define if you want the C and C++ compilers to support multibyte
character sets for source code.])
fi)
-
+
# Find the native compiler
AC_PROG_CC
AC_PROG_CC_C_O
AC_PROG_CPP
AC_C_INLINE
+gcc_AC_C__BOOL
+
# sizeof(char) is 1 by definition.
gcc_AC_COMPILE_CHECK_SIZEOF(short)
gcc_AC_COMPILE_CHECK_SIZEOF(int)
gcc_AC_C_CHARSET
-# If the native compiler is GCC, we can enable warnings even in stage1.
+# If the native compiler is GCC, we can enable warnings even in stage1.
# That's useful for people building cross-compilers, or just running a
# quick `make'.
warn_cflags=
AC_HEADER_STDC
AC_HEADER_TIME
+gcc_AC_HEADER_STDBOOL
gcc_AC_HEADER_STRING
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h \
# Restore CFLAGS from before the gcc_AC_NEED_DECLARATIONS tests.
CFLAGS="$saved_CFLAGS"
-# mkdir takes a single argument on some systems.
+# mkdir takes a single argument on some systems.
gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG
# File extensions
# auto-host.h is the file containing items generated by autoconf and is
# the first file included by config.h.
# If host=build, it is correct to have hconfig include auto-host.h
-# as well. If host!=build, we are in error and need to do more
+# as well. If host!=build, we are in error and need to do more
# work to find out the build config parameters.
if test x$host = x$build
then
# We create a subdir, then run autoconf in the subdir.
# To prevent recursion we set host and build for the new
# invocation of configure to the build for this invocation
- # of configure.
+ # of configure.
tempdir=build.$$
rm -rf $tempdir
mkdir $tempdir
AC_SUBST(build_canonical)
AC_SUBST(host_canonical)
AC_SUBST(target_subdir)
-
+
# Nothing to do for FLOAT_H, float_format already handled.
objdir=`pwd`
AC_SUBST(objdir)
/* /usr/local/include comes before the fixincluded header files. */
{ LOCAL_INCLUDE_DIR, 0, 0, 1 },
#endif
+#ifdef PREFIX_INCLUDE_DIR
+ { PREFIX_INCLUDE_DIR, 0, 0, 1 },
+#endif
#ifdef GCC_INCLUDE_DIR
/* This is the dir for fixincludes and for gcc's private headers. */
{ GCC_INCLUDE_DIR, "GCC", 0, 0 },
struct default_include
{
- const char *fname; /* The name of the directory. */
- const char *component; /* The component containing the directory
+ const char *const fname; /* The name of the directory. */
+ const char *const component; /* The component containing the directory
(see update_path in prefix.c) */
- int cplusplus; /* Only look here if we're compiling C++. */
- int cxx_aware; /* Includes in this directory don't need to
+ const int cplusplus; /* Only look here if we're compiling C++. */
+ const int cxx_aware; /* Includes in this directory don't need to
be wrapped in extern "C" when compiling
C++. */
};
/* Default error handlers for CPP Library.
- Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1998, 1999, 2000
- Free Software Foundation, Inc.
+ Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1998, 1999, 2000,
+ 2001, 2002 Free Software Foundation, Inc.
Written by Per Bothner, 1994.
Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987
#include "cpphash.h"
#include "intl.h"
-static void print_containing_files PARAMS ((cpp_buffer *));
-static void print_location PARAMS ((cpp_reader *,
- const char *,
- const cpp_lexer_pos *));
+static void print_location PARAMS ((cpp_reader *, unsigned int, unsigned int));
/* Don't remove the blank before do, as otherwise the exgettext
script will mistake this as a function definition */
#define v_message(msgid, ap) \
do { vfprintf (stderr, _(msgid), ap); putc ('\n', stderr); } while (0)
-/* Print the file names and line numbers of the #include
- commands which led to the current file. */
+/* Print the logical file location (LINE, COL) in preparation for a
+ diagnostic. Outputs the #include chain if it has changed. */
static void
-print_containing_files (ip)
- cpp_buffer *ip;
-{
- int first = 1;
-
- /* Find the other, outer source files. */
- for (ip = ip->prev; ip; ip = ip->prev)
- {
- if (first)
- {
- first = 0;
- /* The current line in each outer source file is now the
- same as the line of the #include. */
- fprintf (stderr, _("In file included from %s:%u"),
- ip->nominal_fname, CPP_BUF_LINE (ip));
- }
- else
- /* Translators note: this message is used in conjunction
- with "In file included from %s:%ld" and some other
- tricks. We want something like this:
-
- | In file included from sys/select.h:123,
- | from sys/types.h:234,
- | from userfile.c:31:
- | bits/select.h:45: <error message here>
-
- with all the "from"s lined up.
- The trailing comma is at the beginning of this message,
- and the trailing colon is not translated. */
- fprintf (stderr, _(",\n from %s:%u"),
- ip->nominal_fname, CPP_BUF_LINE (ip));
- }
- fputs (":\n", stderr);
-}
-
-static void
-print_location (pfile, filename, pos)
+print_location (pfile, line, col)
cpp_reader *pfile;
- const char *filename;
- const cpp_lexer_pos *pos;
+ unsigned int line, col;
{
cpp_buffer *buffer = pfile->buffer;
fprintf (stderr, "%s: ", progname);
else
{
- unsigned int line, col = 0;
- enum cpp_buffer_type type = buffer->type;
-
- /* For _Pragma buffers, we want to print the location as
- "foo.c:5:8: _Pragma:", where foo.c is the containing buffer.
- For diagnostics relating to command line options, we want to
- print "<command line>:" with no line number. */
- if (type == BUF_CL_OPTION || type == BUF_BUILTIN)
- line = 0;
- else
+ const struct line_map *map;
+
+ if (line == 0)
{
- if (type == BUF_PRAGMA)
- {
- buffer = buffer->prev;
- line = CPP_BUF_LINE (buffer);
- col = CPP_BUF_COL (buffer);
- }
- else
- {
- if (pos == 0)
- pos = cpp_get_line (pfile);
- line = pos->line;
- col = pos->col;
- }
-
- if (col == 0)
- col = 1;
-
- /* Don't repeat the include stack unnecessarily. */
- if (buffer->prev && ! buffer->include_stack_listed)
- {
- buffer->include_stack_listed = 1;
- print_containing_files (buffer);
- }
+ line = pfile->cur_token[-1].line;
+ col = pfile->cur_token[-1].col;
}
- if (filename == 0)
- filename = buffer->nominal_fname;
+ map = lookup_line (&pfile->line_maps, line);
+ print_containing_files (&pfile->line_maps, map);
+
+ line = SOURCE_LINE (map, line);
+ if (col == 0)
+ col = 1;
if (line == 0)
- fprintf (stderr, "%s: ", filename);
+ fprintf (stderr, "%s:", map->to_file);
else if (CPP_OPTION (pfile, show_column) == 0)
- fprintf (stderr, "%s:%u: ", filename, line);
+ fprintf (stderr, "%s:%u:", map->to_file, line);
else
- fprintf (stderr, "%s:%u:%u: ", filename, line, col);
+ fprintf (stderr, "%s:%u:%u:", map->to_file, line, col);
- if (type == BUF_PRAGMA)
- fprintf (stderr, "_Pragma: ");
+ fputc (' ', stderr);
}
}
/* Set up for an error message: print the file and line, bump the error
- counter, etc.
- If it returns 0, this error has been suppressed. */
-
+ counter, etc. LINE is the logical line number; zero means to print
+ at the location of the previously lexed token, which tends to be the
+ correct place by default. Returns 0 if the error has been suppressed. */
int
-_cpp_begin_message (pfile, code, file, pos)
+_cpp_begin_message (pfile, code, line, column)
cpp_reader *pfile;
enum error_type code;
- const char *file;
- const cpp_lexer_pos *pos;
+ unsigned int line, column;
{
int is_warning = 0;
break;
}
- print_location (pfile, file, pos);
+ print_location (pfile, line, column);
if (is_warning)
fputs (_("warning: "), stderr);
/* For reporting internal errors. Prints "internal error: " for you,
otherwise identical to cpp_fatal. */
-
void
cpp_ice VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
{
-#ifndef ANSI_PROTOTYPES
- cpp_reader *pfile;
- const char *msgid;
-#endif
- va_list ap;
-
- VA_START (ap, msgid);
-
-#ifndef ANSI_PROTOTYPES
- pfile = va_arg (ap, cpp_reader *);
- msgid = va_arg (ap, const char *);
-#endif
-
- if (_cpp_begin_message (pfile, ICE, NULL, 0))
+ VA_OPEN (ap, msgid);
+ VA_FIXEDARG (ap, cpp_reader *, pfile);
+ VA_FIXEDARG (ap, const char *, msgid);
+
+ if (_cpp_begin_message (pfile, ICE, 0, 0))
v_message (msgid, ap);
- va_end(ap);
+
+ VA_CLOSE (ap);
}
/* Same as cpp_error, except we consider the error to be "fatal",
(We do not exit, to support use of cpplib as a library.
Instead, it is the caller's responsibility to check
CPP_FATAL_ERRORS. */
-
void
cpp_fatal VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
{
-#ifndef ANSI_PROTOTYPES
- cpp_reader *pfile;
- const char *msgid;
-#endif
- va_list ap;
-
- VA_START (ap, msgid);
-
-#ifndef ANSI_PROTOTYPES
- pfile = va_arg (ap, cpp_reader *);
- msgid = va_arg (ap, const char *);
-#endif
-
- if (_cpp_begin_message (pfile, FATAL, NULL, 0))
+ VA_OPEN (ap, msgid);
+ VA_FIXEDARG (ap, cpp_reader *, pfile);
+ VA_FIXEDARG (ap, const char *, msgid);
+
+ if (_cpp_begin_message (pfile, FATAL, 0, 0))
v_message (msgid, ap);
- va_end(ap);
+
+ VA_CLOSE (ap);
}
+/* Print an error at the location of the previously lexed token. */
void
cpp_error VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
{
-#ifndef ANSI_PROTOTYPES
- cpp_reader *pfile;
- const char *msgid;
-#endif
- va_list ap;
-
- VA_START(ap, msgid);
-
-#ifndef ANSI_PROTOTYPES
- pfile = va_arg (ap, cpp_reader *);
- msgid = va_arg (ap, const char *);
-#endif
-
- if (_cpp_begin_message (pfile, ERROR, NULL, 0))
+ VA_OPEN (ap, msgid);
+ VA_FIXEDARG (ap, cpp_reader *, pfile);
+ VA_FIXEDARG (ap, const char *, msgid);
+
+ if (_cpp_begin_message (pfile, ERROR, 0, 0))
v_message (msgid, ap);
- va_end(ap);
+
+ VA_CLOSE (ap);
}
+/* Print an error at a specific location. */
void
cpp_error_with_line VPARAMS ((cpp_reader *pfile, int line, int column,
const char *msgid, ...))
{
-#ifndef ANSI_PROTOTYPES
- cpp_reader *pfile;
- int line;
- int column;
- const char *msgid;
-#endif
- va_list ap;
- cpp_lexer_pos pos;
-
- VA_START (ap, msgid);
-
-#ifndef ANSI_PROTOTYPES
- pfile = va_arg (ap, cpp_reader *);
- line = va_arg (ap, int);
- column = va_arg (ap, int);
- msgid = va_arg (ap, const char *);
-#endif
-
- pos.line = line;
- pos.col = column;
- if (_cpp_begin_message (pfile, ERROR, NULL, &pos))
+ VA_OPEN (ap, msgid);
+ VA_FIXEDARG (ap, cpp_reader *, pfile);
+ VA_FIXEDARG (ap, int, line);
+ VA_FIXEDARG (ap, int, column);
+ VA_FIXEDARG (ap, const char *, msgid);
+
+ if (_cpp_begin_message (pfile, ERROR, line, column))
v_message (msgid, ap);
- va_end(ap);
+
+ VA_CLOSE (ap);
}
/* Error including a message from `errno'. */
cpp_error (pfile, "%s: %s", name, xstrerror (errno));
}
+/* Print a warning at the location of the previously lexed token. */
void
cpp_warning VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
{
-#ifndef ANSI_PROTOTYPES
- cpp_reader *pfile;
- const char *msgid;
-#endif
- va_list ap;
-
- VA_START (ap, msgid);
-
-#ifndef ANSI_PROTOTYPES
- pfile = va_arg (ap, cpp_reader *);
- msgid = va_arg (ap, const char *);
-#endif
-
- if (_cpp_begin_message (pfile, WARNING, NULL, 0))
+ VA_OPEN (ap, msgid);
+ VA_FIXEDARG (ap, cpp_reader *, pfile);
+ VA_FIXEDARG (ap, const char *, msgid);
+
+ if (_cpp_begin_message (pfile, WARNING, 0, 0))
v_message (msgid, ap);
- va_end(ap);
+
+ VA_CLOSE (ap);
}
+/* Print a warning at a specific location. */
void
cpp_warning_with_line VPARAMS ((cpp_reader * pfile, int line, int column,
const char *msgid, ...))
{
-#ifndef ANSI_PROTOTYPES
- cpp_reader *pfile;
- int line;
- int column;
- const char *msgid;
-#endif
- va_list ap;
- cpp_lexer_pos pos;
-
- VA_START (ap, msgid);
-
-#ifndef ANSI_PROTOTYPES
- pfile = va_arg (ap, cpp_reader *);
- line = va_arg (ap, int);
- column = va_arg (ap, int);
- msgid = va_arg (ap, const char *);
-#endif
-
- pos.line = line;
- pos.col = column;
- if (_cpp_begin_message (pfile, WARNING, NULL, &pos))
+ VA_OPEN (ap, msgid);
+ VA_FIXEDARG (ap, cpp_reader *, pfile);
+ VA_FIXEDARG (ap, int, line);
+ VA_FIXEDARG (ap, int, column);
+ VA_FIXEDARG (ap, const char *, msgid);
+
+ if (_cpp_begin_message (pfile, WARNING, line, column))
v_message (msgid, ap);
- va_end(ap);
+
+ VA_CLOSE (ap);
}
+/* Pedwarn at the location of the previously lexed token. */
void
cpp_pedwarn VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
{
-#ifndef ANSI_PROTOTYPES
- cpp_reader *pfile;
- const char *msgid;
-#endif
- va_list ap;
-
- VA_START (ap, msgid);
-
-#ifndef ANSI_PROTOTYPES
- pfile = va_arg (ap, cpp_reader *);
- msgid = va_arg (ap, const char *);
-#endif
-
- if (_cpp_begin_message (pfile, PEDWARN, NULL, 0))
+ VA_OPEN (ap, msgid);
+ VA_FIXEDARG (ap, cpp_reader *, pfile);
+ VA_FIXEDARG (ap, const char *, msgid);
+
+ if (_cpp_begin_message (pfile, PEDWARN, 0, 0))
v_message (msgid, ap);
- va_end(ap);
+
+ VA_CLOSE (ap);
}
+/* Pedwarn at a specific location. */
void
cpp_pedwarn_with_line VPARAMS ((cpp_reader * pfile, int line, int column,
const char *msgid, ...))
{
-#ifndef ANSI_PROTOTYPES
- cpp_reader *pfile;
- int line;
- int column;
- const char *msgid;
-#endif
- va_list ap;
- cpp_lexer_pos pos;
-
- VA_START (ap, msgid);
-
-#ifndef ANSI_PROTOTYPES
- pfile = va_arg (ap, cpp_reader *);
- line = va_arg (ap, int);
- column = va_arg (ap, int);
- msgid = va_arg (ap, const char *);
-#endif
-
- pos.line = line;
- pos.col = column;
- if (_cpp_begin_message (pfile, PEDWARN, NULL, &pos))
- v_message (msgid, ap);
- va_end(ap);
-}
+ VA_OPEN (ap, msgid);
+ VA_FIXEDARG (ap, cpp_reader *, pfile);
+ VA_FIXEDARG (ap, int, line);
+ VA_FIXEDARG (ap, int, column);
+ VA_FIXEDARG (ap, const char *, msgid);
-/* Report a warning (or an error if pedantic_errors)
- giving specified file name and line number, not current. */
-
-void
-cpp_pedwarn_with_file_and_line VPARAMS ((cpp_reader *pfile,
- const char *file, int line, int col,
- const char *msgid, ...))
-{
-#ifndef ANSI_PROTOTYPES
- cpp_reader *pfile;
- const char *file;
- int line;
- int col;
- const char *msgid;
-#endif
- va_list ap;
- cpp_lexer_pos pos;
-
- VA_START (ap, msgid);
-
-#ifndef ANSI_PROTOTYPES
- pfile = va_arg (ap, cpp_reader *);
- file = va_arg (ap, const char *);
- line = va_arg (ap, int);
- col = va_arg (ap, int);
- msgid = va_arg (ap, const char *);
-#endif
-
- pos.line = line;
- pos.col = col;
- if (_cpp_begin_message (pfile, PEDWARN, file, &pos))
+ if (_cpp_begin_message (pfile, PEDWARN, line, column))
v_message (msgid, ap);
- va_end(ap);
+
+ VA_CLOSE (ap);
}
-/* Print an error message not associated with a file. */
+/* Print an error message not associated with the translation unit. */
void
cpp_notice VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
{
-#ifndef ANSI_PROTOTYPES
- cpp_reader *pfile;
- const char *msgid;
-#endif
- va_list ap;
-
- VA_START (ap, msgid);
-
-#ifndef ANSI_PROTOTYPES
- pfile = va_arg (ap, cpp_reader *);
- msgid = va_arg (ap, const char *);
-#endif
+ VA_OPEN (ap, msgid);
+ VA_FIXEDARG (ap, cpp_reader *, pfile);
+ VA_FIXEDARG (ap, const char *, msgid);
if (pfile->errors < CPP_FATAL_LIMIT)
pfile->errors++;
- vfprintf (stderr, _(msgid), ap);
- putc('\n', stderr);
+ v_message (msgid, ap);
- va_end(ap);
+ VA_CLOSE (ap);
}
+/* Print an error message originating from ERRNO and not associated
+ with the translation unit. */
void
cpp_notice_from_errno (pfile, name)
cpp_reader *pfile;
/* Parse C expressions for cpplib.
- Copyright (C) 1987, 1992, 1994, 1995, 1997, 1998, 1999, 2000, 2001
- Free Software Foundation.
+ Copyright (C) 1987, 1992, 1994, 1995, 1997, 1998, 1999, 2000, 2001,
+ 2002 Free Software Foundation.
Contributed by Per Bothner, 1994.
This program is free software; you can redistribute it and/or modify it
unsigned HOST_WIDEST_INT));
static struct op parse_number PARAMS ((cpp_reader *, const cpp_token *));
static struct op parse_defined PARAMS ((cpp_reader *));
-static struct op lex PARAMS ((cpp_reader *, int, cpp_token *));
+static struct op lex PARAMS ((cpp_reader *, int));
static const unsigned char *op_as_text PARAMS ((cpp_reader *, enum cpp_ttype));
struct op
#define SYNTAX_ERROR2(msgid, arg) \
do { cpp_error (pfile, msgid, arg); goto syntax_error; } while(0)
-/* Parse and convert an integer for #if. Accepts decimal, hex, or octal
- with or without size suffixes. */
struct suffix
{
- unsigned char s[4];
- unsigned char u;
- unsigned char l;
+ const unsigned char s[4];
+ const unsigned char u;
+ const unsigned char l;
};
-const struct suffix vsuf_1[] = {
+static const struct suffix vsuf_1[] = {
{ "u", 1, 0 }, { "U", 1, 0 },
{ "l", 0, 1 }, { "L", 0, 1 }
};
-const struct suffix vsuf_2[] = {
+static const struct suffix vsuf_2[] = {
{ "ul", 1, 1 }, { "UL", 1, 1 }, { "uL", 1, 1 }, { "Ul", 1, 1 },
{ "lu", 1, 1 }, { "LU", 1, 1 }, { "Lu", 1, 1 }, { "lU", 1, 1 },
{ "ll", 0, 2 }, { "LL", 0, 2 }
};
-const struct suffix vsuf_3[] = {
+static const struct suffix vsuf_3[] = {
{ "ull", 1, 2 }, { "ULL", 1, 2 }, { "uLL", 1, 2 }, { "Ull", 1, 2 },
{ "llu", 1, 2 }, { "LLU", 1, 2 }, { "LLu", 1, 2 }, { "llU", 1, 2 }
};
#define Nsuff(tab) (sizeof tab / sizeof (struct suffix))
+/* Parse and convert what is presumably an integer in TOK. Accepts
+ decimal, hex, or octal with or without size suffixes. Returned op
+ is CPP_ERROR on error, otherwise it is a CPP_NUMBER. */
static struct op
parse_number (pfile, tok)
cpp_reader *pfile;
{
c = *p;
- if (c >= '0' && c <= '9')
- digit = c - '0';
- /* We believe that in all live character sets, a-f are
- consecutive, and so are A-F. */
- else if (base == 16 && c >= 'a' && c <= 'f')
- digit = c - 'a' + 10;
- else if (base == 16 && c >= 'A' && c <= 'F')
- digit = c - 'A' + 10;
+ if (ISDIGIT (c)
+ || (base == 16 && ISXDIGIT (c)))
+ digit = hex_value (c);
else
break;
}
op.value = n;
- op.op = CPP_INT;
+ op.op = CPP_NUMBER;
return op;
invalid_suffix:
return op;
}
+/* Handle meeting "defined" in a preprocessor expression. */
static struct op
parse_defined (pfile)
cpp_reader *pfile;
{
int paren = 0;
cpp_hashnode *node = 0;
- cpp_token token;
+ const cpp_token *token;
struct op op;
+ cpp_context *initial_context = pfile->context;
/* Don't expand macros. */
pfile->state.prevent_expansion++;
- cpp_get_token (pfile, &token);
- if (token.type == CPP_OPEN_PAREN)
+ token = cpp_get_token (pfile);
+ if (token->type == CPP_OPEN_PAREN)
{
paren = 1;
- cpp_get_token (pfile, &token);
+ token = cpp_get_token (pfile);
}
- if (token.type == CPP_NAME)
+ if (token->type == CPP_NAME)
{
- node = token.val.node;
- if (paren)
+ node = token->val.node;
+ if (paren && cpp_get_token (pfile)->type != CPP_CLOSE_PAREN)
{
- cpp_get_token (pfile, &token);
- if (token.type != CPP_CLOSE_PAREN)
- {
- cpp_error (pfile, "missing ')' after \"defined\"");
- node = 0;
- }
+ cpp_error (pfile, "missing ')' after \"defined\"");
+ node = 0;
}
}
else
{
cpp_error (pfile, "operator \"defined\" requires an identifier");
- if (token.flags & NAMED_OP)
+ if (token->flags & NAMED_OP)
{
cpp_token op;
op.flags = 0;
- op.type = token.type;
+ op.type = token->type;
cpp_error (pfile,
"(\"%s\" is an alternative token for \"%s\" in C++)",
- cpp_token_as_text (pfile, &token),
+ cpp_token_as_text (pfile, token),
cpp_token_as_text (pfile, &op));
}
}
op.op = CPP_ERROR;
else
{
+ if (pfile->context != initial_context)
+ cpp_warning (pfile, "this use of \"defined\" may not be portable");
+
op.value = node->type == NT_MACRO;
op.unsignedp = 0;
- op.op = CPP_INT;
+ op.op = CPP_NUMBER;
- /* No macros? At top of file? */
- if (pfile->mi_state == MI_OUTSIDE && pfile->mi_cmacro == 0
- && pfile->mi_if_not_defined == MI_IND_NOT && pfile->mi_lexed == 1)
- {
- cpp_start_lookahead (pfile);
- cpp_get_token (pfile, &token);
- if (token.type == CPP_EOF)
- pfile->mi_ind_cmacro = node;
- cpp_stop_lookahead (pfile, 0);
- }
+ /* A possible controlling macro of the form #if !defined ().
+ _cpp_parse_expr checks there was no other junk on the line. */
+ pfile->mi_ind_cmacro = node;
}
pfile->state.prevent_expansion--;
return op;
}
-/* Read one token. */
-
+/* Read a token. The returned type is CPP_NUMBER for a valid number
+ (an interpreted preprocessing number or character constant, or the
+ result of the "defined" or "#" operators), CPP_ERROR on error,
+ CPP_EOF, or the type of an operator token. */
static struct op
-lex (pfile, skip_evaluation, token)
+lex (pfile, skip_evaluation)
cpp_reader *pfile;
int skip_evaluation;
- cpp_token *token;
{
struct op op;
-
- cpp_get_token (pfile, token);
+ const cpp_token *token = cpp_get_token (pfile);
switch (token->type)
{
- case CPP_INT:
case CPP_NUMBER:
return parse_number (pfile, token);
{
unsigned int chars_seen;
- /* This is always a signed type. */
- op.unsignedp = 0;
- op.op = CPP_INT;
+ if (token->type == CPP_CHAR)
+ op.unsignedp = 0;
+ else
+ op.unsignedp = WCHAR_UNSIGNED;
+ op.op = CPP_NUMBER;
op.value = cpp_interpret_charconst (pfile, token, 1, 0, &chars_seen);
return op;
}
case CPP_WSTRING:
SYNTAX_ERROR ("string constants are not valid in #if");
- case CPP_FLOAT:
- SYNTAX_ERROR ("floating point numbers are not valid in #if");
-
case CPP_OTHER:
if (ISGRAPH (token->val.c))
SYNTAX_ERROR2 ("invalid character '%c' in #if", token->val.c);
case CPP_NAME:
if (token->val.node == pfile->spec_nodes.n_defined)
- {
- if (pfile->context->prev && CPP_PEDANTIC (pfile))
- cpp_pedwarn (pfile, "\"defined\" operator appears during macro expansion");
-
- return parse_defined (pfile);
- }
+ return parse_defined (pfile);
else if (CPP_OPTION (pfile, cplusplus)
&& (token->val.node == pfile->spec_nodes.n_true
|| token->val.node == pfile->spec_nodes.n_false))
{
- op.op = CPP_INT;
+ op.op = CPP_NUMBER;
op.unsignedp = 0;
op.value = (token->val.node == pfile->spec_nodes.n_true);
}
else
{
- /* Controlling #if expressions cannot contain identifiers (they
- could become macros in the future). */
- pfile->mi_state = MI_FAILED;
-
- op.op = CPP_INT;
+ op.op = CPP_NUMBER;
op.unsignedp = 0;
op.value = 0;
{
int temp;
- op.op = CPP_INT;
+ op.op = CPP_NUMBER;
if (_cpp_test_assertion (pfile, &temp))
op.op = CPP_ERROR;
op.unsignedp = 0;
return op;
}
- case CPP_NOT:
- /* We don't worry about its position here. */
- pfile->mi_if_not_defined = MI_IND_NOT;
- /* Fall through. */
-
default:
if (((int) token->type > (int) CPP_EQ
&& (int) token->type < (int) CPP_PLUS_EQ)
return op;
}
+/* Warn if appropriate on overflow. */
static void
integer_overflow (pfile)
cpp_reader *pfile;
cpp_pedwarn (pfile, "integer overflow in preprocessor expression");
}
+/* Handle shifting A left by B bits. UNSIGNEDP is non-zero if A is
+ unsigned. */
static HOST_WIDEST_INT
left_shift (pfile, a, unsignedp, b)
cpp_reader *pfile;
}
}
+/* Handle shifting A right by B bits. UNSIGNEDP is non-zero if A is
+ unsigned. */
static HOST_WIDEST_INT
right_shift (pfile, a, unsignedp, b)
cpp_reader *pfile ATTRIBUTE_UNUSED;
#define FLAG_BITS 8
#define FLAG_MASK ((1 << FLAG_BITS) - 1)
#define PRIO_SHIFT (FLAG_BITS + 1)
-#define EXTRACT_PRIO(cnst) (cnst >> FLAG_BITS)
-#define EXTRACT_FLAGS(cnst) (cnst & FLAG_MASK)
+#define EXTRACT_PRIO(CNST) ((CNST) >> FLAG_BITS)
+#define EXTRACT_FLAGS(CNST) ((CNST) & FLAG_MASK)
/* Flags. */
#define HAVE_VALUE (1 << 0)
/* Parse and evaluate a C expression, reading from PFILE.
Returns the truth value of the expression. */
-
int
_cpp_parse_expr (pfile)
cpp_reader *pfile;
struct op init_stack[INIT_STACK_SIZE];
struct op *stack = init_stack;
struct op *limit = stack + INIT_STACK_SIZE;
- cpp_token token;
- register struct op *top = stack + 1;
+ struct op *top = stack + 1;
int skip_evaluation = 0;
int result;
+ unsigned int lex_count, saw_leading_not;
/* Set up detection of #if ! defined(). */
- pfile->mi_lexed = 0;
- pfile->mi_if_not_defined = MI_IND_NONE;
+ pfile->mi_ind_cmacro = 0;
+ saw_leading_not = 0;
+ lex_count = 0;
/* We've finished when we try to reduce this. */
top->op = CPP_EOF;
struct op op;
/* Read a token */
- op = lex (pfile, skip_evaluation, &token);
- pfile->mi_lexed++;
+ op = lex (pfile, skip_evaluation);
+ lex_count++;
/* If the token is an operand, push its value and get next
token. If it is an operator, get its priority and flags, and
case CPP_ERROR:
goto syntax_error;
push_immediate:
- case CPP_INT:
+ case CPP_NUMBER:
/* Push a value onto the stack. */
if (top->flags & HAVE_VALUE)
SYNTAX_ERROR ("missing binary operator");
continue;
case CPP_EOF: prio = FORCE_REDUCE_PRIO; break;
+
+ case CPP_NOT:
+ saw_leading_not = lex_count == 1;
+ prio = op_to_prio[op.op];
+ break;
case CPP_PLUS:
case CPP_MINUS: prio = PLUS_PRIO; if (top->flags & HAVE_VALUE) break;
/* else unary; fall through */
{
if (top->flags & HAVE_VALUE)
SYNTAX_ERROR2 ("missing binary operator before '%s'",
- op_as_text (pfile, top->op));
+ op_as_text (pfile, op.op));
}
else
{
if (!(top->flags & HAVE_VALUE))
SYNTAX_ERROR2 ("operator '%s' has no left operand",
- op_as_text (pfile, top->op));
+ op_as_text (pfile, op.op));
}
/* Check for and handle stack overflow. */
}
done:
+ /* The controlling macro expression is only valid if we called lex 3
+ times: <!> <defined expression> and <EOF>. push_conditional ()
+ checks that we are at top-of-file. */
+ if (pfile->mi_ind_cmacro && !(saw_leading_not && lex_count == 3))
+ pfile->mi_ind_cmacro = 0;
+
result = (top[1].value != 0);
+
if (top != stack)
CPP_ICE ("unbalanced stack in #if");
else if (!(top[1].flags & HAVE_VALUE))
return result;
}
+/* Output OP as text for diagnostics. */
static const unsigned char *
op_as_text (pfile, op)
cpp_reader *pfile;
/* Part of CPP library. (include file handling)
Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1998,
- 1999, 2000, 2001 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Written by Per Bothner, 1994.
Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987
# ifndef MMAP_THRESHOLD
# define MMAP_THRESHOLD 3 /* Minimum page count to mmap the file. */
# endif
+# if MMAP_THRESHOLD
+# define TEST_THRESHOLD(size, pagesize) \
+ (size / pagesize >= MMAP_THRESHOLD && (size % pagesize) != 0)
+ /* Use mmap if the file is big enough to be worth it (controlled
+ by MMAP_THRESHOLD) and if we can safely count on there being
+ at least one readable NUL byte after the end of the file's
+ contents. This is true for all tested operating systems when
+ the file size is not an exact multiple of the page size. */
+# ifndef __CYGWIN__
+# define SHOULD_MMAP(size, pagesize) TEST_THRESHOLD (size, pagesize)
+# else
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+ /* Cygwin can't correctly emulate mmap under Windows 9x style systems so
+ disallow use of mmap on those systems. Windows 9x does not zero fill
+ memory at EOF and beyond, as required. */
+# define SHOULD_MMAP(size, pagesize) ((GetVersion() & 0x80000000) \
+ ? 0 : TEST_THRESHOLD (size, pagesize))
+# endif
+# endif
#else /* No MMAP_FILE */
# undef MMAP_THRESHOLD
unsigned char mapped; /* file buffer is mmapped */
};
+/* Variable length record files on VMS will have a stat size that includes
+ record control characters that won't be included in the read size. */
+#ifdef VMS
+# define FAB_C_VAR 2 /* variable length records (see Starlet fabdef.h) */
+# define STAT_SIZE_TOO_BIG(ST) ((ST).st_fab_rfm == FAB_C_VAR)
+#else
+# define STAT_SIZE_TOO_BIG(ST) 0
+#endif
+
/* The cmacro works like this: If it's NULL, the file is to be
included again. If it's NEVER_REREAD, the file is never to be
included again. Otherwise it is a macro hashnode, and the file is
enum include_type));
static struct include_file *open_file PARAMS ((cpp_reader *, const char *));
static int read_include_file PARAMS ((cpp_reader *, struct include_file *));
-static void stack_include_file PARAMS ((cpp_reader *, struct include_file *));
+static bool stack_include_file PARAMS ((cpp_reader *, struct include_file *));
static void purge_cache PARAMS ((struct include_file *));
static void destroy_node PARAMS ((splay_tree_value));
static int report_missing_guard PARAMS ((splay_tree_node, void *));
Returns an include_file structure with an open file descriptor on
success, or NULL on failure. */
-
static struct include_file *
open_file (pfile, filename)
cpp_reader *pfile;
return 0;
}
- /* Don't reopen an idempotent file. */
+ /* Don't reopen an idempotent file. */
if (DO_NOT_REREAD (file))
return file;
-
- /* Don't reopen one which is already loaded. */
+
+ /* Don't reopen one which is already loaded. */
if (file->buffer != NULL)
return file;
if (file->fd != -1 && fstat (file->fd, &file->st) == 0)
{
+ if (!S_ISDIR (file->st.st_mode))
+ return file;
+
/* If it's a directory, we return null and continue the search
as the file we're looking for may appear elsewhere in the
search path. */
- if (S_ISDIR (file->st.st_mode))
- errno = ENOENT;
- else
- {
- /* Mark a regular, zero-length file never-reread now. */
- if (S_ISREG (file->st.st_mode) && file->st.st_size == 0)
- {
- _cpp_never_reread (file);
- close (file->fd);
- file->fd = -1;
- }
-
- return file;
- }
+ errno = ENOENT;
+ close (file->fd);
+ file->fd = -1;
}
- /* Don't issue an error message if the file doesn't exist. */
file->err_no = errno;
- if (errno != ENOENT && errno != ENOTDIR)
- cpp_error_from_errno (pfile, file->name);
-
return 0;
}
-/* Place the file referenced by INC into a new buffer on PFILE's
- stack. If there are errors, or the file should not be re-included,
- a null (zero-length) buffer is pushed. */
-
-static void
+/* Place the file referenced by INC into a new buffer on the buffer
+ stack, unless there are errors, or the file is not re-included
+ because of e.g. multiple-include guards. Returns true if a buffer
+ is stacked. */
+static bool
stack_include_file (pfile, inc)
cpp_reader *pfile;
struct include_file *inc;
{
- size_t len = 0;
cpp_buffer *fp;
- int sysp, deps_sysp;
+ int sysp;
+ const char *filename;
- /* We'll try removing deps_sysp after the release of 3.0. */
- deps_sysp = pfile->system_include_depth != 0;
- sysp = MAX ((pfile->buffer ? pfile->buffer->sysp : 0),
+ if (DO_NOT_REREAD (inc))
+ return false;
+
+ sysp = MAX ((pfile->map ? pfile->map->sysp : 0),
(inc->foundhere ? inc->foundhere->sysp : 0));
/* For -M, add the file to the dependencies on its first inclusion. */
- if (CPP_OPTION (pfile, print_deps) > deps_sysp && !inc->include_count)
+ if (CPP_OPTION (pfile, print_deps) > sysp && !inc->include_count)
deps_add_dep (pfile->deps, inc->name);
/* Not in cache? */
- if (! DO_NOT_REREAD (inc) && ! inc->buffer)
+ if (! inc->buffer)
{
- /* If an error occurs, do not try to read this file again. */
if (read_include_file (pfile, inc))
+ {
+ /* If an error occurs, do not try to read this file again. */
+ _cpp_never_reread (inc);
+ return false;
+ }
+ /* Mark a regular, zero-length file never-reread. We read it,
+ NUL-terminate it, and stack it once, so preprocessing a main
+ file of zero length does not raise an error. */
+ if (S_ISREG (inc->st.st_mode) && inc->st.st_size == 0)
_cpp_never_reread (inc);
close (inc->fd);
inc->fd = -1;
}
- if (! DO_NOT_REREAD (inc))
- {
- len = inc->st.st_size;
- if (pfile->buffer)
- {
- /* We don't want MI guard advice for the main file. */
- inc->include_count++;
-
- /* Handle -H option. */
- if (CPP_OPTION (pfile, print_include_names))
- {
- for (fp = pfile->buffer; fp; fp = fp->prev)
- putc ('.', stderr);
- fprintf (stderr, " %s\n", inc->name);
- }
- }
- }
+ if (pfile->buffer)
+ /* We don't want MI guard advice for the main file. */
+ inc->include_count++;
/* Push a buffer. */
- fp = cpp_push_buffer (pfile, inc->buffer, len, BUF_FILE, inc->name);
+ fp = cpp_push_buffer (pfile, inc->buffer, inc->st.st_size,
+ /* from_stage3 */ CPP_OPTION (pfile, preprocessed), 0);
fp->inc = inc;
fp->inc->refcnt++;
- fp->sysp = sysp;
/* Initialise controlling macro state. */
- pfile->mi_state = MI_OUTSIDE;
+ pfile->mi_valid = true;
pfile->mi_cmacro = 0;
- pfile->include_depth++;
/* Generate the call back. */
- fp->lineno = 0;
- _cpp_do_file_change (pfile, FC_ENTER, 0, 0);
- fp->lineno = 1;
+ filename = inc->name;
+ if (*filename == '\0')
+ filename = "<stdin>";
+ _cpp_do_file_change (pfile, LC_ENTER, filename, 1, sysp);
+
+ return true;
}
/* Read the file referenced by INC into the file cache.
and block devices.
FIXME: Flush file cache and try again if we run out of memory. */
-
static int
read_include_file (pfile, inc)
cpp_reader *pfile;
#ifndef __BORLANDC__
if (inc->st.st_size > INTTYPE_MAXIMUM (ssize_t))
{
- cpp_error (pfile, "%s is too large (%lu > %lu)", inc->name,
+ cpp_error (pfile, "%s is too large (%lu > %lu)", inc->name,
(unsigned long)inc->st.st_size,
INTTYPE_MAXIMUM(ssize_t));
goto fail;
}
-#endif
+#endif
size = inc->st.st_size;
inc->mapped = 0;
if (pagesize == -1)
pagesize = getpagesize ();
- if (size / pagesize >= MMAP_THRESHOLD)
+ if (SHOULD_MMAP (size, pagesize))
{
buf = (U_CHAR *) mmap (0, size, PROT_READ, MAP_PRIVATE, inc->fd, 0);
if (buf == (U_CHAR *)-1)
else
#endif
{
- buf = (U_CHAR *) xmalloc (size);
+ buf = (U_CHAR *) xmalloc (size + 1);
offset = 0;
while (offset < size)
{
goto perror_fail;
if (count == 0)
{
-#ifndef __BORLANDC__
- /* For some reason, even though we opened with O_BINARY,
- * Borland C++ seems to insist on doing CR/LF -> LF
- * translations for us, which results in the file appearing
- * shorter than stat told us it should be.
- *
- * This sucks, but don't bother throwing a warning.
- */
- cpp_warning (pfile, "%s is shorter than expected (expected %u, got %u)",
- inc->name, inc->st.st_size, offset);
-#endif
- inc->st.st_size = offset;
+ if (!STAT_SIZE_TOO_BIG (inc->st))
+ {
+#ifndef __BORLANDC__
+ /* For some reason, even though we opened with O_BINARY,
+ * Borland C++ seems to insist on doing CR/LF -> LF
+ * translations for us, which results in the file appearing
+ * shorter than stat told us it should be.
+ *
+ * This sucks, but don't bother throwing a warning.
+ */
+ cpp_warning (pfile, "%s is shorter than expected (expected %u, got %u)",
+ inc->name, inc->st.st_size, offset);
+#endif
+ }
+ size = offset;
+ buf = xrealloc (buf, size + 1);
+ inc->st.st_size = size;
break;
}
offset += count;
}
+ /* The lexer requires that the buffer be NUL-terminated. */
+ buf[size] = '\0';
}
}
else if (S_ISBLK (inc->st.st_mode))
bigger than the majority of C source files. */
size = 8 * 1024;
- buf = (U_CHAR *) xmalloc (size);
+ buf = (U_CHAR *) xmalloc (size + 1);
offset = 0;
while ((count = read (inc->fd, buf + offset, size - offset)) > 0)
{
offset += count;
if (offset == size)
- buf = xrealloc (buf, (size *= 2));
+ {
+ size *= 2;
+ buf = xrealloc (buf, size + 1);
+ }
}
if (count < 0)
goto perror_fail;
- if (offset < size)
- buf = xrealloc (buf, offset);
+ if (offset + 1 < size)
+ buf = xrealloc (buf, offset + 1);
+
+ /* The lexer requires that the buffer be NUL-terminated. */
+ buf[offset] = '\0';
inc->st.st_size = offset;
}
return 1;
}
+/* Drop INC's buffer from memory, if we are unlikely to need it again. */
static void
purge_cache (inc)
struct include_file *inc;
nd = splay_tree_lookup (pfile->all_include_files, (splay_tree_key) fname);
return (nd && nd->value);
}
-
+
/* Search directory path for the file. */
name = (char *) alloca (strlen (fname) + pfile->max_include_len + 2);
for (path = CPP_OPTION (pfile, quote_include); path; path = path->next)
un-openable), in which case an error code will be in errno. If
there is no include path to use it returns NO_INCLUDE_PATH,
otherwise an include_file structure. If this request originates
- from a #include_next directive, set INCLUDE_NEXT to true. */
-
+ from a directive of TYPE #include_next, set INCLUDE_NEXT to true. */
static struct include_file *
find_include_file (pfile, header, type)
cpp_reader *pfile;
if (path == NULL)
{
- cpp_error (pfile, "No include path in which to find %s", fname);
+ cpp_error (pfile, "no include path in which to find %s", fname);
return NO_INCLUDE_PATH;
}
name = (char *) alloca (strlen (fname) + pfile->max_include_len + 2);
for (; path; path = path->next)
{
- memcpy (name, path->name, path->len);
- name[path->len] = '/';
- strcpy (&name[path->len + 1], fname);
+ int len = path->len;
+ memcpy (name, path->name, len);
+ /* Don't turn / into // or // into ///; // may be a namespace
+ escape. */
+ if (name[len-1] == '/')
+ len--;
+ name[len] = '/';
+ strcpy (&name[len + 1], fname);
if (CPP_OPTION (pfile, remap))
n = remap_filename (pfile, name, path);
else
/* 1 = system header, 2 = system header to be treated as C. */
if (syshdr)
flags = 1 + (externc != 0);
- pfile->buffer->sysp = flags;
- _cpp_do_file_change (pfile, FC_RENAME, pfile->buffer->nominal_fname,
- pfile->buffer->lineno);
+ _cpp_do_file_change (pfile, LC_RENAME, pfile->map->to_file,
+ SOURCE_LINE (pfile->map, pfile->line), flags);
}
/* Report on all files that might benefit from a multiple include guard.
(PTR) &banner);
}
+/* Callback function for splay_tree_foreach(). */
static int
report_missing_guard (n, b)
splay_tree_node n;
return 0;
}
-/* Create a dependency, or issue an error message as appropriate. */
+/* Create a dependency for file FNAME, or issue an error message as
+ appropriate. ANGLE_BRACKETS is non-zero if the file was bracketed
+ like <..>. */
static void
handle_missing_header (pfile, fname, angle_brackets)
cpp_reader *pfile;
const char *fname;
int angle_brackets;
{
- /* We will try making the RHS pfile->buffer->sysp after 3.0. */
- int print_dep = CPP_PRINT_DEPS(pfile) > (angle_brackets
- || pfile->system_include_depth);
+ int print_dep = CPP_PRINT_DEPS(pfile) > (angle_brackets || pfile->map->sysp);
if (CPP_OPTION (pfile, print_deps_missing_files) && print_dep)
{
we can still produce correct output. Otherwise, we can't produce
correct output, because there may be dependencies we need inside
the missing file, and we don't know what directory this missing
- file exists in. FIXME: Use a future cpp_diagnotic_with_errno ()
+ file exists in. FIXME: Use a future cpp_diagnostic_with_errno ()
for both of these cases. */
else if (CPP_PRINT_DEPS (pfile) && ! print_dep)
cpp_warning (pfile, "%s: %s", fname, xstrerror (errno));
cpp_error_from_errno (pfile, fname);
}
-/* Returns non-zero if a buffer was stacked. */
-int
+/* Handles #include-family directives (distinguished by TYPE),
+ including HEADER, and the command line -imacros and -include.
+ Returns true if a buffer was stacked. */
+bool
_cpp_execute_include (pfile, header, type)
cpp_reader *pfile;
const cpp_token *header;
enum include_type type;
{
+ bool stacked = false;
struct include_file *inc = find_include_file (pfile, header, type);
if (inc == 0)
header->type == CPP_HEADER_NAME);
else if (inc != NO_INCLUDE_PATH)
{
- if (header->type == CPP_HEADER_NAME)
- pfile->system_include_depth++;
-
- stack_include_file (pfile, inc);
+ stacked = stack_include_file (pfile, inc);
if (type == IT_IMPORT)
_cpp_never_reread (inc);
-
- return 1;
}
- return 0;
+ return stacked;
}
/* Locate HEADER, and determine whether it is newer than the current
const cpp_token *header;
{
struct include_file *inc = find_include_file (pfile, header, 0);
-
+
if (inc == NULL || inc == NO_INCLUDE_PATH)
return -1;
close (inc->fd);
inc->fd = -1;
}
-
+
return inc->st.st_mtime > pfile->buffer->inc->st.st_mtime;
}
-/* Push an input buffer and load it up with the contents of FNAME.
- If FNAME is "", read standard input. */
-int
+/* Push an input buffer and load it up with the contents of FNAME. If
+ FNAME is "", read standard input. Return true if a buffer was
+ stacked. */
+bool
_cpp_read_file (pfile, fname)
cpp_reader *pfile;
const char *fname;
if (f == NULL)
{
cpp_error_from_errno (pfile, fname);
- return 0;
+ return false;
}
- stack_include_file (pfile, f);
- return 1;
+ return stack_include_file (pfile, f);
}
-/* Do appropriate cleanup when a file buffer is popped off the input
- stack. */
-void
-_cpp_pop_file_buffer (pfile, buf)
+/* Do appropriate cleanup when a file INC's buffer is popped off the
+ input stack. Push the next -include file, if any remain. */
+bool
+_cpp_pop_file_buffer (pfile, inc)
cpp_reader *pfile;
- cpp_buffer *buf;
+ struct include_file *inc;
{
- struct include_file *inc = buf->inc;
-
- if (pfile->system_include_depth)
- pfile->system_include_depth--;
- if (pfile->include_depth)
- pfile->include_depth--;
+ bool pushed = false;
/* Record the inclusion-preventing macro, which could be NULL
- meaning no controlling macro, if we haven't got it already. */
- if (pfile->mi_state == MI_OUTSIDE && inc->cmacro == NULL)
+ meaning no controlling macro. */
+ if (pfile->mi_valid && inc->cmacro == NULL)
inc->cmacro = pfile->mi_cmacro;
/* Invalidate control macros in the #including file. */
- pfile->mi_state = MI_FAILED;
+ pfile->mi_valid = false;
inc->refcnt--;
if (inc->refcnt == 0 && DO_NOT_REREAD (inc))
purge_cache (inc);
+
+ /* Don't generate a callback for popping the main file. */
+ if (pfile->buffer)
+ {
+ _cpp_do_file_change (pfile, LC_LEAVE, 0, 0, 0);
+
+ /* Finally, push the next -included file, if any. */
+ if (!pfile->buffer->prev)
+ pushed = _cpp_push_next_buffer (pfile);
+ }
+
+ return pushed;
}
/* Returns the first place in the include chain to start searching for
if (dlen)
{
/* We don't guarantee NAME is null-terminated. This saves
- allocating and freeing memory, and duplicating it when faking
- buffers in cpp_push_buffer. Drop a trailing '/'. */
+ allocating and freeing memory. Drop a trailing '/'. */
buffer->dir.name = buffer->inc->name;
if (dlen > 1)
dlen--;
buffer->dir.len = dlen;
buffer->dir.next = CPP_OPTION (pfile, quote_include);
- buffer->dir.sysp = buffer->sysp;
+ buffer->dir.sysp = pfile->map->sysp;
}
return &buffer->dir;
such as DOS. The format of the file name map file is just a series
of lines with two tokens on each line. The first token is the name
to map, and the second token is the actual name to use. */
-
struct file_name_map
{
struct file_name_map *map_next;
#define FILE_NAME_MAP_FILE "header.gcc"
/* Read a space delimited string of unlimited length from a stdio
- file. */
-
+ file F. */
static char *
read_filename_string (ch, f)
int ch;
}
/* This structure holds a linked list of file name maps, one per directory. */
-
struct file_name_map_list
{
struct file_name_map_list *map_list_next;
};
/* Read the file name map file for DIRNAME. */
-
static struct file_name_map *
read_name_map (pfile, dirname)
cpp_reader *pfile;
const char *dirname;
{
- register struct file_name_map_list *map_list_ptr;
+ struct file_name_map_list *map_list_ptr;
char *name;
FILE *f;
ptr->map_to[dirlen] = '/';
strcpy (ptr->map_to + dirlen + 1, to);
free (to);
- }
+ }
ptr->map_next = map_list_ptr->map_list_map;
map_list_ptr->map_list_map = ptr;
}
fclose (f);
}
-
+
/* Add this information to the cache. */
map_list_ptr->map_list_next = CPP_OPTION (pfile, map_list);
CPP_OPTION (pfile, map_list) = map_list_ptr;
return map_list_ptr->map_list_map;
-}
+}
/* Remap an unsimplified path NAME based on the file_name_map (if any)
for LOC. */
if (! loc->name_map)
return name;
}
-
+
/* This works since NAME has not been simplified yet. */
from = name + loc->len + 1;
-
+
for (map = loc->name_map; map; map = map->map_next)
if (!strcmp (map->map_from, from))
return map->map_to;
memcpy (dir, name, p - name);
dir[p - name] = '\0';
from = p + 1;
-
+
for (map = read_name_map (pfile, dir); map; map = map->map_next)
if (! strcmp (map->map_from, from))
return map->map_to;
Guarantees no trailing slashes. All transforms reduce the length
of the string. Returns PATH. errno is 0 if no error occurred;
nonzero if an error occurred when using stat () or lstat (). */
-
char *
_cpp_simplify_pathname (path)
char *path;
return path;
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
- /* Convert all backslashes to slashes. */
+ /* Convert all backslashes to slashes. */
for (from = path; *from; from++)
if (*from == '\\') *from = '/';
-
- /* Skip over leading drive letter if present. */
+
+ /* Skip over leading drive letter if present. */
if (ISALPHA (path[0]) && path[1] == ':')
from = to = &path[2];
else
#else
from = to = path;
#endif
-
+
/* Remove redundant leading /s. */
if (*from == '/')
{
if (move_base)
base = to;
}
-
+
/* Change the empty string to "." so that it is not treated as stdin.
Null terminate. */
if (to == path)
/* Hash tables for the CPP library.
Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1998,
- 1999, 2000 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Written by Per Bothner, 1994.
Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987
/* Return an identifier node for hashtable.c. Used by cpplib except
when integrated with the C front ends. */
-
static cpp_hashnode *
alloc_node (table)
hash_table *table;
{
cpp_hashnode *node;
-
+
node = (cpp_hashnode *) obstack_alloc (&table->pfile->hash_ob,
sizeof (cpp_hashnode));
memset ((PTR) node, 0, sizeof (cpp_hashnode));
/* Set up the identifier hash table. Use TABLE if non-null, otherwise
create our own. */
-
void
_cpp_init_hashtable (pfile, table)
cpp_reader *pfile;
hash_table *table;
{
+ struct spec_nodes *s;
+
if (table == NULL)
{
pfile->our_hashtable = 1;
table->pfile = pfile;
pfile->hash_table = table;
+
+ /* Now we can initialize things that use the hash table. */
+ _cpp_init_directives (pfile);
+ _cpp_init_internal_pragmas (pfile);
+
+ s = &pfile->spec_nodes;
+ s->n_defined = cpp_lookup (pfile, DSC("defined"));
+ s->n_true = cpp_lookup (pfile, DSC("true"));
+ s->n_false = cpp_lookup (pfile, DSC("false"));
+ s->n__STRICT_ANSI__ = cpp_lookup (pfile, DSC("__STRICT_ANSI__"));
+ s->n__VA_ARGS__ = cpp_lookup (pfile, DSC("__VA_ARGS__"));
+ s->n__VA_ARGS__->flags |= NODE_DIAGNOSTIC;
+ /* SDCC _asm specific */
+ s->n__asm = cpp_lookup (pfile, DSC("_asm"));
+
}
/* Tear down the identifier hash table. */
-
void
_cpp_destroy_hashtable (pfile)
cpp_reader *pfile;
{
if (pfile->our_hashtable)
{
- free (pfile->hash_table);
+ ht_destroy (pfile->hash_table);
obstack_free (&pfile->hash_ob, 0);
}
}
/* Returns the hash entry for the STR of length LEN, creating one
if necessary. */
-
cpp_hashnode *
cpp_lookup (pfile, str, len)
cpp_reader *pfile;
}
/* Determine whether the str STR, of length LEN, is a defined macro. */
-
int
cpp_defined (pfile, str, len)
cpp_reader *pfile;
/* For all nodes in the hashtable, callback CB with parameters PFILE,
the node, and V. */
-
void
cpp_forall_identifiers (pfile, cb, v)
cpp_reader *pfile;
/* Part of CPP library.
- Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
+ Free Software Foundation, Inc.
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
#define CPP_OPTION(PFILE, OPTION) ((PFILE)->opts.OPTION)
#define CPP_BUFFER(PFILE) ((PFILE)->buffer)
-#define CPP_BUF_LINE(BUF) ((BUF)->lineno)
#define CPP_BUF_COLUMN(BUF, CUR) ((CUR) - (BUF)->line_base + (BUF)->col_adjust)
#define CPP_BUF_COL(BUF) CPP_BUF_COLUMN(BUF, (BUF)->cur)
efficiency, and partly to limit runaway recursion. */
#define CPP_STACK_MAX 200
-/* Memory pools. */
-#define POOL_ALIGN(size, align) (((size) + ((align) - 1)) & ~((align) - 1))
-#define POOL_FRONT(p) ((p)->cur->front)
-#define POOL_LIMIT(p) ((p)->cur->limit)
-#define POOL_BASE(p) ((p)->cur->base)
-#define POOL_SIZE(p) ((p)->cur->limit - (p)->cur->base)
-#define POOL_ROOM(p) ((p)->cur->limit - (p)->cur->front)
-#define POOL_USED(p) ((p)->cur->front - (p)->cur->base)
-#define POOL_COMMIT(p, len) do {\
- ((p)->cur->front += POOL_ALIGN (len, (p)->align));\
- if ((p)->cur->front > (p)->cur->limit) abort ();} while (0)
-
-typedef struct cpp_chunk cpp_chunk;
-struct cpp_chunk
+/* A generic memory buffer, and operations on it. */
+typedef struct _cpp_buff _cpp_buff;
+struct _cpp_buff
{
- cpp_chunk *next;
- unsigned char *front;
- unsigned char *limit;
- unsigned char *base;
+ struct _cpp_buff *next;
+ unsigned char *base, *cur, *limit;
};
-typedef struct cpp_pool cpp_pool;
-struct cpp_pool
-{
- struct cpp_chunk *cur, *locked;
- unsigned char *pos; /* Current position. */
- unsigned int align;
- unsigned int locks;
-};
+extern _cpp_buff *_cpp_get_buff PARAMS ((cpp_reader *, size_t));
+extern void _cpp_release_buff PARAMS ((cpp_reader *, _cpp_buff *));
+extern void _cpp_extend_buff PARAMS ((cpp_reader *, _cpp_buff **, size_t));
+extern _cpp_buff *_cpp_append_extend_buff PARAMS ((cpp_reader *, _cpp_buff *,
+ size_t));
+extern void _cpp_free_buff PARAMS ((_cpp_buff *));
+extern unsigned char *_cpp_aligned_alloc PARAMS ((cpp_reader *, size_t));
+extern unsigned char *_cpp_unaligned_alloc PARAMS ((cpp_reader *, size_t));
+
+#define BUFF_ROOM(BUFF) (size_t) ((BUFF)->limit - (BUFF)->cur)
+#define BUFF_FRONT(BUFF) ((BUFF)->cur)
+#define BUFF_LIMIT(BUFF) ((BUFF)->limit)
/* List of directories to look for include files in. */
struct search_path
struct file_name_map *name_map;
};
-/* Multiple-include optimisation. */
-enum mi_state {MI_FAILED = 0, MI_OUTSIDE};
-enum mi_ind {MI_IND_NONE = 0, MI_IND_NOT};
-
/* #include types. */
enum include_type {IT_INCLUDE, IT_INCLUDE_NEXT, IT_IMPORT, IT_CMDLINE};
-typedef struct toklist toklist;
-struct toklist
+union utoken
{
- cpp_token *first;
- cpp_token *limit;
+ const cpp_token *token;
+ const cpp_token **ptoken;
+};
+
+/* A "run" of tokens; part of a chain of runs. */
+typedef struct tokenrun tokenrun;
+struct tokenrun
+{
+ tokenrun *next, *prev;
+ cpp_token *base, *limit;
};
typedef struct cpp_context cpp_context;
/* Contexts other than the base context are contiguous tokens.
e.g. macro expansions, expanded argument tokens. */
- struct toklist list;
+ union utoken first;
+ union utoken last;
+
+ /* If non-NULL, a buffer used for storage related to this context.
+ When the context is popped, the buffer is released. */
+ _cpp_buff *buff;
- /* For a macro context, these are the macro and its arguments. */
- cpp_macro *macro;
+ /* For a macro context, the macro node, otherwise NULL. */
+ cpp_hashnode *macro;
+
+ /* True if utoken element is token, else ptoken. */
+ bool direct_p;
};
struct lexer_state
/* Nonzero if first token on line is CPP_HASH. */
unsigned char in_directive;
+ /* True if we are skipping a failed conditional group. */
+ unsigned char skipping;
+
/* Nonzero if in a directive that takes angle-bracketed headers. */
unsigned char angled_headers;
all directives apart from #define. */
unsigned char save_comments;
- /* If nonzero the next token is at the beginning of the line. */
- unsigned char next_bol;
-
/* Nonzero if we're mid-comment. */
unsigned char lexing_comment;
/* Nonzero when parsing arguments to a function-like macro. */
unsigned char parsing_args;
-
- /* Nonzero when in a # NUMBER directive. */
- unsigned char line_extension;
};
/* Special nodes - identifiers with predefined significance. */
struct spec_nodes
{
- cpp_hashnode *n_L; /* L"str" */
cpp_hashnode *n_defined; /* defined operator */
cpp_hashnode *n_true; /* C++ keyword true */
cpp_hashnode *n_false; /* C++ keyword false */
- cpp_hashnode *n__Pragma; /* _Pragma operator */
cpp_hashnode *n__STRICT_ANSI__; /* STDC_0_IN_SYSTEM_HEADERS */
- cpp_hashnode *n__CHAR_UNSIGNED__; /* plain char is unsigned */
cpp_hashnode *n__VA_ARGS__; /* C99 vararg macros */
/* SDCC _asm specific */
cpp_hashnode *n__asm; /* _asm ... _endasm ; */
};
+/* Represents the contents of a file cpplib has read in. */
struct cpp_buffer
{
const unsigned char *cur; /* current position */
+ const unsigned char *backup_to; /* if peeked character is not wanted */
const unsigned char *rlimit; /* end of valid data */
const unsigned char *line_base; /* start of current line */
- cppchar_t read_ahead; /* read ahead character */
- cppchar_t extra_char; /* extra read-ahead for long tokens. */
- struct cpp_reader *pfile; /* Owns this buffer. */
struct cpp_buffer *prev;
- const unsigned char *buf; /* entire buffer */
+ const unsigned char *buf; /* Entire character buffer. */
- /* Filename specified with #line command. */
- const char *nominal_fname;
-
- /* Pointer into the include table. Used for include_next and
- to record control macros. */
+ /* Pointer into the include table; non-NULL if this is a file
+ buffer. Used for include_next and to record control macros. */
struct include_file *inc;
/* Value of if_stack at start of this file.
/* Token column position adjustment owing to tabs in whitespace. */
unsigned int col_adjust;
- /* Line number at line_base (above). */
- unsigned int lineno;
-
/* Contains PREV_WHITE and/or AVOID_LPASTE. */
unsigned char saved_flags;
buffers. */
unsigned char from_stage3;
- /* Temporary storage for pfile->skipping whilst in a directive. */
- unsigned char was_skipping;
-
- /* 1 = system header file, 2 = C system header file used for C++. */
- unsigned char sysp;
-
- /* Nonzero means we have printed (while error reporting) a list of
- containing files that matches the current status. */
- unsigned char include_stack_listed;
-
/* Nonzero means that the directory to start searching for ""
include files has been calculated and stored in "dir" below. */
unsigned char search_cached;
- /* Buffer type. */
- ENUM_BITFIELD (cpp_buffer_type) type : 8;
+ /* At EOF, a buffer is automatically popped. If RETURN_AT_EOF is
+ true, a CPP_EOF token is then returned. Otherwise, the next
+ token from the enclosing buffer is returned. */
+ bool return_at_eof;
/* The directory of the this buffer's file. Its NAME member is not
allocated, so we don't need to worry about freeing it. */
/* A cpp_reader encapsulates the "state" of a pre-processor run.
Applying cpp_get_token repeatedly yields a stream of pre-processor
tokens. Usually, there is only one cpp_reader object active. */
-
struct cpp_reader
{
/* Top of buffer stack. */
/* Lexer state. */
struct lexer_state state;
- /* The position of the last lexed token and last lexed directive. */
- cpp_lexer_pos lexer_pos;
- cpp_lexer_pos directive_pos;
+ /* Source line tracking. */
+ struct line_maps line_maps;
+ const struct line_map *map;
+ unsigned int line;
- /* Memory pools. */
- cpp_pool ident_pool; /* For all identifiers, and permanent
- numbers and strings. */
- cpp_pool macro_pool; /* For macro definitions. Permanent. */
- cpp_pool argument_pool; /* For macro arguments. Temporary. */
+ /* The line of the '#' of the current directive. */
+ unsigned int directive_line;
+
+ /* Memory buffers. */
+ _cpp_buff *a_buff; /* Aligned permanent storage. */
+ _cpp_buff *u_buff; /* Unaligned permanent storage. */
+ _cpp_buff *free_buffs; /* Free buffer chain. */
/* Context stack. */
struct cpp_context base_context;
const struct directive *directive;
/* Multiple inlcude optimisation. */
- enum mi_state mi_state;
- enum mi_ind mi_if_not_defined;
- unsigned int mi_lexed;
const cpp_hashnode *mi_cmacro;
const cpp_hashnode *mi_ind_cmacro;
+ bool mi_valid;
+
+ /* Lexing. */
+ cpp_token *cur_token;
+ tokenrun base_run, *cur_run;
+ unsigned int lookaheads;
- /* Token lookahead. */
- struct cpp_lookahead *la_read; /* Read from this lookahead. */
- struct cpp_lookahead *la_write; /* Write to this lookahead. */
- struct cpp_lookahead *la_unused; /* Free store. */
- struct cpp_lookahead *la_saved; /* Backup when entering directive. */
+ /* Non-zero prevents the lexer from re-using the token runs. */
+ unsigned int keep_tokens;
/* Error counter for exit code. */
unsigned int errors;
/* Line and column where a newline was first seen in a string
constant (multi-line strings). */
- cpp_lexer_pos mlstring_pos;
+ unsigned int mls_line;
+ unsigned int mls_col;
/* Buffer to hold macro definition string. */
unsigned char *macro_buffer;
unsigned int macro_buffer_len;
- /* Current depth in #include directives that use <...>. */
- unsigned int system_include_depth;
-
- /* Current depth of buffer stack. */
- unsigned int buffer_stack_depth;
-
- /* Current depth in #include directives. */
- unsigned int include_depth;
-
/* Tree of other included files. See cppfiles.c. */
struct splay_tree_s *all_include_files;
cpp_token date;
cpp_token time;
+ /* EOF token, and a token forcing paste avoidance. */
+ cpp_token avoid_paste;
+ cpp_token eof;
+
/* Opaque handle to the dependencies of mkdeps.c. Used by -M etc. */
struct deps *deps;
preprocessor. */
struct spec_nodes spec_nodes;
- /* We're printed a warning recommending against using #import. */
- unsigned char import_warning;
-
- /* True if we are skipping a failed conditional group. */
- unsigned char skipping;
-
/* Whether to print our version number. Done this way so
we don't get it twice for -v -version. */
unsigned char print_version;
/* Macros. */
#define CPP_PRINT_DEPS(PFILE) CPP_OPTION (PFILE, print_deps)
-#define CPP_IN_SYSTEM_HEADER(PFILE) \
- (CPP_BUFFER (PFILE) && CPP_BUFFER (PFILE)->sysp)
+#define CPP_IN_SYSTEM_HEADER(PFILE) ((PFILE)->map && (PFILE)->map->sysp)
#define CPP_PEDANTIC(PF) CPP_OPTION (PF, pedantic)
#define CPP_WTRADITIONAL(PF) CPP_OPTION (PF, warn_traditional)
/* In cpperror.c */
enum error_type { WARNING = 0, WARNING_SYSHDR, PEDWARN, ERROR, FATAL, ICE };
extern int _cpp_begin_message PARAMS ((cpp_reader *, enum error_type,
- const char *, const cpp_lexer_pos *));
+ unsigned int, unsigned int));
/* In cppmacro.c */
extern void _cpp_free_definition PARAMS ((cpp_hashnode *));
extern int _cpp_create_definition PARAMS ((cpp_reader *, cpp_hashnode *));
extern void _cpp_pop_context PARAMS ((cpp_reader *));
-extern void _cpp_free_lookaheads PARAMS ((cpp_reader *));
-extern void _cpp_release_lookahead PARAMS ((cpp_reader *));
-extern void _cpp_push_token PARAMS ((cpp_reader *, const cpp_token *,
- const cpp_lexer_pos *));
/* In cpphash.c */
extern void _cpp_init_hashtable PARAMS ((cpp_reader *, hash_table *));
extern void _cpp_fake_include PARAMS ((cpp_reader *, const char *));
extern void _cpp_never_reread PARAMS ((struct include_file *));
extern char *_cpp_simplify_pathname PARAMS ((char *));
-extern int _cpp_read_file PARAMS ((cpp_reader *, const char *));
-extern int _cpp_execute_include PARAMS ((cpp_reader *,
+extern bool _cpp_read_file PARAMS ((cpp_reader *, const char *));
+extern bool _cpp_execute_include PARAMS ((cpp_reader *,
const cpp_token *,
enum include_type));
extern int _cpp_compare_file_date PARAMS ((cpp_reader *,
extern void _cpp_report_missing_guards PARAMS ((cpp_reader *));
extern void _cpp_init_includes PARAMS ((cpp_reader *));
extern void _cpp_cleanup_includes PARAMS ((cpp_reader *));
-extern void _cpp_pop_file_buffer PARAMS ((cpp_reader *, cpp_buffer *));
+extern bool _cpp_pop_file_buffer PARAMS ((cpp_reader *,
+ struct include_file *));
/* In cppexp.c */
extern int _cpp_parse_expr PARAMS ((cpp_reader *));
/* In cpplex.c */
-extern void _cpp_lex_token PARAMS ((cpp_reader *, cpp_token *));
+extern cpp_token *_cpp_temp_token PARAMS ((cpp_reader *));
+extern const cpp_token *_cpp_lex_token PARAMS ((cpp_reader *));
+extern cpp_token *_cpp_lex_direct PARAMS ((cpp_reader *));
extern int _cpp_equiv_tokens PARAMS ((const cpp_token *,
const cpp_token *));
-extern void _cpp_init_pool PARAMS ((cpp_pool *, unsigned int,
- unsigned int, unsigned int));
-extern void _cpp_free_pool PARAMS ((cpp_pool *));
-extern unsigned char *_cpp_pool_reserve PARAMS ((cpp_pool *, unsigned int));
-extern unsigned char *_cpp_pool_alloc PARAMS ((cpp_pool *, unsigned int));
-extern unsigned char *_cpp_next_chunk PARAMS ((cpp_pool *, unsigned int,
- unsigned char **));
-extern void _cpp_lock_pool PARAMS ((cpp_pool *));
-extern void _cpp_unlock_pool PARAMS ((cpp_pool *));
+extern void _cpp_init_tokenrun PARAMS ((tokenrun *, unsigned int));
+
+/* In cppinit.c. */
+extern bool _cpp_push_next_buffer PARAMS ((cpp_reader *));
/* In cpplib.c */
extern int _cpp_test_assertion PARAMS ((cpp_reader *, int *));
extern void _cpp_do__Pragma PARAMS ((cpp_reader *));
extern void _cpp_init_directives PARAMS ((cpp_reader *));
extern void _cpp_init_internal_pragmas PARAMS ((cpp_reader *));
-extern void _cpp_do_file_change PARAMS ((cpp_reader *, enum cpp_fc_reason,
- const char *, unsigned int));
+extern void _cpp_do_file_change PARAMS ((cpp_reader *, enum lc_reason,
+ const char *,
+ unsigned int, unsigned int));
+extern void _cpp_pop_buffer PARAMS ((cpp_reader *));
/* Utility routines and macros. */
#define DSC(str) (const U_CHAR *)str, sizeof str - 1
/* CPP Library.
Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Contributed by Per Bothner, 1994-95.
Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987
#include "system.h"
#include "cpplib.h"
#include "cpphash.h"
-#include "output.h"
#include "prefix.h"
#include "intl.h"
#include "version.h"
#include "mkdeps.h"
#include "cppdefault.h"
+#include "except.h" /* for USING_SJLJ_EXCEPTIONS */
/* Predefined symbols, built-in macros, and the default include path. */
/* Windows does not natively support inodes, and neither does MSDOS.
Cygwin's emulation can generate non-unique inodes, so don't use it.
- VMS has non-numeric inodes. */
+ VMS has non-numeric inodes. */
#ifdef VMS
-# define INO_T_EQ(a, b) (!memcmp (&(a), &(b), sizeof (a)))
+# define INO_T_EQ(A, B) (!memcmp (&(A), &(B), sizeof (A)))
+# define INO_T_COPY(DEST, SRC) memcpy(&(DEST), &(SRC), sizeof (SRC))
#else
# if (defined _WIN32 && ! defined (_UWIN)) || defined __MSDOS__
-# define INO_T_EQ(a, b) 0
+# define INO_T_EQ(A, B) 0
# else
-# define INO_T_EQ(a, b) ((a) == (b))
+# define INO_T_EQ(A, B) ((A) == (B))
# endif
+# define INO_T_COPY(DEST, SRC) (DEST) = (SRC)
#endif
/* Internal structures and prototypes. */
/* A `struct pending_option' remembers one -D, -A, -U, -include, or
-imacros switch. */
-
typedef void (* cl_directive_handler) PARAMS ((cpp_reader *, const char *));
struct pending_option
{
};
/* The `pending' structure accumulates all the options that are not
- actually processed until we hit cpp_start_read. It consists of
+ actually processed until we hit cpp_read_main_file. It consists of
several lists, one for each type of option. We keep both head and
tail pointers for quick insertion. */
struct cpp_pending
static void init_builtins PARAMS ((cpp_reader *));
static void append_include_chain PARAMS ((cpp_reader *,
char *, int, int));
-struct search_path * remove_dup_dir PARAMS ((cpp_reader *,
+static struct search_path * remove_dup_dir PARAMS ((cpp_reader *,
struct search_path *));
-struct search_path * remove_dup_dirs PARAMS ((cpp_reader *,
+static struct search_path * remove_dup_dirs PARAMS ((cpp_reader *,
struct search_path *));
static void merge_include_chains PARAMS ((cpp_reader *));
-static void do_includes PARAMS ((cpp_reader *,
- struct pending_option *,
- int));
+static bool push_include PARAMS ((cpp_reader *,
+ struct pending_option *));
+static void free_chain PARAMS ((struct pending_option *));
static void set_lang PARAMS ((cpp_reader *, enum c_lang));
static void init_dependency_output PARAMS ((cpp_reader *));
static void init_standard_includes PARAMS ((cpp_reader *));
+static void read_original_filename PARAMS ((cpp_reader *));
static void new_pending_directive PARAMS ((struct cpp_pending *,
const char *,
cl_directive_handler));
/* Given a colon-separated list of file names PATH,
add all the names to the search path for include files. */
-
static void
path_include (pfile, list, path)
cpp_reader *pfile;
while (1);
}
-/* Append DIR to include path PATH. DIR must be permanently allocated
- and writable. */
+/* Append DIR to include path PATH. DIR must be allocated on the
+ heap; this routine takes responsibility for freeing it. CXX_AWARE
+ is non-zero if the header contains extern "C" guards for C++,
+ otherwise it is zero. */
static void
append_include_chain (pfile, dir, path, cxx_aware)
cpp_reader *pfile;
unsigned int len;
if (*dir == '\0')
- dir = xstrdup (".");
+ {
+ free (dir);
+ dir = xstrdup (".");
+ }
_cpp_simplify_pathname (dir);
+
if (stat (dir, &st))
{
/* Dirs that don't exist are silently ignored. */
cpp_notice_from_errno (pfile, dir);
else if (CPP_OPTION (pfile, verbose))
fprintf (stderr, _("ignoring nonexistent directory \"%s\"\n"), dir);
+ free (dir);
return;
}
if (!S_ISDIR (st.st_mode))
{
cpp_notice (pfile, "%s: Not a directory", dir);
+ free (dir);
return;
}
new = (struct search_path *) xmalloc (sizeof (struct search_path));
new->name = dir;
new->len = len;
- new->ino = st.st_ino;
+ INO_T_COPY (new->ino, st.st_ino);
new->dev = st.st_dev;
/* Both systm and after include file lists should be treated as system
include files since these two lists are really just a concatenation
- of one "system" list. */
+ of one "system" list. */
if (path == SYSTEM || path == AFTER)
#ifdef NO_IMPLICIT_EXTERN_C
new->sysp = 1;
/* Handle a duplicated include path. PREV is the link in the chain
before the duplicate. The duplicate is removed from the chain and
freed. Returns PREV. */
-struct search_path *
+static struct search_path *
remove_dup_dir (pfile, prev)
cpp_reader *pfile;
struct search_path *prev;
chain, or NULL if the chain is empty. This algorithm is quadratic
in the number of -I switches, which is acceptable since there
aren't usually that many of them. */
-struct search_path *
+static struct search_path *
remove_dup_dirs (pfile, head)
cpp_reader *pfile;
struct search_path *head;
for (other = head; other != cur; other = other->next)
if (INO_T_EQ (cur->ino, other->ino) && cur->dev == other->dev)
{
+ if (cur->sysp && !other->sysp)
+ {
+ cpp_warning (pfile,
+ "changing search order for system directory \"%s\"",
+ cur->name);
+ if (strcmp (cur->name, other->name))
+ cpp_warning (pfile,
+ " as it is the same as non-system directory \"%s\"",
+ other->name);
+ else
+ cpp_warning (pfile,
+ " as it has already been specified as a non-system directory");
+ }
cur = remove_dup_dir (pfile, prev);
break;
}
system, after. Remove duplicate dirs (as determined by
INO_T_EQ()). The system_include and after_include chains are never
referred to again after this function; all access is through the
- bracket_include path.
-
- For the future: Check if the directory is empty (but
- how?) and possibly preload the include hash. */
-
+ bracket_include path. */
static void
merge_include_chains (pfile)
cpp_reader *pfile;
qtail->next = brack;
/* If brack == qtail, remove brack as it's simpler. */
- if (INO_T_EQ (qtail->ino, brack->ino) && qtail->dev == brack->dev)
+ if (brack && INO_T_EQ (qtail->ino, brack->ino)
+ && qtail->dev == brack->dev)
brack = remove_dup_dir (pfile, qtail);
}
else
- quote = brack;
+ quote = brack;
CPP_OPTION (pfile, quote_include) = quote;
CPP_OPTION (pfile, bracket_include) = brack;
}
-/* Sets internal flags correctly for a given language, and defines
- macros if necessary. */
+/* A set of booleans indicating what CPP features each source language
+ requires. */
+struct lang_flags
+{
+ char c99;
+ char objc;
+ char cplusplus;
+ char extended_numbers;
+ char trigraphs;
+ char dollars_in_ident;
+ char cplusplus_comments;
+ char digraphs;
+};
+
+/* ??? Enable $ in identifiers in assembly? */
+static const struct lang_flags lang_defaults[] =
+{ /* c99 objc c++ xnum trig dollar c++comm digr */
+ /* GNUC89 */ { 0, 0, 0, 1, 0, 1, 1, 1 },
+ /* GNUC99 */ { 1, 0, 0, 1, 0, 1, 1, 1 },
+ /* STDC89 */ { 0, 0, 0, 0, 1, 0, 0, 0 },
+ /* STDC94 */ { 0, 0, 0, 0, 1, 0, 0, 1 },
+ /* STDC99 */ { 1, 0, 0, 1, 1, 0, 1, 1 },
+ /* GNUCXX */ { 0, 0, 1, 1, 0, 1, 1, 1 },
+ /* CXX98 */ { 0, 0, 1, 1, 1, 0, 1, 1 },
+ /* OBJC */ { 0, 1, 0, 1, 0, 1, 1, 1 },
+ /* OBJCXX */ { 0, 1, 1, 1, 0, 1, 1, 1 },
+ /* ASM */ { 0, 0, 0, 1, 0, 0, 1, 0 }
+};
+
+/* Sets internal flags correctly for a given language. */
static void
set_lang (pfile, lang)
cpp_reader *pfile;
enum c_lang lang;
{
- /* Defaults. */
- CPP_OPTION (pfile, lang) = lang;
- CPP_OPTION (pfile, objc) = 0;
- CPP_OPTION (pfile, cplusplus) = 0;
- CPP_OPTION (pfile, extended_numbers) = 1; /* Allowed in GNU C and C99. */
-
- switch (lang)
- {
- /* GNU C. */
- case CLK_GNUC99:
- CPP_OPTION (pfile, trigraphs) = 0;
- CPP_OPTION (pfile, dollars_in_ident) = 1;
- CPP_OPTION (pfile, cplusplus_comments) = 1;
- CPP_OPTION (pfile, digraphs) = 1;
- CPP_OPTION (pfile, c99) = 1;
- break;
- case CLK_GNUC89:
- CPP_OPTION (pfile, trigraphs) = 0;
- CPP_OPTION (pfile, dollars_in_ident) = 1;
- CPP_OPTION (pfile, cplusplus_comments) = 1;
- CPP_OPTION (pfile, digraphs) = 1;
- CPP_OPTION (pfile, c99) = 0;
- break;
-
- /* ISO C. */
- case CLK_STDC94:
- case CLK_STDC89:
- CPP_OPTION (pfile, trigraphs) = 1;
- CPP_OPTION (pfile, dollars_in_ident) = 0;
- CPP_OPTION (pfile, cplusplus_comments) = 0;
- CPP_OPTION (pfile, digraphs) = lang == CLK_STDC94;
- CPP_OPTION (pfile, c99) = 0;
- CPP_OPTION (pfile, extended_numbers) = 0;
- break;
- case CLK_STDC99:
- CPP_OPTION (pfile, trigraphs) = 1;
- CPP_OPTION (pfile, dollars_in_ident) = 0;
- CPP_OPTION (pfile, cplusplus_comments) = 1;
- CPP_OPTION (pfile, digraphs) = 1;
- CPP_OPTION (pfile, c99) = 1;
- break;
-
- /* Objective C. */
- case CLK_OBJCXX:
- CPP_OPTION (pfile, cplusplus) = 1;
- case CLK_OBJC:
- CPP_OPTION (pfile, trigraphs) = 0;
- CPP_OPTION (pfile, dollars_in_ident) = 1;
- CPP_OPTION (pfile, cplusplus_comments) = 1;
- CPP_OPTION (pfile, digraphs) = 1;
- CPP_OPTION (pfile, c99) = 0;
- CPP_OPTION (pfile, objc) = 1;
- break;
+ const struct lang_flags *l = &lang_defaults[(int) lang];
- /* C++. */
- case CLK_GNUCXX:
- case CLK_CXX98:
- CPP_OPTION (pfile, cplusplus) = 1;
- CPP_OPTION (pfile, trigraphs) = lang == CLK_CXX98;
- CPP_OPTION (pfile, dollars_in_ident) = lang == CLK_GNUCXX;
- CPP_OPTION (pfile, cplusplus_comments) = 1;
- CPP_OPTION (pfile, digraphs) = 1;
- CPP_OPTION (pfile, c99) = 0;
- break;
+ CPP_OPTION (pfile, lang) = lang;
- /* Assembler. */
- case CLK_ASM:
- CPP_OPTION (pfile, trigraphs) = 0;
- CPP_OPTION (pfile, dollars_in_ident) = 0; /* Maybe not? */
- CPP_OPTION (pfile, cplusplus_comments) = 1;
- CPP_OPTION (pfile, digraphs) = 0;
- CPP_OPTION (pfile, c99) = 0;
- break;
- }
+ CPP_OPTION (pfile, c99) = l->c99;
+ CPP_OPTION (pfile, objc) = l->objc;
+ CPP_OPTION (pfile, cplusplus) = l->cplusplus;
+ CPP_OPTION (pfile, extended_numbers) = l->extended_numbers;
+ CPP_OPTION (pfile, trigraphs) = l->trigraphs;
+ CPP_OPTION (pfile, dollars_in_ident) = l->dollars_in_ident;
+ CPP_OPTION (pfile, cplusplus_comments) = l->cplusplus_comments;
+ CPP_OPTION (pfile, digraphs) = l->digraphs;
}
#ifdef HOST_EBCDIC
/* init initializes library global state. It might not need to
do anything depending on the platform and compiler. */
-
static void
init_library ()
{
}
}
-/* Initialize a cpp_reader structure. */
+/* Initialize a cpp_reader structure. */
cpp_reader *
-cpp_create_reader (table, lang)
- hash_table *table;
+cpp_create_reader (lang)
enum c_lang lang;
{
- struct spec_nodes *s;
cpp_reader *pfile;
/* Initialise this instance of the library if it hasn't been already. */
CPP_OPTION (pfile, show_column) = 1;
CPP_OPTION (pfile, tabstop) = 8;
CPP_OPTION (pfile, operator_names) = 1;
+#if DEFAULT_SIGNED_CHAR
+ CPP_OPTION (pfile, signed_char) = 1;
+#else
+ CPP_OPTION (pfile, signed_char) = 0;
+#endif
/* SDCC _asm specific */
CPP_OPTION (pfile, preproc_asm) = 1;
be needed. */
pfile->deps = deps_init ();
+ /* Initialise the line map. Start at logical line 1, so we can use
+ a line number of zero for special states. */
+ init_line_maps (&pfile->line_maps);
+ pfile->line = 1;
+
/* Initialize lexer state. */
pfile->state.save_comments = ! CPP_OPTION (pfile, discard_comments);
- /* Indicate date and time not yet calculated. */
+ /* Set up static tokens. */
pfile->date.type = CPP_EOF;
+ pfile->avoid_paste.type = CPP_PADDING;
+ pfile->avoid_paste.val.source = NULL;
+ pfile->eof.type = CPP_EOF;
+ pfile->eof.flags = 0;
+
+ /* Create a token buffer for the lexer. */
+ _cpp_init_tokenrun (&pfile->base_run, 250);
+ pfile->cur_run = &pfile->base_run;
+ pfile->cur_token = pfile->base_run.base;
/* Initialise the base context. */
pfile->context = &pfile->base_context;
pfile->base_context.macro = 0;
pfile->base_context.prev = pfile->base_context.next = 0;
- /* Identifier pool initially 8K. Unaligned, permanent pool. */
- _cpp_init_pool (&pfile->ident_pool, 8 * 1024, 1, 0);
-
- /* Argument pool initially 8K. Aligned, temporary pool. */
- _cpp_init_pool (&pfile->argument_pool, 8 * 1024, 0, 1);
-
- /* Macro pool initially 8K. Aligned, permanent pool. */
- _cpp_init_pool (&pfile->macro_pool, 8 * 1024, 0, 0);
+ /* Aligned and unaligned storage. */
+ pfile->a_buff = _cpp_get_buff (pfile, 0);
+ pfile->u_buff = _cpp_get_buff (pfile, 0);
/* Initialise the buffer obstack. */
gcc_obstack_init (&pfile->buffer_ob);
- /* Initialise the hashtable. */
- _cpp_init_hashtable (pfile, table);
-
- _cpp_init_directives (pfile);
_cpp_init_includes (pfile);
- _cpp_init_internal_pragmas (pfile);
-
- /* Initialize the special nodes. */
- s = &pfile->spec_nodes;
- s->n_L = cpp_lookup (pfile, DSC("L"));
- s->n_defined = cpp_lookup (pfile, DSC("defined"));
- s->n_true = cpp_lookup (pfile, DSC("true"));
- s->n_false = cpp_lookup (pfile, DSC("false"));
- s->n__Pragma = cpp_lookup (pfile, DSC("_Pragma"));
- s->n__STRICT_ANSI__ = cpp_lookup (pfile, DSC("__STRICT_ANSI__"));
- s->n__CHAR_UNSIGNED__ = cpp_lookup (pfile, DSC("__CHAR_UNSIGNED__"));
- s->n__VA_ARGS__ = cpp_lookup (pfile, DSC("__VA_ARGS__"));
- s->n__VA_ARGS__->flags |= NODE_DIAGNOSTIC;
- /* SDCC _asm specific */
- s->n__asm = cpp_lookup (pfile, DSC("_asm"));
return pfile;
}
/* Free resources used by PFILE. Accessing PFILE after this function
- returns leads to undefined behaviour. */
+ returns leads to undefined behaviour. Returns the error count. */
int
cpp_destroy (pfile)
cpp_reader *pfile;
int result;
struct search_path *dir, *dirn;
cpp_context *context, *contextn;
+ tokenrun *run, *runn;
while (CPP_BUFFER (pfile) != NULL)
- cpp_pop_buffer (pfile);
+ _cpp_pop_buffer (pfile);
if (pfile->macro_buffer)
{
_cpp_destroy_hashtable (pfile);
_cpp_cleanup_includes (pfile);
- _cpp_free_lookaheads (pfile);
- _cpp_free_pool (&pfile->ident_pool);
- _cpp_free_pool (&pfile->macro_pool);
- _cpp_free_pool (&pfile->argument_pool);
+ _cpp_free_buff (pfile->a_buff);
+ _cpp_free_buff (pfile->u_buff);
+ _cpp_free_buff (pfile->free_buffs);
+
+ for (run = &pfile->base_run; run; run = runn)
+ {
+ runn = run->next;
+ free (run->base);
+ if (run != &pfile->base_run)
+ free (run);
+ }
for (dir = CPP_OPTION (pfile, quote_include); dir; dir = dirn)
{
free (context);
}
+ free_line_maps (&pfile->line_maps);
+
result = pfile->errors;
free (pfile);
ULP value is the global user_label_prefix
Also, macros with CPLUS set in the flags field are entered only for C++. */
-
struct builtin
{
const U_CHAR *name;
B("__BASE_FILE__", BT_BASE_FILE),
B("__LINE__", BT_SPECLINE),
B("__INCLUDE_LEVEL__", BT_INCLUDE_LEVEL),
+ B("_Pragma", BT_PRAGMA),
X("__VERSION__", VERS),
X("__USER_LABEL_PREFIX__", ULP),
C("__REGISTER_PREFIX__", REGISTER_PREFIX),
C("__HAVE_BUILTIN_SETJMP__", "1"),
+#if USING_SJLJ_EXCEPTIONS
+ /* libgcc needs to know this. */
+ C("__USING_SJLJ_EXCEPTIONS__","1"),
+#endif
#ifndef NO_BUILTIN_SIZE_TYPE
C("__SIZE_TYPE__", SIZE_TYPE),
#endif
#define builtin_array_end \
builtin_array + sizeof(builtin_array)/sizeof(struct builtin)
-/* Subroutine of cpp_start_read; reads the builtins table above and
- enters the macros into the hash table. */
+/* Subroutine of cpp_read_main_file; reads the builtins table above and
+ enters them, and language-specific macros, into the hash table. */
static void
init_builtins (pfile)
cpp_reader *pfile;
else if (CPP_OPTION (pfile, c99))
_cpp_define_builtin (pfile, "__STDC_VERSION__ 199901L");
+ if (CPP_OPTION (pfile, signed_char) == 0)
+ _cpp_define_builtin (pfile, "__CHAR_UNSIGNED__ 1");
+
if (CPP_OPTION (pfile, lang) == CLK_STDC89
|| CPP_OPTION (pfile, lang) == CLK_STDC94
|| CPP_OPTION (pfile, lang) == CLK_STDC99)
if (specd_prefix != 0 && cpp_GCC_INCLUDE_DIR_len)
{
/* Remove the `include' from /usr/local/lib/gcc.../include.
- GCC_INCLUDE_DIR will always end in /include. */
+ GCC_INCLUDE_DIR will always end in /include. */
int default_len = cpp_GCC_INCLUDE_DIR_len;
char *default_prefix = (char *) alloca (default_len + 1);
int specd_len = strlen (specd_prefix);
|| (CPP_OPTION (pfile, cplusplus)
&& !CPP_OPTION (pfile, no_standard_cplusplus_includes)))
{
- char *str = xstrdup (update_path (p->fname, p->component));
+ char *str = update_path (p->fname, p->component);
append_include_chain (pfile, str, SYSTEM, p->cxx_aware);
}
}
}
-/* Handles -imacro and -include from the command line. */
-static void
-do_includes (pfile, p, scan)
+/* Pushes a command line -imacro and -include file indicated by P onto
+ the buffer stack. Returns non-zero if successful. */
+static bool
+push_include (pfile, p)
cpp_reader *pfile;
struct pending_option *p;
- int scan;
{
- while (p)
- {
- struct pending_option *q;
+ cpp_token header;
- /* Don't handle if -fpreprocessed. Later: maybe update this to
- use the #include "" search path if cpp_read_file fails. */
- if (CPP_OPTION (pfile, preprocessed))
- cpp_error (pfile, "-include and -imacros cannot be used with -fpreprocessed");
- else
- {
- cpp_token header;
- header.type = CPP_STRING;
- header.val.str.text = (const unsigned char *) p->arg;
- header.val.str.len = strlen (p->arg);
- if (_cpp_execute_include (pfile, &header, IT_CMDLINE) && scan)
- cpp_scan_buffer_nooutput (pfile, 0);
- }
- q = p->next;
- free (p);
- p = q;
+ /* Later: maybe update this to use the #include "" search path
+ if cpp_read_file fails. */
+ header.type = CPP_STRING;
+ header.val.str.text = (const unsigned char *) p->arg;
+ header.val.str.len = strlen (p->arg);
+ /* Make the command line directive take up a line. */
+ pfile->line++;
+
+ return _cpp_execute_include (pfile, &header, IT_CMDLINE);
+}
+
+/* Frees a pending_option chain. */
+static void
+free_chain (head)
+ struct pending_option *head;
+{
+ struct pending_option *next;
+
+ while (head)
+ {
+ next = head->next;
+ free (head);
+ head = next;
}
}
-/* This is called after options have been processed. Setup for
- processing input from the file named FNAME, or stdin if it is the
- empty string. Return 1 on success, 0 on failure. */
-int
-cpp_start_read (pfile, fname)
+/* This is called after options have been parsed, and partially
+ processed. Setup for processing input from the file named FNAME,
+ or stdin if it is the empty string. Return the original filename
+ on success (e.g. foo.i->foo.c), or NULL on failure. */
+const char *
+cpp_read_main_file (pfile, fname, table)
cpp_reader *pfile;
const char *fname;
+ hash_table *table;
{
- struct pending_option *p, *q;
+ /* The front ends don't set up the hash table until they have
+ finished processing the command line options, so initializing the
+ hashtable is deferred until now. */
+ _cpp_init_hashtable (pfile, table);
/* Set up the include search path now. */
if (! CPP_OPTION (pfile, no_standard_includes))
/* Set the default target (if there is none already). */
deps_add_default_target (pfile, fname);
- /* Open the main input file. This must be done early, so we have a
- buffer to stand on. */
+ /* Open the main input file. */
if (!_cpp_read_file (pfile, fname))
- return 0;
+ return NULL;
- /* If already preprocessed, don't install __LINE__, etc., and ignore
- command line definitions and assertions. Handle -U's, -D's and
- -A's in the order they were seen. */
- if (! CPP_OPTION (pfile, preprocessed))
- init_builtins (pfile);
+ /* Set this after cpp_post_options so the client can change the
+ option if it wishes, and after stacking the main file so we don't
+ trace the main file. */
+ pfile->line_maps.trace_includes = CPP_OPTION (pfile, print_include_names);
+
+ /* For foo.i, read the original filename foo.c now, for the benefit
+ of the front ends. */
+ if (CPP_OPTION (pfile, preprocessed))
+ read_original_filename (pfile);
+
+ return pfile->map->to_file;
+}
+
+/* For preprocessed files, if the first tokens are of the form # NUM.
+ handle the directive so we know the original file name. This will
+ generate file_change callbacks, which the front ends must handle
+ appropriately given their state of initialization. */
+static void
+read_original_filename (pfile)
+ cpp_reader *pfile;
+{
+ const cpp_token *token, *token1;
+
+ /* Lex ahead; if the first tokens are of the form # NUM, then
+ process the directive, otherwise back up. */
+ token = _cpp_lex_direct (pfile);
+ if (token->type == CPP_HASH)
+ {
+ token1 = _cpp_lex_direct (pfile);
+ _cpp_backup_tokens (pfile, 1);
+
+ /* If it's a #line directive, handle it. */
+ if (token1->type == CPP_NUMBER)
+ {
+ _cpp_handle_directive (pfile, token->flags & PREV_WHITE);
+ return;
+ }
+ }
+
+ /* Backup as if nothing happened. */
+ _cpp_backup_tokens (pfile, 1);
+}
- p = CPP_OPTION (pfile, pending)->directive_head;
- while (p)
+/* Handle pending command line options: -D, -U, -A, -imacros and
+ -include. This should be called after debugging has been properly
+ set up in the front ends. */
+void
+cpp_finish_options (pfile)
+ cpp_reader *pfile;
+{
+ /* Install builtins and process command line macros etc. in the order
+ they appeared, but only if not already preprocessed. */
+ if (! CPP_OPTION (pfile, preprocessed))
{
- if (! CPP_OPTION (pfile, preprocessed))
+ struct pending_option *p;
+
+ _cpp_do_file_change (pfile, LC_RENAME, _("<built-in>"), 1, 0);
+ init_builtins (pfile);
+ _cpp_do_file_change (pfile, LC_RENAME, _("<command line>"), 1, 0);
+ for (p = CPP_OPTION (pfile, pending)->directive_head; p; p = p->next)
(*p->handler) (pfile, p->arg);
- q = p->next;
- free (p);
- p = q;
+
+ /* Scan -imacros files after command line defines, but before
+ files given with -include. */
+ while ((p = CPP_OPTION (pfile, pending)->imacros_head) != NULL)
+ {
+ if (push_include (pfile, p))
+ {
+ pfile->buffer->return_at_eof = true;
+ cpp_scan_nooutput (pfile);
+ }
+ CPP_OPTION (pfile, pending)->imacros_head = p->next;
+ free (p);
+ }
}
- /* The -imacros files can be scanned now, but the -include files
- have to be pushed onto the buffer stack and processed later,
- otherwise cppmain.c won't see the tokens. include_head was built
- up as a stack, and popping this stack onto the buffer stack means
- we preserve the order of the command line. */
- do_includes (pfile, CPP_OPTION (pfile, pending)->imacros_head, 1);
- do_includes (pfile, CPP_OPTION (pfile, pending)->include_head, 0);
+ free_chain (CPP_OPTION (pfile, pending)->directive_head);
+ _cpp_push_next_buffer (pfile);
+}
- free (CPP_OPTION (pfile, pending));
- CPP_OPTION (pfile, pending) = NULL;
+/* Called to push the next buffer on the stack given by -include. If
+ there are none, free the pending structure and restore the line map
+ for the main file. */
+bool
+_cpp_push_next_buffer (pfile)
+ cpp_reader *pfile;
+{
+ bool pushed = false;
+
+ /* This is't pretty; we'd rather not be relying on this as a boolean
+ for reverting the line map. Further, we only free the chains in
+ this conditional, so an early call to cpp_finish / cpp_destroy
+ will leak that memory. */
+ if (CPP_OPTION (pfile, pending)
+ && CPP_OPTION (pfile, pending)->imacros_head == NULL)
+ {
+ while (!pushed)
+ {
+ struct pending_option *p = CPP_OPTION (pfile, pending)->include_head;
+
+ if (p == NULL)
+ break;
+ if (! CPP_OPTION (pfile, preprocessed))
+ pushed = push_include (pfile, p);
+ CPP_OPTION (pfile, pending)->include_head = p->next;
+ free (p);
+ }
+
+ if (!pushed)
+ {
+ free (CPP_OPTION (pfile, pending));
+ CPP_OPTION (pfile, pending) = NULL;
+
+ /* Restore the line map for the main file. */
+ if (! CPP_OPTION (pfile, preprocessed))
+ _cpp_do_file_change (pfile, LC_RENAME,
+ pfile->line_maps.maps[0].to_file, 1, 0);
+ }
+ }
- return 1;
+ return pushed;
}
/* Use mkdeps.c to output dependency information. */
{
/* Stream on which to print the dependency information. */
FILE *deps_stream = 0;
- const char *deps_mode = CPP_OPTION (pfile, print_deps_append) ? "a" : "w";
+ const char *const deps_mode =
+ CPP_OPTION (pfile, print_deps_append) ? "a" : "w";
- if (CPP_OPTION (pfile, deps_file) == 0)
+ if (CPP_OPTION (pfile, deps_file)[0] == '\0')
deps_stream = stdout;
else
{
deps_phony_targets (pfile->deps, deps_stream);
/* Don't close stdout. */
- if (CPP_OPTION (pfile, deps_file))
+ if (deps_stream != stdout)
{
if (ferror (deps_stream) || fclose (deps_stream) != 0)
cpp_fatal (pfile, "I/O error on output");
cpp_finish (pfile)
cpp_reader *pfile;
{
- if (CPP_BUFFER (pfile))
- {
- cpp_ice (pfile, "buffers still stacked in cpp_finish");
- while (CPP_BUFFER (pfile))
- cpp_pop_buffer (pfile);
- }
+ /* cpplex.c leaves the final buffer on the stack. This it so that
+ it returns an unending stream of CPP_EOFs to the client. If we
+ popped the buffer, we'd dereference a NULL buffer pointer and
+ segfault. It's nice to allow the client to do worry-free excess
+ cpp_get_token calls. */
+ while (pfile->buffer)
+ _cpp_pop_buffer (pfile);
/* Don't write the deps file if preprocessing has failed. */
if (CPP_OPTION (pfile, print_deps) && pfile->errors == 0)
_cpp_report_missing_guards (pfile);
}
+/* Add a directive to be handled later in the initialization phase. */
static void
new_pending_directive (pend, text, handler)
struct cpp_pending *pend;
/* Irix6 "cc -n32" and OSF4 cc have problems with char foo[] = ("string");
I.e. a const string initializer with parens around it. That is
what N_("string") resolves to, so we make no_* be macros instead. */
-#define no_arg N_("Argument missing after %s")
-#define no_ass N_("Assertion missing after %s")
-#define no_dir N_("Directory name missing after %s")
-#define no_fil N_("File name missing after %s")
-#define no_mac N_("Macro name missing after %s")
-#define no_pth N_("Path name missing after %s")
-#define no_num N_("Number missing after %s")
-#define no_tgt N_("Target missing after %s")
+#define no_arg N_("argument missing after %s")
+#define no_ass N_("assertion missing after %s")
+#define no_dir N_("directory name missing after %s")
+#define no_fil N_("file name missing after %s")
+#define no_mac N_("macro name missing after %s")
+#define no_pth N_("path name missing after %s")
+#define no_num N_("number missing after %s")
+#define no_tgt N_("target missing after %s")
/* This is the list of all command line options, with the leading
"-" removed. It must be sorted in ASCII collating order. */
DEF_OPT("fno-show-column", 0, OPT_fno_show_column) \
DEF_OPT("fpreprocessed", 0, OPT_fpreprocessed) \
DEF_OPT("fshow-column", 0, OPT_fshow_column) \
+ DEF_OPT("fsigned-char", 0, OPT_fsigned_char) \
DEF_OPT("ftabstop=", no_num, OPT_ftabstop) \
+ DEF_OPT("funsigned-char", 0, OPT_funsigned_char) \
DEF_OPT("h", 0, OPT_h) \
DEF_OPT("idirafter", no_dir, OPT_idirafter) \
DEF_OPT("imacros", no_fil, OPT_imacros) \
/* Handle one command-line option in (argc, argv).
Can be called multiple times, to handle multiple sets of options.
+ If ignore is non-zero, this will ignore unrecognized -W* options.
Returns number of strings consumed. */
-
int
-cpp_handle_option (pfile, argc, argv)
+cpp_handle_option (pfile, argc, argv, ignore)
cpp_reader *pfile;
int argc;
char **argv;
+ int ignore;
{
int i = 0;
struct cpp_pending *pend = CPP_OPTION (pfile, pending);
else if (CPP_OPTION (pfile, out_fname) == NULL)
CPP_OPTION (pfile, out_fname) = argv[i];
else
- cpp_fatal (pfile, "Too many filenames. Type %s --help for usage info",
+ cpp_fatal (pfile, "too many filenames. Type %s --help for usage info",
progname);
}
else
case OPT_fno_show_column:
CPP_OPTION (pfile, show_column) = 0;
break;
+ case OPT_fsigned_char:
+ CPP_OPTION (pfile, signed_char) = 1;
+ break;
+ case OPT_funsigned_char:
+ CPP_OPTION (pfile, signed_char) = 0;
+ break;
case OPT_ftabstop:
/* Silently ignore empty string, non-longs and silly values. */
if (arg[0] != '\0')
CPP_OPTION (pfile, no_standard_includes) = 1;
break;
case OPT_nostdincplusplus:
- /* -nostdinc++ causes no default C++-specific include directories. */
+ /* -nostdinc++ causes no default C++-specific include directories. */
CPP_OPTION (pfile, no_standard_cplusplus_includes) = 1;
break;
case OPT_o:
CPP_OPTION (pfile, out_fname) = arg;
else
{
- cpp_fatal (pfile, "Output filename specified twice");
+ cpp_fatal (pfile, "output filename specified twice");
return argc;
}
break;
{
case 'M':
CPP_OPTION (pfile, dump_macros) = dump_only;
- CPP_OPTION (pfile, no_output) = 1;
break;
case 'N':
CPP_OPTION (pfile, dump_macros) = dump_names;
CPP_OPTION (pfile, print_deps_missing_files) = 1;
break;
case OPT_M:
+ /* When doing dependencies with -M or -MM, suppress normal
+ preprocessed output, but still do -dM etc. as software
+ depends on this. Preprocessed output occurs if -MD, -MMD
+ or environment var dependency generation is used. */
CPP_OPTION (pfile, print_deps) = 2;
+ CPP_OPTION (pfile, no_output) = 1;
break;
case OPT_MM:
CPP_OPTION (pfile, print_deps) = 1;
+ CPP_OPTION (pfile, no_output) = 1;
break;
case OPT_MF:
CPP_OPTION (pfile, deps_file) = arg;
deps_add_target (pfile->deps, arg, opt_code == OPT_MQ);
break;
- /* -MD and -MMD for cpp0 are deprecated and undocumented
- (use -M or -MM with -MF instead), and probably should be
- removed with the next major GCC version. For the moment
- we allow these for the benefit of Automake 1.4, which
- uses these when dependency tracking is enabled. Automake
- 1.5 will fix this. */
case OPT_MD:
CPP_OPTION (pfile, print_deps) = 2;
CPP_OPTION (pfile, deps_file) = arg;
if (arg[1] == '\0')
{
- struct pending_option *o1, *o2;
-
- o1 = pend->directive_head;
- while (o1)
- {
- o2 = o1->next;
- free (o1);
- o1 = o2;
- }
+ free_chain (pend->directive_head);
pend->directive_head = NULL;
pend->directive_tail = NULL;
}
append_include_chain (pfile, (char *)xstrdup(arg), SYSTEM, 0);
break;
case OPT_include:
- {
- struct pending_option *o = (struct pending_option *)
- xmalloc (sizeof (struct pending_option));
- o->arg = arg;
-
- /* This list has to be built in reverse order so that
- when cpp_start_read pushes all the -include files onto
- the buffer stack, they will be scanned in forward order. */
- o->next = pend->include_head;
- pend->include_head = o;
- }
- break;
case OPT_imacros:
{
struct pending_option *o = (struct pending_option *)
o->arg = arg;
o->next = NULL;
- APPEND (pend, imacros, o);
+ if (opt_code == OPT_include)
+ APPEND (pend, include, o);
+ else
+ APPEND (pend, imacros, o);
}
break;
case OPT_iwithprefix:
CPP_OPTION (pfile, warnings_are_errors) = 0;
else if (!strcmp (argv[i], "-Wno-system-headers"))
CPP_OPTION (pfile, warn_system_headers) = 0;
+ else if (! ignore)
+ return i;
break;
/* SDCC specific */
case OPT_obj_ext:
for (i = 0; i < argc; i += strings_processed)
{
- strings_processed = cpp_handle_option (pfile, argc - i, argv + i);
+ strings_processed = cpp_handle_option (pfile, argc - i, argv + i, 1);
if (strings_processed == 0)
break;
}
if (CPP_OPTION (pfile, cplusplus))
CPP_OPTION (pfile, warn_traditional) = 0;
- /* Set this if it hasn't been set already. */
+ /* Set this if it hasn't been set already. */
if (CPP_OPTION (pfile, user_label_prefix) == NULL)
CPP_OPTION (pfile, user_label_prefix) = USER_LABEL_PREFIX;
if (CPP_OPTION (pfile, preprocessed))
pfile->state.prevent_expansion = 1;
+ /* -dM makes no normal output. This is set here so that -dM -dD
+ works as expected. */
+ if (CPP_OPTION (pfile, dump_macros) == dump_only)
+ CPP_OPTION (pfile, no_output) = 1;
+
+ /* Disable -dD, -dN and -dI if we should make no normal output
+ (such as with -M). Allow -M -dM since some software relies on
+ this. */
+ if (CPP_OPTION (pfile, no_output))
+ {
+ if (CPP_OPTION (pfile, dump_macros) != dump_only)
+ CPP_OPTION (pfile, dump_macros) = dump_none;
+ CPP_OPTION (pfile, dump_includes) = 0;
+ }
+
/* We need to do this after option processing and before
cpp_start_read, as cppmain.c relies on the options->no_output to
set its callbacks correctly before calling cpp_start_read. */
cpp_fatal (pfile, "you must additionally specify either -M or -MM");
}
-/* Set up dependency-file output. */
+/* Set up dependency-file output. On exit, if print_deps is non-zero
+ then deps_file is not NULL; stdout is the empty string. */
static void
init_dependency_output (pfile)
cpp_reader *pfile;
else
output_file = spec;
- /* Command line overrides environment variables. */
+ /* Command line -MF overrides environment variables and default. */
if (CPP_OPTION (pfile, deps_file) == 0)
CPP_OPTION (pfile, deps_file) = output_file;
+
CPP_OPTION (pfile, print_deps_append) = 1;
}
-
- /* If dependencies go to standard output, or -MG is used, we should
- suppress output. The user may be requesting other stuff to
- stdout, with -dM, -v etc. We let them shoot themselves in the
- foot. */
- if (CPP_OPTION (pfile, deps_file) == 0
- || CPP_OPTION (pfile, print_deps_missing_files))
- CPP_OPTION (pfile, no_output) = 1;
+ else if (CPP_OPTION (pfile, deps_file) == 0)
+ /* If -M or -MM was seen without -MF, default output to wherever
+ was specified with -o. out_fname is non-NULL here. */
+ CPP_OPTION (pfile, deps_file) = CPP_OPTION (pfile, out_fname);
}
+/* Handle --help output. */
static void
print_help ()
{
- fprintf (stderr, _("Usage: %s [switches] input output\n"), progname);
/* To keep the lines from getting too long for some compilers, limit
- to about 500 characters (6 lines) per chunk. */
+ to about 500 characters (6 lines) per chunk. */
fputs (_("\
Switches:\n\
-include <file> Include the contents of <file> before other files\n\
fputs (_("\
-M Generate make dependencies\n\
-MM As -M, but ignore system header files\n\
+ -MD Generate make dependencies and compile\n\
+ -MMD As -MD, but ignore system header files\n\
-MF <file> Write dependency output to the given file\n\
-MG Treat missing header file as generated files\n\
"), stdout);
fputs (_("\
-D<macro> Define a <macro> with string '1' as its value\n\
-D<macro>=<val> Define a <macro> with <val> as its value\n\
- -A<question> (<answer>) Assert the <answer> to <question>\n\
- -A-<question> (<answer>) Disable the <answer> to <question>\n\
+ -A<question>=<answer> Assert the <answer> to <question>\n\
+ -A-<question>=<answer> Disable the <answer> to <question>\n\
-U<macro> Undefine <macro> \n\
-v Display the version number\n\
"), stdout);
-ftabstop=<number> Distance between tab stops for column reporting\n\
-P Do not generate #line directives\n\
-$ Do not allow '$' in identifiers\n\
- -remap Remap file names when including files.\n\
+ -remap Remap file names when including files\n\
--version Display version information\n\
-h or --help Display this information\n\
"), stdout);
/* CPP Library - lexical analysis.
- Copyright (C) 2000 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
Contributed by Per Bothner, 1994-95.
Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987
along with this program; if not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-/* This lexer works with a single pass of the file. Recently I
- re-wrote it to minimize the places where we step backwards in the
- input stream, to make future changes to support multi-byte
- character sets fairly straight-forward.
-
- There is now only one routine where we do step backwards:
- skip_escaped_newlines. This routine could probably also be changed
- so that it doesn't need to step back. One possibility is to use a
- trick similar to that used in lex_period and lex_percent. Two
- extra characters might be needed, but skip_escaped_newlines itself
- would probably be the only place that needs to be aware of that,
- and changes to the remaining routines would probably only be needed
- if they process a backslash. */
-
#include "config.h"
#include "system.h"
#include "cpplib.h"
SPELL_OPERATOR = 0,
SPELL_CHAR,
SPELL_IDENT,
+ SPELL_NUMBER,
SPELL_STRING,
SPELL_NONE
};
const unsigned char *name;
};
-const unsigned char *digraph_spellings [] = {U"%:", U"%:%:", U"<:",
- U":>", U"<%", U"%>"};
+static const unsigned char *const digraph_spellings[] =
+{ U"%:", U"%:%:", U"<:", U":>", U"<%", U"%>" };
#define OP(e, s) { SPELL_OPERATOR, U s },
#define TK(e, s) { s, U STRINGX (e) },
-const struct token_spelling token_spellings [N_TTYPES] = {TTYPE_TABLE };
+static const struct token_spelling token_spellings[N_TTYPES] = { TTYPE_TABLE };
#undef OP
#undef TK
#define TOKEN_SPELL(token) (token_spellings[(token)->type].category)
#define TOKEN_NAME(token) (token_spellings[(token)->type].name)
+#define BACKUP() do {buffer->cur = buffer->backup_to;} while (0)
-static cppchar_t handle_newline PARAMS ((cpp_buffer *, cppchar_t));
-static cppchar_t skip_escaped_newlines PARAMS ((cpp_buffer *, cppchar_t));
-static cppchar_t get_effective_char PARAMS ((cpp_buffer *));
+static void handle_newline PARAMS ((cpp_reader *));
+static cppchar_t skip_escaped_newlines PARAMS ((cpp_reader *));
+static cppchar_t get_effective_char PARAMS ((cpp_reader *));
-static int skip_asm_block PARAMS ((cpp_reader *, int));
+static int skip_asm_block PARAMS ((cpp_reader *));
static int skip_block_comment PARAMS ((cpp_reader *));
static int skip_line_comment PARAMS ((cpp_reader *));
static void adjust_column PARAMS ((cpp_reader *));
-static void skip_whitespace PARAMS ((cpp_reader *, cppchar_t));
-static cpp_hashnode *parse_identifier PARAMS ((cpp_reader *, cppchar_t));
+static int skip_whitespace PARAMS ((cpp_reader *, cppchar_t));
+static cpp_hashnode *parse_identifier PARAMS ((cpp_reader *));
+static cpp_hashnode *parse_identifier_slow PARAMS ((cpp_reader *,
+ const U_CHAR *));
static void parse_number PARAMS ((cpp_reader *, cpp_string *, cppchar_t, int));
static int unescaped_terminator_p PARAMS ((cpp_reader *, const U_CHAR *));
static void parse_string PARAMS ((cpp_reader *, cpp_token *, cppchar_t));
static void unterminated PARAMS ((cpp_reader *, int));
-static int trigraph_ok PARAMS ((cpp_reader *, cppchar_t));
-static unsigned int copy_text_chars (char *, const char *, unsigned int, int);
-static void save_asm PARAMS ((cpp_reader *, cpp_token *, const U_CHAR *, int));
+static bool trigraph_p PARAMS ((cpp_reader *));
+static unsigned int copy_text_chars PARAMS ((char *, const char *, unsigned int));
+static void save_asm PARAMS ((cpp_reader *, cpp_token *, const U_CHAR *));
static void save_comment PARAMS ((cpp_reader *, cpp_token *, const U_CHAR *));
-static void lex_percent PARAMS ((cpp_buffer *, cpp_token *));
-static void lex_dot PARAMS ((cpp_reader *, cpp_token *));
static int name_p PARAMS ((cpp_reader *, const cpp_string *));
static int maybe_read_ucs PARAMS ((cpp_reader *, const unsigned char **,
const unsigned char *, unsigned int *));
+static tokenrun *next_tokenrun PARAMS ((tokenrun *));
-static cpp_chunk *new_chunk PARAMS ((unsigned int));
-static int chunk_suitable PARAMS ((cpp_pool *, cpp_chunk *, unsigned int));
static unsigned int hex_digit_value PARAMS ((unsigned int));
+static _cpp_buff *new_buff PARAMS ((size_t));
/* Utility routine:
Compares, the token TOKEN to the NUL-terminated string STRING.
TOKEN must be a CPP_NAME. Returns 1 for equal, 0 for unequal. */
-
int
cpp_ideq (token, string)
const cpp_token *token;
return !ustrcmp (NODE_NAME (token->val.node), (const U_CHAR *) string);
}
-/* Call when meeting a newline. Returns the character after the newline
- (or carriage-return newline combination), or EOF. */
-static cppchar_t
-handle_newline (buffer, newline_char)
- cpp_buffer *buffer;
- cppchar_t newline_char;
+/* Call when meeting a newline, assumed to be in buffer->cur[-1].
+ Returns with buffer->cur pointing to the character immediately
+ following the newline (combination). */
+static void
+handle_newline (pfile)
+ cpp_reader *pfile;
{
- cppchar_t next = EOF;
-
- buffer->col_adjust = 0;
- buffer->lineno++;
- buffer->line_base = buffer->cur;
+ cpp_buffer *buffer = pfile->buffer;
- /* Handle CR-LF and LF-CR combinations, get the next character. */
- if (buffer->cur < buffer->rlimit)
- {
- next = *buffer->cur++;
- if (next + newline_char == '\r' + '\n')
- {
- buffer->line_base = buffer->cur;
- if (buffer->cur < buffer->rlimit)
- next = *buffer->cur++;
- else
- next = EOF;
- }
- }
+ /* Handle CR-LF and LF-CR. Most other implementations (e.g. java)
+ only accept CR-LF; maybe we should fall back to that behaviour? */
+ if (buffer->cur[-1] + buffer->cur[0] == '\r' + '\n')
+ buffer->cur++;
- buffer->read_ahead = next;
- return next;
+ buffer->line_base = buffer->cur;
+ buffer->col_adjust = 0;
+ pfile->line++;
}
-/* Subroutine of skip_escaped_newlines; called when a trigraph is
- encountered. It warns if necessary, and returns true if the
- trigraph should be honoured. FROM_CHAR is the third character of a
- trigraph, and presumed to be the previous character for position
- reporting. */
-static int
-trigraph_ok (pfile, from_char)
+/* Subroutine of skip_escaped_newlines; called when a 3-character
+ sequence beginning with "??" is encountered. buffer->cur points to
+ the second '?'.
+
+ Warn if necessary, and returns true if the sequence forms a
+ trigraph and the trigraph should be honoured. */
+static bool
+trigraph_p (pfile)
cpp_reader *pfile;
- cppchar_t from_char;
{
- int accept = CPP_OPTION (pfile, trigraphs);
-
+ cpp_buffer *buffer = pfile->buffer;
+ cppchar_t from_char = buffer->cur[1];
+ bool accept;
+
+ if (!_cpp_trigraph_map[from_char])
+ return false;
+
+ accept = CPP_OPTION (pfile, trigraphs);
+
/* Don't warn about trigraphs in comments. */
if (CPP_OPTION (pfile, warn_trigraphs) && !pfile->state.lexing_comment)
{
- cpp_buffer *buffer = pfile->buffer;
if (accept)
- cpp_warning_with_line (pfile, buffer->lineno, CPP_BUF_COL (buffer) - 2,
+ cpp_warning_with_line (pfile, pfile->line, CPP_BUF_COL (buffer) - 1,
"trigraph ??%c converted to %c",
(int) from_char,
(int) _cpp_trigraph_map[from_char]);
else if (buffer->cur != buffer->last_Wtrigraphs)
{
buffer->last_Wtrigraphs = buffer->cur;
- cpp_warning_with_line (pfile, buffer->lineno,
- CPP_BUF_COL (buffer) - 2,
+ cpp_warning_with_line (pfile, pfile->line,
+ CPP_BUF_COL (buffer) - 1,
"trigraph ??%c ignored", (int) from_char);
}
}
return accept;
}
-/* Assumes local variables buffer and result. */
-#define ACCEPT_CHAR(t) \
- do { result->type = t; buffer->read_ahead = EOF; } while (0)
-
-/* When we move to multibyte character sets, add to these something
- that saves and restores the state of the multibyte conversion
- library. This probably involves saving and restoring a "cookie".
- In the case of glibc it is an 8-byte structure, so is not a high
- overhead operation. In any case, it's out of the fast path. */
-#define SAVE_STATE() do { saved_cur = buffer->cur; } while (0)
-#define RESTORE_STATE() do { buffer->cur = saved_cur; } while (0)
-
-/* Skips any escaped newlines introduced by NEXT, which is either a
- '?' or a '\\'. Returns the next character, which will also have
- been placed in buffer->read_ahead. This routine performs
- preprocessing stages 1 and 2 of the ISO C standard. */
+/* Skips any escaped newlines introduced by '?' or a '\\', assumed to
+ lie in buffer->cur[-1]. Returns the next byte, which will be in
+ buffer->cur[-1]. This routine performs preprocessing stages 1 and
+ 2 of the ISO C standard. */
static cppchar_t
-skip_escaped_newlines (buffer, next)
- cpp_buffer *buffer;
- cppchar_t next;
+skip_escaped_newlines (pfile)
+ cpp_reader *pfile;
{
+ cpp_buffer *buffer = pfile->buffer;
+ cppchar_t next = buffer->cur[-1];
+
/* Only do this if we apply stages 1 and 2. */
if (!buffer->from_stage3)
{
- cppchar_t next1;
const unsigned char *saved_cur;
- int space;
+ cppchar_t next1;
do
{
- if (buffer->cur == buffer->rlimit)
- break;
-
- SAVE_STATE ();
if (next == '?')
{
- next1 = *buffer->cur++;
- if (next1 != '?' || buffer->cur == buffer->rlimit)
- {
- RESTORE_STATE ();
- break;
- }
-
- next1 = *buffer->cur++;
- if (!_cpp_trigraph_map[next1]
- || !trigraph_ok (buffer->pfile, next1))
- {
- RESTORE_STATE ();
- break;
- }
-
- /* We have a full trigraph here. */
- next = _cpp_trigraph_map[next1];
- if (next != '\\' || buffer->cur == buffer->rlimit)
+ if (buffer->cur[0] != '?' || !trigraph_p (pfile))
break;
- SAVE_STATE ();
- }
- /* We have a backslash, and room for at least one more character. */
- space = 0;
- do
- {
- next1 = *buffer->cur++;
- if (!is_nvspace (next1))
+ /* Translate the trigraph. */
+ next = _cpp_trigraph_map[buffer->cur[1]];
+ buffer->cur += 2;
+ if (next != '\\')
break;
- space = 1;
}
- while (buffer->cur < buffer->rlimit);
+
+ if (buffer->cur == buffer->rlimit)
+ break;
+
+ /* We have a backslash, and room for at least one more
+ character. Skip horizontal whitespace. */
+ saved_cur = buffer->cur;
+ do
+ next1 = *buffer->cur++;
+ while (is_nvspace (next1) && buffer->cur < buffer->rlimit);
if (!is_vspace (next1))
{
- RESTORE_STATE ();
+ buffer->cur = saved_cur;
break;
}
- if (space && !buffer->pfile->state.lexing_comment)
- cpp_warning (buffer->pfile,
- "backslash and newline separated by space");
+ if (saved_cur != buffer->cur - 1
+ && !pfile->state.lexing_comment)
+ cpp_warning (pfile, "backslash and newline separated by space");
- next = handle_newline (buffer, next1);
- if (next == EOF)
- cpp_pedwarn (buffer->pfile, "backslash-newline at end of file");
+ handle_newline (pfile);
+ buffer->backup_to = buffer->cur;
+ if (buffer->cur == buffer->rlimit)
+ {
+ cpp_pedwarn (pfile, "backslash-newline at end of file");
+ next = EOF;
+ }
+ else
+ next = *buffer->cur++;
}
while (next == '\\' || next == '?');
}
- buffer->read_ahead = next;
return next;
}
/* Obtain the next character, after trigraph conversion and skipping
- an arbitrary string of escaped newlines. The common case of no
- trigraphs or escaped newlines falls through quickly. */
+ an arbitrarily long string of escaped newlines. The common case of
+ no trigraphs or escaped newlines falls through quickly. On return,
+ buffer->backup_to points to where to return to if the character is
+ not to be processed. */
static cppchar_t
-get_effective_char (buffer)
- cpp_buffer *buffer;
+get_effective_char (pfile)
+ cpp_reader *pfile;
{
- cppchar_t next = EOF;
+ cppchar_t next;
+ cpp_buffer *buffer = pfile->buffer;
- if (buffer->cur < buffer->rlimit)
- {
- next = *buffer->cur++;
-
- /* '?' can introduce trigraphs (and therefore backslash); '\\'
- can introduce escaped newlines, which we want to skip, or
- UCNs, which, depending upon lexer state, we will handle in
- the future. */
- if (next == '?' || next == '\\')
- next = skip_escaped_newlines (buffer, next);
- }
+ buffer->backup_to = buffer->cur;
+ next = *buffer->cur++;
+ if (__builtin_expect (next == '?' || next == '\\', 0))
+ next = skip_escaped_newlines (pfile);
- buffer->read_ahead = next;
- return next;
+ return next;
}
/* SDCC _asm specific */
seeing _endasm. Returns non-zero if _asm terminated by EOF, zero
otherwise. */
static int
-skip_asm_block (pfile, read_ahead)
+skip_asm_block (pfile)
cpp_reader *pfile;
- int read_ahead;
{
#define _ENDASM_STR "endasm"
#define _ENDASM_LEN ((sizeof _ENDASM_STR) - 1)
pfile->state.lexing_comment = 1;
while (buffer->cur != buffer->rlimit)
{
- if (read_ahead != EOF)
- {
- prev_space = 0;
- c = buffer->read_ahead;
- read_ahead = EOF;
- }
- else
- {
- prev_space = is_space(c);
- c = *buffer->cur++;
- }
+ prev_space = is_space(c);
+ c = *buffer->cur++;
next_char:
/* FIXME: For speed, create a new character class of characters
of interest inside block comments. */
if (c == '?' || c == '\\')
- c = skip_escaped_newlines (buffer, c);
+ c = skip_escaped_newlines (pfile);
if (prev_space && c == '_')
{
}
else if (is_vspace (c))
{
- prev_space = is_space(c), c = handle_newline (buffer, c);
+ prev_space = is_space(c);
+ handle_newline (pfile);
goto next_char;
}
else if (c == '\t')
}
pfile->state.lexing_comment = 0;
- buffer->read_ahead = EOF;
return ret;
}
{
prevc = c, c = *buffer->cur++;
- next_char:
/* FIXME: For speed, create a new character class of characters
of interest inside block comments. */
if (c == '?' || c == '\\')
- c = skip_escaped_newlines (buffer, c);
+ c = skip_escaped_newlines (pfile);
/* People like decorating comments with '*', so check for '/'
instead for efficiency. */
break;
/* Warn about potential nested comments, but not if the '/'
- comes immediately before the true comment delimeter.
+ comes immediately before the true comment delimiter.
Don't bother to get it right across escaped newlines. */
if (CPP_OPTION (pfile, warn_comments)
- && buffer->cur != buffer->rlimit)
- {
- prevc = c, c = *buffer->cur++;
- if (c == '*' && buffer->cur != buffer->rlimit)
- {
- prevc = c, c = *buffer->cur++;
- if (c != '/')
- cpp_warning_with_line (pfile, CPP_BUF_LINE (buffer),
- CPP_BUF_COL (buffer),
- "\"/*\" within comment");
- }
- goto next_char;
- }
+ && buffer->cur[0] == '*' && buffer->cur[1] != '/')
+ cpp_warning_with_line (pfile,
+ pfile->line, CPP_BUF_COL (buffer),
+ "\"/*\" within comment");
}
else if (is_vspace (c))
- {
- prevc = c, c = handle_newline (buffer, c);
- goto next_char;
- }
+ handle_newline (pfile);
else if (c == '\t')
adjust_column (pfile);
}
pfile->state.lexing_comment = 0;
- buffer->read_ahead = EOF;
return c != '/' || prevc != '*';
}
-/* Skip a C++ line comment. Handles escaped newlines. Returns
- non-zero if a multiline comment. The following new line, if any,
- is left in buffer->read_ahead. */
+/* Skip a C++ line comment, leaving buffer->cur pointing to the
+ terminating newline. Handles escaped newlines. Returns non-zero
+ if a multiline comment. */
static int
skip_line_comment (pfile)
cpp_reader *pfile;
{
cpp_buffer *buffer = pfile->buffer;
- unsigned int orig_lineno = buffer->lineno;
+ unsigned int orig_line = pfile->line;
cppchar_t c;
pfile->state.lexing_comment = 1;
do
{
- c = EOF;
if (buffer->cur == buffer->rlimit)
- break;
+ goto at_eof;
c = *buffer->cur++;
if (c == '?' || c == '\\')
- c = skip_escaped_newlines (buffer, c);
+ c = skip_escaped_newlines (pfile);
}
while (!is_vspace (c));
+ /* Step back over the newline, except at EOF. */
+ buffer->cur--;
+ at_eof:
+
pfile->state.lexing_comment = 0;
- buffer->read_ahead = c; /* Leave any newline for caller. */
- return orig_lineno != buffer->lineno;
+ return orig_line != pfile->line;
}
/* pfile->buffer->cur is one beyond the \t character. Update
/* Skips whitespace, saving the next non-whitespace character.
Adjusts pfile->col_adjust to account for tabs. Without this,
tokens might be assigned an incorrect column. */
-static void
+static int
skip_whitespace (pfile, c)
cpp_reader *pfile;
cppchar_t c;
/* Just \f \v or \0 left. */
else if (c == '\0')
{
+ if (buffer->cur - 1 == buffer->rlimit)
+ return 0;
if (!warned)
{
cpp_warning (pfile, "null character(s) ignored");
}
}
else if (pfile->state.in_directive && CPP_PEDANTIC (pfile))
- cpp_pedwarn_with_line (pfile, CPP_BUF_LINE (buffer),
+ cpp_pedwarn_with_line (pfile, pfile->line,
CPP_BUF_COL (buffer),
"%s in preprocessing directive",
c == '\f' ? "form feed" : "vertical tab");
- c = EOF;
- if (buffer->cur == buffer->rlimit)
- break;
c = *buffer->cur++;
}
- /* We only want non-vertical space, i.e. ' ' \t \f \v \0. */
+ /* We only want non-vertical space, i.e. ' ' \t \f \v \0. */
while (is_nvspace (c));
- /* Remember the next character. */
- buffer->read_ahead = c;
+ buffer->cur--;
+ return 1;
}
/* See if the characters of a number token are valid in a name (no
if (!is_idchar (string->text[i]))
return 0;
- return 1;
+ return 1;
}
-/* Parse an identifier, skipping embedded backslash-newlines.
- Calculate the hash value of the token while parsing, for improved
- performance. The hashing algorithm *must* match cpp_lookup(). */
-
+/* Parse an identifier, skipping embedded backslash-newlines. This is
+ a critical inner loop. The common case is an identifier which has
+ not been split by backslash-newline, does not contain a dollar
+ sign, and has already been scanned (roughly 10:1 ratio of
+ seen:unseen identifiers in normal code; the distribution is
+ Poisson-like). Second most common case is a new identifier, not
+ split and no dollar sign. The other possibilities are rare and
+ have been relegated to parse_identifier_slow. */
static cpp_hashnode *
-parse_identifier (pfile, c)
+parse_identifier (pfile)
cpp_reader *pfile;
- cppchar_t c;
{
cpp_hashnode *result;
+ const U_CHAR *cur;
+
+ /* Fast-path loop. Skim over a normal identifier.
+ N.B. ISIDNUM does not include $. */
+ cur = pfile->buffer->cur;
+ while (ISIDNUM (*cur))
+ cur++;
+
+ /* Check for slow-path cases. */
+ if (*cur == '?' || *cur == '\\' || *cur == '$')
+ result = parse_identifier_slow (pfile, cur);
+ else
+ {
+ const U_CHAR *base = pfile->buffer->cur - 1;
+ result = (cpp_hashnode *)
+ ht_lookup (pfile->hash_table, base, cur - base, HT_ALLOC);
+ pfile->buffer->cur = cur;
+ }
+
+ /* Rarely, identifiers require diagnostics when lexed.
+ XXX Has to be forced out of the fast path. */
+ if (__builtin_expect ((result->flags & NODE_DIAGNOSTIC)
+ && !pfile->state.skipping, 0))
+ {
+ /* It is allowed to poison the same identifier twice. */
+ if ((result->flags & NODE_POISONED) && !pfile->state.poisoned_ok)
+ cpp_error (pfile, "attempt to use poisoned \"%s\"",
+ NODE_NAME (result));
+
+ /* Constraint 6.10.3.5: __VA_ARGS__ should only appear in the
+ replacement list of a variadic macro. */
+ if (result == pfile->spec_nodes.n__VA_ARGS__
+ && !pfile->state.va_args_ok)
+ cpp_pedwarn (pfile,
+ "__VA_ARGS__ can only appear in the expansion of a C99 variadic macro");
+ }
+
+ return result;
+}
+
+/* Slow path. This handles identifiers which have been split, and
+ identifiers which contain dollar signs. The part of the identifier
+ from PFILE->buffer->cur-1 to CUR has already been scanned. */
+static cpp_hashnode *
+parse_identifier_slow (pfile, cur)
+ cpp_reader *pfile;
+ const U_CHAR *cur;
+{
cpp_buffer *buffer = pfile->buffer;
- unsigned int saw_dollar = 0, len;
+ const U_CHAR *base = buffer->cur - 1;
struct obstack *stack = &pfile->hash_table->stack;
+ unsigned int c, saw_dollar = 0, len;
+
+ /* Copy the part of the token which is known to be okay. */
+ obstack_grow (stack, base, cur - base);
+ /* Now process the part which isn't. We are looking at one of
+ '$', '\\', or '?' on entry to this loop. */
+ c = *cur++;
+ buffer->cur = cur;
do
{
- do
- {
- obstack_1grow (stack, c);
-
- if (c == '$')
- saw_dollar++;
+ while (is_idchar (c))
+ {
+ obstack_1grow (stack, c);
- c = EOF;
- if (buffer->cur == buffer->rlimit)
- break;
+ if (c == '$')
+ saw_dollar++;
- c = *buffer->cur++;
- }
- while (is_idchar (c));
+ c = *buffer->cur++;
+ }
/* Potential escaped newline? */
+ buffer->backup_to = buffer->cur - 1;
if (c != '?' && c != '\\')
- break;
- c = skip_escaped_newlines (buffer, c);
+ break;
+ c = skip_escaped_newlines (pfile);
}
while (is_idchar (c));
- /* Remember the next character. */
- buffer->read_ahead = c;
+ /* Step back over the unwanted char. */
+ BACKUP ();
- /* $ is not a identifier character in the standard, but is commonly
+ /* $ is not an identifier character in the standard, but is commonly
accepted as an extension. Don't warn about it in skipped
conditional blocks. */
- if (saw_dollar && CPP_PEDANTIC (pfile) && ! pfile->skipping)
+ if (saw_dollar && CPP_PEDANTIC (pfile) && ! pfile->state.skipping)
cpp_pedwarn (pfile, "'$' character(s) in identifier");
/* Identifiers are null-terminated. */
len = obstack_object_size (stack);
obstack_1grow (stack, '\0');
- /* This routine commits the memory if necessary. */
- result = (cpp_hashnode *)
+ return (cpp_hashnode *)
ht_lookup (pfile->hash_table, obstack_finish (stack), len, HT_ALLOCED);
-
- /* Some identifiers require diagnostics when lexed. */
- if (result->flags & NODE_DIAGNOSTIC && !pfile->skipping)
- {
- /* It is allowed to poison the same identifier twice. */
- if ((result->flags & NODE_POISONED) && !pfile->state.poisoned_ok)
- cpp_error (pfile, "attempt to use poisoned \"%s\"",
- NODE_NAME (result));
-
- /* Constraint 6.10.3.5: __VA_ARGS__ should only appear in the
- replacement list of a variadic macro. */
- if (result == pfile->spec_nodes.n__VA_ARGS__
- && !pfile->state.va_args_ok)
- cpp_pedwarn (pfile, "__VA_ARGS__ can only appear in the expansion of a C99 variadic macro");
- }
-
- return result;
}
-/* Parse a number, skipping embedded backslash-newlines. */
+/* Parse a number, beginning with character C, skipping embedded
+ backslash-newlines. LEADING_PERIOD is non-zero if there was a "."
+ before C. Place the result in NUMBER. */
static void
parse_number (pfile, number, c, leading_period)
cpp_reader *pfile;
int leading_period;
{
cpp_buffer *buffer = pfile->buffer;
- cpp_pool *pool = &pfile->ident_pool;
unsigned char *dest, *limit;
- dest = POOL_FRONT (pool);
- limit = POOL_LIMIT (pool);
+ dest = BUFF_FRONT (pfile->u_buff);
+ limit = BUFF_LIMIT (pfile->u_buff);
/* Place a leading period. */
if (leading_period)
{
- if (dest >= limit)
- limit = _cpp_next_chunk (pool, 0, &dest);
+ if (dest == limit)
+ {
+ _cpp_extend_buff (pfile, &pfile->u_buff, 1);
+ dest = BUFF_FRONT (pfile->u_buff);
+ limit = BUFF_LIMIT (pfile->u_buff);
+ }
*dest++ = '.';
}
-
+
do
{
do
{
/* Need room for terminating null. */
- if (dest + 1 >= limit)
- limit = _cpp_next_chunk (pool, 0, &dest);
+ if ((size_t) (limit - dest) < 2)
+ {
+ size_t len_so_far = dest - BUFF_FRONT (pfile->u_buff);
+ _cpp_extend_buff (pfile, &pfile->u_buff, 2);
+ dest = BUFF_FRONT (pfile->u_buff) + len_so_far;
+ limit = BUFF_LIMIT (pfile->u_buff);
+ }
*dest++ = c;
- c = EOF;
- if (buffer->cur == buffer->rlimit)
- break;
-
c = *buffer->cur++;
}
while (is_numchar (c) || c == '.' || VALID_SIGN (c, dest[-1]));
/* Potential escaped newline? */
+ buffer->backup_to = buffer->cur - 1;
if (c != '?' && c != '\\')
break;
- c = skip_escaped_newlines (buffer, c);
+ c = skip_escaped_newlines (pfile);
}
while (is_numchar (c) || c == '.' || VALID_SIGN (c, dest[-1]));
- /* Remember the next character. */
- buffer->read_ahead = c;
+ /* Step back over the unwanted char. */
+ BACKUP ();
/* Null-terminate the number. */
*dest = '\0';
- number->text = POOL_FRONT (pool);
+ number->text = BUFF_FRONT (pfile->u_buff);
number->len = dest - number->text;
- POOL_COMMIT (pool, number->len + 1);
+ BUFF_FRONT (pfile->u_buff) = dest + 1;
}
/* Subroutine of parse_string. Emits error for unterminated strings. */
{
cpp_error (pfile, "missing terminating %c character", term);
- if (term == '\"' && pfile->mlstring_pos.line
- && pfile->mlstring_pos.line != pfile->lexer_pos.line)
+ if (term == '\"' && pfile->mls_line && pfile->mls_line != pfile->line)
{
- cpp_error_with_line (pfile, pfile->mlstring_pos.line,
- pfile->mlstring_pos.col,
+ cpp_error_with_line (pfile, pfile->mls_line, pfile->mls_col,
"possible start of unterminated string literal");
- pfile->mlstring_pos.line = 0;
+ pfile->mls_line = 0;
}
}
if (pfile->state.angled_headers)
return 1;
- start = POOL_FRONT (&pfile->ident_pool);
+ start = BUFF_FRONT (pfile->u_buff);
/* An odd number of consecutive backslashes represents an escaped
terminator. */
name. Handles embedded trigraphs and escaped newlines. The stored
string is guaranteed NUL-terminated, but it is not guaranteed that
this is the first NUL since embedded NULs are preserved.
+ Multi-line strings are allowed, but they are deprecated.
- Multi-line strings are allowed, but they are deprecated. */
+ When this function returns, buffer->cur points to the next
+ character to be processed. */
static void
parse_string (pfile, token, terminator)
cpp_reader *pfile;
cppchar_t terminator;
{
cpp_buffer *buffer = pfile->buffer;
- cpp_pool *pool = &pfile->ident_pool;
unsigned char *dest, *limit;
cppchar_t c;
- unsigned int nulls = 0;
+ bool warned_nulls = false, warned_multi = false;
- dest = POOL_FRONT (pool);
- limit = POOL_LIMIT (pool);
+ dest = BUFF_FRONT (pfile->u_buff);
+ limit = BUFF_LIMIT (pfile->u_buff);
for (;;)
{
- if (buffer->cur == buffer->rlimit)
- c = EOF;
- else
- c = *buffer->cur++;
-
- have_char:
- /* We need space for the terminating NUL. */
- if (dest >= limit)
- limit = _cpp_next_chunk (pool, 0, &dest);
-
- if (c == EOF)
+ /* We need room for another char, possibly the terminating NUL. */
+ if ((size_t) (limit - dest) < 1)
{
- unterminated (pfile, terminator);
- break;
+ size_t len_so_far = dest - BUFF_FRONT (pfile->u_buff);
+ _cpp_extend_buff (pfile, &pfile->u_buff, 2);
+ dest = BUFF_FRONT (pfile->u_buff) + len_so_far;
+ limit = BUFF_LIMIT (pfile->u_buff);
}
/* Handle trigraphs, escaped newlines etc. */
+ c = *buffer->cur++;
if (c == '?' || c == '\\')
- c = skip_escaped_newlines (buffer, c);
+ c = skip_escaped_newlines (pfile);
- if (c == terminator && unescaped_terminator_p (pfile, dest))
+ if (c == terminator)
{
- c = EOF;
- break;
+ if (unescaped_terminator_p (pfile, dest))
+ break;
}
else if (is_vspace (c))
{
character literals at end of line. This is a kludge
around not knowing where comments are. */
if (CPP_OPTION (pfile, lang) == CLK_ASM && terminator != '>')
- break;
+ {
+ buffer->cur--;
+ break;
+ }
/* Character constants and header names may not extend over
multiple lines. In Standard C, neither may strings.
if (terminator != '"' || pfile->state.angled_headers)
{
unterminated (pfile, terminator);
+ buffer->cur--;
break;
}
- cpp_pedwarn (pfile, "multi-line string literals are deprecated");
- if (pfile->mlstring_pos.line == 0)
- pfile->mlstring_pos = pfile->lexer_pos;
-
- c = handle_newline (buffer, c);
- *dest++ = '\n';
- goto have_char;
+ if (!warned_multi)
+ {
+ warned_multi = true;
+ cpp_pedwarn (pfile, "multi-line string literals are deprecated");
+ }
+
+ if (pfile->mls_line == 0)
+ {
+ pfile->mls_line = token->line;
+ pfile->mls_col = token->col;
+ }
+
+ handle_newline (pfile);
+ c = '\n';
}
else if (c == '\0')
{
- if (nulls++ == 0)
- cpp_warning (pfile, "null character(s) preserved in literal");
+ if (buffer->cur - 1 == buffer->rlimit)
+ {
+ unterminated (pfile, terminator);
+ buffer->cur--;
+ break;
+ }
+ if (!warned_nulls)
+ {
+ warned_nulls = true;
+ cpp_warning (pfile, "null character(s) preserved in literal");
+ }
}
*dest++ = c;
}
- /* Remember the next character. */
- buffer->read_ahead = c;
*dest = '\0';
- token->val.str.text = POOL_FRONT (pool);
- token->val.str.len = dest - token->val.str.text;
- POOL_COMMIT (pool, token->val.str.len + 1);
+ token->val.str.text = BUFF_FRONT (pfile->u_buff);
+ token->val.str.len = dest - BUFF_FRONT (pfile->u_buff);
+ BUFF_FRONT (pfile->u_buff) = dest + 1;
}
/* Fixed _WIN32 problem with CR-CR-LF sequences when outputting
CRs are automatically generated, because the output is
opened in TEXT mode. If dest == NULL, only count chars */
static unsigned int
-copy_text_chars (dest, src, len, read_ahead)
+copy_text_chars (dest, src, len)
char *dest;
const char *src;
unsigned int len;
- int read_ahead;
{
unsigned int n = 0;
const char *p;
- if (read_ahead != EOF && read_ahead != '\r')
- {
- if (dest != NULL)
- *dest++ = read_ahead;
- ++n;
- }
-
for (p = src; p != src + len; ++p)
{
assert(*p != '\0');
/* SDCC _asm specific */
/* The stored comment includes the comment start and any terminator. */
static void
-save_asm (pfile, token, from, read_ahead)
+save_asm (pfile, token, from)
cpp_reader *pfile;
cpp_token *token;
const unsigned char *from;
- int read_ahead;
{
#define _ASM_STR "_asm"
#define _ASM_LEN ((sizeof _ASM_STR) - 1)
unsigned char *buffer;
unsigned int text_len, len;
- /* ignore read_ahead if it is a CR */
- if (read_ahead == '\r')
- read_ahead = EOF;
len = pfile->buffer->cur - from;
/* + _ASM_LEN for the initial '_asm'. */
- text_len = copy_text_chars (NULL, from, len, read_ahead) + _ASM_LEN;
- buffer = _cpp_pool_alloc (&pfile->ident_pool, text_len);
+ text_len = copy_text_chars (NULL, from, len) + _ASM_LEN;
+ buffer = _cpp_unaligned_alloc (pfile, text_len);
+
token->type = CPP_ASM;
token->val.str.len = text_len;
token->val.str.text = buffer;
memcpy (buffer, _ASM_STR, _ASM_LEN);
- copy_text_chars (buffer + _ASM_LEN, from, len, read_ahead);
+ copy_text_chars (buffer + _ASM_LEN, from, len);
}
/* The stored comment includes the comment start and any terminator. */
const unsigned char *from;
{
unsigned char *buffer;
- unsigned int text_len, len;
+ unsigned int len;
+
+ len = pfile->buffer->cur - from + 1; /* + 1 for the initial '/'. */
- len = pfile->buffer->cur - from;
/* C++ comments probably (not definitely) have moved past a new
line, which we don't want to save in the comment. */
- if (pfile->buffer->read_ahead != EOF)
+ if (is_vspace (pfile->buffer->cur[-1]))
len--;
- /* + 1 for the initial '/'. */
- text_len = copy_text_chars (NULL, from, len, EOF) + 1;
- buffer = _cpp_pool_alloc (&pfile->ident_pool, text_len);
+ buffer = _cpp_unaligned_alloc (pfile, len);
token->type = CPP_COMMENT;
- token->val.str.len = text_len;
+ token->val.str.len = len;
token->val.str.text = buffer;
buffer[0] = '/';
- copy_text_chars (buffer + 1, from, len, EOF);
+ copy_text_chars (buffer + 1, from, len);
}
-/* Subroutine of lex_token to handle '%'. A little tricky, since we
- want to avoid stepping back when lexing %:%X. */
-static void
-lex_percent (buffer, result)
- cpp_buffer *buffer;
- cpp_token *result;
+/* Allocate COUNT tokens for RUN. */
+void
+_cpp_init_tokenrun (run, count)
+ tokenrun *run;
+ unsigned int count;
{
- cppchar_t c;
+ run->base = xnewvec (cpp_token, count);
+ run->limit = run->base + count;
+ run->next = NULL;
+}
- result->type = CPP_MOD;
- /* Parsing %:%X could leave an extra character. */
- if (buffer->extra_char == EOF)
- c = get_effective_char (buffer);
- else
+/* Returns the next tokenrun, or creates one if there is none. */
+static tokenrun *
+next_tokenrun (run)
+ tokenrun *run;
+{
+ if (run->next == NULL)
{
- c = buffer->read_ahead = buffer->extra_char;
- buffer->extra_char = EOF;
+ run->next = xnew (tokenrun);
+ run->next->prev = run;
+ _cpp_init_tokenrun (run->next, 250);
}
- if (c == '=')
- ACCEPT_CHAR (CPP_MOD_EQ);
- else if (CPP_OPTION (buffer->pfile, digraphs))
- {
- if (c == ':')
- {
- result->flags |= DIGRAPH;
- ACCEPT_CHAR (CPP_HASH);
- if (get_effective_char (buffer) == '%')
- {
- buffer->extra_char = get_effective_char (buffer);
- if (buffer->extra_char == ':')
- {
- buffer->extra_char = EOF;
- ACCEPT_CHAR (CPP_PASTE);
- }
- else
- /* We'll catch the extra_char when we're called back. */
- buffer->read_ahead = '%';
- }
- }
- else if (c == '>')
- {
- result->flags |= DIGRAPH;
- ACCEPT_CHAR (CPP_CLOSE_BRACE);
- }
- }
+ return run->next;
}
-/* Subroutine of lex_token to handle '.'. This is tricky, since we
- want to avoid stepping back when lexing '...' or '.123'. In the
- latter case we should also set a flag for parse_number. */
-static void
-lex_dot (pfile, result)
+/* Allocate a single token that is invalidated at the same time as the
+ rest of the tokens on the line. Has its line and col set to the
+ same as the last lexed token, so that diagnostics appear in the
+ right place. */
+cpp_token *
+_cpp_temp_token (pfile)
cpp_reader *pfile;
- cpp_token *result;
{
- cpp_buffer *buffer = pfile->buffer;
- cppchar_t c;
+ cpp_token *old, *result;
- /* Parsing ..X could leave an extra character. */
- if (buffer->extra_char == EOF)
- c = get_effective_char (buffer);
- else
+ old = pfile->cur_token - 1;
+ if (pfile->cur_token == pfile->cur_run->limit)
{
- c = buffer->read_ahead = buffer->extra_char;
- buffer->extra_char = EOF;
+ pfile->cur_run = next_tokenrun (pfile->cur_run);
+ pfile->cur_token = pfile->cur_run->base;
}
- /* All known character sets have 0...9 contiguous. */
- if (c >= '0' && c <= '9')
- {
- result->type = CPP_NUMBER;
- parse_number (pfile, &result->val.str, c, 1);
- }
- else
+ result = pfile->cur_token++;
+ result->line = old->line;
+ result->col = old->col;
+ return result;
+}
+
+/* Lex a token into RESULT (external interface). Takes care of issues
+ like directive handling, token lookahead, multiple include
+ optimization and skipping. */
+const cpp_token *
+_cpp_lex_token (pfile)
+ cpp_reader *pfile;
+{
+ cpp_token *result;
+
+ for (;;)
{
- result->type = CPP_DOT;
- if (c == '.')
+ if (pfile->cur_token == pfile->cur_run->limit)
{
- buffer->extra_char = get_effective_char (buffer);
- if (buffer->extra_char == '.')
- {
- buffer->extra_char = EOF;
- ACCEPT_CHAR (CPP_ELLIPSIS);
- }
- else
- /* We'll catch the extra_char when we're called back. */
- buffer->read_ahead = '.';
+ pfile->cur_run = next_tokenrun (pfile->cur_run);
+ pfile->cur_token = pfile->cur_run->base;
}
- else if (c == '*' && CPP_OPTION (pfile, cplusplus))
- ACCEPT_CHAR (CPP_DOT_STAR);
+
+ if (pfile->lookaheads)
+ {
+ pfile->lookaheads--;
+ result = pfile->cur_token++;
+ }
+ else
+ result = _cpp_lex_direct (pfile);
+
+ if (result->flags & BOL)
+ {
+ /* Is this a directive. If _cpp_handle_directive returns
+ false, it is an assembler #. */
+ if (result->type == CPP_HASH
+ && !pfile->state.parsing_args
+ && _cpp_handle_directive (pfile, result->flags & PREV_WHITE))
+ continue;
+ if (pfile->cb.line_change && !pfile->state.skipping)
+ (*pfile->cb.line_change)(pfile, result, pfile->state.parsing_args);
+ }
+
+ /* We don't skip tokens in directives. */
+ if (pfile->state.in_directive)
+ break;
+
+ /* Outside a directive, invalidate controlling macros. At file
+ EOF, _cpp_lex_direct takes care of popping the buffer, so we never
+ get here and MI optimisation works. */
+ pfile->mi_valid = false;
+
+ if (!pfile->state.skipping || result->type == CPP_EOF)
+ break;
}
+
+ return result;
}
-void
-_cpp_lex_token (pfile, result)
+#define IF_NEXT_IS(CHAR, THEN_TYPE, ELSE_TYPE) \
+ do { \
+ if (get_effective_char (pfile) == CHAR) \
+ result->type = THEN_TYPE; \
+ else \
+ { \
+ BACKUP (); \
+ result->type = ELSE_TYPE; \
+ } \
+ } while (0)
+
+/* Lex a token into pfile->cur_token, which is also incremented, to
+ get diagnostics pointing to the correct location.
+
+ Does not handle issues such as token lookahead, multiple-include
+ optimisation, directives, skipping etc. This function is only
+ suitable for use by _cpp_lex_token, and in special cases like
+ lex_expansion_token which doesn't care for any of these issues.
+
+ When meeting a newline, returns CPP_EOF if parsing a directive,
+ otherwise returns to the start of the token buffer if permissible.
+ Returns the location of the lexed token. */
+cpp_token *
+_cpp_lex_direct (pfile)
cpp_reader *pfile;
- cpp_token *result;
{
cppchar_t c;
cpp_buffer *buffer;
const unsigned char *comment_start;
- unsigned char bol;
+ cpp_token *result = pfile->cur_token++;
- skip:
- bol = pfile->state.next_bol;
- done_directive:
+ fresh_line:
buffer = pfile->buffer;
- pfile->state.next_bol = 0;
result->flags = buffer->saved_flags;
buffer->saved_flags = 0;
- next_char:
- pfile->lexer_pos.line = buffer->lineno;
- next_char2:
- pfile->lexer_pos.col = CPP_BUF_COLUMN (buffer, buffer->cur);
+ update_tokens_line:
+ result->line = pfile->line;
- c = buffer->read_ahead;
- if (c == EOF && buffer->cur < buffer->rlimit)
- {
- c = *buffer->cur++;
- pfile->lexer_pos.col++;
- }
+ skipped_white:
+ c = *buffer->cur++;
+ result->col = CPP_BUF_COLUMN (buffer, buffer->cur);
- do_switch:
- buffer->read_ahead = EOF;
+ trigraph:
switch (c)
{
- case EOF:
- /* Non-empty files should end in a newline. Checking "bol" too
- prevents multiple warnings when hitting the EOF more than
- once, like in a directive. Don't warn for command line and
- _Pragma buffers. */
- if (pfile->lexer_pos.col != 0 && !bol && !buffer->from_stage3)
- cpp_pedwarn (pfile, "no newline at end of file");
- pfile->state.next_bol = 1;
- pfile->skipping = 0; /* In case missing #endif. */
- result->type = CPP_EOF;
- /* Don't do MI optimisation. */
- return;
-
case ' ': case '\t': case '\f': case '\v': case '\0':
- skip_whitespace (pfile, c);
result->flags |= PREV_WHITE;
- goto next_char2;
+ if (skip_whitespace (pfile, c))
+ goto skipped_white;
- case '\n': case '\r':
- if (!pfile->state.in_directive)
+ /* EOF. */
+ buffer->cur--;
+ buffer->saved_flags = BOL;
+ if (!pfile->state.parsing_args && !pfile->state.in_directive)
{
- handle_newline (buffer, c);
- bol = 1;
- pfile->lexer_pos.output_line = buffer->lineno;
- /* This is a new line, so clear any white space flag.
- Newlines in arguments are white space (6.10.3.10);
- parse_arg takes care of that. */
- result->flags &= ~(PREV_WHITE | AVOID_LPASTE);
- goto next_char;
+ if (buffer->cur != buffer->line_base)
+ {
+ /* Non-empty files should end in a newline. Don't warn
+ for command line and _Pragma buffers. */
+ if (!buffer->from_stage3)
+ cpp_pedwarn (pfile, "no newline at end of file");
+ handle_newline (pfile);
+ }
+
+ /* Don't pop the last buffer. */
+ if (buffer->prev)
+ {
+ unsigned char stop = buffer->return_at_eof;
+
+ _cpp_pop_buffer (pfile);
+ if (!stop)
+ goto fresh_line;
+ }
}
+ result->type = CPP_EOF;
+ break;
- /* Don't let directives spill over to the next line. */
- buffer->read_ahead = c;
- pfile->state.next_bol = 1;
+ case '\n': case '\r':
+ handle_newline (pfile);
+ buffer->saved_flags = BOL;
+ if (! pfile->state.in_directive)
+ {
+ if (pfile->state.parsing_args == 2)
+ buffer->saved_flags |= PREV_WHITE;
+ if (!pfile->keep_tokens)
+ {
+ pfile->cur_run = &pfile->base_run;
+ result = pfile->base_run.base;
+ pfile->cur_token = result + 1;
+ }
+ goto fresh_line;
+ }
result->type = CPP_EOF;
- /* Don't break; pfile->skipping might be true. */
- return;
+ break;
case '?':
case '\\':
/* These could start an escaped newline, or '?' a trigraph. Let
skip_escaped_newlines do all the work. */
{
- unsigned int lineno = buffer->lineno;
+ unsigned int line = pfile->line;
- c = skip_escaped_newlines (buffer, c);
- if (lineno != buffer->lineno)
- /* We had at least one escaped newline of some sort, and the
- next character is in buffer->read_ahead. Update the
- token's line and column. */
- goto next_char;
+ c = skip_escaped_newlines (pfile);
+ if (line != pfile->line)
+ {
+ buffer->cur--;
+ /* We had at least one escaped newline of some sort.
+ Update the token's line and column. */
+ goto update_tokens_line;
+ }
+ }
- /* We are either the original '?' or '\\', or a trigraph. */
+ /* We are either the original '?' or '\\', or a trigraph. */
+ if (c == '?')
result->type = CPP_QUERY;
- buffer->read_ahead = EOF;
- if (c == '\\')
- goto random_char;
- else if (c != '?')
- goto do_switch;
- }
+ else if (c == '\\')
+ goto random_char;
+ else
+ goto trigraph;
break;
case '0': case '1': case '2': case '3': case '4':
parse_number (pfile, &result->val.str, c, 0);
break;
- case '$':
- if (!CPP_OPTION (pfile, dollars_in_ident))
- goto random_char;
- /* Fall through... */
+ case 'L':
+ /* 'L' may introduce wide characters or strings. */
+ {
+ const unsigned char *pos = buffer->cur;
+
+ c = get_effective_char (pfile);
+ if (c == '\'' || c == '"')
+ {
+ result->type = (c == '"' ? CPP_WSTRING: CPP_WCHAR);
+ parse_string (pfile, result, c);
+ break;
+ }
+ buffer->cur = pos;
+ }
+ /* Fall through. */
+ start_ident:
case '_':
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
case 's': case 't': case 'u': case 'v': case 'w': case 'x':
case 'y': case 'z':
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
- case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
+ case 'G': case 'H': case 'I': case 'J': case 'K':
case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
case 'Y': case 'Z':
result->type = CPP_NAME;
- result->val.node = parse_identifier (pfile, c);
+ result->val.node = parse_identifier (pfile);
- /* 'L' may introduce wide characters or strings. */
- if (result->val.node == pfile->spec_nodes.n_L)
- {
- c = buffer->read_ahead; /* For make_string. */
- if (c == '\'' || c == '"')
- {
- ACCEPT_CHAR (c == '"' ? CPP_WSTRING: CPP_WCHAR);
- goto make_string;
- }
- }
/* SDCC _asm specific */
/* handle _asm ... _endasm ; */
- else if (CPP_OPTION(pfile, preproc_asm) == 0 && result->val.node == pfile->spec_nodes.n__asm)
+ if (CPP_OPTION(pfile, preproc_asm) == 0 && result->val.node == pfile->spec_nodes.n__asm)
{
- int read_ahead = buffer->read_ahead;
-
comment_start = buffer->cur;
result->type = CPP_ASM;
- skip_asm_block (pfile, read_ahead);
+ skip_asm_block (pfile);
/* Save the _asm block as a token in its own right. */
- save_asm (pfile, result, comment_start, read_ahead);
+ save_asm (pfile, result, comment_start);
}
/* Convert named operators to their proper types. */
else if (result->val.node->flags & NODE_OPERATOR)
case '\'':
case '"':
result->type = c == '"' ? CPP_STRING: CPP_CHAR;
- make_string:
parse_string (pfile, result, c);
break;
case '/':
/* A potential block or line comment. */
comment_start = buffer->cur;
- result->type = CPP_DIV;
- c = get_effective_char (buffer);
- if (c == '=')
- ACCEPT_CHAR (CPP_DIV_EQ);
- if (c != '/' && c != '*')
- break;
-
+ c = get_effective_char (pfile);
+
if (c == '*')
{
if (skip_block_comment (pfile))
- cpp_error_with_line (pfile, pfile->lexer_pos.line,
- pfile->lexer_pos.col,
- "unterminated comment");
+ cpp_error (pfile, "unterminated comment");
}
- else
+ else if (c == '/' && (CPP_OPTION (pfile, cplusplus_comments)
+ || CPP_IN_SYSTEM_HEADER (pfile)))
{
- if (!CPP_OPTION (pfile, cplusplus_comments)
- && !CPP_IN_SYSTEM_HEADER (pfile))
- break;
-
/* Warn about comments only if pedantically GNUC89, and not
in system headers. */
if (CPP_OPTION (pfile, lang) == CLK_GNUC89 && CPP_PEDANTIC (pfile)
buffer->warned_cplusplus_comments = 1;
}
- /* Skip_line_comment updates buffer->read_ahead. */
if (skip_line_comment (pfile) && CPP_OPTION (pfile, warn_comments))
- cpp_warning_with_line (pfile, pfile->lexer_pos.line,
- pfile->lexer_pos.col,
- "multi-line comment");
+ cpp_warning (pfile, "multi-line comment");
+ }
+ else if (c == '=')
+ {
+ result->type = CPP_DIV_EQ;
+ break;
+ }
+ else
+ {
+ BACKUP ();
+ result->type = CPP_DIV;
+ break;
}
- /* Skipping the comment has updated buffer->read_ahead. */
if (!pfile->state.save_comments)
{
result->flags |= PREV_WHITE;
- goto next_char;
+ goto update_tokens_line;
}
/* Save the comment as a token in its own right. */
save_comment (pfile, result, comment_start);
- /* fixed for SDCPP:
- when executed with -C option, comments
- were included even if they where in skipped #if block.
- Applied solution from GCC cpp 3.3.2 */
break;
case '<':
if (pfile->state.angled_headers)
{
result->type = CPP_HEADER_NAME;
- c = '>'; /* terminator. */
- goto make_string;
+ parse_string (pfile, result, '>');
+ break;
}
- result->type = CPP_LESS;
- c = get_effective_char (buffer);
+ c = get_effective_char (pfile);
if (c == '=')
- ACCEPT_CHAR (CPP_LESS_EQ);
+ result->type = CPP_LESS_EQ;
else if (c == '<')
- {
- ACCEPT_CHAR (CPP_LSHIFT);
- if (get_effective_char (buffer) == '=')
- ACCEPT_CHAR (CPP_LSHIFT_EQ);
- }
+ IF_NEXT_IS ('=', CPP_LSHIFT_EQ, CPP_LSHIFT);
else if (c == '?' && CPP_OPTION (pfile, cplusplus))
- {
- ACCEPT_CHAR (CPP_MIN);
- if (get_effective_char (buffer) == '=')
- ACCEPT_CHAR (CPP_MIN_EQ);
- }
+ IF_NEXT_IS ('=', CPP_MIN_EQ, CPP_MIN);
else if (c == ':' && CPP_OPTION (pfile, digraphs))
{
- ACCEPT_CHAR (CPP_OPEN_SQUARE);
+ result->type = CPP_OPEN_SQUARE;
result->flags |= DIGRAPH;
}
else if (c == '%' && CPP_OPTION (pfile, digraphs))
{
- ACCEPT_CHAR (CPP_OPEN_BRACE);
+ result->type = CPP_OPEN_BRACE;
result->flags |= DIGRAPH;
}
+ else
+ {
+ BACKUP ();
+ result->type = CPP_LESS;
+ }
break;
case '>':
- result->type = CPP_GREATER;
- c = get_effective_char (buffer);
+ c = get_effective_char (pfile);
if (c == '=')
- ACCEPT_CHAR (CPP_GREATER_EQ);
+ result->type = CPP_GREATER_EQ;
else if (c == '>')
- {
- ACCEPT_CHAR (CPP_RSHIFT);
- if (get_effective_char (buffer) == '=')
- ACCEPT_CHAR (CPP_RSHIFT_EQ);
- }
+ IF_NEXT_IS ('=', CPP_RSHIFT_EQ, CPP_RSHIFT);
else if (c == '?' && CPP_OPTION (pfile, cplusplus))
+ IF_NEXT_IS ('=', CPP_MAX_EQ, CPP_MAX);
+ else
{
- ACCEPT_CHAR (CPP_MAX);
- if (get_effective_char (buffer) == '=')
- ACCEPT_CHAR (CPP_MAX_EQ);
+ BACKUP ();
+ result->type = CPP_GREATER;
}
break;
case '%':
- lex_percent (buffer, result);
- if (result->type == CPP_HASH)
- goto do_hash;
- break;
-
- case '.':
- lex_dot (pfile, result);
- break;
-
- case '+':
- result->type = CPP_PLUS;
- c = get_effective_char (buffer);
+ c = get_effective_char (pfile);
if (c == '=')
- ACCEPT_CHAR (CPP_PLUS_EQ);
- else if (c == '+')
- ACCEPT_CHAR (CPP_PLUS_PLUS);
- break;
+ result->type = CPP_MOD_EQ;
+ else if (CPP_OPTION (pfile, digraphs) && c == ':')
+ {
+ result->flags |= DIGRAPH;
+ result->type = CPP_HASH;
+ if (get_effective_char (pfile) == '%')
+ {
+ const unsigned char *pos = buffer->cur;
- case '-':
- result->type = CPP_MINUS;
- c = get_effective_char (buffer);
- if (c == '>')
+ if (get_effective_char (pfile) == ':')
+ result->type = CPP_PASTE;
+ else
+ buffer->cur = pos - 1;
+ }
+ else
+ BACKUP ();
+ }
+ else if (CPP_OPTION (pfile, digraphs) && c == '>')
{
- ACCEPT_CHAR (CPP_DEREF);
- if (CPP_OPTION (pfile, cplusplus)
- && get_effective_char (buffer) == '*')
- ACCEPT_CHAR (CPP_DEREF_STAR);
+ result->flags |= DIGRAPH;
+ result->type = CPP_CLOSE_BRACE;
+ }
+ else
+ {
+ BACKUP ();
+ result->type = CPP_MOD;
}
- else if (c == '=')
- ACCEPT_CHAR (CPP_MINUS_EQ);
- else if (c == '-')
- ACCEPT_CHAR (CPP_MINUS_MINUS);
- break;
-
- case '*':
- result->type = CPP_MULT;
- if (get_effective_char (buffer) == '=')
- ACCEPT_CHAR (CPP_MULT_EQ);
- break;
-
- case '=':
- result->type = CPP_EQ;
- if (get_effective_char (buffer) == '=')
- ACCEPT_CHAR (CPP_EQ_EQ);
break;
- case '!':
- result->type = CPP_NOT;
- if (get_effective_char (buffer) == '=')
- ACCEPT_CHAR (CPP_NOT_EQ);
- break;
+ case '.':
+ result->type = CPP_DOT;
+ c = get_effective_char (pfile);
+ if (c == '.')
+ {
+ const unsigned char *pos = buffer->cur;
- case '&':
- result->type = CPP_AND;
- c = get_effective_char (buffer);
- if (c == '=')
- ACCEPT_CHAR (CPP_AND_EQ);
- else if (c == '&')
- ACCEPT_CHAR (CPP_AND_AND);
- break;
-
- case '#':
- c = buffer->extra_char; /* Can be set by error condition below. */
- if (c != EOF)
+ if (get_effective_char (pfile) == '.')
+ result->type = CPP_ELLIPSIS;
+ else
+ buffer->cur = pos - 1;
+ }
+ /* All known character sets have 0...9 contiguous. */
+ else if (ISDIGIT (c))
{
- buffer->read_ahead = c;
- buffer->extra_char = EOF;
+ result->type = CPP_NUMBER;
+ parse_number (pfile, &result->val.str, c, 1);
}
+ else if (c == '*' && CPP_OPTION (pfile, cplusplus))
+ result->type = CPP_DOT_STAR;
else
- c = get_effective_char (buffer);
+ BACKUP ();
+ break;
- if (c == '#')
+ case '+':
+ c = get_effective_char (pfile);
+ if (c == '+')
+ result->type = CPP_PLUS_PLUS;
+ else if (c == '=')
+ result->type = CPP_PLUS_EQ;
+ else
{
- ACCEPT_CHAR (CPP_PASTE);
- break;
+ BACKUP ();
+ result->type = CPP_PLUS;
}
+ break;
- result->type = CPP_HASH;
- do_hash:
- if (!bol)
- break;
- /* 6.10.3 paragraph 11: If there are sequences of preprocessing
- tokens within the list of arguments that would otherwise act
- as preprocessing directives, the behavior is undefined.
-
- This implementation will report a hard error, terminate the
- macro invocation, and proceed to process the directive. */
- if (pfile->state.parsing_args)
+ case '-':
+ c = get_effective_char (pfile);
+ if (c == '>')
{
- if (pfile->state.parsing_args == 2)
- cpp_error (pfile,
- "directives may not be used inside a macro argument");
-
- /* Put a '#' in lookahead, return CPP_EOF for parse_arg. */
- buffer->extra_char = buffer->read_ahead;
- buffer->read_ahead = '#';
- pfile->state.next_bol = 1;
- result->type = CPP_EOF;
-
- /* Get whitespace right - newline_in_args sets it. */
- if (pfile->lexer_pos.col == 1)
- result->flags &= ~(PREV_WHITE | AVOID_LPASTE);
+ result->type = CPP_DEREF;
+ if (CPP_OPTION (pfile, cplusplus))
+ {
+ if (get_effective_char (pfile) == '*')
+ result->type = CPP_DEREF_STAR;
+ else
+ BACKUP ();
+ }
}
+ else if (c == '-')
+ result->type = CPP_MINUS_MINUS;
+ else if (c == '=')
+ result->type = CPP_MINUS_EQ;
else
{
- /* This is the hash introducing a directive. */
- if (_cpp_handle_directive (pfile, result->flags & PREV_WHITE))
- goto done_directive; /* bol still 1. */
- /* This is in fact an assembler #. */
+ BACKUP ();
+ result->type = CPP_MINUS;
}
break;
- case '|':
- result->type = CPP_OR;
- c = get_effective_char (buffer);
- if (c == '=')
- ACCEPT_CHAR (CPP_OR_EQ);
- else if (c == '|')
- ACCEPT_CHAR (CPP_OR_OR);
+ case '&':
+ c = get_effective_char (pfile);
+ if (c == '&')
+ result->type = CPP_AND_AND;
+ else if (c == '=')
+ result->type = CPP_AND_EQ;
+ else
+ {
+ BACKUP ();
+ result->type = CPP_AND;
+ }
break;
- case '^':
- result->type = CPP_XOR;
- if (get_effective_char (buffer) == '=')
- ACCEPT_CHAR (CPP_XOR_EQ);
+ case '|':
+ c = get_effective_char (pfile);
+ if (c == '|')
+ result->type = CPP_OR_OR;
+ else if (c == '=')
+ result->type = CPP_OR_EQ;
+ else
+ {
+ BACKUP ();
+ result->type = CPP_OR;
+ }
break;
case ':':
- result->type = CPP_COLON;
- c = get_effective_char (buffer);
+ c = get_effective_char (pfile);
if (c == ':' && CPP_OPTION (pfile, cplusplus))
- ACCEPT_CHAR (CPP_SCOPE);
+ result->type = CPP_SCOPE;
else if (c == '>' && CPP_OPTION (pfile, digraphs))
{
result->flags |= DIGRAPH;
- ACCEPT_CHAR (CPP_CLOSE_SQUARE);
+ result->type = CPP_CLOSE_SQUARE;
+ }
+ else
+ {
+ BACKUP ();
+ result->type = CPP_COLON;
}
break;
+ case '*': IF_NEXT_IS ('=', CPP_MULT_EQ, CPP_MULT); break;
+ case '=': IF_NEXT_IS ('=', CPP_EQ_EQ, CPP_EQ); break;
+ case '!': IF_NEXT_IS ('=', CPP_NOT_EQ, CPP_NOT); break;
+ case '^': IF_NEXT_IS ('=', CPP_XOR_EQ, CPP_XOR); break;
+ case '#': IF_NEXT_IS ('#', CPP_PASTE, CPP_HASH); break;
+
case '~': result->type = CPP_COMPL; break;
case ',': result->type = CPP_COMMA; break;
case '(': result->type = CPP_OPEN_PAREN; break;
/* @ is a punctuator in Objective C. */
case '@': result->type = CPP_ATSIGN; break;
+ case '$':
+ if (CPP_OPTION (pfile, dollars_in_ident))
+ goto start_ident;
+ /* Fall through... */
+
random_char:
default:
result->type = CPP_OTHER;
break;
}
- if (pfile->skipping)
- goto skip;
-
- /* If not in a directive, this token invalidates controlling macros. */
- if (!pfile->state.in_directive)
- pfile->mi_state = MI_FAILED;
+ return result;
}
-/* An upper bound on the number of bytes needed to spell a token,
+/* An upper bound on the number of bytes needed to spell TOKEN,
including preceding whitespace. */
unsigned int
cpp_token_len (token)
switch (TOKEN_SPELL (token))
{
default: len = 0; break;
+ case SPELL_NUMBER:
case SPELL_STRING: len = token->val.str.len; break;
case SPELL_IDENT: len = NODE_LEN (token->val.node); break;
}
- /* 1 for whitespace, 4 for comment delimeters. */
+ /* 1 for whitespace, 4 for comment delimiters. */
return len + 5;
}
goto spell_ident;
else
spelling = TOKEN_NAME (token);
-
+
while ((c = *spelling++) != '\0')
*buffer++ = c;
}
break;
+ case SPELL_CHAR:
+ *buffer++ = token->val.c;
+ break;
+
+ spell_ident:
case SPELL_IDENT:
- spell_ident:
memcpy (buffer, NODE_NAME (token->val.node), NODE_LEN (token->val.node));
buffer += NODE_LEN (token->val.node);
break;
+ case SPELL_NUMBER:
+ memcpy (buffer, token->val.str.text, token->val.str.len);
+ buffer += token->val.str.len;
+ break;
+
case SPELL_STRING:
{
int left, right, tag;
case CPP_CHAR: left = '\''; right = '\''; tag = '\0'; break;
case CPP_WCHAR: left = '\''; right = '\''; tag = 'L'; break;
case CPP_HEADER_NAME: left = '<'; right = '>'; tag = '\0'; break;
- default: left = '\0'; right = '\0'; tag = '\0'; break;
+ default:
+ cpp_ice (pfile, "unknown string token %s\n", TOKEN_NAME (token));
+ return buffer;
}
if (tag) *buffer++ = tag;
- if (left) *buffer++ = left;
+ *buffer++ = left;
memcpy (buffer, token->val.str.text, token->val.str.len);
buffer += token->val.str.len;
- if (right) *buffer++ = right;
+ *buffer++ = right;
}
break;
- case SPELL_CHAR:
- *buffer++ = token->val.c;
- break;
-
case SPELL_NONE:
- cpp_ice (pfile, "Unspellable token %s", TOKEN_NAME (token));
+ cpp_ice (pfile, "unspellable token %s", TOKEN_NAME (token));
break;
}
return buffer;
}
-/* Returns a token as a null-terminated string. The string is
- temporary, and automatically freed later. Useful for diagnostics. */
+/* Returns TOKEN spelt as a null-terminated string. The string is
+ freed when the reader is destroyed. Useful for diagnostics. */
unsigned char *
cpp_token_as_text (pfile, token)
cpp_reader *pfile;
const cpp_token *token;
{
unsigned int len = cpp_token_len (token);
- unsigned char *start = _cpp_pool_alloc (&pfile->ident_pool, len), *end;
+ unsigned char *start = _cpp_unaligned_alloc (pfile, len), *end;
end = cpp_spell_token (pfile, token, start);
end[0] = '\0';
return start;
}
-/* Used by C front ends. Should really move to using cpp_token_as_text. */
+/* Used by C front ends, which really should move to using
+ cpp_token_as_text. */
const char *
cpp_type2name (type)
enum cpp_ttype type;
return (const char *) token_spellings[type].name;
}
-/* Writes the spelling of token to FP. Separate from cpp_spell_token
- for efficiency - to avoid double-buffering. Also, outputs a space
- if PREV_WHITE is flagged. */
+/* Writes the spelling of token to FP, without any preceding space.
+ Separated from cpp_spell_token for efficiency - to avoid stdio
+ double-buffering. */
void
cpp_output_token (token, fp)
const cpp_token *token;
FILE *fp;
{
- if (token->flags & PREV_WHITE)
- putc (' ', fp);
-
switch (TOKEN_SPELL (token))
{
case SPELL_OPERATOR:
{
const unsigned char *spelling;
+ int c;
if (token->flags & DIGRAPH)
spelling
else
spelling = TOKEN_NAME (token);
- ufputs (spelling, fp);
+ c = *spelling;
+ do
+ putc (c, fp);
+ while ((c = *++spelling) != '\0');
}
break;
+ case SPELL_CHAR:
+ putc (token->val.c, fp);
+ break;
+
spell_ident:
case SPELL_IDENT:
- ufputs (NODE_NAME (token->val.node), fp);
+ fwrite (NODE_NAME (token->val.node), 1, NODE_LEN (token->val.node), fp);
break;
+ case SPELL_NUMBER:
+ fwrite (token->val.str.text, 1, token->val.str.len, fp);
+ break;
+
case SPELL_STRING:
{
int left, right, tag;
case CPP_CHAR: left = '\''; right = '\''; tag = '\0'; break;
case CPP_WCHAR: left = '\''; right = '\''; tag = 'L'; break;
case CPP_HEADER_NAME: left = '<'; right = '>'; tag = '\0'; break;
- default: left = '\0'; right = '\0'; tag = '\0'; break;
+ default:
+ fprintf (stderr, "impossible STRING token %s\n", TOKEN_NAME (token));
+ return;
}
if (tag) putc (tag, fp);
- if (left) putc (left, fp);
+ putc (left, fp);
fwrite (token->val.str.text, 1, token->val.str.len, fp);
- if (right) putc (right, fp);
+ putc (right, fp);
}
break;
- case SPELL_CHAR:
- putc (token->val.c, fp);
- break;
-
case SPELL_NONE:
/* An error, most probably. */
break;
return (a->type != CPP_MACRO_ARG || a->val.arg_no == b->val.arg_no);
case SPELL_IDENT:
return a->val.node == b->val.node;
+ case SPELL_NUMBER:
case SPELL_STRING:
return (a->val.str.len == b->val.str.len
&& !memcmp (a->val.str.text, b->val.str.text,
return 0;
}
-/* Determine whether two tokens can be pasted together, and if so,
- what the resulting token is. Returns CPP_EOF if the tokens cannot
- be pasted, or the appropriate type for the merged token if they
- can. */
-enum cpp_ttype
-cpp_can_paste (pfile, token1, token2, digraph)
- cpp_reader * pfile;
- const cpp_token *token1, *token2;
- int* digraph;
-{
- enum cpp_ttype a = token1->type, b = token2->type;
- int cxx = CPP_OPTION (pfile, cplusplus);
-
- /* Treat named operators as if they were ordinary NAMEs. */
- if (token1->flags & NAMED_OP)
- a = CPP_NAME;
- if (token2->flags & NAMED_OP)
- b = CPP_NAME;
-
- if ((int) a <= (int) CPP_LAST_EQ && b == CPP_EQ)
- return (enum cpp_ttype) ((int) a + ((int) CPP_EQ_EQ - (int) CPP_EQ));
-
- switch (a)
- {
- case CPP_GREATER:
- if (b == a) return CPP_RSHIFT;
- if (b == CPP_QUERY && cxx) return CPP_MAX;
- if (b == CPP_GREATER_EQ) return CPP_RSHIFT_EQ;
- break;
- case CPP_LESS:
- if (b == a) return CPP_LSHIFT;
- if (b == CPP_QUERY && cxx) return CPP_MIN;
- if (b == CPP_LESS_EQ) return CPP_LSHIFT_EQ;
- if (CPP_OPTION (pfile, digraphs))
- {
- if (b == CPP_COLON)
- {*digraph = 1; return CPP_OPEN_SQUARE;} /* <: digraph */
- if (b == CPP_MOD)
- {*digraph = 1; return CPP_OPEN_BRACE;} /* <% digraph */
- }
- break;
-
- case CPP_PLUS: if (b == a) return CPP_PLUS_PLUS; break;
- case CPP_AND: if (b == a) return CPP_AND_AND; break;
- case CPP_OR: if (b == a) return CPP_OR_OR; break;
-
- case CPP_MINUS:
- if (b == a) return CPP_MINUS_MINUS;
- if (b == CPP_GREATER) return CPP_DEREF;
- break;
- case CPP_COLON:
- if (b == a && cxx) return CPP_SCOPE;
- if (b == CPP_GREATER && CPP_OPTION (pfile, digraphs))
- {*digraph = 1; return CPP_CLOSE_SQUARE;} /* :> digraph */
- break;
-
- case CPP_MOD:
- if (CPP_OPTION (pfile, digraphs))
- {
- if (b == CPP_GREATER)
- {*digraph = 1; return CPP_CLOSE_BRACE;} /* %> digraph */
- if (b == CPP_COLON)
- {*digraph = 1; return CPP_HASH;} /* %: digraph */
- }
- break;
- case CPP_DEREF:
- if (b == CPP_MULT && cxx) return CPP_DEREF_STAR;
- break;
- case CPP_DOT:
- if (b == CPP_MULT && cxx) return CPP_DOT_STAR;
- if (b == CPP_NUMBER) return CPP_NUMBER;
- break;
-
- case CPP_HASH:
- if (b == a && (token1->flags & DIGRAPH) == (token2->flags & DIGRAPH))
- /* %:%: digraph */
- {*digraph = (token1->flags & DIGRAPH); return CPP_PASTE;}
- break;
-
- case CPP_NAME:
- if (b == CPP_NAME) return CPP_NAME;
- if (b == CPP_NUMBER
- && name_p (pfile, &token2->val.str)) return CPP_NAME;
- if (b == CPP_CHAR
- && token1->val.node == pfile->spec_nodes.n_L) return CPP_WCHAR;
- if (b == CPP_STRING
- && token1->val.node == pfile->spec_nodes.n_L) return CPP_WSTRING;
- break;
-
- case CPP_NUMBER:
- if (b == CPP_NUMBER) return CPP_NUMBER;
- if (b == CPP_NAME) return CPP_NUMBER;
- if (b == CPP_DOT) return CPP_NUMBER;
- /* Numbers cannot have length zero, so this is safe. */
- if ((b == CPP_PLUS || b == CPP_MINUS)
- && VALID_SIGN ('+', token1->val.str.text[token1->val.str.len - 1]))
- return CPP_NUMBER;
- break;
-
- default:
- break;
- }
-
- return CPP_EOF;
-}
-
/* Returns nonzero if a space should be inserted to avoid an
accidental token paste for output. For simplicity, it is
conservative, and occasionally advises a space where one is not
needed, e.g. "." and ".2". */
-
int
cpp_avoid_paste (pfile, token1, token2)
cpp_reader *pfile;
}
/* Output all the remaining tokens on the current line, and a newline
- character, to FP. Leading whitespace is removed. */
+ character, to FP. Leading whitespace is removed. If there are
+ macros, special token padding is not performed. */
void
cpp_output_line (pfile, fp)
cpp_reader *pfile;
FILE *fp;
{
- cpp_token token;
+ const cpp_token *token;
- cpp_get_token (pfile, &token);
- token.flags &= ~PREV_WHITE;
- while (token.type != CPP_EOF)
+ token = cpp_get_token (pfile);
+ while (token->type != CPP_EOF)
{
- cpp_output_token (&token, fp);
- cpp_get_token (pfile, &token);
+ cpp_output_token (token, fp);
+ token = cpp_get_token (pfile);
+ if (token->flags & PREV_WHITE)
+ putc (' ', fp);
}
putc ('\n', fp);
hex_digit_value (c)
unsigned int c;
{
- if (c >= 'a' && c <= 'f')
- return c - 'a' + 10;
- if (c >= 'A' && c <= 'F')
- return c - 'A' + 10;
- if (c >= '0' && c <= '9')
- return c - '0';
- abort ();
+ if (hex_p (c))
+ return hex_value (c);
+ else
+ abort ();
}
/* Parse a '\uNNNN' or '\UNNNNNNNN' sequence. Returns 1 to indicate
interpret escapes that did not exist in traditional C.
Handles all relevant diagnostics. */
-
unsigned int
cpp_parse_escape (pfile, pstr, limit, mask, traditional)
cpp_reader *pfile;
cpp_pedwarn (pfile, "non-ISO-standard escape sequence, '\\%c'", c);
c = TARGET_ESC;
break;
-
+
case 'u': case 'U':
unknown = maybe_read_ucs (pfile, &str, limit, &c);
break;
unsigned int width, max_chars, c;
unsigned HOST_WIDE_INT mask;
HOST_WIDE_INT result = 0;
+ bool unsigned_p;
#ifdef MULTIBYTE_CHARS
(void) local_mbtowc (NULL, NULL, 0);
/* Width in bits. */
if (token->type == CPP_CHAR)
- width = MAX_CHAR_TYPE_SIZE;
+ {
+ width = MAX_CHAR_TYPE_SIZE;
+ unsigned_p = CPP_OPTION (pfile, signed_char) == 0;
+ }
else
- width = MAX_WCHAR_TYPE_SIZE;
+ {
+ width = MAX_WCHAR_TYPE_SIZE;
+ unsigned_p = WCHAR_UNSIGNED;
+ }
if (width < HOST_BITS_PER_WIDE_INT)
mask = ((unsigned HOST_WIDE_INT) 1 << width) - 1;
if (ISPRINT (c))
c = MAP_CHARACTER (c);
#endif
-
+
/* Merge character into result; ignore excess chars. */
if (++chars_seen <= max_chars)
{
else if (chars_seen > 1 && !traditional && warn_multi)
cpp_warning (pfile, "multi-character character constant");
- /* If char type is signed, sign-extend the constant. The
- __CHAR_UNSIGNED__ macro is set by the driver if appropriate. */
- if (token->type == CPP_CHAR && chars_seen)
+ /* If relevant type is signed, sign-extend the constant. */
+ if (chars_seen)
{
unsigned int nbits = chars_seen * width;
- unsigned int mask = (unsigned int) ~0 >> (HOST_BITS_PER_INT - nbits);
- if (pfile->spec_nodes.n__CHAR_UNSIGNED__->type == NT_MACRO
- || ((result >> (nbits - 1)) & 1) == 0)
+ mask = (unsigned HOST_WIDE_INT) ~0 >> (HOST_BITS_PER_WIDE_INT - nbits);
+ if (unsigned_p || ((result >> (nbits - 1)) & 1) == 0)
result &= mask;
else
result |= ~mask;
return result;
}
-/* Memory pools. */
+/* Memory buffers. Changing these three constants can have a dramatic
+ effect on performance. The values here are reasonable defaults,
+ but might be tuned. If you adjust them, be sure to test across a
+ range of uses of cpplib, including heavy nested function-like macro
+ expansion. Also check the change in peak memory usage (NJAMD is a
+ good tool for this). */
+#define MIN_BUFF_SIZE 8000
+#define BUFF_SIZE_UPPER_BOUND(MIN_SIZE) (MIN_BUFF_SIZE + (MIN_SIZE) * 3 / 2)
+#define EXTENDED_BUFF_SIZE(BUFF, MIN_EXTRA) \
+ (MIN_EXTRA + ((BUFF)->limit - (BUFF)->cur) * 2)
+
+#if MIN_BUFF_SIZE > BUFF_SIZE_UPPER_BOUND (0)
+ #error BUFF_SIZE_UPPER_BOUND must be at least as large as MIN_BUFF_SIZE!
+#endif
struct dummy
{
};
#define DEFAULT_ALIGNMENT (offsetof (struct dummy, u))
+#define CPP_ALIGN(size, align) (((size) + ((align) - 1)) & ~((align) - 1))
-static int
-chunk_suitable (pool, chunk, size)
- cpp_pool *pool;
- cpp_chunk *chunk;
- unsigned int size;
-{
- /* Being at least twice SIZE means we can use memcpy in
- _cpp_next_chunk rather than memmove. Besides, it's a good idea
- anyway. */
- return (chunk && pool->locked != chunk
- && (unsigned int) (chunk->limit - chunk->base) >= size * 2);
-}
-
-/* Returns the end of the new pool. PTR points to a char in the old
- pool, and is updated to point to the same char in the new pool. */
-unsigned char *
-_cpp_next_chunk (pool, len, ptr)
- cpp_pool *pool;
- unsigned int len;
- unsigned char **ptr;
+/* Create a new allocation buffer. Place the control block at the end
+ of the buffer, so that buffer overflows will cause immediate chaos. */
+static _cpp_buff *
+new_buff (len)
+ size_t len;
{
- cpp_chunk *chunk = pool->cur->next;
-
- /* LEN is the minimum size we want in the new pool. */
- len += POOL_ROOM (pool);
- if (! chunk_suitable (pool, chunk, len))
- {
- chunk = new_chunk (POOL_SIZE (pool) * 2 + len);
+ _cpp_buff *result;
+ unsigned char *base;
- chunk->next = pool->cur->next;
- pool->cur->next = chunk;
- }
+ if (len < MIN_BUFF_SIZE)
+ len = MIN_BUFF_SIZE;
+ len = CPP_ALIGN (len, DEFAULT_ALIGNMENT);
- /* Update the pointer before changing chunk's front. */
- if (ptr)
- *ptr += chunk->base - POOL_FRONT (pool);
+ base = xmalloc (len + sizeof (_cpp_buff));
+ result = (_cpp_buff *) (base + len);
+ result->base = base;
+ result->cur = base;
+ result->limit = base + len;
+ result->next = NULL;
+ return result;
+}
- memcpy (chunk->base, POOL_FRONT (pool), POOL_ROOM (pool));
- chunk->front = chunk->base;
+/* Place a chain of unwanted allocation buffers on the free list. */
+void
+_cpp_release_buff (pfile, buff)
+ cpp_reader *pfile;
+ _cpp_buff *buff;
+{
+ _cpp_buff *end = buff;
- pool->cur = chunk;
- return POOL_LIMIT (pool);
+ while (end->next)
+ end = end->next;
+ end->next = pfile->free_buffs;
+ pfile->free_buffs = buff;
}
-static cpp_chunk *
-new_chunk (size)
- unsigned int size;
+/* Return a free buffer of size at least MIN_SIZE. */
+_cpp_buff *
+_cpp_get_buff (pfile, min_size)
+ cpp_reader *pfile;
+ size_t min_size;
{
- unsigned char *base;
- cpp_chunk *result;
+ _cpp_buff *result, **p;
- size = POOL_ALIGN (size, DEFAULT_ALIGNMENT);
- base = (unsigned char *) xmalloc (size + sizeof (cpp_chunk));
- /* Put the chunk descriptor at the end. Then chunk overruns will
- cause obvious chaos. */
- result = (cpp_chunk *) (base + size);
- result->base = base;
- result->front = base;
- result->limit = base + size;
- result->next = 0;
+ for (p = &pfile->free_buffs;; p = &(*p)->next)
+ {
+ size_t size;
+
+ if (*p == NULL)
+ return new_buff (min_size);
+ result = *p;
+ size = result->limit - result->base;
+ /* Return a buffer that's big enough, but don't waste one that's
+ way too big. */
+ if (size >= min_size && size <= BUFF_SIZE_UPPER_BOUND (min_size))
+ break;
+ }
+ *p = result->next;
+ result->next = NULL;
+ result->cur = result->base;
return result;
}
-void
-_cpp_init_pool (pool, size, align, temp)
- cpp_pool *pool;
- unsigned int size, align, temp;
+/* Creates a new buffer with enough space to hold the uncommitted
+ remaining bytes of BUFF, and at least MIN_EXTRA more bytes. Copies
+ the excess bytes to the new buffer. Chains the new buffer after
+ BUFF, and returns the new buffer. */
+_cpp_buff *
+_cpp_append_extend_buff (pfile, buff, min_extra)
+ cpp_reader *pfile;
+ _cpp_buff *buff;
+ size_t min_extra;
{
- if (align == 0)
- align = DEFAULT_ALIGNMENT;
- if (align & (align - 1))
- abort ();
- pool->align = align;
- pool->cur = new_chunk (size);
- pool->locked = 0;
- pool->locks = 0;
- if (temp)
- pool->cur->next = pool->cur;
-}
+ size_t size = EXTENDED_BUFF_SIZE (buff, min_extra);
+ _cpp_buff *new_buff = _cpp_get_buff (pfile, size);
-void
-_cpp_lock_pool (pool)
- cpp_pool *pool;
-{
- if (pool->locks++ == 0)
- pool->locked = pool->cur;
+ buff->next = new_buff;
+ memcpy (new_buff->base, buff->cur, BUFF_ROOM (buff));
+ return new_buff;
}
+/* Creates a new buffer with enough space to hold the uncommitted
+ remaining bytes of the buffer pointed to by BUFF, and at least
+ MIN_EXTRA more bytes. Copies the excess bytes to the new buffer.
+ Chains the new buffer before the buffer pointed to by BUFF, and
+ updates the pointer to point to the new buffer. */
void
-_cpp_unlock_pool (pool)
- cpp_pool *pool;
+_cpp_extend_buff (pfile, pbuff, min_extra)
+ cpp_reader *pfile;
+ _cpp_buff **pbuff;
+ size_t min_extra;
{
- if (--pool->locks == 0)
- pool->locked = 0;
+ _cpp_buff *new_buff, *old_buff = *pbuff;
+ size_t size = EXTENDED_BUFF_SIZE (old_buff, min_extra);
+
+ new_buff = _cpp_get_buff (pfile, size);
+ memcpy (new_buff->base, old_buff->cur, BUFF_ROOM (old_buff));
+ new_buff->next = old_buff;
+ *pbuff = new_buff;
}
+/* Free a chain of buffers starting at BUFF. */
void
-_cpp_free_pool (pool)
- cpp_pool *pool;
+_cpp_free_buff (buff)
+ _cpp_buff *buff;
{
- cpp_chunk *chunk = pool->cur, *next;
+ _cpp_buff *next;
- do
+ for (; buff; buff = next)
{
- next = chunk->next;
- free (chunk->base);
- chunk = next;
+ next = buff->next;
+ free (buff->base);
}
- while (chunk && chunk != pool->cur);
}
-/* Reserve LEN bytes from a memory pool. */
+/* Allocate permanent, unaligned storage of length LEN. */
unsigned char *
-_cpp_pool_reserve (pool, len)
- cpp_pool *pool;
- unsigned int len;
+_cpp_unaligned_alloc (pfile, len)
+ cpp_reader *pfile;
+ size_t len;
{
- len = POOL_ALIGN (len, pool->align);
- if (len > (unsigned int) POOL_ROOM (pool))
- _cpp_next_chunk (pool, len, 0);
+ _cpp_buff *buff = pfile->u_buff;
+ unsigned char *result = buff->cur;
+
+ if (len > (size_t) (buff->limit - result))
+ {
+ buff = _cpp_get_buff (pfile, len);
+ buff->next = pfile->u_buff;
+ pfile->u_buff = buff;
+ result = buff->cur;
+ }
- return POOL_FRONT (pool);
+ buff->cur = result + len;
+ return result;
}
-/* Allocate LEN bytes from a memory pool. */
+/* Allocate permanent, unaligned storage of length LEN from a_buff.
+ That buffer is used for growing allocations when saving macro
+ replacement lists in a #define, and when parsing an answer to an
+ assertion in #assert, #unassert or #if (and therefore possibly
+ whilst expanding macros). It therefore must not be used by any
+ code that they might call: specifically the lexer and the guts of
+ the macro expander.
+
+ All existing other uses clearly fit this restriction: storing
+ registered pragmas during initialization. */
unsigned char *
-_cpp_pool_alloc (pool, len)
- cpp_pool *pool;
- unsigned int len;
+_cpp_aligned_alloc (pfile, len)
+ cpp_reader *pfile;
+ size_t len;
{
- unsigned char *result = _cpp_pool_reserve (pool, len);
+ _cpp_buff *buff = pfile->a_buff;
+ unsigned char *result = buff->cur;
+
+ if (len > (size_t) (buff->limit - result))
+ {
+ buff = _cpp_get_buff (pfile, len);
+ buff->next = pfile->a_buff;
+ pfile->a_buff = buff;
+ result = buff->cur;
+ }
- POOL_COMMIT (pool, len);
+ buff->cur = result + len;
return result;
}
/* CPP Library. (Directive handling.)
Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Contributed by Per Bothner, 1994-95.
Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987
#include "cpplib.h"
#include "cpphash.h"
-#include "intl.h"
#include "obstack.h"
/* Chained list of answers to an assertion. */
/* Stack of conditionals currently in progress
(including both successful and failing conditionals). */
-
struct if_stack
{
struct if_stack *next;
- cpp_lexer_pos pos; /* line and column where condition started */
+ unsigned int line; /* Line where condition started. */
const cpp_hashnode *mi_cmacro;/* macro name for #ifndef around entire file */
- unsigned char was_skipping; /* Value of pfile->skipping before this if. */
- int type; /* type of last directive seen in this group */
+ bool skip_elses; /* Can future #else / #elif be skipped? */
+ bool was_skipping; /* If were skipping on entry. */
+ int type; /* Most recent conditional, for diagnostics. */
+};
+
+/* Contains a registered pragma or pragma namespace. */
+typedef void (*pragma_cb) PARAMS ((cpp_reader *));
+struct pragma_entry
+{
+ struct pragma_entry *next;
+ const cpp_hashnode *pragma; /* Name and length. */
+ int is_nspace;
+ union {
+ pragma_cb handler;
+ struct pragma_entry *space;
+ } u;
};
/* Values for the origin field of struct directive. KANDR directives
static void check_eol PARAMS ((cpp_reader *));
static void start_directive PARAMS ((cpp_reader *));
static void end_directive PARAMS ((cpp_reader *, int));
+static void directive_diagnostics
+ PARAMS ((cpp_reader *, const directive *, int));
static void run_directive PARAMS ((cpp_reader *, int,
- enum cpp_buffer_type,
const char *, size_t));
-static int glue_header_name PARAMS ((cpp_reader *, cpp_token *));
-static int parse_include PARAMS ((cpp_reader *, cpp_token *));
+static const cpp_token *glue_header_name PARAMS ((cpp_reader *));
+static const cpp_token *parse_include PARAMS ((cpp_reader *));
static void push_conditional PARAMS ((cpp_reader *, int, int,
const cpp_hashnode *));
static unsigned int read_flag PARAMS ((cpp_reader *, unsigned int));
+static U_CHAR *dequote_string PARAMS ((cpp_reader *, const U_CHAR *,
+ unsigned int));
static int strtoul_for_line PARAMS ((const U_CHAR *, unsigned int,
unsigned long *));
static void do_diagnostic PARAMS ((cpp_reader *, enum error_type, int));
-static cpp_hashnode *lex_macro_node PARAMS ((cpp_reader *));
+static cpp_hashnode *lex_macro_node PARAMS ((cpp_reader *));
static void do_include_common PARAMS ((cpp_reader *, enum include_type));
+static struct pragma_entry *lookup_pragma_entry
+ PARAMS ((struct pragma_entry *, const cpp_hashnode *pragma));
+static struct pragma_entry *insert_pragma_entry
+ PARAMS ((cpp_reader *, struct pragma_entry **, const cpp_hashnode *,
+ pragma_cb));
static void do_pragma_once PARAMS ((cpp_reader *));
static void do_pragma_poison PARAMS ((cpp_reader *));
static void do_pragma_sdcc_hash PARAMS ((cpp_reader *));
-static void do_pragma_preproc_asm PARAMS ((cpp_reader *));
-static void do_pragma_system_header PARAMS ((cpp_reader *));
-static void do_pragma_dependency PARAMS ((cpp_reader *));
-static int get__Pragma_string PARAMS ((cpp_reader *, cpp_token *));
-static unsigned char *destringize PARAMS ((const cpp_string *,
- unsigned int *));
+static void do_pragma_preproc_asm PARAMS ((cpp_reader *));
+static void do_pragma_system_header PARAMS ((cpp_reader *));
+static void do_pragma_dependency PARAMS ((cpp_reader *));
+static void do_linemarker PARAMS ((cpp_reader *));
+static const cpp_token *get_token_no_padding PARAMS ((cpp_reader *));
+static const cpp_token *get__Pragma_string PARAMS ((cpp_reader *));
+static unsigned char *destringize PARAMS ((const cpp_string *, unsigned int *));
+static void destringize_and_run PARAMS ((cpp_reader *, const cpp_string *));
static int parse_answer PARAMS ((cpp_reader *, struct answer **, int));
static cpp_hashnode *parse_assertion PARAMS ((cpp_reader *, struct answer **,
int));
const struct answer *));
static void handle_assertion PARAMS ((cpp_reader *, const char *, int));
-extern cpp_output_string (const char *s);
+extern cpp_output_string PARAMS ((const char *s));
/* This is the table of directive handlers. It is ordered by
frequency of occurrence; the numbers at the end are directive
D(else, T_ELSE, KANDR, COND) /* 9863 */ \
D(ifndef, T_IFNDEF, KANDR, COND | IF_COND) /* 9675 */ \
D(undef, T_UNDEF, KANDR, IN_I) /* 4837 */ \
-D(line, T_LINE, KANDR, IN_I) /* 2465 */ \
+D(line, T_LINE, KANDR, 0) /* 2465 */ \
D(elif, T_ELIF, STDC89, COND) /* 610 */ \
D(error, T_ERROR, STDC89, 0) /* 475 */ \
D(pragma, T_PRAGMA, STDC89, IN_I) /* 195 */ \
/* Use the table to generate a series of prototypes, an enum for the
directive names, and an array of directive handlers. */
-/* The directive-processing functions are declared to return int
- instead of void, because some old compilers have trouble with
- pointers to functions returning void. */
-
-/* Don't invoke CONCAT2 with any whitespace or K&R cc will fail. */
+/* Don't invoke CONCAT2 with any whitespace or K&R cc will fail. */
#define D(name, t, o, f) static void CONCAT2(do_,name) PARAMS ((cpp_reader *));
DIRECTIVE_TABLE
#undef D
};
#undef D
-/* Don't invoke CONCAT2 with any whitespace or K&R cc will fail. */
+/* Don't invoke CONCAT2 with any whitespace or K&R cc will fail. */
#define D(name, t, origin, flags) \
{ CONCAT2(do_,name), (const U_CHAR *) STRINGX(name), \
sizeof STRINGX(name) - 1, origin, flags },
#undef D
#undef DIRECTIVE_TABLE
+/* Wrapper struct directive for linemarkers.
+ The origin is more or less true - the original K+R cpp
+ did use this notation in its preprocessed output. */
+static const directive linemarker_dir =
+{
+ do_linemarker, U"#", 1, KANDR, IN_I
+};
+
+#define SEEN_EOL() (pfile->cur_token[-1].type == CPP_EOF)
+
/* Skip any remaining tokens in a directive. */
static void
skip_rest_of_line (pfile)
cpp_reader *pfile;
{
- cpp_token token;
-
- /* Discard all input lookaheads. */
- while (pfile->la_read)
- _cpp_release_lookahead (pfile);
-
/* Discard all stacked contexts. */
while (pfile->context != &pfile->base_context)
_cpp_pop_context (pfile);
/* Sweep up all tokens remaining on the line. */
- pfile->state.prevent_expansion++;
- while (!pfile->state.next_bol)
- _cpp_lex_token (pfile, &token);
- pfile->state.prevent_expansion--;
+ if (! SEEN_EOL ())
+ while (_cpp_lex_token (pfile)->type != CPP_EOF)
+ ;
}
/* Ensure there are no stray tokens at the end of a directive. */
check_eol (pfile)
cpp_reader *pfile;
{
- if (!pfile->state.next_bol)
- {
- cpp_token token;
-
- _cpp_lex_token (pfile, &token);
- if (token.type != CPP_EOF)
- cpp_pedwarn (pfile, "extra tokens at end of #%s directive",
- pfile->directive->name);
- }
+ if (! SEEN_EOL () && _cpp_lex_token (pfile)->type != CPP_EOF)
+ cpp_pedwarn (pfile, "extra tokens at end of #%s directive",
+ pfile->directive->name);
}
/* Called when entering a directive, _Pragma or command-line directive. */
start_directive (pfile)
cpp_reader *pfile;
{
- cpp_buffer *buffer = pfile->buffer;
-
/* Setup in-directive state. */
pfile->state.in_directive = 1;
pfile->state.save_comments = 0;
/* Some handlers need the position of the # for diagnostics. */
- pfile->directive_pos = pfile->lexer_pos;
-
- /* Don't save directive tokens for external clients. */
- pfile->la_saved = pfile->la_write;
- pfile->la_write = 0;
-
- /* Turn off skipping. */
- buffer->was_skipping = pfile->skipping;
- pfile->skipping = 0;
+ pfile->directive_line = pfile->line;
}
/* Called when leaving a directive, _Pragma or command-line directive. */
cpp_reader *pfile;
int skip_line;
{
- cpp_buffer *buffer = pfile->buffer;
-
- /* Restore pfile->skipping before skip_rest_of_line, so that e.g.
- __VA_ARGS__ in the rest of the directive doesn't warn. */
- pfile->skipping = buffer->was_skipping;
-
/* We don't skip for an assembler #. */
if (skip_line)
- skip_rest_of_line (pfile);
+ {
+ skip_rest_of_line (pfile);
+ if (!pfile->keep_tokens)
+ {
+ pfile->cur_run = &pfile->base_run;
+ pfile->cur_token = pfile->base_run.base;
+ }
+ }
/* Restore state. */
- pfile->la_write = pfile->la_saved;
pfile->state.save_comments = ! CPP_OPTION (pfile, discard_comments);
pfile->state.in_directive = 0;
pfile->state.angled_headers = 0;
- pfile->state.line_extension = 0;
pfile->directive = 0;
}
-/* Check if a token's name matches that of a known directive. Put in
- this file to save exporting dtable and other unneeded information. */
+/* Output diagnostics for a directive DIR. INDENTED is non-zero if
+ the '#' was indented. */
+static void
+directive_diagnostics (pfile, dir, indented)
+ cpp_reader *pfile;
+ const directive *dir;
+ int indented;
+{
+ /* Issue -pedantic warnings for extensions. */
+ if (CPP_PEDANTIC (pfile)
+ && ! pfile->state.skipping
+ && dir->origin == EXTENSION)
+ cpp_pedwarn (pfile, "#%s is a GCC extension", dir->name);
+
+ /* Traditionally, a directive is ignored unless its # is in
+ column 1. Therefore in code intended to work with K+R
+ compilers, directives added by C89 must have their #
+ indented, and directives present in traditional C must not.
+ This is true even of directives in skipped conditional
+ blocks. #elif cannot be used at all. */
+ if (CPP_WTRADITIONAL (pfile))
+ {
+ if (dir == &dtable[T_ELIF])
+ cpp_warning (pfile, "suggest not using #elif in traditional C");
+ else if (indented && dir->origin == KANDR)
+ cpp_warning (pfile,
+ "traditional C ignores #%s with the # indented",
+ dir->name);
+ else if (!indented && dir->origin != KANDR)
+ cpp_warning (pfile,
+ "suggest hiding #%s from traditional C with an indented #",
+ dir->name);
+ }
+}
+
+/* Check if we have a known directive. INDENTED is non-zero if the
+ '#' of the directive was indented. This function is in this file
+ to save unnecessarily exporting dtable etc. to cpplex.c. Returns
+ non-zero if the line of tokens has been handled, zero if we should
+ continue processing the line. */
int
_cpp_handle_directive (pfile, indented)
cpp_reader *pfile;
int indented;
{
- cpp_buffer *buffer = pfile->buffer;
const directive *dir = 0;
- cpp_token dname;
+ const cpp_token *dname;
int skip = 1;
start_directive (pfile);
+ dname = _cpp_lex_token (pfile);
- /* Lex the directive name directly. */
- _cpp_lex_token (pfile, &dname);
-
- if (dname.type == CPP_NAME)
+ if (dname->type == CPP_NAME)
{
- unsigned int index = dname.val.node->directive_index;
- if (index)
- dir = &dtable[index - 1];
+ if (dname->val.node->directive_index)
+ dir = &dtable[dname->val.node->directive_index - 1];
}
- else if (dname.type == CPP_NUMBER)
+ /* We do not recognise the # followed by a number extension in
+ assembler code. */
+ else if (dname->type == CPP_NUMBER && CPP_OPTION (pfile, lang) != CLK_ASM)
{
- /* # followed by a number is equivalent to #line. Do not
- recognize this form in assembly language source files or
- skipped conditional groups. Complain about this form if
- we're being pedantic, but not if this is regurgitated input
- (preprocessed or fed back in by the C++ frontend). */
- if (! buffer->was_skipping && CPP_OPTION (pfile, lang) != CLK_ASM)
- {
- dir = &dtable[T_LINE];
- pfile->state.line_extension = 1;
- _cpp_push_token (pfile, &dname, &pfile->directive_pos);
- if (CPP_PEDANTIC (pfile) && ! CPP_OPTION (pfile, preprocessed))
- cpp_pedwarn (pfile, "# followed by integer");
- }
+ dir = &linemarker_dir;
+ if (CPP_PEDANTIC (pfile) && ! CPP_OPTION (pfile, preprocessed)
+ && ! pfile->state.skipping)
+ cpp_pedwarn (pfile, "style of line directive is a GCC extension");
}
- pfile->directive = dir;
if (dir)
{
- /* Make sure we lex headers correctly, whether skipping or not. */
- pfile->state.angled_headers = dir->flags & INCL;
-
- /* If we are rescanning preprocessed input, only directives tagged
- with IN_I are honored, and the warnings below are suppressed. */
- if (CPP_OPTION (pfile, preprocessed))
+ /* If we have a directive that is not an opening conditional,
+ invalidate any control macro. */
+ if (! (dir->flags & IF_COND))
+ pfile->mi_valid = false;
+
+ /* Kluge alert. In order to be sure that code like this
+
+ #define HASH #
+ HASH define foo bar
+
+ does not cause '#define foo bar' to get executed when
+ compiled with -save-temps, we recognize directives in
+ -fpreprocessed mode only if the # is in column 1. cppmacro.c
+ puts a space in front of any '#' at the start of a macro. */
+ if (CPP_OPTION (pfile, preprocessed)
+ && (indented || !(dir->flags & IN_I)))
{
- /* Kluge alert. In order to be sure that code like this
- #define HASH #
- HASH define foo bar
- does not cause '#define foo bar' to get executed when
- compiled with -save-temps, we recognize directives in
- -fpreprocessed mode only if the # is in column 1 and the
- directive name starts in column 2. This output can only
- be generated by the directive callbacks in cppmain.c (see
- also the special case in scan_buffer). */
- if (dir->flags & IN_I && !indented && !(dname.flags & PREV_WHITE))
- (*dir->handler) (pfile);
- /* That check misses '# 123' linemarkers. Let them through too. */
- else if (dname.type == CPP_NUMBER)
- (*dir->handler) (pfile);
- else
- {
- /* We don't want to process this directive. Put back the
- tokens so caller will see them (and issue an error,
- probably). */
- _cpp_push_token (pfile, &dname, &pfile->directive_pos);
- skip = 0;
- }
+ skip = 0;
+ dir = 0;
}
else
{
- /* Traditionally, a directive is ignored unless its # is in
- column 1. Therefore in code intended to work with K+R
- compilers, directives added by C89 must have their #
- indented, and directives present in traditional C must
- not. This is true even of directives in skipped
- conditional blocks. */
- if (CPP_WTRADITIONAL (pfile))
- {
- if (dir == &dtable[T_ELIF])
- cpp_warning (pfile,
- "suggest not using #elif in traditional C");
- else if (indented && dir->origin == KANDR)
- cpp_warning (pfile,
- "traditional C ignores #%s with the # indented",
- dir->name);
- else if (!indented && dir->origin != KANDR)
- cpp_warning (pfile,
- "suggest hiding #%s from traditional C with an indented #",
- dir->name);
- }
-
- /* If we are skipping a failed conditional group, all
- non-conditional directives are ignored. */
- if (! buffer->was_skipping || (dir->flags & COND))
- {
- /* Issue -pedantic warnings for extensions. */
- if (CPP_PEDANTIC (pfile) && dir->origin == EXTENSION)
- cpp_pedwarn (pfile, "#%s is a GCC extension", dir->name);
-
- /* If we have a directive that is not an opening
- conditional, invalidate any control macro. */
- if (! (dir->flags & IF_COND))
- pfile->mi_state = MI_FAILED;
-
- (*dir->handler) (pfile);
- }
+ /* In failed conditional groups, all non-conditional
+ directives are ignored. Before doing that, whether
+ skipping or not, we should lex angle-bracketed headers
+ correctly, and maybe output some diagnostics. */
+ pfile->state.angled_headers = dir->flags & INCL;
+ if (! CPP_OPTION (pfile, preprocessed))
+ directive_diagnostics (pfile, dir, indented);
+ if (pfile->state.skipping && !(dir->flags & COND))
+ dir = 0;
}
}
- else if (dname.type != CPP_EOF && ! buffer->was_skipping)
+ else if (dname->type == CPP_EOF)
+ ; /* CPP_EOF is the "null directive". */
+ else
{
/* An unknown directive. Don't complain about it in assembly
source: we don't know where the comments are, and # may
introduce assembler pseudo-ops. Don't complain about invalid
directives in skipped conditional groups (6.10 p4). */
if (CPP_OPTION (pfile, lang) == CLK_ASM)
- {
- /* Output the # and lookahead token for the assembler. */
- _cpp_push_token (pfile, &dname, &pfile->directive_pos);
- skip = 0;
- }
- else
+ skip = 0;
+ else if (!pfile->state.skipping)
cpp_error (pfile, "invalid preprocessing directive #%s",
- cpp_token_as_text (pfile, &dname));
+ cpp_token_as_text (pfile, dname));
+ }
+
+ if (dir)
+ {
+ pfile->directive = dir;
+ (*pfile->directive->handler) (pfile);
}
+ else if (skip == 0)
+ _cpp_backup_tokens (pfile, 1);
end_directive (pfile, skip);
return skip;
/* Directive handler wrapper used by the command line option
processor. */
static void
-run_directive (pfile, dir_no, type, buf, count)
+run_directive (pfile, dir_no, buf, count)
cpp_reader *pfile;
int dir_no;
- enum cpp_buffer_type type;
const char *buf;
size_t count;
{
- unsigned int output_line = pfile->lexer_pos.output_line;
- cpp_buffer *buffer;
-
- buffer = cpp_push_buffer (pfile, (const U_CHAR *) buf, count, type, 0);
-
- if (dir_no == T_PRAGMA)
- {
- /* A kludge to avoid line markers for _Pragma. */
- pfile->lexer_pos.output_line = output_line;
- /* Avoid interpretation of directives in a _Pragma string. */
- pfile->state.next_bol = 0;
- }
-
+ cpp_push_buffer (pfile, (const U_CHAR *) buf, count,
+ /* from_stage3 */ true, 1);
start_directive (pfile);
- pfile->state.prevent_expansion++;
+ /* We don't want a leading # to be interpreted as a directive. */
+ pfile->buffer->saved_flags = 0;
pfile->directive = &dtable[dir_no];
(void) (*pfile->directive->handler) (pfile);
- pfile->state.prevent_expansion--;
- check_eol (pfile);
end_directive (pfile, 1);
-
- cpp_pop_buffer (pfile);
+ _cpp_pop_buffer (pfile);
}
/* Checks for validity the macro name in #define, #undef, #ifdef and
lex_macro_node (pfile)
cpp_reader *pfile;
{
- cpp_token token;
-
- /* Lex the macro name directly. */
- _cpp_lex_token (pfile, &token);
+ cpp_hashnode *node;
+ const cpp_token *token = _cpp_lex_token (pfile);
/* The token immediately after #define must be an identifier. That
- identifier is not allowed to be "defined". See predefined macro
- names (6.10.8.4). In C++, it is not allowed to be any of the
- <iso646.h> macro names (which are keywords in C++) either. */
+ identifier may not be "defined", per C99 6.10.8p4.
+ In C++, it may not be any of the "named operators" either,
+ per C++98 [lex.digraph], [lex.key].
+ Finally, the identifier may not have been poisoned. (In that case
+ the lexer has issued the error message for us.) */
- if (token.type != CPP_NAME)
+ if (token->type != CPP_NAME)
{
- if (token.type == CPP_EOF)
+ if (token->type == CPP_EOF)
cpp_error (pfile, "no macro name given in #%s directive",
pfile->directive->name);
- else if (token.flags & NAMED_OP)
+ else if (token->flags & NAMED_OP)
cpp_error (pfile,
- "\"%s\" cannot be used as a macro name as it is an operator in C++",
- NODE_NAME (token.val.node));
+ "\"%s\" cannot be used as a macro name as it is an operator in C++",
+ NODE_NAME (token->val.node));
else
cpp_error (pfile, "macro names must be identifiers");
+
+ return 0;
}
- else
+
+ node = token->val.node;
+ if (node->flags & NODE_POISONED)
+ return 0;
+
+ if (node == pfile->spec_nodes.n_defined)
{
- cpp_hashnode *node = token.val.node;
-
- /* In Objective C, some keywords begin with '@', but general
- identifiers do not, and you're not allowed to #define them. */
- if (node == pfile->spec_nodes.n_defined || NODE_NAME (node)[0] == '@')
- cpp_error (pfile, "\"%s\" cannot be used as a macro name",
- NODE_NAME (node));
- else if (!(node->flags & NODE_POISONED))
- return node;
+ cpp_error (pfile, "\"%s\" cannot be used as a macro name",
+ NODE_NAME (node));
+ return 0;
}
- return 0;
+ return node;
}
/* Process a #define directive. Most work is done in cppmacro.c. */
{
if (_cpp_create_definition (pfile, node))
if (pfile->cb.define)
- (*pfile->cb.define) (pfile, node);
+ (*pfile->cb.define) (pfile, pfile->directive_line, node);
}
}
-/* Handle #undef. Marks the identifier NT_VOID in the hash table. */
+/* Handle #undef. Mark the identifier NT_VOID in the hash table. */
static void
do_undef (pfile)
cpp_reader *pfile;
{
- cpp_hashnode *node = lex_macro_node (pfile);
+ cpp_hashnode *node = lex_macro_node (pfile);
/* 6.10.3.5 paragraph 2: [#undef] is ignored if the specified identifier
is not currently defined as a macro name. */
if (node && node->type == NT_MACRO)
{
if (pfile->cb.undef)
- (*pfile->cb.undef) (pfile, node);
+ (*pfile->cb.undef) (pfile, pfile->directive_line, node);
if (node->flags & NODE_WARN)
cpp_warning (pfile, "undefining \"%s\"", NODE_NAME (node));
/* Helper routine used by parse_include. Reinterpret the current line
as an h-char-sequence (< ... >); we are looking at the first token
- after the <. Returns zero on success. */
-static int
-glue_header_name (pfile, header)
+ after the <. Returns the header as a token, or NULL on failure. */
+static const cpp_token *
+glue_header_name (pfile)
cpp_reader *pfile;
- cpp_token *header;
{
- cpp_token token;
- unsigned char *buffer, *token_mem;
+ cpp_token *header = NULL;
+ const cpp_token *token;
+ unsigned char *buffer;
size_t len, total_len = 0, capacity = 1024;
/* To avoid lexed tokens overwriting our glued name, we can only
allocate from the string pool once we've lexed everything. */
-
buffer = (unsigned char *) xmalloc (capacity);
for (;;)
{
- cpp_get_token (pfile, &token);
+ token = cpp_get_token (pfile);
- if (token.type == CPP_GREATER || token.type == CPP_EOF)
+ if (token->type == CPP_GREATER || token->type == CPP_EOF)
break;
- len = cpp_token_len (&token);
+ len = cpp_token_len (token);
if (total_len + len > capacity)
{
capacity = (capacity + len) * 2;
buffer = (unsigned char *) xrealloc (buffer, capacity);
}
- if (token.flags & PREV_WHITE)
+ if (token->flags & PREV_WHITE)
buffer[total_len++] = ' ';
- total_len = cpp_spell_token (pfile, &token, &buffer[total_len]) - buffer;
+ total_len = cpp_spell_token (pfile, token, &buffer[total_len]) - buffer;
}
- if (token.type == CPP_EOF)
+ if (token->type == CPP_EOF)
cpp_error (pfile, "missing terminating > character");
else
{
- token_mem = _cpp_pool_alloc (&pfile->ident_pool, total_len + 1);
+ unsigned char *token_mem = _cpp_unaligned_alloc (pfile, total_len + 1);
memcpy (token_mem, buffer, total_len);
token_mem[total_len] = '\0';
+ header = _cpp_temp_token (pfile);
header->type = CPP_HEADER_NAME;
- header->flags &= ~PREV_WHITE;
+ header->flags = 0;
header->val.str.len = total_len;
header->val.str.text = token_mem;
}
free ((PTR) buffer);
- return token.type == CPP_EOF;
+ return header;
}
-/* Parse the header name of #include, #include_next, #import and
- #pragma dependency. Returns zero on success. */
-static int
-parse_include (pfile, header)
+/* Returns the header string of #include, #include_next, #import and
+ #pragma dependency. Returns NULL on error. */
+static const cpp_token *
+parse_include (pfile)
cpp_reader *pfile;
- cpp_token *header;
{
- int is_pragma = pfile->directive == &dtable[T_PRAGMA];
const unsigned char *dir;
+ const cpp_token *header;
- if (is_pragma)
+ if (pfile->directive == &dtable[T_PRAGMA])
dir = U"pragma dependency";
else
dir = pfile->directive->name;
/* Allow macro expansion. */
- cpp_get_token (pfile, header);
+ header = cpp_get_token (pfile);
if (header->type != CPP_STRING && header->type != CPP_HEADER_NAME)
{
if (header->type != CPP_LESS)
{
cpp_error (pfile, "#%s expects \"FILENAME\" or <FILENAME>", dir);
- return 1;
+ return NULL;
}
- if (glue_header_name (pfile, header))
- return 1;
+
+ header = glue_header_name (pfile);
+ if (header == NULL)
+ return header;
}
if (header->val.str.len == 0)
{
cpp_error (pfile, "empty file name in #%s", dir);
- return 1;
+ return NULL;
}
- if (!is_pragma)
- {
- check_eol (pfile);
- /* Get out of macro context, if we are. */
- skip_rest_of_line (pfile);
- if (pfile->cb.include)
- (*pfile->cb.include) (pfile, dir, header);
- }
-
- return 0;
+ return header;
}
/* Handle #include, #include_next and #import. */
cpp_reader *pfile;
enum include_type type;
{
- cpp_token header;
+ const cpp_token *header;
- if (!parse_include (pfile, &header))
+ /* For #include_next, if this is the primary source file, warn and
+ use the normal search logic. */
+ if (type == IT_INCLUDE_NEXT && ! pfile->buffer->prev)
+ {
+ cpp_warning (pfile, "#include_next in primary source file");
+ type = IT_INCLUDE;
+ }
+ else if (type == IT_IMPORT && CPP_OPTION (pfile, warn_import))
+ {
+ CPP_OPTION (pfile, warn_import) = 0;
+ cpp_warning (pfile,
+ "#import is obsolete, use an #ifndef wrapper in the header file");
+ }
+
+ header = parse_include (pfile);
+ if (header)
{
/* Prevent #include recursion. */
- if (pfile->buffer_stack_depth >= CPP_STACK_MAX)
+ if (pfile->line_maps.depth >= CPP_STACK_MAX)
cpp_fatal (pfile, "#include nested too deeply");
- else if (pfile->context->prev)
- cpp_ice (pfile, "attempt to push file buffer with contexts stacked");
else
{
- /* For #include_next, if this is the primary source file,
- warn and use the normal search logic. */
- if (type == IT_INCLUDE_NEXT && ! pfile->buffer->prev)
- {
- cpp_warning (pfile, "#include_next in primary source file");
- type = IT_INCLUDE;
- }
-
- _cpp_execute_include (pfile, &header, type);
+ check_eol (pfile);
+ /* Get out of macro context, if we are. */
+ skip_rest_of_line (pfile);
+ if (pfile->cb.include)
+ (*pfile->cb.include) (pfile, pfile->directive_line,
+ pfile->directive->name, header);
+
+ _cpp_execute_include (pfile, header, type);
}
}
}
do_import (pfile)
cpp_reader *pfile;
{
- if (!pfile->import_warning && CPP_OPTION (pfile, warn_import))
- {
- pfile->import_warning = 1;
- cpp_warning (pfile,
- "#import is obsolete, use an #ifndef wrapper in the header file");
- }
-
do_include_common (pfile, IT_IMPORT);
}
do_include_common (pfile, IT_INCLUDE_NEXT);
}
-/* Subroutine of do_line. Read possible flags after file name. LAST
- is the last flag seen; 0 if this is the first flag. Return the flag
- if it is valid, 0 at the end of the directive. Otherwise complain. */
-
+/* Subroutine of do_linemarker. Read possible flags after file name.
+ LAST is the last flag seen; 0 if this is the first flag. Return the
+ flag if it is valid, 0 at the end of the directive. Otherwise
+ complain. */
static unsigned int
read_flag (pfile, last)
cpp_reader *pfile;
unsigned int last;
{
- cpp_token token;
+ const cpp_token *token = _cpp_lex_token (pfile);
- _cpp_lex_token (pfile, &token);
- if (token.type == CPP_NUMBER && token.val.str.len == 1)
+ if (token->type == CPP_NUMBER && token->val.str.len == 1)
{
- unsigned int flag = token.val.str.text[0] - '0';
+ unsigned int flag = token->val.str.text[0] - '0';
if (flag > last && flag <= 4
&& (flag != 4 || last == 3)
return flag;
}
- if (token.type != CPP_EOF)
+ if (token->type != CPP_EOF)
cpp_error (pfile, "invalid flag \"%s\" in line directive",
- cpp_token_as_text (pfile, &token));
+ cpp_token_as_text (pfile, token));
return 0;
}
-/* Another subroutine of do_line. Convert a number in STR, of length
- LEN, to binary; store it in NUMP, and return 0 if the number was
- well-formed, 1 if not. Temporary, hopefully. */
+/* Subroutine of do_line and do_linemarker. Returns a version of STR
+ which has a NUL terminator and all escape sequences converted to
+ their equivalents. Temporary, hopefully. */
+static U_CHAR *
+dequote_string (pfile, str, len)
+ cpp_reader *pfile;
+ const U_CHAR *str;
+ unsigned int len;
+{
+ U_CHAR *result = _cpp_unaligned_alloc (pfile, len + 1);
+ U_CHAR *dst = result;
+ const U_CHAR *limit = str + len;
+ unsigned int c;
+ unsigned HOST_WIDE_INT mask;
+
+ /* We need the mask to match the host's 'unsigned char', not the
+ target's. */
+ if (CHAR_BIT < HOST_BITS_PER_WIDE_INT)
+ mask = ((unsigned HOST_WIDE_INT) 1 << CHAR_BIT) - 1;
+ else
+ mask = ~(unsigned HOST_WIDE_INT)0;
+
+ while (str < limit)
+ {
+ c = *str++;
+ if (c != '\\')
+ *dst++ = c;
+ else
+ *dst++ = cpp_parse_escape (pfile, (const U_CHAR **)&str, limit, mask, 0);
+ }
+ *dst++ = '\0';
+ return result;
+}
+
+/* Subroutine of do_line and do_linemarker. Convert a number in STR,
+ of length LEN, to binary; store it in NUMP, and return 0 if the
+ number was well-formed, 1 if not. Temporary, hopefully. */
static int
strtoul_for_line (str, len, nump)
const U_CHAR *str;
}
/* Interpret #line command.
- Note that the filename string (if any) is treated as if it were an
- include filename. That means no escape handling. */
-
+ Note that the filename string (if any) is a true string constant
+ (escapes are interpreted), unlike in #line. */
static void
do_line (pfile)
cpp_reader *pfile;
{
- cpp_buffer *buffer = pfile->buffer;
- const char *filename = buffer->nominal_fname;
- unsigned int lineno = buffer->lineno;
- enum cpp_fc_reason reason = FC_RENAME;
+ const cpp_token *token;
+ const char *new_file = pfile->map->to_file;
unsigned long new_lineno;
- unsigned int cap;
- cpp_token token;
/* C99 raised the minimum limit on #line numbers. */
- cap = CPP_OPTION (pfile, c99) ? 2147483647 : 32767;
+ unsigned int cap = CPP_OPTION (pfile, c99) ? 2147483647 : 32767;
/* #line commands expand macros. */
- cpp_get_token (pfile, &token);
- if (token.type != CPP_NUMBER
- || strtoul_for_line (token.val.str.text, token.val.str.len, &new_lineno))
+ token = cpp_get_token (pfile);
+ if (token->type != CPP_NUMBER
+ || strtoul_for_line (token->val.str.text, token->val.str.len,
+ &new_lineno))
{
cpp_error (pfile, "\"%s\" after #line is not a positive integer",
- cpp_token_as_text (pfile, &token));
+ cpp_token_as_text (pfile, token));
return;
- }
+ }
if (CPP_PEDANTIC (pfile) && (new_lineno == 0 || new_lineno > cap))
cpp_pedwarn (pfile, "line number out of range");
- cpp_get_token (pfile, &token);
- if (token.type == CPP_STRING)
+ token = cpp_get_token (pfile);
+ if (token->type == CPP_STRING)
{
- const char *fname = (const char *) token.val.str.text;
-
- /* Only accept flags for the # 55 form. */
- if (! pfile->state.line_extension)
- check_eol (pfile);
- else
- {
- int flag = 0, sysp = 0;
-
- flag = read_flag (pfile, flag);
- if (flag == 1)
- {
- reason = FC_ENTER;
- flag = read_flag (pfile, flag);
- }
- else if (flag == 2)
- {
- reason = FC_LEAVE;
- flag = read_flag (pfile, flag);
- }
- if (flag == 3)
- {
- sysp = 1;
- flag = read_flag (pfile, flag);
- if (flag == 4)
- sysp = 2, read_flag (pfile, flag);
- }
-
- if (reason == FC_ENTER)
- {
- /* Fake a buffer stack for diagnostics. */
- cpp_push_buffer (pfile, 0, 0, BUF_FAKE, fname);
- /* Fake an include for cpp_included. */
- _cpp_fake_include (pfile, fname);
- buffer = pfile->buffer;
- }
- else if (reason == FC_LEAVE)
- {
- if (buffer->type != BUF_FAKE)
- cpp_warning (pfile, "file \"%s\" left but not entered",
- buffer->nominal_fname);
- else
- {
- cpp_pop_buffer (pfile);
- buffer = pfile->buffer;
-#ifdef ENABLE_CHECKING
- if (strcmp (buffer->nominal_fname, fname))
- cpp_warning (pfile, "expected to return to file \"%s\"",
- buffer->nominal_fname);
- if (buffer->lineno + 1 != new_lineno)
- cpp_warning (pfile, "expected to return to line number %u",
- buffer->lineno + 1);
- if (buffer->sysp != sysp)
- cpp_warning (pfile, "header flags for \"%s\" have changed",
- buffer->nominal_fname);
-#endif
- }
- }
- buffer->sysp = sysp;
- }
- buffer->nominal_fname = fname;
+ new_file = (const char *) dequote_string (pfile, token->val.str.text,
+ token->val.str.len);
+ check_eol (pfile);
}
- else if (token.type != CPP_EOF)
+ else if (token->type != CPP_EOF)
{
cpp_error (pfile, "\"%s\" is not a valid filename",
- cpp_token_as_text (pfile, &token));
+ cpp_token_as_text (pfile, token));
return;
}
- /* Our line number is incremented after the directive is processed. */
- buffer->lineno = new_lineno - 1;
- _cpp_do_file_change (pfile, reason, filename, lineno);
+ skip_rest_of_line (pfile);
+ _cpp_do_file_change (pfile, LC_RENAME, new_file, new_lineno,
+ pfile->map->sysp);
}
-/* Arrange the file_change callback. */
-void
-_cpp_do_file_change (pfile, reason, from_file, from_lineno)
+/* Interpret the # 44 "file" [flags] notation, which has slightly
+ different syntax and semantics from #line: Flags are allowed,
+ and we never complain about the line number being too big. */
+static void
+do_linemarker (pfile)
cpp_reader *pfile;
- enum cpp_fc_reason reason;
- const char *from_file;
- unsigned int from_lineno;
{
- if (pfile->cb.file_change)
- {
- cpp_file_change fc;
- cpp_buffer *buffer = pfile->buffer;
+ const cpp_token *token;
+ const char *new_file = pfile->map->to_file;
+ unsigned long new_lineno;
+ unsigned int new_sysp = pfile->map->sysp;
+ enum lc_reason reason = LC_RENAME;
+ int flag;
- fc.reason = reason;
- fc.to.filename = buffer->nominal_fname;
- fc.to.lineno = buffer->lineno + 1;
- fc.sysp = buffer->sysp;
- fc.externc = CPP_OPTION (pfile, cplusplus) && buffer->sysp == 2;
+ /* Back up so we can get the number again. Putting this in
+ _cpp_handle_directive risks two calls to _cpp_backup_tokens in
+ some circumstances, which can segfault. */
+ _cpp_backup_tokens (pfile, 1);
- /* Caller doesn't need to handle FC_ENTER. */
- if (reason == FC_ENTER)
+ /* #line commands expand macros. */
+ token = cpp_get_token (pfile);
+ if (token->type != CPP_NUMBER
+ || strtoul_for_line (token->val.str.text, token->val.str.len,
+ &new_lineno))
+ {
+ cpp_error (pfile, "\"%s\" after # is not a positive integer",
+ cpp_token_as_text (pfile, token));
+ return;
+ }
+
+ token = cpp_get_token (pfile);
+ if (token->type == CPP_STRING)
+ {
+ new_file = (const char *) dequote_string (pfile, token->val.str.text,
+ token->val.str.len);
+ new_sysp = 0;
+ flag = read_flag (pfile, 0);
+ if (flag == 1)
{
- if (buffer->prev)
- {
- from_file = buffer->prev->nominal_fname;
- from_lineno = buffer->prev->lineno;
- }
- else
- from_file = 0;
+ reason = LC_ENTER;
+ /* Fake an include for cpp_included (). */
+ _cpp_fake_include (pfile, new_file);
+ flag = read_flag (pfile, flag);
+ }
+ else if (flag == 2)
+ {
+ reason = LC_LEAVE;
+ flag = read_flag (pfile, flag);
}
- /* Special case for file "foo.i" with "# 1 foo.c" on first line. */
- else if (reason == FC_RENAME && ! buffer->prev
- && pfile->directive_pos.line == 1)
- from_file = 0;
-
- fc.from.filename = from_file;
- fc.from.lineno = from_lineno;
- pfile->cb.file_change (pfile, &fc);
+ if (flag == 3)
+ {
+ new_sysp = 1;
+ flag = read_flag (pfile, flag);
+ if (flag == 4)
+ new_sysp = 2;
+ }
+
+ check_eol (pfile);
+ }
+ else if (token->type != CPP_EOF)
+ {
+ cpp_error (pfile, "\"%s\" is not a valid filename",
+ cpp_token_as_text (pfile, token));
+ return;
}
+
+ skip_rest_of_line (pfile);
+ _cpp_do_file_change (pfile, reason, new_file, new_lineno, new_sysp);
}
-/*
- * Report a warning or error detected by the program we are
- * processing. Use the directive's tokens in the error message.
- */
+/* Arrange the file_change callback. pfile->line has changed to
+ FILE_LINE of TO_FILE, for reason REASON. SYSP is 1 for a system
+ header, 2 for a system header that needs to be extern "C" protected,
+ and zero otherwise. */
+void
+_cpp_do_file_change (pfile, reason, to_file, file_line, sysp)
+ cpp_reader *pfile;
+ enum lc_reason reason;
+ const char *to_file;
+ unsigned int file_line;
+ unsigned int sysp;
+{
+ pfile->map = add_line_map (&pfile->line_maps, reason, sysp,
+ pfile->line, to_file, file_line);
+
+ if (pfile->cb.file_change)
+ (*pfile->cb.file_change) (pfile, pfile->map);
+}
+/* Report a warning or error detected by the program we are
+ processing. Use the directive's tokens in the error message. */
static void
do_diagnostic (pfile, code, print_dir)
cpp_reader *pfile;
enum error_type code;
int print_dir;
{
- if (_cpp_begin_message (pfile, code, NULL, 0))
+ if (_cpp_begin_message (pfile, code, 0, 0))
{
if (print_dir)
fprintf (stderr, "#%s ", pfile->directive->name);
}
/* Report program identification. */
-
static void
do_ident (pfile)
cpp_reader *pfile;
{
- cpp_token str;
+ const cpp_token *str = cpp_get_token (pfile);
- cpp_get_token (pfile, &str);
- if (str.type != CPP_STRING)
- cpp_error (pfile, "invalid #ident");
+ if (str->type != CPP_STRING)
+ cpp_error (pfile, "invalid #ident directive");
else if (pfile->cb.ident)
- (*pfile->cb.ident) (pfile, &str.val.str);
+ (*pfile->cb.ident) (pfile, pfile->directive_line, &str->val.str);
check_eol (pfile);
}
-/* Pragmata handling. We handle some of these, and pass the rest on
- to the front end. C99 defines three pragmas and says that no macro
- expansion is to be performed on them; whether or not macro
- expansion happens for other pragmas is implementation defined.
- This implementation never macro-expands the text after #pragma. */
-
-/* Sub-handlers for the pragmas needing treatment here.
- They return 1 if the token buffer is to be popped, 0 if not. */
-struct pragma_entry
+/* Lookup a PRAGMA name in a singly-linked CHAIN. Returns the
+ matching entry, or NULL if none is found. The returned entry could
+ be the start of a namespace chain, or a pragma. */
+static struct pragma_entry *
+lookup_pragma_entry (chain, pragma)
+ struct pragma_entry *chain;
+ const cpp_hashnode *pragma;
{
- struct pragma_entry *next;
- const char *name;
- size_t len;
- int isnspace;
- union {
- void (*handler) PARAMS ((cpp_reader *));
- struct pragma_entry *space;
- } u;
-};
+ while (chain && chain->pragma != pragma)
+ chain = chain->next;
-void
-cpp_register_pragma (pfile, space, name, handler)
+ return chain;
+}
+
+/* Create and insert a pragma entry for NAME at the beginning of a
+ singly-linked CHAIN. If handler is NULL, it is a namespace,
+ otherwise it is a pragma and its handler. */
+static struct pragma_entry *
+insert_pragma_entry (pfile, chain, pragma, handler)
cpp_reader *pfile;
- const char *space;
- const char *name;
- void (*handler) PARAMS ((cpp_reader *));
+ struct pragma_entry **chain;
+ const cpp_hashnode *pragma;
+ pragma_cb handler;
{
- struct pragma_entry **x, *new;
- size_t len;
+ struct pragma_entry *new;
- x = &pfile->pragmas;
- if (space)
+ new = (struct pragma_entry *)
+ _cpp_aligned_alloc (pfile, sizeof (struct pragma_entry));
+ new->pragma = pragma;
+ if (handler)
{
- struct pragma_entry *p = pfile->pragmas;
- len = strlen (space);
- while (p)
- {
- if (p->isnspace && p->len == len && !memcmp (p->name, space, len))
- {
- x = &p->u.space;
- goto found;
- }
- p = p->next;
- }
- cpp_ice (pfile, "unknown #pragma namespace %s", space);
- return;
+ new->is_nspace = 0;
+ new->u.handler = handler;
+ }
+ else
+ {
+ new->is_nspace = 1;
+ new->u.space = NULL;
}
- found:
- new = xnew (struct pragma_entry);
- new->name = name;
- new->len = strlen (name);
- new->isnspace = 0;
- new->u.handler = handler;
-
- new->next = *x;
- *x = new;
+ new->next = *chain;
+ *chain = new;
+ return new;
}
+/* Register a pragma NAME in namespace SPACE. If SPACE is null, it
+ goes in the global namespace. HANDLER is the handler it will call,
+ which must be non-NULL. */
void
-cpp_register_pragma_space (pfile, space)
+cpp_register_pragma (pfile, space, name, handler)
cpp_reader *pfile;
const char *space;
+ const char *name;
+ pragma_cb handler;
{
- struct pragma_entry *new;
- const struct pragma_entry *p = pfile->pragmas;
- size_t len = strlen (space);
+ struct pragma_entry **chain = &pfile->pragmas;
+ struct pragma_entry *entry;
+ const cpp_hashnode *node;
- while (p)
+ if (!handler)
+ abort ();
+
+ if (space)
{
- if (p->isnspace && p->len == len && !memcmp (p->name, space, len))
- /* Multiple different callers are allowed to register the same
- namespace. */
- return;
- p = p->next;
+ node = cpp_lookup (pfile, U space, strlen (space));
+ entry = lookup_pragma_entry (*chain, node);
+ if (!entry)
+ entry = insert_pragma_entry (pfile, chain, node, NULL);
+ else if (!entry->is_nspace)
+ goto clash;
+ chain = &entry->u.space;
}
- new = xnew (struct pragma_entry);
- new->name = space;
- new->len = len;
- new->isnspace = 1;
- new->u.space = 0;
-
- new->next = pfile->pragmas;
- pfile->pragmas = new;
+ /* Check for duplicates. */
+ node = cpp_lookup (pfile, U name, strlen (name));
+ entry = lookup_pragma_entry (*chain, node);
+ if (entry)
+ {
+ if (entry->is_nspace)
+ clash:
+ cpp_ice (pfile,
+ "registering \"%s\" as both a pragma and a pragma namespace",
+ NODE_NAME (node));
+ else if (space)
+ cpp_ice (pfile, "#pragma %s %s is already registered", space, name);
+ else
+ cpp_ice (pfile, "#pragma %s is already registered", name);
+ }
+ else
+ insert_pragma_entry (pfile, chain, node, handler);
}
-
+
+/* Register the pragmas the preprocessor itself handles. */
void
_cpp_init_internal_pragmas (pfile)
cpp_reader *pfile;
{
- /* top level */
+ /* Pragmas in the global namespace. */
cpp_register_pragma (pfile, 0, "poison", do_pragma_poison);
cpp_register_pragma (pfile, 0, "once", do_pragma_once);
- /* GCC namespace */
- cpp_register_pragma_space (pfile, "GCC");
-
+ /* New GCC-specific pragmas should be put in the GCC namespace. */
cpp_register_pragma (pfile, "GCC", "poison", do_pragma_poison);
cpp_register_pragma (pfile, "GCC", "system_header", do_pragma_system_header);
cpp_register_pragma (pfile, "GCC", "dependency", do_pragma_dependency);
-
+
/* Kevin abuse for SDCC. */
cpp_register_pragma(pfile, 0, "sdcc_hash", do_pragma_sdcc_hash);
- /* SDCC _asm specific */
+ /* SDCC _asm specific */
cpp_register_pragma(pfile, 0, "preproc_asm", do_pragma_preproc_asm);
}
+/* Pragmata handling. We handle some, and pass the rest on to the
+ front end. C99 defines three pragmas and says that no macro
+ expansion is to be performed on them; whether or not macro
+ expansion happens for other pragmas is implementation defined.
+ This implementation never macro-expands the text after #pragma. */
static void
do_pragma (pfile)
cpp_reader *pfile;
{
- const struct pragma_entry *p;
- cpp_token tok;
- int drop = 0;
+ const struct pragma_entry *p = NULL;
+ const cpp_token *token;
+ unsigned int count = 1;
- p = pfile->pragmas;
pfile->state.prevent_expansion++;
- cpp_start_lookahead (pfile);
- new_space:
- cpp_get_token (pfile, &tok);
- if (tok.type == CPP_NAME)
+ token = cpp_get_token (pfile);
+ if (token->type == CPP_NAME)
{
- const cpp_hashnode *node = tok.val.node;
- size_t len = NODE_LEN (node);
-
- while (p)
+ p = lookup_pragma_entry (pfile->pragmas, token->val.node);
+ if (p && p->is_nspace)
{
- if (strlen (p->name) == len
- && !memcmp (p->name, NODE_NAME (node), len))
- {
- if (p->isnspace)
- {
- p = p->u.space;
- goto new_space;
- }
- else
- {
- (*p->u.handler) (pfile);
- drop = 1;
- break;
- }
- }
- p = p->next;
+ count = 2;
+ token = cpp_get_token (pfile);
+ if (token->type == CPP_NAME)
+ p = lookup_pragma_entry (p->u.space, token->val.node);
+ else
+ p = NULL;
}
}
- cpp_stop_lookahead (pfile, drop);
- pfile->state.prevent_expansion--;
+ /* FIXME. This is an awful kludge to get the front ends to update
+ their notion of line number for diagnostic purposes. The line
+ number should be passed to the handler and they should do it
+ themselves. Stand-alone CPP must ignore us, otherwise it will
+ prefix the directive with spaces, hence the 1. Ugh. */
+ if (pfile->cb.line_change)
+ (*pfile->cb.line_change)(pfile, token, 1);
+
+ if (p)
+ (*p->u.handler) (pfile);
+ else if (pfile->cb.def_pragma)
+ {
+ _cpp_backup_tokens (pfile, count);
+ (*pfile->cb.def_pragma) (pfile, pfile->directive_line);
+ }
- if (!drop && pfile->cb.def_pragma)
- (*pfile->cb.def_pragma) (pfile);
+ pfile->state.prevent_expansion--;
}
+/* Handle #pragma once. */
static void
do_pragma_once (pfile)
cpp_reader *pfile;
{
cpp_warning (pfile, "#pragma once is obsolete");
-
+
if (pfile->buffer->prev == NULL)
cpp_warning (pfile, "#pragma once in main file");
else
check_eol (pfile);
}
+/* Handle #pragma poison, to poison one or more identifiers so that
+ the lexer produces a hard error for each subsequent usage. */
static void
do_pragma_poison (pfile)
cpp_reader *pfile;
{
- /* Poison these symbols so that all subsequent usage produces an
- error message. */
- cpp_token tok;
+ const cpp_token *tok;
cpp_hashnode *hp;
pfile->state.poisoned_ok = 1;
for (;;)
{
- _cpp_lex_token (pfile, &tok);
- if (tok.type == CPP_EOF)
+ tok = _cpp_lex_token (pfile);
+ if (tok->type == CPP_EOF)
break;
- if (tok.type != CPP_NAME)
+ if (tok->type != CPP_NAME)
{
cpp_error (pfile, "invalid #pragma GCC poison directive");
break;
}
- hp = tok.val.node;
+ hp = tok->val.node;
if (hp->flags & NODE_POISONED)
continue;
hp->flags |= NODE_POISONED | NODE_DIAGNOSTIC;
}
pfile->state.poisoned_ok = 0;
-
-#if 0 /* Doesn't quite work yet. */
- if (tok.type == CPP_EOF && pfile->cb.poison)
- (*pfile->cb.poison) (pfile);
-#endif
}
static void
do_pragma_sdcc_hash (pfile)
cpp_reader *pfile;
{
- cpp_token tok;
- /*cpp_hashnode *hp;*/
+ const cpp_token *tok = _cpp_lex_token (pfile);
- _cpp_lex_token (pfile, &tok);
- if (tok.type == CPP_PLUS)
+ if (tok->type == CPP_PLUS)
{
CPP_OPTION(pfile, allow_naked_hash)++;
}
- else if (tok.type == CPP_MINUS)
+ else if (tok->type == CPP_MINUS)
{
- CPP_OPTION(pfile, allow_naked_hash)--;
+ CPP_OPTION(pfile, allow_naked_hash)--;
}
else
{
do_pragma_preproc_asm (pfile)
cpp_reader *pfile;
{
- cpp_token tok;
+ const cpp_token *tok = _cpp_lex_token (pfile);
- _cpp_lex_token (pfile, &tok);
- if (tok.type == CPP_PLUS)
+ if (tok->type == CPP_PLUS)
{
CPP_OPTION(pfile, preproc_asm) = 1;
}
- else if (tok.type == CPP_MINUS)
+ else if (tok->type == CPP_MINUS)
{
- CPP_OPTION(pfile, preproc_asm)= 0;
+ CPP_OPTION(pfile, preproc_asm)= 0;
}
else
{
if (buffer->prev == 0)
cpp_warning (pfile, "#pragma system_header ignored outside include file");
else
- cpp_make_system_header (pfile, 1, 0);
-
- check_eol (pfile);
+ {
+ check_eol (pfile);
+ skip_rest_of_line (pfile);
+ cpp_make_system_header (pfile, 1, 0);
+ }
}
/* Check the modified date of the current include file against a specified
do_pragma_dependency (pfile)
cpp_reader *pfile;
{
- cpp_token header, msg;
+ const cpp_token *header;
int ordering;
-
- if (parse_include (pfile, &header))
+
+ header = parse_include (pfile);
+ if (!header)
return;
- ordering = _cpp_compare_file_date (pfile, &header);
+ ordering = _cpp_compare_file_date (pfile, header);
if (ordering < 0)
cpp_warning (pfile, "cannot find source %s",
- cpp_token_as_text (pfile, &header));
+ cpp_token_as_text (pfile, header));
else if (ordering > 0)
{
cpp_warning (pfile, "current file is older than %s",
- cpp_token_as_text (pfile, &header));
- cpp_start_lookahead (pfile);
- cpp_get_token (pfile, &msg);
- cpp_stop_lookahead (pfile, msg.type == CPP_EOF);
- if (msg.type != CPP_EOF)
- do_diagnostic (pfile, WARNING, 0);
+ cpp_token_as_text (pfile, header));
+ if (cpp_get_token (pfile)->type != CPP_EOF)
+ {
+ _cpp_backup_tokens (pfile, 1);
+ do_diagnostic (pfile, WARNING, 0);
+ }
}
}
-/* Check syntax is "(string-literal)". Returns 0 on success. */
-static int
-get__Pragma_string (pfile, string)
+/* Get a token but skip padding. */
+static const cpp_token *
+get_token_no_padding (pfile)
+ cpp_reader *pfile;
+{
+ for (;;)
+ {
+ const cpp_token *result = cpp_get_token (pfile);
+ if (result->type != CPP_PADDING)
+ return result;
+ }
+}
+
+/* Check syntax is "(string-literal)". Returns the string on success,
+ or NULL on failure. */
+static const cpp_token *
+get__Pragma_string (pfile)
cpp_reader *pfile;
- cpp_token *string;
{
- cpp_token paren;
+ const cpp_token *string;
- cpp_get_token (pfile, &paren);
- if (paren.type != CPP_OPEN_PAREN)
- return 1;
+ if (get_token_no_padding (pfile)->type != CPP_OPEN_PAREN)
+ return NULL;
- cpp_get_token (pfile, string);
+ string = get_token_no_padding (pfile);
if (string->type != CPP_STRING && string->type != CPP_WSTRING)
- return 1;
+ return NULL;
- cpp_get_token (pfile, &paren);
- return paren.type != CPP_CLOSE_PAREN;
+ if (get_token_no_padding (pfile)->type != CPP_CLOSE_PAREN)
+ return NULL;
+
+ return string;
}
/* Returns a malloced buffer containing a destringized cpp_string by
return result;
}
+/* Destringize IN into a temporary buffer, by removing the first \ of
+ \" and \\ sequences, and process the result as a #pragma directive. */
+static void
+destringize_and_run (pfile, in)
+ cpp_reader *pfile;
+ const cpp_string *in;
+{
+ const unsigned char *src, *limit;
+ char *dest, *result;
+
+ dest = result = alloca (in->len + 1);
+ for (src = in->text, limit = src + in->len; src < limit;)
+ {
+ /* We know there is a character following the backslash. */
+ if (*src == '\\' && (src[1] == '\\' || src[1] == '"'))
+ src++;
+ *dest++ = *src++;
+ }
+ *dest = '\0';
+
+ run_directive (pfile, T_PRAGMA, result, dest - result);
+}
+
+/* Handle the _Pragma operator. */
void
_cpp_do__Pragma (pfile)
cpp_reader *pfile;
{
- cpp_token string;
unsigned char *buffer;
unsigned int len;
+ const cpp_token *string = get__Pragma_string (pfile);
- if (get__Pragma_string (pfile, &string))
+ if (!string)
+ cpp_error (pfile, "_Pragma takes a parenthesized string literal");
+ else
{
- cpp_error (pfile, "_Pragma takes a parenthesized string literal");
- return;
+ /* Ideally, we'd like
+ token1 _Pragma ("foo") token2
+ to be output as
+ token1
+ # 7 "file.c"
+ #pragma foo
+ # 7 "file.c"
+ token2
+ Getting these correct line markers is a little tricky. */
+
+ buffer = destringize (&string->val.str, &len);
+ buffer[len] = 0;
+ cpp_output_string ("\n#pragma "); cpp_output_string (buffer); cpp_output_string ("\n");
+ free ((PTR) buffer);
}
-
- buffer = destringize (&string.val.str, &len);
- buffer[len] = 0;
- cpp_output_string ("\n#pragma "); cpp_output_string (buffer); cpp_output_string ("\n");
- //run_directive (pfile, T_PRAGMA, BUF_PRAGMA, (char *) buffer, len);
- free ((PTR) buffer);
}
/* Just ignore #sccs, on systems where we define it at all. */
}
#endif
+/* Handle #ifdef. */
static void
do_ifdef (pfile)
cpp_reader *pfile;
{
int skip = 1;
- if (! pfile->buffer->was_skipping)
+ if (! pfile->state.skipping)
{
const cpp_hashnode *node = lex_macro_node (pfile);
push_conditional (pfile, skip, T_IFDEF, 0);
}
+/* Handle #ifndef. */
static void
do_ifndef (pfile)
cpp_reader *pfile;
int skip = 1;
const cpp_hashnode *node = 0;
- if (! pfile->buffer->was_skipping)
+ if (! pfile->state.skipping)
{
node = lex_macro_node (pfile);
if (node)
push_conditional (pfile, skip, T_IFNDEF, node);
}
-/* #if cooperates with parse_defined to handle multiple-include
- optimisations. If macro expansions or identifiers appear in the
- expression, we cannot treat it as a controlling conditional, since
- their values could change in the future. */
-
+/* _cpp_parse_expr puts a macro in a "#if !defined ()" expression in
+ pfile->mi_ind_cmacro so we can handle multiple-include
+ optimisations. If macro expansion occurs in the expression, we
+ cannot treat it as a controlling conditional, since the expansion
+ could change in the future. That is handled by cpp_get_token. */
static void
do_if (pfile)
cpp_reader *pfile;
{
int skip = 1;
- const cpp_hashnode *cmacro = 0;
- if (! pfile->buffer->was_skipping)
- {
- /* Controlling macro of #if ! defined () */
- pfile->mi_ind_cmacro = 0;
- skip = _cpp_parse_expr (pfile) == 0;
- cmacro = pfile->mi_ind_cmacro;
- }
+ if (! pfile->state.skipping)
+ skip = _cpp_parse_expr (pfile) == 0;
- push_conditional (pfile, skip, T_IF, cmacro);
+ push_conditional (pfile, skip, T_IF, pfile->mi_ind_cmacro);
}
/* Flip skipping state if appropriate and continue without changing
if_stack; this is so that the error message for missing #endif's
etc. will point to the original #if. */
-
static void
do_else (pfile)
cpp_reader *pfile;
if (ifs->type == T_ELSE)
{
cpp_error (pfile, "#else after #else");
- cpp_error_with_line (pfile, ifs->pos.line, ifs->pos.col,
+ cpp_error_with_line (pfile, ifs->line, 0,
"the conditional began here");
}
ifs->type = T_ELSE;
- /* Buffer->was_skipping is 1 if all conditionals in this chain
- have been false, 2 if a conditional has been true. */
- if (! ifs->was_skipping && buffer->was_skipping != 2)
- buffer->was_skipping = ! buffer->was_skipping;
+ /* Skip any future (erroneous) #elses or #elifs. */
+ pfile->state.skipping = ifs->skip_elses;
+ ifs->skip_elses = true;
/* Invalidate any controlling macro. */
ifs->mi_cmacro = 0;
- }
- check_eol (pfile);
+ /* Only check EOL if was not originally skipping. */
+ if (!ifs->was_skipping)
+ check_eol (pfile);
+ }
}
-/* handle a #elif directive by not changing if_stack either. see the
+/* Handle a #elif directive by not changing if_stack either. See the
comment above do_else. */
-
static void
do_elif (pfile)
cpp_reader *pfile;
if (ifs->type == T_ELSE)
{
cpp_error (pfile, "#elif after #else");
- cpp_error_with_line (pfile, ifs->pos.line, ifs->pos.col,
+ cpp_error_with_line (pfile, ifs->line, 0,
"the conditional began here");
}
ifs->type = T_ELIF;
- /* Don't evaluate #elif if our higher level is skipping. */
- if (! ifs->was_skipping)
+ /* Only evaluate this if we aren't skipping elses. During
+ evaluation, set skipping to false to get lexer warnings. */
+ if (ifs->skip_elses)
+ pfile->state.skipping = 1;
+ else
{
- /* Buffer->was_skipping is 1 if all conditionals in this
- chain have been false, 2 if a conditional has been true. */
- if (buffer->was_skipping == 1)
- buffer->was_skipping = ! _cpp_parse_expr (pfile);
- else
- buffer->was_skipping = 2;
-
- /* Invalidate any controlling macro. */
- ifs->mi_cmacro = 0;
+ pfile->state.skipping = 0;
+ pfile->state.skipping = ! _cpp_parse_expr (pfile);
+ ifs->skip_elses = ! pfile->state.skipping;
}
+
+ /* Invalidate any controlling macro. */
+ ifs->mi_cmacro = 0;
}
}
-/* #endif pops the if stack and resets pfile->skipping. */
-
+/* #endif pops the if stack and resets pfile->state.skipping. */
static void
do_endif (pfile)
cpp_reader *pfile;
cpp_error (pfile, "#endif without #if");
else
{
+ /* Only check EOL if was not originally skipping. */
+ if (!ifs->was_skipping)
+ check_eol (pfile);
+
/* If potential control macro, we go back outside again. */
if (ifs->next == 0 && ifs->mi_cmacro)
{
- pfile->mi_state = MI_OUTSIDE;
+ pfile->mi_valid = true;
pfile->mi_cmacro = ifs->mi_cmacro;
}
buffer->if_stack = ifs->next;
- buffer->was_skipping = ifs->was_skipping;
+ pfile->state.skipping = ifs->was_skipping;
obstack_free (&pfile->buffer_ob, ifs);
}
-
- check_eol (pfile);
}
-/* Push an if_stack entry and set pfile->skipping accordingly.
- If this is a #ifndef starting at the beginning of a file,
- CMACRO is the macro name tested by the #ifndef. */
-
+/* Push an if_stack entry for a preprocessor conditional, and set
+ pfile->state.skipping to SKIP. If TYPE indicates the conditional
+ is #if or #ifndef, CMACRO is a potentially controlling macro, and
+ we need to check here that we are at the top of the file. */
static void
push_conditional (pfile, skip, type, cmacro)
cpp_reader *pfile;
cpp_buffer *buffer = pfile->buffer;
ifs = xobnew (&pfile->buffer_ob, struct if_stack);
- ifs->pos = pfile->directive_pos;
+ ifs->line = pfile->directive_line;
ifs->next = buffer->if_stack;
- ifs->was_skipping = buffer->was_skipping;
+ ifs->skip_elses = pfile->state.skipping || !skip;
+ ifs->was_skipping = pfile->state.skipping;
ifs->type = type;
- if (pfile->mi_state == MI_OUTSIDE && pfile->mi_cmacro == 0)
+ /* This condition is effectively a test for top-of-file. */
+ if (pfile->mi_valid && pfile->mi_cmacro == 0)
ifs->mi_cmacro = cmacro;
else
ifs->mi_cmacro = 0;
- buffer->was_skipping = skip;
+ pfile->state.skipping = skip;
buffer->if_stack = ifs;
}
-/* Read the tokens of the answer into the macro pool. Only commit the
- memory if we intend it as permanent storage, i.e. the #assert case.
- Returns 0 on success. */
-
+/* Read the tokens of the answer into the macro pool, in a directive
+ of type TYPE. Only commit the memory if we intend it as permanent
+ storage, i.e. the #assert case. Returns 0 on success, and sets
+ ANSWERP to point to the answer. */
static int
parse_answer (pfile, answerp, type)
cpp_reader *pfile;
struct answer **answerp;
int type;
{
- cpp_token paren, *token;
+ const cpp_token *paren;
struct answer *answer;
-
- if (POOL_FRONT (&pfile->macro_pool) + sizeof (struct answer) >
- POOL_LIMIT (&pfile->macro_pool))
- _cpp_next_chunk (&pfile->macro_pool, sizeof (struct answer), 0);
- answer = (struct answer *) POOL_FRONT (&pfile->macro_pool);
- answer->count = 0;
+ unsigned int acount;
/* In a conditional, it is legal to not have an open paren. We
should save the following token in this case. */
- if (type == T_IF)
- cpp_start_lookahead (pfile);
- cpp_get_token (pfile, &paren);
- if (type == T_IF)
- cpp_stop_lookahead (pfile, paren.type == CPP_OPEN_PAREN);
+ paren = cpp_get_token (pfile);
/* If not a paren, see if we're OK. */
- if (paren.type != CPP_OPEN_PAREN)
+ if (paren->type != CPP_OPEN_PAREN)
{
/* In a conditional no answer is a test for any answer. It
could be followed by any token. */
if (type == T_IF)
- return 0;
+ {
+ _cpp_backup_tokens (pfile, 1);
+ return 0;
+ }
/* #unassert with no answer is valid - it removes all answers. */
- if (type == T_UNASSERT && paren.type == CPP_EOF)
+ if (type == T_UNASSERT && paren->type == CPP_EOF)
return 0;
cpp_error (pfile, "missing '(' after predicate");
return 1;
}
- for (;;)
+ for (acount = 0;; acount++)
{
- token = &answer->first[answer->count];
- /* Check we have room for the token. */
- if ((unsigned char *) (token + 1) >= POOL_LIMIT (&pfile->macro_pool))
- {
- _cpp_next_chunk (&pfile->macro_pool, sizeof (cpp_token),
- (unsigned char **) &answer);
- token = &answer->first[answer->count];
- }
+ size_t room_needed;
+ const cpp_token *token = cpp_get_token (pfile);
+ cpp_token *dest;
- cpp_get_token (pfile, token);
if (token->type == CPP_CLOSE_PAREN)
break;
cpp_error (pfile, "missing ')' to complete answer");
return 1;
}
- answer->count++;
+
+ /* struct answer includes the space for one token. */
+ room_needed = (sizeof (struct answer) + acount * sizeof (cpp_token));
+
+ if (BUFF_ROOM (pfile->a_buff) < room_needed)
+ _cpp_extend_buff (pfile, &pfile->a_buff, sizeof (struct answer));
+
+ dest = &((struct answer *) BUFF_FRONT (pfile->a_buff))->first[acount];
+ *dest = *token;
+
+ /* Drop whitespace at start, for answer equivalence purposes. */
+ if (acount == 0)
+ dest->flags &= ~PREV_WHITE;
}
- if (answer->count == 0)
+ if (acount == 0)
{
cpp_error (pfile, "predicate's answer is empty");
return 1;
}
- /* Drop whitespace at start. */
- answer->first->flags &= ~PREV_WHITE;
+ answer = (struct answer *) BUFF_FRONT (pfile->a_buff);
+ answer->count = acount;
+ answer->next = NULL;
*answerp = answer;
- if (type == T_ASSERT || type == T_UNASSERT)
- check_eol (pfile);
return 0;
}
-/* Parses an assertion, returning a pointer to the hash node of the
- predicate, or 0 on error. If an answer was supplied, it is placed
- in ANSWERP, otherwise it is set to 0. */
+/* Parses an assertion directive of type TYPE, returning a pointer to
+ the hash node of the predicate, or 0 on error. If an answer was
+ supplied, it is placed in ANSWERP, otherwise it is set to 0. */
static cpp_hashnode *
parse_assertion (pfile, answerp, type)
cpp_reader *pfile;
int type;
{
cpp_hashnode *result = 0;
- cpp_token predicate;
+ const cpp_token *predicate;
/* We don't expand predicates or answers. */
pfile->state.prevent_expansion++;
*answerp = 0;
- cpp_get_token (pfile, &predicate);
- if (predicate.type == CPP_EOF)
+ predicate = cpp_get_token (pfile);
+ if (predicate->type == CPP_EOF)
cpp_error (pfile, "assertion without predicate");
- else if (predicate.type != CPP_NAME)
+ else if (predicate->type != CPP_NAME)
cpp_error (pfile, "predicate must be an identifier");
else if (parse_answer (pfile, answerp, type) == 0)
{
- unsigned int len = NODE_LEN (predicate.val.node);
+ unsigned int len = NODE_LEN (predicate->val.node);
unsigned char *sym = alloca (len + 1);
/* Prefix '#' to get it out of macro namespace. */
sym[0] = '#';
- memcpy (sym + 1, NODE_NAME (predicate.val.node), len);
+ memcpy (sym + 1, NODE_NAME (predicate->val.node), len);
result = cpp_lookup (pfile, sym, len + 1);
}
return result;
}
-/* Returns a pointer to the pointer to the answer in the answer chain,
+/* Returns a pointer to the pointer to CANDIDATE in the answer chain,
or a pointer to NULL if the answer is not in the chain. */
static struct answer **
find_answer (node, candidate)
return node == 0;
}
+/* Handle #assert. */
static void
do_assert (pfile)
cpp_reader *pfile;
{
struct answer *new_answer;
cpp_hashnode *node;
-
+
node = parse_assertion (pfile, &new_answer, T_ASSERT);
if (node)
{
}
new_answer->next = node->value.answers;
}
+
node->type = NT_ASSERTION;
node->value.answers = new_answer;
- POOL_COMMIT (&pfile->macro_pool, (sizeof (struct answer)
- + (new_answer->count - 1)
- * sizeof (cpp_token)));
+ BUFF_FRONT (pfile->a_buff) += (sizeof (struct answer)
+ + (new_answer->count - 1)
+ * sizeof (cpp_token));
+ check_eol (pfile);
}
}
+/* Handle #unassert. */
static void
do_unassert (pfile)
cpp_reader *pfile;
{
cpp_hashnode *node;
struct answer *answer;
-
+
node = parse_assertion (pfile, &answer, T_UNASSERT);
/* It isn't an error to #unassert something that isn't asserted. */
if (node && node->type == NT_ASSERTION)
/* Did we free the last answer? */
if (node->value.answers == 0)
node->type = NT_VOID;
+
+ check_eol (pfile);
}
else
_cpp_free_definition (node);
/* Process the string STR as if it appeared as the body of a #define.
If STR is just an identifier, define it with value 1.
If STR has anything after the identifier, then it should
- be identifier=definition. */
-
+ be identifier=definition. */
void
cpp_define (pfile, str)
cpp_reader *pfile;
char *buf, *p;
size_t count;
- /* Copy the entire option so we can modify it.
+ /* Copy the entire option so we can modify it.
Change the first "=" in the string to a space. If there is none,
tack " 1" on the end. */
- /* Length including the null. */
count = strlen (str);
- buf = (char *) alloca (count + 2);
+ buf = (char *) alloca (count + 3);
memcpy (buf, str, count);
p = strchr (str, '=');
buf[count++] = ' ';
buf[count++] = '1';
}
+ buf[count] = '\0';
- run_directive (pfile, T_DEFINE, BUF_CL_OPTION, buf, count);
+ run_directive (pfile, T_DEFINE, buf, count);
}
/* Slight variant of the above for use by initialize_builtins. */
cpp_reader *pfile;
const char *str;
{
- run_directive (pfile, T_DEFINE, BUF_BUILTIN, str, strlen (str));
+ run_directive (pfile, T_DEFINE, str, strlen (str));
}
/* Process MACRO as if it appeared as the body of an #undef. */
cpp_reader *pfile;
const char *macro;
{
- run_directive (pfile, T_UNDEF, BUF_CL_OPTION, macro, strlen (macro));
+ run_directive (pfile, T_UNDEF, macro, strlen (macro));
}
-/* Process the string STR as if it appeared as the body of a #assert. */
+/* Process the string STR as if it appeared as the body of a #assert. */
void
cpp_assert (pfile, str)
cpp_reader *pfile;
handle_assertion (pfile, str, T_ASSERT);
}
-/* Process STR as if it appeared as the body of an #unassert. */
+/* Process STR as if it appeared as the body of an #unassert. */
void
cpp_unassert (pfile, str)
cpp_reader *pfile;
const char *str;
{
handle_assertion (pfile, str, T_UNASSERT);
-}
+}
/* Common code for cpp_assert (-A) and cpp_unassert (-A-). */
static void
{
/* Copy the entire option so we can modify it. Change the first
"=" in the string to a '(', and tack a ')' on the end. */
- char *buf = (char *) alloca (count + 1);
+ char *buf = (char *) alloca (count + 2);
memcpy (buf, str, count);
buf[p - str] = '(';
buf[count++] = ')';
+ buf[count] = '\0';
str = buf;
}
- run_directive (pfile, type, BUF_CL_OPTION, str, count);
+ run_directive (pfile, type, str, count);
}
/* The number of errors for a given reader. */
return &pfile->cb;
}
+/* The line map set. */
+const struct line_maps *
+cpp_get_line_maps (pfile)
+ cpp_reader *pfile;
+{
+ return &pfile->line_maps;
+}
+
/* Copy the given callbacks structure to our own. */
void
cpp_set_callbacks (pfile, cb)
doesn't fail. It does not generate a file change call back; that
is the responsibility of the caller. */
cpp_buffer *
-cpp_push_buffer (pfile, buffer, len, type, filename)
+cpp_push_buffer (pfile, buffer, len, from_stage3, return_at_eof)
cpp_reader *pfile;
const U_CHAR *buffer;
size_t len;
- enum cpp_buffer_type type;
- const char *filename;
+ int from_stage3;
+ int return_at_eof;
{
cpp_buffer *new = xobnew (&pfile->buffer_ob, cpp_buffer);
- if (type == BUF_FAKE)
- {
- /* A copy of the current buffer, just with a new name and type. */
- memcpy (new, pfile->buffer, sizeof (cpp_buffer));
- new->type = BUF_FAKE;
- }
- else
- {
- if (type == BUF_BUILTIN)
- filename = _("<builtin>");
- else if (type == BUF_CL_OPTION)
- filename = _("<command line>");
- else if (type == BUF_PRAGMA)
- filename = "<_Pragma>";
-
- /* Clears, amongst other things, if_stack and mi_cmacro. */
- memset (new, 0, sizeof (cpp_buffer));
-
- new->line_base = new->buf = new->cur = buffer;
- new->rlimit = buffer + len;
- new->sysp = 0;
+ /* Clears, amongst other things, if_stack and mi_cmacro. */
+ memset (new, 0, sizeof (cpp_buffer));
- /* No read ahead or extra char initially. */
- new->read_ahead = EOF;
- new->extra_char = EOF;
-
- /* Preprocessed files, builtins, _Pragma and command line
- options don't do trigraph and escaped newline processing. */
- new->from_stage3 = type != BUF_FILE || CPP_OPTION (pfile, preprocessed);
-
- pfile->lexer_pos.output_line = 1;
- }
-
- if (*filename == '\0')
- new->nominal_fname = _("<stdin>");
- else
- new->nominal_fname = filename;
- new->type = type;
+ new->line_base = new->buf = new->cur = buffer;
+ new->rlimit = buffer + len;
+ new->from_stage3 = from_stage3;
new->prev = pfile->buffer;
- new->pfile = pfile;
- new->include_stack_listed = 0;
- new->lineno = 1;
+ new->return_at_eof = return_at_eof;
+ new->saved_flags = BOL;
- pfile->state.next_bol = 1;
- pfile->buffer_stack_depth++;
pfile->buffer = new;
return new;
/* If called from do_line, pops a single buffer. Otherwise pops all
buffers until a real file is reached. Generates appropriate
call-backs. */
-cpp_buffer *
-cpp_pop_buffer (pfile)
+void
+_cpp_pop_buffer (pfile)
cpp_reader *pfile;
{
- cpp_buffer *buffer;
+ cpp_buffer *buffer = pfile->buffer;
struct if_stack *ifs;
+ bool pushed = false;
- for (;;)
- {
- buffer = pfile->buffer;
- /* Walk back up the conditional stack till we reach its level at
- entry to this file, issuing error messages. */
- for (ifs = buffer->if_stack; ifs; ifs = ifs->next)
- cpp_error_with_line (pfile, ifs->pos.line, ifs->pos.col,
- "unterminated #%s", dtable[ifs->type].name);
-
- if (buffer->type == BUF_FAKE)
- buffer->prev->cur = buffer->cur;
- else if (buffer->type == BUF_FILE)
- _cpp_pop_file_buffer (pfile, buffer);
-
- pfile->buffer = buffer->prev;
- pfile->buffer_stack_depth--;
-
- /* Callbacks only generated for faked or real files. */
- if (buffer->type != BUF_FILE && buffer->type != BUF_FAKE)
- break;
-
- /* No callback for EOF of last file. */
- if (!pfile->buffer)
- break;
+ /* Walk back up the conditional stack till we reach its level at
+ entry to this file, issuing error messages. */
+ for (ifs = buffer->if_stack; ifs; ifs = ifs->next)
+ cpp_error_with_line (pfile, ifs->line, 0,
+ "unterminated #%s", dtable[ifs->type].name);
- /* do_line does its own call backs. */
- pfile->buffer->include_stack_listed = 0;
- if (pfile->directive == &dtable[T_LINE])
- break;
+ /* In case of a missing #endif. */
+ pfile->state.skipping = 0;
- _cpp_do_file_change (pfile, FC_LEAVE, buffer->nominal_fname,
- buffer->lineno);
- if (pfile->buffer->type == BUF_FILE)
- break;
+ /* Update the reader's buffer before _cpp_do_file_change. */
+ pfile->buffer = buffer->prev;
- cpp_warning (pfile, "file \"%s\" entered but not left",
- buffer->nominal_fname);
- }
+ if (buffer->inc)
+ pushed = _cpp_pop_file_buffer (pfile, buffer->inc);
- obstack_free (&pfile->buffer_ob, buffer);
- return pfile->buffer;
+ if (!pushed)
+ obstack_free (&pfile->buffer_ob, buffer);
}
+/* Enter all recognised directives in the hash table. */
void
_cpp_init_directives (pfile)
cpp_reader *pfile;
unsigned int i;
cpp_hashnode *node;
- /* Register the directives. */
for (i = 0; i < (unsigned int) N_DIRECTIVES; i++)
{
node = cpp_lookup (pfile, dtable[i].name, dtable[i].length);
/* Definitions for CPP library.
- Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001
+ Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
Written by Per Bothner, 1994-95.
#include <sys/types.h>
#include "hashtable.h"
+#include "line-map.h"
#ifdef __cplusplus
extern "C" {
typedef struct cpp_string cpp_string;
typedef struct cpp_hashnode cpp_hashnode;
typedef struct cpp_macro cpp_macro;
-typedef struct cpp_lexer_pos cpp_lexer_pos;
-typedef struct cpp_lookahead cpp_lookahead;
typedef struct cpp_callbacks cpp_callbacks;
struct answer;
struct file_name_map_list;
-struct ht;
/* The first two groups, apart from '=', can appear in preprocessor
expressions. This allows a lookup table to be implemented in
OP(CPP_ATSIGN, "@") /* used in Objective C */ \
\
TK(CPP_NAME, SPELL_IDENT) /* word */ \
- TK(CPP_INT, SPELL_STRING) /* 23 */ \
- TK(CPP_FLOAT, SPELL_STRING) /* 3.14159 */ \
- TK(CPP_NUMBER, SPELL_STRING) /* 34_be+ta */ \
+ TK(CPP_NUMBER, SPELL_NUMBER) /* 34_be+ta */ \
\
TK(CPP_CHAR, SPELL_STRING) /* 'char' */ \
TK(CPP_WCHAR, SPELL_STRING) /* L'char' */ \
TK(CPP_WSTRING, SPELL_STRING) /* L"string" */ \
TK(CPP_HEADER_NAME, SPELL_STRING) /* <stdio.h> in #include */ \
\
- TK(CPP_COMMENT, SPELL_STRING) /* Only if output comments. */ \
+ TK(CPP_COMMENT, SPELL_NUMBER) /* Only if output comments. */ \
+ /* SPELL_NUMBER happens to DTRT. */ \
TK(CPP_MACRO_ARG, SPELL_NONE) /* Macro argument. */ \
- OP(CPP_EOF, "EOL") /* End of line or file. */ \
+ TK(CPP_PADDING, SPELL_NONE) /* Whitespace for cpp0. */ \
+ TK(CPP_EOF, SPELL_NONE) /* End of line or file. */ \
\
/* SDCC _asm specific */ \
TK(CPP_ASM, SPELL_STRING) /* _asm ... _endasm ; */
enum c_lang {CLK_GNUC89 = 0, CLK_GNUC99, CLK_STDC89, CLK_STDC94, CLK_STDC99,
CLK_GNUCXX, CLK_CXX98, CLK_OBJC, CLK_OBJCXX, CLK_ASM};
-/* Payload of a NUMBER, FLOAT, STRING, or COMMENT token. */
+/* Payload of a NUMBER, STRING, CHAR or COMMENT token. */
struct cpp_string
{
unsigned int len;
#define PASTE_LEFT (1 << 3) /* If on LHS of a ## operator. */
#define NAMED_OP (1 << 4) /* C++ named operators. */
#define NO_EXPAND (1 << 5) /* Do not macro-expand this token. */
-#define AVOID_LPASTE (1 << 6) /* Check left for accidental pastes. */
+#define BOL (1 << 6) /* Token at beginning of line. */
/* A preprocessing token. This has been carefully packed and should
- occupy 12 bytes on 32-bit hosts and 16 bytes on 64-bit hosts. */
+ occupy 16 bytes on 32-bit hosts and 24 bytes on 64-bit hosts. */
struct cpp_token
{
+ unsigned int line; /* Logical line of first char of token. */
+ unsigned short col; /* Column of first char of token. */
ENUM_BITFIELD(cpp_ttype) type : CHAR_BIT; /* token type */
unsigned char flags; /* flags - see above */
union
{
cpp_hashnode *node; /* An identifier. */
+ const cpp_token *source; /* Inherit padding from this token. */
struct cpp_string str; /* A string, or number. */
unsigned int arg_no; /* Argument no. for a CPP_MACRO_ARG. */
unsigned char c; /* Character represented by CPP_OTHER. */
} val;
};
-/* The position of a token in the current file. */
-struct cpp_lexer_pos
-{
- unsigned int line;
- unsigned int output_line;
- unsigned short col;
-};
-
-typedef struct cpp_token_with_pos cpp_token_with_pos;
-struct cpp_token_with_pos
-{
- cpp_token token;
- cpp_lexer_pos pos;
-};
-
-/* Token lookahead. */
-struct cpp_lookahead
-{
- struct cpp_lookahead *next;
- cpp_token_with_pos *tokens;
- cpp_lexer_pos pos;
- unsigned int cur, count, cap;
-};
-
/* A standalone character. We may want to make it unsigned for the
same reason we use unsigned char - to avoid signedness issues. */
typedef int cppchar_t;
/* Characters between tab stops. */
unsigned int tabstop;
- /* Pending options - -D, -U, -A, -I, -ixxx. */
+ /* Pending options - -D, -U, -A, -I, -ixxx. */
struct cpp_pending *pending;
/* File name which deps are being written to. This is 0 if deps are
/* Non-0 means -v, so print the full set of include dirs. */
unsigned char verbose;
+ /* Nonzero means chars are signed. */
+ unsigned char signed_char;
+
/* Nonzero means use extra default include directories for C++. */
unsigned char cplusplus;
generated files and not errors. */
unsigned char print_deps_missing_files;
- /* If true, fopen (deps_file, "a") else fopen (deps_file, "w"). */
+ /* If true, fopen (deps_file, "a") else fopen (deps_file, "w"). */
unsigned char print_deps_append;
/* Nonzero means print names of header files (-H). */
the source-file directory. */
unsigned char ignore_srcdir;
- /* Zero means dollar signs are punctuation. */
+ /* Zero means dollar signs are punctuation. */
unsigned char dollars_in_ident;
/* Nonzero means warn if undefined identifiers are evaluated in an #if. */
/* Print column number in error messages. */
unsigned char show_column;
- /* Treat C++ alternate operator names special. */
+ /* Nonzero means handle C++ alternate operator names. */
unsigned char operator_names;
/* True if --help, --version or --target-help appeared in the
options. Stand-alone CPP should then bail out after option
parsing; drivers might want to continue printing help. */
unsigned char help_only;
-
+
/* SDCC abuse by Kevin: allow naked '#' characters in expanded macros
* (see _cpp_create_definition in cppmacro.c)
*/
const char *obj_ext;
};
-/* This structure is passed to the call back when changing file. */
-enum cpp_fc_reason {FC_ENTER = 0, FC_LEAVE, FC_RENAME};
-
-struct cpp_file_loc
-{
- const char *filename;
- unsigned int lineno;
-};
-
-typedef struct cpp_file_change cpp_file_change;
-struct cpp_file_change
-{
- struct cpp_file_loc from; /* Line of #include or #line. */
- struct cpp_file_loc to; /* Line after #include or #line, or start. */
- enum cpp_fc_reason reason; /* Reason for change. */
- unsigned char sysp; /* Nonzero if system header. */
- unsigned char externc; /* Nonzero if wrapper needed. */
-};
-
/* Call backs. */
struct cpp_callbacks
{
- void (*file_change) PARAMS ((cpp_reader *, const cpp_file_change *));
- void (*include) PARAMS ((cpp_reader *, const unsigned char *,
- const cpp_token *));
- void (*define) PARAMS ((cpp_reader *, cpp_hashnode *));
- void (*undef) PARAMS ((cpp_reader *, cpp_hashnode *));
- void (*poison) PARAMS ((cpp_reader *));
- void (*ident) PARAMS ((cpp_reader *, const cpp_string *));
- void (*def_pragma) PARAMS ((cpp_reader *));
+ /* Called when a new line of preprocessed output is started. */
+ void (*line_change) PARAMS ((cpp_reader *, const cpp_token *, int));
+ void (*file_change) PARAMS ((cpp_reader *, const struct line_map *));
+ void (*include) PARAMS ((cpp_reader *, unsigned int,
+ const unsigned char *, const cpp_token *));
+ void (*define) PARAMS ((cpp_reader *, unsigned int, cpp_hashnode *));
+ void (*undef) PARAMS ((cpp_reader *, unsigned int, cpp_hashnode *));
+ void (*ident) PARAMS ((cpp_reader *, unsigned int, const cpp_string *));
+ void (*def_pragma) PARAMS ((cpp_reader *, unsigned int));
};
#define CPP_FATAL_LIMIT 1000
-/* True if we have seen a "fatal" error. */
+/* True if we have seen a "fatal" error. */
#define CPP_FATAL_ERRORS(PFILE) (cpp_errors (PFILE) >= CPP_FATAL_LIMIT)
/* Name under which this program was invoked. */
extern const char *progname;
-/* Where does this buffer come from? A faked include, a source file,
- a builtin macro, a command-line option, or a _Pragma operator. */
-enum cpp_buffer_type {BUF_FAKE, BUF_FILE, BUF_BUILTIN,
- BUF_CL_OPTION, BUF_PRAGMA};
-
/* The structure of a node in the hash table. The hash table has
entries for all identifiers: either macros defined by #define
commands (type NT_MACRO), assertions created with #assert
#define NODE_BUILTIN (1 << 2) /* Builtin macro. */
#define NODE_DIAGNOSTIC (1 << 3) /* Possible diagnostic when lexed. */
#define NODE_WARN (1 << 4) /* Warn if redefined or undefined. */
+#define NODE_DISABLED (1 << 5) /* A disabled macro. */
/* Different flavors of hash node. */
enum node_type
NT_ASSERTION /* Predicate for #assert. */
};
-/* Different flavors of builtin macro. */
+/* Different flavors of builtin macro. _Pragma is an operator, but we
+ handle it with the builtin code for efficiency reasons. */
enum builtin_type
{
BT_SPECLINE = 0, /* `__LINE__' */
BT_BASE_FILE, /* `__BASE_FILE__' */
BT_INCLUDE_LEVEL, /* `__INCLUDE_LEVEL__' */
BT_TIME, /* `__TIME__' */
- BT_STDC /* `__STDC__' */
+ BT_STDC, /* `__STDC__' */
+ BT_PRAGMA /* `_Pragma' operator */
};
#define CPP_HASHNODE(HNODE) ((cpp_hashnode *) (HNODE))
} value;
};
-/* Call this first to get a handle to pass to other functions. If you
- want cpplib to manage its own hashtable, pass in a NULL pointer.
- Or you can pass in an initialised hash table that cpplib will use;
- this technique is used by the C front ends. */
-extern cpp_reader *cpp_create_reader PARAMS ((struct ht *,
- enum c_lang));
-
-/* Call this to release the handle. Any use of the handle after this
- function returns is invalid. Returns cpp_errors (pfile). */
-extern int cpp_destroy PARAMS ((cpp_reader *));
+/* Call this first to get a handle to pass to other functions. */
+extern cpp_reader *cpp_create_reader PARAMS ((enum c_lang));
/* Call these to get pointers to the options and callback structures
for a given reader. These pointers are good until you call
through the pointer returned from cpp_get_callbacks, or set them
with cpp_set_callbacks. */
extern cpp_options *cpp_get_options PARAMS ((cpp_reader *));
+extern const struct line_maps *cpp_get_line_maps PARAMS ((cpp_reader *));
extern cpp_callbacks *cpp_get_callbacks PARAMS ((cpp_reader *));
extern void cpp_set_callbacks PARAMS ((cpp_reader *, cpp_callbacks *));
return value is the number of arguments used. If
cpp_handle_options returns without using all arguments, it couldn't
understand the next switch. When there are no switches left, you
- must call cpp_post_options before calling cpp_start_read. Only
+ must call cpp_post_options before calling cpp_read_main_file. Only
after cpp_post_options are the contents of the cpp_options
- structure reliable. */
+ structure reliable. Options processing is not completed until you
+ call cpp_finish_options. */
extern int cpp_handle_options PARAMS ((cpp_reader *, int, char **));
-extern int cpp_handle_option PARAMS ((cpp_reader *, int, char **));
+extern int cpp_handle_option PARAMS ((cpp_reader *, int, char **, int));
extern void cpp_post_options PARAMS ((cpp_reader *));
+/* This function reads the file, but does not start preprocessing. It
+ returns the name of the original file; this is the same as the
+ input file, except for preprocessed input. This will generate at
+ least one file change callback, and possibly a line change callback
+ too. If there was an error opening the file, it returns NULL.
+
+ If you want cpplib to manage its own hashtable, pass in a NULL
+ pointer. Otherise you should pass in an initialised hash table
+ that cpplib will share; this technique is used by the C front
+ ends. */
+extern const char *cpp_read_main_file PARAMS ((cpp_reader *, const char *,
+ struct ht *));
+
+/* Deferred handling of command line options that can generate debug
+ callbacks, such as -D and -imacros. Call this after
+ cpp_read_main_file. The front ends need this separation so they
+ can initialize debug output with the original file name, returned
+ from cpp_read_main_file, before they get debug callbacks. */
+extern void cpp_finish_options PARAMS ((cpp_reader *));
+
+/* Call this to release the handle at the end of preprocessing. Any
+ use of the handle after this function returns is invalid. Returns
+ cpp_errors (pfile). */
+extern int cpp_destroy PARAMS ((cpp_reader *));
+
/* Error count. */
extern unsigned int cpp_errors PARAMS ((cpp_reader *));
extern void cpp_register_pragma PARAMS ((cpp_reader *,
const char *, const char *,
void (*) PARAMS ((cpp_reader *))));
-extern void cpp_register_pragma_space PARAMS ((cpp_reader *, const char *));
-extern int cpp_start_read PARAMS ((cpp_reader *, const char *));
extern void cpp_finish PARAMS ((cpp_reader *));
extern int cpp_avoid_paste PARAMS ((cpp_reader *, const cpp_token *,
const cpp_token *));
-extern enum cpp_ttype cpp_can_paste PARAMS ((cpp_reader *, const cpp_token *,
- const cpp_token *, int *));
-extern void cpp_get_token PARAMS ((cpp_reader *, cpp_token *));
-extern const cpp_lexer_pos *cpp_get_line PARAMS ((cpp_reader *));
+extern const cpp_token *cpp_get_token PARAMS ((cpp_reader *));
extern const unsigned char *cpp_macro_definition PARAMS ((cpp_reader *,
const cpp_hashnode *));
+extern void _cpp_backup_tokens PARAMS ((cpp_reader *, unsigned int));
/* Evaluate a CPP_CHAR or CPP_WCHAR token. */
extern HOST_WIDE_INT
extern cpp_buffer *cpp_push_buffer PARAMS ((cpp_reader *,
const unsigned char *, size_t,
- enum cpp_buffer_type,
- const char *));
-extern cpp_buffer *cpp_pop_buffer PARAMS ((cpp_reader *));
+ int, int));
extern int cpp_defined PARAMS ((cpp_reader *, const unsigned char *, int));
/* N.B. The error-message-printer prototypes have not been nicely
ATTRIBUTE_PRINTF_4;
extern void cpp_pedwarn_with_line PARAMS ((cpp_reader *, int, int, const char *msgid, ...))
ATTRIBUTE_PRINTF_4;
-extern void cpp_pedwarn_with_file_and_line PARAMS ((cpp_reader *, const char *, int, int, const char *msgid, ...))
- ATTRIBUTE_PRINTF_5;
extern void cpp_error_from_errno PARAMS ((cpp_reader *, const char *));
extern void cpp_notice_from_errno PARAMS ((cpp_reader *, const char *));
cpp_cb, void *));
/* In cppmacro.c */
-extern void cpp_scan_buffer_nooutput PARAMS ((cpp_reader *, int));
-extern void cpp_start_lookahead PARAMS ((cpp_reader *));
-extern void cpp_stop_lookahead PARAMS ((cpp_reader *, int));
+extern void cpp_scan_nooutput PARAMS ((cpp_reader *));
extern int cpp_sys_macro_p PARAMS ((cpp_reader *));
+extern unsigned char *cpp_quote_string PARAMS ((unsigned char *,
+ const unsigned char *,
+ unsigned int));
/* In cppfiles.c */
extern int cpp_included PARAMS ((cpp_reader *, const char *));
/* Part of CPP library. (Macro and #define handling.)
Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1998,
- 1999, 2000, 2001 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Written by Per Bothner, 1994.
Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987
#include "config.h"
#include "system.h"
-#include "intl.h" /* for _("<command line>") below. */
#include "cpplib.h"
#include "cpphash.h"
struct cpp_macro
{
cpp_hashnode **params; /* Parameters, if any. */
- cpp_token *expansion; /* First token of replacement list. */
- const char *file; /* Defined in file name. */
+ cpp_token *expansion; /* First token of replacement list. */
unsigned int line; /* Starting line number. */
unsigned int count; /* Number of tokens in expansion. */
unsigned short paramc; /* Number of parameters. */
unsigned int fun_like : 1; /* If a function-like macro. */
unsigned int variadic : 1; /* If a variadic macro. */
- unsigned int disabled : 1; /* If macro is disabled. */
unsigned int syshdr : 1; /* If macro defined in system header. */
};
typedef struct macro_arg macro_arg;
struct macro_arg
{
- cpp_token *first; /* First token in unexpanded argument. */
- cpp_token *expanded; /* Macro-expanded argument. */
- cpp_token *stringified; /* Stringified argument. */
+ const cpp_token **first; /* First token in unexpanded argument. */
+ const cpp_token **expanded; /* Macro-expanded argument. */
+ const cpp_token *stringified; /* Stringified argument. */
unsigned int count; /* # of tokens in argument. */
unsigned int expanded_count; /* # of tokens in expanded argument. */
};
/* Macro expansion. */
-static void lock_pools PARAMS ((cpp_reader *));
-static void unlock_pools PARAMS ((cpp_reader *));
static int enter_macro_context PARAMS ((cpp_reader *, cpp_hashnode *));
-static void builtin_macro PARAMS ((cpp_reader *, cpp_token *));
-static cpp_context *push_arg_context PARAMS ((cpp_reader *, macro_arg *));
-static enum cpp_ttype parse_arg PARAMS ((cpp_reader *, macro_arg *, int));
-static macro_arg *parse_args PARAMS ((cpp_reader *, const cpp_hashnode *));
+static int builtin_macro PARAMS ((cpp_reader *, cpp_hashnode *));
+static void push_token_context
+ PARAMS ((cpp_reader *, cpp_hashnode *, const cpp_token *, unsigned int));
+static void push_ptoken_context
+ PARAMS ((cpp_reader *, cpp_hashnode *, _cpp_buff *,
+ const cpp_token **, unsigned int));
+static _cpp_buff *collect_args PARAMS ((cpp_reader *, const cpp_hashnode *));
static cpp_context *next_context PARAMS ((cpp_reader *));
+static const cpp_token *padding_token
+ PARAMS ((cpp_reader *, const cpp_token *));
static void expand_arg PARAMS ((cpp_reader *, macro_arg *));
-static unsigned char *quote_string PARAMS ((unsigned char *,
- const unsigned char *,
- unsigned int));
-static void make_string_token PARAMS ((cpp_pool *, cpp_token *,
- const U_CHAR *, unsigned int));
-static void make_number_token PARAMS ((cpp_reader *, cpp_token *, int));
-static void stringify_arg PARAMS ((cpp_reader *, macro_arg *));
-static void paste_all_tokens PARAMS ((cpp_reader *, cpp_token *));
-static int paste_tokens PARAMS ((cpp_reader *, cpp_token *, cpp_token *));
-static int funlike_invocation_p PARAMS ((cpp_reader *, const cpp_hashnode *,
- struct toklist *));
-static void replace_args PARAMS ((cpp_reader *, cpp_macro *, macro_arg *,
- struct toklist *));
-
-/* Lookaheads. */
-
-static void save_lookahead_token PARAMS ((cpp_reader *, const cpp_token *));
-static void take_lookahead_token PARAMS ((cpp_reader *, cpp_token *));
-static cpp_lookahead *alloc_lookahead PARAMS ((cpp_reader *));
-static void free_lookahead PARAMS ((cpp_lookahead *));
+static const cpp_token *new_string_token PARAMS ((cpp_reader *, U_CHAR *,
+ unsigned int));
+static const cpp_token *new_number_token PARAMS ((cpp_reader *, unsigned int));
+static const cpp_token *stringify_arg PARAMS ((cpp_reader *, macro_arg *));
+static void paste_all_tokens PARAMS ((cpp_reader *, const cpp_token *));
+static bool paste_tokens PARAMS ((cpp_reader *, const cpp_token **,
+ const cpp_token *));
+static void replace_args PARAMS ((cpp_reader *, cpp_hashnode *, macro_arg *));
+static _cpp_buff *funlike_invocation_p PARAMS ((cpp_reader *, cpp_hashnode *));
/* #define directive parsing and handling. */
+static cpp_token *alloc_expansion_token PARAMS ((cpp_reader *, cpp_macro *));
static cpp_token *lex_expansion_token PARAMS ((cpp_reader *, cpp_macro *));
-static int warn_of_redefinition PARAMS ((cpp_reader *, const cpp_hashnode *,
+static int warn_of_redefinition PARAMS ((const cpp_hashnode *,
const cpp_macro *));
static int save_parameter PARAMS ((cpp_reader *, cpp_macro *, cpp_hashnode *));
static int parse_params PARAMS ((cpp_reader *, cpp_macro *));
const cpp_macro *,
const cpp_string *));
-/* Allocates a buffer to hold a token's TEXT, and converts TOKEN to a
- CPP_STRING token containing TEXT in quoted form. */
-static void
-make_string_token (pool, token, text, len)
- cpp_pool *pool;
- cpp_token *token;
- const U_CHAR *text;
+/* Allocates and returns a CPP_STRING token, containing TEXT of length
+ LEN, after null-terminating it. TEXT must be in permanent storage. */
+static const cpp_token *
+new_string_token (pfile, text, len)
+ cpp_reader *pfile;
+ unsigned char *text;
unsigned int len;
{
- U_CHAR *buf = _cpp_pool_alloc (pool, len * 4 + 1);
+ cpp_token *token = _cpp_temp_token (pfile);
+ text[len] = '\0';
token->type = CPP_STRING;
- token->val.str.text = buf;
- token->val.str.len = quote_string (buf, text, len) - buf;
- buf[token->val.str.len] = '\0';
+ token->val.str.len = len;
+ token->val.str.text = text;
token->flags = 0;
+ return token;
}
-/* Allocates and converts a temporary token to a CPP_NUMBER token,
- evaluating to NUMBER. */
-static void
-make_number_token (pfile, token, number)
+/* Allocates and returns a CPP_NUMBER token evaluating to NUMBER. */
+static const cpp_token *
+new_number_token (pfile, number)
cpp_reader *pfile;
- cpp_token *token;
- int number;
+ unsigned int number;
{
- unsigned char *buf = _cpp_pool_alloc (&pfile->ident_pool, 20);
+ cpp_token *token = _cpp_temp_token (pfile);
+ /* 21 bytes holds all NUL-terminated unsigned 64-bit numbers. */
+ unsigned char *buf = _cpp_unaligned_alloc (pfile, 21);
- sprintf ((char *) buf, "%d", number);
+ sprintf ((char *) buf, "%u", number);
token->type = CPP_NUMBER;
token->val.str.text = buf;
token->val.str.len = ustrlen (buf);
token->flags = 0;
+ return token;
}
static const char * const monthnames[] =
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
-/* Handle builtin macros like __FILE__. */
-static void
-builtin_macro (pfile, token)
+/* Handle builtin macros like __FILE__, and push the resulting token
+ on the context stack. Also handles _Pragma, for which no new token
+ is created. Returns 1 if it generates a new token context, 0 to
+ return the token to the caller. */
+static int
+builtin_macro (pfile, node)
cpp_reader *pfile;
- cpp_token *token;
+ cpp_hashnode *node;
{
- unsigned char flags = ((token->flags & PREV_WHITE) | AVOID_LPASTE);
- cpp_hashnode *node = token->val.node;
+ const cpp_token *result;
switch (node->value.builtin)
{
+ default:
+ cpp_ice (pfile, "invalid built-in macro \"%s\"", NODE_NAME (node));
+ return 0;
+
case BT_FILE:
case BT_BASE_FILE:
{
+ unsigned int len;
const char *name;
- cpp_buffer *buffer = pfile->buffer;
+ U_CHAR *buf;
+ const struct line_map *map = pfile->map;
if (node->value.builtin == BT_BASE_FILE)
- while (buffer->prev)
- buffer = buffer->prev;
+ while (! MAIN_FILE_P (map))
+ map = INCLUDED_FROM (&pfile->line_maps, map);
- name = buffer->nominal_fname;
- make_string_token (&pfile->ident_pool, token,
- (const unsigned char *) name, strlen (name));
+ name = map->to_file;
+ len = strlen (name);
+ buf = _cpp_unaligned_alloc (pfile, len * 4 + 1);
+ len = cpp_quote_string (buf, (const unsigned char *) name, len) - buf;
+
+ result = new_string_token (pfile, buf, len);
}
break;
-
+
case BT_INCLUDE_LEVEL:
- /* pfile->include_depth counts the primary source as level 1,
- but historically __INCLUDE_DEPTH__ has called the primary
- source level 0. */
- make_number_token (pfile, token, pfile->include_depth - 1);
+ /* The line map depth counts the primary source as level 1, but
+ historically __INCLUDE_DEPTH__ has called the primary source
+ level 0. */
+ result = new_number_token (pfile, pfile->line_maps.depth - 1);
break;
case BT_SPECLINE:
/* If __LINE__ is embedded in a macro, it must expand to the
line of the macro's invocation, not its definition.
Otherwise things like assert() will not work properly. */
- make_number_token (pfile, token, cpp_get_line (pfile)->line);
+ result = new_number_token (pfile,
+ SOURCE_LINE (pfile->map,
+ pfile->cur_token[-1].line));
break;
case BT_STDC:
{
int stdc = (!CPP_IN_SYSTEM_HEADER (pfile)
|| pfile->spec_nodes.n__STRICT_ANSI__->type != NT_VOID);
- make_number_token (pfile, token, stdc);
+ result = new_number_token (pfile, stdc);
}
break;
case BT_TIME:
if (pfile->date.type == CPP_EOF)
{
- /* Allocate __DATE__ and __TIME__ from permanent storage,
- and save them in pfile so we don't have to do this again.
- We don't generate these strings at init time because
- time() and localtime() are very slow on some systems. */
+ /* Allocate __DATE__ and __TIME__ strings from permanent
+ storage. We only do this once, and don't generate them
+ at init time, because time() and localtime() are very
+ slow on some systems. */
time_t tt = time (NULL);
struct tm *tb = localtime (&tt);
- make_string_token (&pfile->ident_pool, &pfile->date,
- DSC("Oct 11 1347"));
- make_string_token (&pfile->ident_pool, &pfile->time,
- DSC("12:34:56"));
-
+ pfile->date.val.str.text =
+ _cpp_unaligned_alloc (pfile, sizeof ("Oct 11 1347"));
+ pfile->date.val.str.len = sizeof ("Oct 11 1347") - 1;
+ pfile->date.type = CPP_STRING;
+ pfile->date.flags = 0;
sprintf ((char *) pfile->date.val.str.text, "%s %2d %4d",
monthnames[tb->tm_mon], tb->tm_mday, tb->tm_year + 1900);
+
+ pfile->time.val.str.text =
+ _cpp_unaligned_alloc (pfile, sizeof ("12:34:56"));
+ pfile->time.val.str.len = sizeof ("12:34:56") - 1;
+ pfile->time.type = CPP_STRING;
+ pfile->time.flags = 0;
sprintf ((char *) pfile->time.val.str.text, "%02d:%02d:%02d",
tb->tm_hour, tb->tm_min, tb->tm_sec);
}
- *token = node->value.builtin == BT_DATE ? pfile->date: pfile->time;
- break;
- default:
- cpp_ice (pfile, "invalid builtin macro \"%s\"", NODE_NAME (node));
+ if (node->value.builtin == BT_DATE)
+ result = &pfile->date;
+ else
+ result = &pfile->time;
break;
- }
-
- token->flags = flags;
-}
-/* Used by cpperror.c to obtain the correct line and column to report
- in a diagnostic. */
-const cpp_lexer_pos *
-cpp_get_line (pfile)
- cpp_reader *pfile;
-{
- return &pfile->lexer_pos;
-}
+ case BT_PRAGMA:
+ /* Don't interpret _Pragma within directives. The standard is
+ not clear on this, but to me this makes most sense. */
+ if (pfile->state.in_directive)
+ return 0;
-static void
-lock_pools (pfile)
- cpp_reader *pfile;
-{
- _cpp_lock_pool (&pfile->argument_pool);
-}
+ _cpp_do__Pragma (pfile);
+ return 1;
+ }
-static void
-unlock_pools (pfile)
- cpp_reader *pfile;
-{
- _cpp_unlock_pool (&pfile->argument_pool);
+ push_token_context (pfile, NULL, result, 1);
+ return 1;
}
-/* Adds backslashes before all backslashes and double quotes appearing
- in strings. Non-printable characters are converted to octal. */
-static U_CHAR *
-quote_string (dest, src, len)
+/* Copies SRC, of length LEN, to DEST, adding backslashes before all
+ backslashes and double quotes. Non-printable characters are
+ converted to octal. DEST must be of sufficient size. Returns
+ a pointer to the end of the string. */
+U_CHAR *
+cpp_quote_string (dest, src, len)
U_CHAR *dest;
const U_CHAR *src;
unsigned int len;
return dest;
}
-/* Convert a token sequence to a single string token according to the
- rules of the ISO C #-operator. */
-static void
+/* Convert a token sequence ARG to a single string token according to
+ the rules of the ISO C #-operator. */
+static const cpp_token *
stringify_arg (pfile, arg)
cpp_reader *pfile;
macro_arg *arg;
{
- cpp_pool *pool = &pfile->ident_pool;
- unsigned char *start = POOL_FRONT (pool);
- unsigned int i, escape_it, total_len = 0, backslash_count = 0;
+ unsigned char *dest = BUFF_FRONT (pfile->u_buff);
+ unsigned int i, escape_it, backslash_count = 0;
+ const cpp_token *source = NULL;
+ size_t len;
/* Loop, reading in the argument's tokens. */
for (i = 0; i < arg->count; i++)
{
- unsigned char *dest;
- const cpp_token *token = &arg->first[i];
- unsigned int len = cpp_token_len (token);
+ const cpp_token *token = arg->first[i];
+
+ if (token->type == CPP_PADDING)
+ {
+ if (source == NULL)
+ source = token->val.source;
+ continue;
+ }
escape_it = (token->type == CPP_STRING || token->type == CPP_WSTRING
|| token->type == CPP_CHAR || token->type == CPP_WCHAR);
+ /* Room for each char being written in octal, initial space and
+ final NUL. */
+ len = cpp_token_len (token);
if (escape_it)
- /* Worst case is each char is octal. */
len *= 4;
- len += 2; /* Room for initial space and final NUL. */
+ len += 2;
- dest = &start[total_len];
- if (dest + len > POOL_LIMIT (pool))
+ if ((size_t) (BUFF_LIMIT (pfile->u_buff) - dest) < len)
{
- _cpp_next_chunk (pool, len, (unsigned char **) &start);
- dest = &start[total_len];
+ size_t len_so_far = dest - BUFF_FRONT (pfile->u_buff);
+ _cpp_extend_buff (pfile, &pfile->u_buff, len);
+ dest = BUFF_FRONT (pfile->u_buff) + len_so_far;
}
- /* No leading white space. */
- if (token->flags & PREV_WHITE && total_len > 0)
- *dest++ = ' ';
+ /* Leading white space? */
+ if (dest != BUFF_FRONT (pfile->u_buff))
+ {
+ if (source == NULL)
+ source = token;
+ if (source->flags & PREV_WHITE)
+ *dest++ = ' ';
+ }
+ source = NULL;
if (escape_it)
{
- unsigned char *buf = (unsigned char *) xmalloc (len);
-
+ _cpp_buff *buff = _cpp_get_buff (pfile, len);
+ unsigned char *buf = BUFF_FRONT (buff);
len = cpp_spell_token (pfile, token, buf) - buf;
- dest = quote_string (dest, buf, len);
- free (buf);
+ dest = cpp_quote_string (dest, buf, len);
+ _cpp_release_buff (pfile, buff);
}
else
dest = cpp_spell_token (pfile, token, dest);
- total_len = dest - start;
if (token->type == CPP_OTHER && token->val.c == '\\')
backslash_count++;
if (backslash_count & 1)
{
cpp_warning (pfile, "invalid string literal, ignoring final '\\'");
- total_len--;
+ dest--;
}
- /* Null terminate, and commit the memory. */
- start[total_len] = '\0';
- POOL_COMMIT (pool, total_len + 1);
-
- arg->stringified = xnew (cpp_token);
- arg->stringified->flags = 0;
- arg->stringified->type = CPP_STRING;
- arg->stringified->val.str.text = start;
- arg->stringified->val.str.len = total_len;
+ /* Commit the memory, including NUL, and return the token. */
+ len = dest - BUFF_FRONT (pfile->u_buff);
+ BUFF_FRONT (pfile->u_buff) = dest + 1;
+ return new_string_token (pfile, dest - len, len);
}
-/* Try to paste two tokens. On success, the LHS becomes the pasted
- token, and 0 is returned. For failure, we update the flags of the
- RHS appropriately and return non-zero. */
-static int
-paste_tokens (pfile, lhs, rhs)
+/* Try to paste two tokens. On success, return non-zero. In any
+ case, PLHS is updated to point to the pasted token, which is
+ guaranteed to not have the PASTE_LEFT flag set. */
+static bool
+paste_tokens (pfile, plhs, rhs)
cpp_reader *pfile;
- cpp_token *lhs, *rhs;
+ const cpp_token **plhs, *rhs;
{
- unsigned char flags;
- int digraph = 0;
- enum cpp_ttype type;
-
- type = cpp_can_paste (pfile, lhs, rhs, &digraph);
-
- if (type == CPP_EOF)
- {
- /* Mandatory warning for all apart from assembler. */
- if (CPP_OPTION (pfile, lang) != CLK_ASM)
- cpp_warning (pfile,
- "pasting \"%s\" and \"%s\" does not give a valid preprocessing token",
- cpp_token_as_text (pfile, lhs),
- cpp_token_as_text (pfile, rhs));
-
- /* The standard states that behaviour is undefined. By the
- principle of least surpise, we step back before the RHS, and
- mark it to prevent macro expansion. Tests in the testsuite
- rely on clearing PREV_WHITE here, though you could argue we
- should actually set it. Assembler can have '.' in labels and
- so requires that we don't insert spaces there. Maybe we should
- change this to put out a space unless it's assembler. */
- rhs->flags &= ~PREV_WHITE;
- rhs->flags |= NO_EXPAND;
- return 1;
- }
-
- flags = lhs->flags & ~DIGRAPH;
- if (digraph)
- flags |= DIGRAPH;
-
- /* Identifiers and numbers need spellings to be pasted. */
- if (type == CPP_NAME || type == CPP_NUMBER)
- {
- unsigned int total_len = cpp_token_len (lhs) + cpp_token_len (rhs);
- unsigned char *result, *end;
-
- result = _cpp_pool_alloc (&pfile->ident_pool, total_len + 1);
-
- /* Paste the spellings and null terminate. */
- end = cpp_spell_token (pfile, rhs, cpp_spell_token (pfile, lhs, result));
- *end = '\0';
- total_len = end - result;
-
- if (type == CPP_NAME)
- {
- lhs->val.node = cpp_lookup (pfile, result, total_len);
- if (lhs->val.node->flags & NODE_OPERATOR)
- {
- flags |= NAMED_OP;
- lhs->type = lhs->val.node->value.operator;
- }
- }
- else
- {
- lhs->val.str.text = result;
- lhs->val.str.len = total_len;
- }
- }
- else if (type == CPP_WCHAR || type == CPP_WSTRING)
- lhs->val.str = rhs->val.str;
-
- /* Set type and flags after pasting spellings. */
- lhs->type = type;
- lhs->flags = flags;
-
- return 0;
+ unsigned char *buf, *end;
+ const cpp_token *lhs;
+ unsigned int len;
+ bool valid;
+
+ lhs = *plhs;
+ len = cpp_token_len (lhs) + cpp_token_len (rhs) + 1;
+ buf = (unsigned char *) alloca (len);
+ end = cpp_spell_token (pfile, lhs, buf);
+
+ /* Avoid comment headers, since they are still processed in stage 3.
+ It is simpler to insert a space here, rather than modifying the
+ lexer to ignore comments in some circumstances. Simply returning
+ false doesn't work, since we want to clear the PASTE_LEFT flag. */
+ if (lhs->type == CPP_DIV
+ && (rhs->type == CPP_MULT || rhs->type == CPP_DIV))
+ *end++ = ' ';
+ end = cpp_spell_token (pfile, rhs, end);
+ *end = '\0';
+
+ cpp_push_buffer (pfile, buf, end - buf, /* from_stage3 */ true, 1);
+
+ /* Tweak the column number the lexer will report. */
+ pfile->buffer->col_adjust = pfile->cur_token[-1].col - 1;
+
+ /* We don't want a leading # to be interpreted as a directive. */
+ pfile->buffer->saved_flags = 0;
+
+ /* Set pfile->cur_token as required by _cpp_lex_direct. */
+ pfile->cur_token = _cpp_temp_token (pfile);
+ *plhs = _cpp_lex_direct (pfile);
+ valid = pfile->buffer->cur == pfile->buffer->rlimit;
+ _cpp_pop_buffer (pfile);
+
+ return valid;
}
-/* Handles an arbitrarily long sequence of ## operators. This
- implementation is left-associative, non-recursive, and finishes a
- paste before handling succeeding ones. If the paste fails, we back
- up a token to just after the ## operator, with the effect that it
- appears in the output stream normally. */
+/* Handles an arbitrarily long sequence of ## operators, with initial
+ operand LHS. This implementation is left-associative,
+ non-recursive, and finishes a paste before handling succeeding
+ ones. If a paste fails, we back up to the RHS of the failing ##
+ operator before pushing the context containing the result of prior
+ successful pastes, with the effect that the RHS appears in the
+ output stream after the pasted LHS normally. */
static void
paste_all_tokens (pfile, lhs)
cpp_reader *pfile;
- cpp_token *lhs;
+ const cpp_token *lhs;
{
- cpp_token *rhs;
- unsigned char orig_flags = lhs->flags;
+ const cpp_token *rhs;
+ cpp_context *context = pfile->context;
do
{
object-like macro, or a function-like macro with arguments
inserted. In either case, the constraints to #define
guarantee we have at least one more token. */
- rhs = pfile->context->list.first++;
- if (paste_tokens (pfile, lhs, rhs))
+ if (context->direct_p)
+ rhs = context->first.token++;
+ else
+ rhs = *context->first.ptoken++;
+
+ if (rhs->type == CPP_PADDING)
+ abort ();
+
+ if (!paste_tokens (pfile, &lhs, rhs))
{
- /* We failed. Step back so we read the RHS in next. */
- pfile->context->list.first--;
+ _cpp_backup_tokens (pfile, 1);
+
+ /* Mandatory warning for all apart from assembler. */
+ if (CPP_OPTION (pfile, lang) != CLK_ASM)
+ cpp_warning (pfile,
+ "pasting \"%s\" and \"%s\" does not give a valid preprocessing token",
+ cpp_token_as_text (pfile, lhs),
+ cpp_token_as_text (pfile, rhs));
break;
}
}
while (rhs->flags & PASTE_LEFT);
- /* The pasted token has the PREV_WHITE flag of the LHS, is no longer
- PASTE_LEFT, and is subject to macro expansion. */
- lhs->flags &= ~(PREV_WHITE | PASTE_LEFT | NO_EXPAND);
- lhs->flags |= orig_flags & (PREV_WHITE | AVOID_LPASTE);
+ /* Put the resulting token in its own context. */
+ push_token_context (pfile, NULL, lhs, 1);
}
-/* Reads the unexpanded tokens of a macro argument into ARG. VAR_ARGS
- is non-zero if this is a variadic macro. Returns the type of the
- token that caused reading to finish. */
-static enum cpp_ttype
-parse_arg (pfile, arg, variadic)
+/* Reads and returns the arguments to a function-like macro
+ invocation. Assumes the opening parenthesis has been processed.
+ If there is an error, emits an appropriate diagnostic and returns
+ NULL. Each argument is terminated by a CPP_EOF token, for the
+ future benefit of expand_arg(). */
+static _cpp_buff *
+collect_args (pfile, node)
cpp_reader *pfile;
- struct macro_arg *arg;
- int variadic;
+ const cpp_hashnode *node;
{
- enum cpp_ttype result;
- unsigned int paren = 0;
- unsigned int line;
-
- arg->first = (cpp_token *) POOL_FRONT (&pfile->argument_pool);
- for (;; arg->count++)
+ _cpp_buff *buff, *base_buff;
+ cpp_macro *macro;
+ macro_arg *args, *arg;
+ const cpp_token *token;
+ unsigned int argc;
+ bool error = false;
+
+ macro = node->value.macro;
+ if (macro->paramc)
+ argc = macro->paramc;
+ else
+ argc = 1;
+ buff = _cpp_get_buff (pfile, argc * (50 * sizeof (cpp_token *)
+ + sizeof (macro_arg)));
+ base_buff = buff;
+ args = (macro_arg *) buff->base;
+ memset (args, 0, argc * sizeof (macro_arg));
+ buff->cur = (unsigned char *) &args[argc];
+ arg = args, argc = 0;
+
+ /* Collect the tokens making up each argument. We don't yet know
+ how many arguments have been supplied, whether too many or too
+ few. Hence the slightly bizarre usage of "argc" and "arg". */
+ do
{
- cpp_token *token = &arg->first[arg->count];
- if ((unsigned char *) (token + 1) >= POOL_LIMIT (&pfile->argument_pool))
- {
- _cpp_next_chunk (&pfile->argument_pool, sizeof (cpp_token),
- (unsigned char **) &arg->first);
- token = &arg->first[arg->count];
- }
-
- /* Newlines in arguments are white space (6.10.3.10). */
- line = pfile->lexer_pos.output_line;
- cpp_get_token (pfile, token);
- if (line != pfile->lexer_pos.output_line)
- token->flags |= PREV_WHITE;
+ unsigned int paren_depth = 0;
+ unsigned int ntokens = 0;
- result = token->type;
- if (result == CPP_OPEN_PAREN)
- paren++;
- else if (result == CPP_CLOSE_PAREN && paren-- == 0)
- break;
- /* Commas are not terminators within parantheses or variadic. */
- else if (result == CPP_COMMA && paren == 0 && !variadic)
- break;
- else if (result == CPP_EOF)
- break; /* Error reported by caller. */
- }
+ argc++;
+ arg->first = (const cpp_token **) buff->cur;
- /* Commit the memory used to store the arguments. */
- POOL_COMMIT (&pfile->argument_pool, arg->count * sizeof (cpp_token));
+ for (;;)
+ {
+ /* Require space for 2 new tokens (including a CPP_EOF). */
+ if ((unsigned char *) &arg->first[ntokens + 2] > buff->limit)
+ {
+ buff = _cpp_append_extend_buff (pfile, buff,
+ 1000 * sizeof (cpp_token *));
+ arg->first = (const cpp_token **) buff->cur;
+ }
- return result;
-}
+ token = cpp_get_token (pfile);
-/* Parse the arguments making up a macro invocation. */
-static macro_arg *
-parse_args (pfile, node)
- cpp_reader *pfile;
- const cpp_hashnode *node;
-{
- cpp_macro *macro = node->value.macro;
- macro_arg *args, *cur;
- enum cpp_ttype type;
- int argc, error = 0;
+ if (token->type == CPP_PADDING)
+ {
+ /* Drop leading padding. */
+ if (ntokens == 0)
+ continue;
+ }
+ else if (token->type == CPP_OPEN_PAREN)
+ paren_depth++;
+ else if (token->type == CPP_CLOSE_PAREN)
+ {
+ if (paren_depth-- == 0)
+ break;
+ }
+ else if (token->type == CPP_COMMA)
+ {
+ /* A comma does not terminate an argument within
+ parentheses or as part of a variable argument. */
+ if (paren_depth == 0
+ && ! (macro->variadic && argc == macro->paramc))
+ break;
+ }
+ else if (token->type == CPP_EOF
+ || (token->type == CPP_HASH && token->flags & BOL))
+ break;
- /* Allocate room for at least one argument, and zero it out. */
- argc = macro->paramc ? macro->paramc: 1;
- args = xcnewvec (macro_arg, argc);
+ arg->first[ntokens++] = token;
+ }
- for (cur = args, argc = 0; ;)
- {
- argc++;
+ /* Drop trailing padding. */
+ while (ntokens > 0 && arg->first[ntokens - 1]->type == CPP_PADDING)
+ ntokens--;
- type = parse_arg (pfile, cur, argc == macro->paramc && macro->variadic);
- if (type == CPP_CLOSE_PAREN || type == CPP_EOF)
- break;
+ arg->count = ntokens;
+ arg->first[ntokens] = &pfile->eof;
- /* Re-use the last argument for excess arguments. */
- if (argc < macro->paramc)
- cur++;
+ /* Terminate the argument. Excess arguments loop back and
+ overwrite the final legitimate argument, before failing. */
+ if (argc <= macro->paramc)
+ {
+ buff->cur = (unsigned char *) &arg->first[ntokens + 1];
+ if (argc != macro->paramc)
+ arg++;
+ }
}
+ while (token->type != CPP_CLOSE_PAREN
+ && token->type != CPP_EOF
+ && token->type != CPP_HASH);
- if (type == CPP_EOF)
+ if (token->type == CPP_EOF || token->type == CPP_HASH)
{
+ bool step_back = false;
+
+ /* 6.10.3 paragraph 11: If there are sequences of preprocessing
+ tokens within the list of arguments that would otherwise act
+ as preprocessing directives, the behavior is undefined.
+
+ This implementation will report a hard error, terminate the
+ macro invocation, and proceed to process the directive. */
+ if (token->type == CPP_HASH)
+ {
+ cpp_error (pfile,
+ "directives may not be used inside a macro argument");
+ step_back = true;
+ }
+ else
+ step_back = (pfile->context->prev || pfile->state.in_directive);
+
+ /* We still need the CPP_EOF to end directives, and to end
+ pre-expansion of a macro argument. Step back is not
+ unconditional, since we don't want to return a CPP_EOF to our
+ callers at the end of an -include-d file. */
+ if (step_back)
+ _cpp_backup_tokens (pfile, 1);
cpp_error (pfile, "unterminated argument list invoking macro \"%s\"",
NODE_NAME (node));
- error = 1;
+ error = true;
}
else if (argc < macro->paramc)
{
cpp_error (pfile,
"macro \"%s\" requires %u arguments, but only %u given",
NODE_NAME (node), macro->paramc, argc);
- error = 1;
+ error = true;
}
}
else if (argc > macro->paramc)
{
/* Empty argument to a macro taking no arguments is OK. */
- if (argc != 1 || cur->count)
+ if (argc != 1 || arg->count)
{
cpp_error (pfile,
"macro \"%s\" passed %u arguments, but takes just %u",
NODE_NAME (node), argc, macro->paramc);
- error = 1;
+ error = true;
}
}
- if (error)
- {
- free (args);
- args = 0;
- }
+ if (!error)
+ return base_buff;
- return args;
+ _cpp_release_buff (pfile, base_buff);
+ return NULL;
}
-static int
-funlike_invocation_p (pfile, node, list)
+/* Search for an opening parenthesis to the macro of NODE, in such a
+ way that, if none is found, we don't lose the information in any
+ intervening padding tokens. If we find the parenthesis, collect
+ the arguments and return the buffer containing them. */
+static _cpp_buff *
+funlike_invocation_p (pfile, node)
cpp_reader *pfile;
- const cpp_hashnode *node;
- struct toklist *list;
+ cpp_hashnode *node;
{
- cpp_context *orig;
- cpp_token maybe_paren;
- macro_arg *args = 0;
- cpp_lexer_pos macro_pos;
-
- macro_pos = pfile->lexer_pos;
- pfile->state.parsing_args = 1;
- pfile->state.prevent_expansion++;
- orig = pfile->context;
-
- cpp_start_lookahead (pfile);
- cpp_get_token (pfile, &maybe_paren);
- cpp_stop_lookahead (pfile, maybe_paren.type == CPP_OPEN_PAREN);
- pfile->state.parsing_args = 2;
-
- if (maybe_paren.type == CPP_OPEN_PAREN)
- args = parse_args (pfile, node);
- else if (CPP_WTRADITIONAL (pfile) && ! node->value.macro->syshdr)
- cpp_warning (pfile,
- "function-like macro \"%s\" must be used with arguments in traditional C",
- NODE_NAME (node));
+ const cpp_token *token, *padding = NULL;
- /* Restore original context. */
- pfile->context = orig;
- pfile->state.prevent_expansion--;
- pfile->state.parsing_args = 0;
+ for (;;)
+ {
+ token = cpp_get_token (pfile);
+ if (token->type != CPP_PADDING)
+ break;
+ if (padding == NULL
+ || (!(padding->flags & PREV_WHITE) && token->val.source == NULL))
+ padding = token;
+ }
- /* Reset the position in case of failure. If success, the macro's
- expansion appears where the name would have. */
- pfile->lexer_pos = macro_pos;
+ if (token->type == CPP_OPEN_PAREN)
+ {
+ pfile->state.parsing_args = 2;
+ return collect_args (pfile, node);
+ }
- if (args)
+ /* CPP_EOF can be the end of macro arguments, or the end of the
+ file. We mustn't back up over the latter. Ugh. */
+ if (token->type != CPP_EOF || token == &pfile->eof)
{
- if (node->value.macro->paramc > 0)
- {
- /* Don't save tokens during pre-expansion. */
- struct cpp_lookahead *la_saved = pfile->la_write;
- pfile->la_write = 0;
- replace_args (pfile, node->value.macro, args, list);
- pfile->la_write = la_saved;
- }
- free (args);
+ /* Back up. We may have skipped padding, in which case backing
+ up more than one token when expanding macros is in general
+ too difficult. We re-insert it in its own context. */
+ _cpp_backup_tokens (pfile, 1);
+ if (padding)
+ push_token_context (pfile, NULL, padding, 1);
}
- return args != 0;
+ return NULL;
}
-/* Push the context of a macro onto the context stack. TOKEN is the
- macro name. If we can successfully start expanding the macro,
- TOKEN is replaced with the first token of the expansion, and we
- return non-zero. */
+/* Push the context of a macro with hash entry NODE onto the context
+ stack. If we can successfully expand the macro, we push a context
+ containing its yet-to-be-rescanned replacement list and return one.
+ Otherwise, we don't push a context and return zero. */
static int
enter_macro_context (pfile, node)
cpp_reader *pfile;
cpp_hashnode *node;
{
- cpp_context *context;
- cpp_macro *macro = node->value.macro;
- struct toklist list;
+ /* The presence of a macro invalidates a file's controlling macro. */
+ pfile->mi_valid = false;
- /* Save the position of the outermost macro invocation. */
- if (!pfile->context->prev)
- lock_pools (pfile);
-
- if (macro->fun_like && !funlike_invocation_p (pfile, node, &list))
+ /* Handle standard macros. */
+ if (! (node->flags & NODE_BUILTIN))
{
- if (!pfile->context->prev)
- unlock_pools (pfile);
- return 0;
- }
+ cpp_macro *macro = node->value.macro;
- if (macro->paramc == 0)
- {
- list.first = macro->expansion;
- list.limit = macro->expansion + macro->count;
- }
+ if (macro->fun_like)
+ {
+ _cpp_buff *buff;
- /* Only push a macro context for non-empty replacement lists. */
- if (list.first != list.limit)
- {
- context = next_context (pfile);
- context->list = list;
- context->macro = macro;
-
- /* Disable the macro within its expansion. */
- macro->disabled = 1;
- }
+ pfile->state.prevent_expansion++;
+ pfile->keep_tokens++;
+ pfile->state.parsing_args = 1;
+ buff = funlike_invocation_p (pfile, node);
+ pfile->state.parsing_args = 0;
+ pfile->keep_tokens--;
+ pfile->state.prevent_expansion--;
- return 1;
-}
+ if (buff == NULL)
+ {
+ if (CPP_WTRADITIONAL (pfile) && ! node->value.macro->syshdr)
+ cpp_warning (pfile,
+ "function-like macro \"%s\" must be used with arguments in traditional C",
+ NODE_NAME (node));
-/* Move to the next context. Create one if there is none. */
-static cpp_context *
-next_context (pfile)
- cpp_reader *pfile;
-{
- cpp_context *prev = pfile->context;
- cpp_context *result = prev->next;
+ return 0;
+ }
- if (result == 0)
- {
- result = xnew (cpp_context);
- prev->next = result;
- result->prev = prev;
- result->next = 0;
+ if (node->value.macro->paramc > 0)
+ replace_args (pfile, node, (macro_arg *) buff->base);
+ _cpp_release_buff (pfile, buff);
+ }
+
+ /* Disable the macro within its expansion. */
+ node->flags |= NODE_DISABLED;
+
+ if (macro->paramc == 0)
+ push_token_context (pfile, node, macro->expansion, macro->count);
+
+ return 1;
}
- pfile->context = result;
- return result;
+ /* Handle built-in macros and the _Pragma operator. */
+ return builtin_macro (pfile, node);
}
+/* Replace the parameters in a function-like macro of NODE with the
+ actual ARGS, and place the result in a newly pushed token context.
+ Expand each argument before replacing, unless it is operated upon
+ by the # or ## operators. */
static void
-replace_args (pfile, macro, args, list)
+replace_args (pfile, node, args)
cpp_reader *pfile;
- cpp_macro *macro;
+ cpp_hashnode *node;
macro_arg *args;
- struct toklist *list;
{
- unsigned char flags = 0;
unsigned int i, total;
const cpp_token *src, *limit;
- cpp_token *dest;
+ const cpp_token **dest, **first;
macro_arg *arg;
-
- src = macro->expansion;
- limit = src + macro->count;
+ _cpp_buff *buff;
+ cpp_macro *macro;
/* First, fully macro-expand arguments, calculating the number of
- tokens in the final expansion as we go. This ensures that the
- possible recursive use of argument_pool is fine. */
- total = limit - src;
- for (; src < limit; src++)
+ tokens in the final expansion as we go. The ordering of the if
+ statements below is subtle; we must handle stringification before
+ pasting. */
+ macro = node->value.macro;
+ total = macro->count;
+ limit = macro->expansion + macro->count;
+
+ for (src = macro->expansion; src < limit; src++)
if (src->type == CPP_MACRO_ARG)
{
+ /* Leading and trailing padding tokens. */
+ total += 2;
+
/* We have an argument. If it is not being stringified or
pasted it is macro-replaced before insertion. */
arg = &args[src->val.arg_no - 1];
if (src->flags & STRINGIFY_ARG)
{
if (!arg->stringified)
- stringify_arg (pfile, arg);
+ arg->stringified = stringify_arg (pfile, arg);
}
else if ((src->flags & PASTE_LEFT)
|| (src > macro->expansion && (src[-1].flags & PASTE_LEFT)))
else
{
if (!arg->expanded)
- {
- arg->expanded_count = 0;
- if (arg->count)
- expand_arg (pfile, arg);
- }
+ expand_arg (pfile, arg);
total += arg->expanded_count - 1;
}
}
- dest = (cpp_token *) _cpp_pool_alloc (&pfile->argument_pool,
- total * sizeof (cpp_token));
- list->first = dest;
+ /* Now allocate space for the expansion, copy the tokens and replace
+ the arguments. */
+ buff = _cpp_get_buff (pfile, total * sizeof (cpp_token *));
+ first = (const cpp_token **) buff->base;
+ dest = first;
for (src = macro->expansion; src < limit; src++)
- if (src->type == CPP_MACRO_ARG)
- {
- unsigned int count;
- const cpp_token *from;
+ {
+ unsigned int count;
+ const cpp_token **from, **paste_flag;
- arg = &args[src->val.arg_no - 1];
- if (src->flags & STRINGIFY_ARG)
- from = arg->stringified, count = 1;
- else if (src->flags & PASTE_LEFT)
- count = arg->count, from = arg->first;
- else if (src > macro->expansion && (src[-1].flags & PASTE_LEFT))
- {
- count = arg->count, from = arg->first;
- if (dest != list->first)
- {
- /* GCC has special semantics for , ## b where b is a
- varargs parameter: the comma disappears if b was
- given no actual arguments (not merely if b is an
- empty argument); otherwise pasting is turned off. */
- if (dest[-1].type == CPP_COMMA
- && macro->variadic
- && src->val.arg_no == macro->paramc)
- {
- if (count == 0)
- dest--;
- else
- dest[-1].flags &= ~PASTE_LEFT;
- }
- /* Count == 0 is the RHS a placemarker case. */
- else if (count == 0)
- dest[-1].flags &= ~PASTE_LEFT;
- }
- }
- else
- count = arg->expanded_count, from = arg->expanded;
+ if (src->type != CPP_MACRO_ARG)
+ {
+ *dest++ = src;
+ continue;
+ }
- /* Count == 0 is the LHS a placemarker case. */
- if (count)
- {
- memcpy (dest, from, count * sizeof (cpp_token));
+ paste_flag = 0;
+ arg = &args[src->val.arg_no - 1];
+ if (src->flags & STRINGIFY_ARG)
+ count = 1, from = &arg->stringified;
+ else if (src->flags & PASTE_LEFT)
+ count = arg->count, from = arg->first;
+ else if (src != macro->expansion && (src[-1].flags & PASTE_LEFT))
+ {
+ count = arg->count, from = arg->first;
+ if (dest != first)
+ {
+ /* GCC has special semantics for , ## b where b is a
+ varargs parameter: the comma disappears if b was
+ given no actual arguments (not merely if b is an
+ empty argument); otherwise the paste flag is removed. */
+ if (dest[-1]->type == CPP_COMMA
+ && macro->variadic
+ && src->val.arg_no == macro->paramc)
+ {
+ if (count == 0)
+ dest--;
+ else
+ paste_flag = dest - 1;
+ }
+ /* Remove the paste flag if the RHS is a placemarker. */
+ else if (count == 0)
+ paste_flag = dest - 1;
+ }
+ }
+ else
+ count = arg->expanded_count, from = arg->expanded;
- /* The first token gets PREV_WHITE of the CPP_MACRO_ARG. */
- dest->flags &= ~PREV_WHITE;
- dest->flags |= src->flags & PREV_WHITE;
- dest->flags |= AVOID_LPASTE;
+ /* Padding on the left of an argument (unless RHS of ##). */
+ if (!pfile->state.in_directive
+ && src != macro->expansion && !(src[-1].flags & PASTE_LEFT))
+ *dest++ = padding_token (pfile, src);
- /* The last token gets the PASTE_LEFT of the CPP_MACRO_ARG. */
- dest[count - 1].flags |= src->flags & PASTE_LEFT;
+ if (count)
+ {
+ memcpy (dest, from, count * sizeof (cpp_token *));
+ dest += count;
- dest += count;
- }
+ /* With a non-empty argument on the LHS of ##, the last
+ token should be flagged PASTE_LEFT. */
+ if (src->flags & PASTE_LEFT)
+ paste_flag = dest - 1;
+ }
- /* The token after the argument must avoid an accidental paste. */
- flags = AVOID_LPASTE;
- }
- else
- {
- *dest = *src;
- dest->flags |= flags;
- dest++;
- flags = 0;
- }
+ /* Avoid paste on RHS (even case count == 0). */
+ if (!pfile->state.in_directive && !(src->flags & PASTE_LEFT))
+ *dest++ = &pfile->avoid_paste;
- list->limit = dest;
+ /* Add a new paste flag, or remove an unwanted one. */
+ if (paste_flag)
+ {
+ cpp_token *token = _cpp_temp_token (pfile);
+ token->type = (*paste_flag)->type;
+ token->val.str = (*paste_flag)->val.str;
+ if (src->flags & PASTE_LEFT)
+ token->flags = (*paste_flag)->flags | PASTE_LEFT;
+ else
+ token->flags = (*paste_flag)->flags & ~PASTE_LEFT;
+ *paste_flag = token;
+ }
+ }
/* Free the expanded arguments. */
for (i = 0; i < macro->paramc; i++)
+ if (args[i].expanded)
+ free (args[i].expanded);
+
+ push_ptoken_context (pfile, node, buff, first, dest - first);
+}
+
+/* Return a special padding token, with padding inherited from SOURCE. */
+static const cpp_token *
+padding_token (pfile, source)
+ cpp_reader *pfile;
+ const cpp_token *source;
+{
+ cpp_token *result = _cpp_temp_token (pfile);
+
+ result->type = CPP_PADDING;
+ result->val.source = source;
+ result->flags = 0;
+ return result;
+}
+
+/* Get a new uninitialized context. Create a new one if we cannot
+ re-use an old one. */
+static cpp_context *
+next_context (pfile)
+ cpp_reader *pfile;
+{
+ cpp_context *result = pfile->context->next;
+
+ if (result == 0)
{
- if (args[i].expanded)
- free (args[i].expanded);
- if (args[i].stringified)
- free (args[i].stringified);
+ result = xnew (cpp_context);
+ result->prev = pfile->context;
+ result->next = 0;
+ pfile->context->next = result;
}
+
+ pfile->context = result;
+ return result;
}
-/* Subroutine of expand_arg to put the unexpanded tokens on the
- context stack. */
-static cpp_context *
-push_arg_context (pfile, arg)
+/* Push a list of pointers to tokens. */
+static void
+push_ptoken_context (pfile, macro, buff, first, count)
cpp_reader *pfile;
- macro_arg *arg;
+ cpp_hashnode *macro;
+ _cpp_buff *buff;
+ const cpp_token **first;
+ unsigned int count;
{
cpp_context *context = next_context (pfile);
- context->macro = 0;
- context->list.first = arg->first;
- context->list.limit = arg->first + arg->count;
- return context;
+ context->direct_p = false;
+ context->macro = macro;
+ context->buff = buff;
+ context->first.ptoken = first;
+ context->last.ptoken = first + count;
}
+/* Push a list of tokens. */
+static void
+push_token_context (pfile, macro, first, count)
+ cpp_reader *pfile;
+ cpp_hashnode *macro;
+ const cpp_token *first;
+ unsigned int count;
+{
+ cpp_context *context = next_context (pfile);
+
+ context->direct_p = true;
+ context->macro = macro;
+ context->buff = NULL;
+ context->first.token = first;
+ context->last.token = first + count;
+}
+
+/* Expand an argument ARG before replacing parameters in a
+ function-like macro. This works by pushing a context with the
+ argument's tokens, and then expanding that into a temporary buffer
+ as if it were a normal part of the token stream. collect_args()
+ has terminated the argument's tokens with a CPP_EOF so that we know
+ when we have fully expanded the argument. */
static void
expand_arg (pfile, arg)
cpp_reader *pfile;
macro_arg *arg;
{
- cpp_token *token;
- unsigned int capacity = 256;
+ unsigned int capacity;
+
+ if (arg->count == 0)
+ return;
/* Loop, reading in the arguments. */
- arg->expanded = (cpp_token *) xmalloc (capacity * sizeof (cpp_token));
+ capacity = 256;
+ arg->expanded = (const cpp_token **)
+ xmalloc (capacity * sizeof (cpp_token *));
- push_arg_context (pfile, arg);
- do
+ push_ptoken_context (pfile, NULL, NULL, arg->first, arg->count + 1);
+ for (;;)
{
- if (arg->expanded_count >= capacity)
+ const cpp_token *token;
+
+ if (arg->expanded_count + 1 >= capacity)
{
capacity *= 2;
- arg->expanded = (cpp_token *)
- xrealloc (arg->expanded, capacity * sizeof (cpp_token));
+ arg->expanded = (const cpp_token **)
+ xrealloc (arg->expanded, capacity * sizeof (cpp_token *));
}
- token = &arg->expanded[arg->expanded_count++];
- cpp_get_token (pfile, token);
- }
- while (token->type != CPP_EOF);
- arg->expanded_count--;
+ token = cpp_get_token (pfile);
+
+ if (token->type == CPP_EOF)
+ break;
+
+ arg->expanded[arg->expanded_count++] = token;
+ }
- /* Pop the context we pushed. */
- pfile->context = pfile->context->prev;
+ _cpp_pop_context (pfile);
}
+/* Pop the current context off the stack, re-enabling the macro if the
+ context represented a macro's replacement list. The context
+ structure is not freed so that we can re-use it later. */
void
_cpp_pop_context (pfile)
cpp_reader *pfile;
{
cpp_context *context = pfile->context;
- pfile->context = context->prev;
- if (!pfile->context->prev && !pfile->state.parsing_args)
- unlock_pools (pfile);
+ if (context->macro)
+ context->macro->flags &= ~NODE_DISABLED;
+
+ if (context->buff)
+ _cpp_release_buff (pfile, context->buff);
- /* Re-enable a macro, temporarily if parsing_args, when leaving its
- expansion. */
- context->macro->disabled = 0;
+ pfile->context = context->prev;
}
/* Eternal routine to get a token. Also used nearly everywhere
a directive inside a macro call, when at the end of a directive and
state.in_directive is still 1, and at the end of argument
pre-expansion. */
-void
-cpp_get_token (pfile, token)
+const cpp_token *
+cpp_get_token (pfile)
cpp_reader *pfile;
- cpp_token *token;
{
+ const cpp_token *result;
+
for (;;)
{
+ cpp_hashnode *node;
cpp_context *context = pfile->context;
- if (pfile->la_read)
- take_lookahead_token (pfile, token);
/* Context->prev == 0 <=> base context. */
- else if (!context->prev)
- _cpp_lex_token (pfile, token);
- else if (context->list.first != context->list.limit)
+ if (!context->prev)
+ result = _cpp_lex_token (pfile);
+ else if (context->first.token != context->last.token)
{
- *token = *context->list.first++;
- token->flags |= pfile->buffer->saved_flags;
- pfile->buffer->saved_flags = 0;
- /* PASTE_LEFT tokens can only appear in macro expansions. */
- if (token->flags & PASTE_LEFT)
+ if (context->direct_p)
+ result = context->first.token++;
+ else
+ result = *context->first.ptoken++;
+
+ if (result->flags & PASTE_LEFT)
{
- paste_all_tokens (pfile, token);
- pfile->buffer->saved_flags = AVOID_LPASTE;
+ paste_all_tokens (pfile, result);
+ if (pfile->state.in_directive)
+ continue;
+ return padding_token (pfile, result);
}
}
else
{
- if (context->macro)
- {
- /* Avoid accidental paste at the end of a macro. */
- pfile->buffer->saved_flags |= AVOID_LPASTE;
- _cpp_pop_context (pfile);
- continue;
- }
- /* End of argument pre-expansion. */
- token->type = CPP_EOF;
- token->flags = 0;
- return;
+ _cpp_pop_context (pfile);
+ if (pfile->state.in_directive)
+ continue;
+ return &pfile->avoid_paste;
}
- if (token->type != CPP_NAME)
+ if (result->type != CPP_NAME)
break;
- /* Handle macros and the _Pragma operator. */
- if (token->val.node->type == NT_MACRO
- && !pfile->state.prevent_expansion
- && !(token->flags & NO_EXPAND))
- {
- cpp_hashnode *node = token->val.node;
-
- /* Macros invalidate controlling macros. */
- pfile->mi_state = MI_FAILED;
-
- if (node->flags & NODE_BUILTIN)
- {
- builtin_macro (pfile, token);
- pfile->buffer->saved_flags = AVOID_LPASTE;
- break;
- }
+ node = result->val.node;
- if (node->value.macro->disabled)
- token->flags |= NO_EXPAND;
- else if (enter_macro_context (pfile, node))
+ if (node->type != NT_MACRO || (result->flags & NO_EXPAND))
+ break;
+
+ if (!(node->flags & NODE_DISABLED))
+ {
+ if (!pfile->state.prevent_expansion
+ && enter_macro_context (pfile, node))
{
- /* Pass AVOID_LPASTE and our PREV_WHITE to next token. */
- pfile->buffer->saved_flags = ((token->flags & PREV_WHITE)
- | AVOID_LPASTE);
- continue;
+ if (pfile->state.in_directive)
+ continue;
+ return padding_token (pfile, result);
}
}
+ else
+ {
+ /* Flag this token as always unexpandable. FIXME: move this
+ to collect_args()?. */
+ cpp_token *t = _cpp_temp_token (pfile);
+ t->type = result->type;
+ t->flags = result->flags | NO_EXPAND;
+ t->val.str = result->val.str;
+ result = t;
+ }
- /* Don't interpret _Pragma within directives. The standard is
- not clear on this, but to me this makes most sense. */
- if (token->val.node != pfile->spec_nodes.n__Pragma
- || pfile->state.in_directive)
- break;
-
- /* Handle it, and loop back for another token. MI is cleared
- since this token came from either the lexer or a macro. */
- _cpp_do__Pragma (pfile);
+ break;
}
- if (pfile->la_write)
- save_lookahead_token (pfile, token);
+ return result;
}
/* Returns true if we're expanding an object-like macro that was
cpp_sys_macro_p (pfile)
cpp_reader *pfile;
{
- cpp_macro *macro = pfile->context->macro;
+ cpp_hashnode *node = pfile->context->macro;
- return macro && macro->syshdr;
+ return node && node->value.macro && node->value.macro->syshdr;
}
/* Read each token in, until EOF. Directives are transparently
processed. */
void
-cpp_scan_buffer_nooutput (pfile, all_buffers)
+cpp_scan_nooutput (pfile)
cpp_reader *pfile;
- int all_buffers;
{
- cpp_token token;
- cpp_buffer *buffer = all_buffers ? 0: pfile->buffer->prev;
-
- do
- do
- cpp_get_token (pfile, &token);
- while (token.type != CPP_EOF);
- while (cpp_pop_buffer (pfile) != buffer);
+ while (cpp_get_token (pfile)->type != CPP_EOF)
+ ;
}
-/* Lookahead handling. */
-
-static void
-save_lookahead_token (pfile, token)
+/* Step back one (or more) tokens. Can only step mack more than 1 if
+ they are from the lexer, and not from macro expansion. */
+void
+_cpp_backup_tokens (pfile, count)
cpp_reader *pfile;
- const cpp_token *token;
+ unsigned int count;
{
- if (token->type != CPP_EOF)
+ if (pfile->context->prev == NULL)
{
- cpp_lookahead *la = pfile->la_write;
- cpp_token_with_pos *twp;
-
- if (la->count == la->cap)
+ pfile->lookaheads += count;
+ while (count--)
{
- la->cap += la->cap + 8;
- la->tokens = (cpp_token_with_pos *)
- xrealloc (la->tokens, la->cap * sizeof (cpp_token_with_pos));
+ pfile->cur_token--;
+ if (pfile->cur_token == pfile->cur_run->base
+ /* Possible with -fpreprocessed and no leading #line. */
+ && pfile->cur_run->prev != NULL)
+ {
+ pfile->cur_run = pfile->cur_run->prev;
+ pfile->cur_token = pfile->cur_run->limit;
+ }
}
-
- twp = &la->tokens[la->count++];
- twp->token = *token;
- twp->pos = *cpp_get_line (pfile);
}
-}
-
-static void
-take_lookahead_token (pfile, token)
- cpp_reader *pfile;
- cpp_token *token;
-{
- cpp_lookahead *la = pfile->la_read;
- cpp_token_with_pos *twp = &la->tokens[la->cur];
-
- *token = twp->token;
- pfile->lexer_pos = twp->pos;
-
- if (++la->cur == la->count)
- _cpp_release_lookahead (pfile);
-}
-
-/* Moves the lookahead at the front of the read list to the free store. */
-void
-_cpp_release_lookahead (pfile)
- cpp_reader *pfile;
-{
- cpp_lookahead *la = pfile->la_read;
-
- pfile->la_read = la->next;
- la->next = pfile->la_unused;
- pfile->la_unused = la;
- unlock_pools (pfile);
-}
-
-/* Take a new lookahead from the free store, or allocate one if none. */
-static cpp_lookahead *
-alloc_lookahead (pfile)
- cpp_reader *pfile;
-{
- cpp_lookahead *la = pfile->la_unused;
-
- if (la)
- pfile->la_unused = la->next;
else
{
- la = xnew (cpp_lookahead);
- la->tokens = 0;
- la->cap = 0;
- }
-
- la->cur = la->count = 0;
- return la;
-}
-
-/* Free memory associated with a lookahead list. */
-static void
-free_lookahead (la)
- cpp_lookahead *la;
-{
- if (la->tokens)
- free ((PTR) la->tokens);
- free ((PTR) la);
-}
-
-/* Free all the lookaheads of a cpp_reader. */
-void
-_cpp_free_lookaheads (pfile)
- cpp_reader *pfile;
-{
- cpp_lookahead *la, *lan;
-
- if (pfile->la_read)
- free_lookahead (pfile->la_read);
- if (pfile->la_write)
- free_lookahead (pfile->la_write);
-
- for (la = pfile->la_unused; la; la = lan)
- {
- lan = la->next;
- free_lookahead (la);
+ if (count != 1)
+ abort ();
+ if (pfile->context->direct_p)
+ pfile->context->first.token--;
+ else
+ pfile->context->first.ptoken--;
}
}
-/* Allocate a lookahead and move it to the front of the write list. */
-void
-cpp_start_lookahead (pfile)
- cpp_reader *pfile;
-{
- cpp_lookahead *la = alloc_lookahead (pfile);
-
- la->next = pfile->la_write;
- pfile->la_write = la;
-
- la->pos = *cpp_get_line (pfile);
-
- /* Don't allow memory pools to be re-used whilst we're reading ahead. */
- lock_pools (pfile);
-}
-
-/* Stop reading ahead - either step back, or drop the read ahead. */
-void
-cpp_stop_lookahead (pfile, drop)
- cpp_reader *pfile;
- int drop;
-{
- cpp_lookahead *la = pfile->la_write;
-
- pfile->la_write = la->next;
- la->next = pfile->la_read;
- pfile->la_read = la;
-
- if (drop || la->count == 0)
- _cpp_release_lookahead (pfile);
- else
- pfile->lexer_pos = la->pos;
-}
-
-/* Push a single token back to the front of the queue. Only to be
- used by cpplib, and only then when necessary. POS is the position
- to report for the preceding token. */
-void
-_cpp_push_token (pfile, token, pos)
- cpp_reader *pfile;
- const cpp_token *token;
- const cpp_lexer_pos *pos;
-{
- cpp_start_lookahead (pfile);
- save_lookahead_token (pfile, token);
- cpp_stop_lookahead (pfile, 0);
- pfile->lexer_pos = *pos;
-}
-
/* #define directive parsing and handling. */
/* Returns non-zero if a macro redefinition warning is required. */
static int
-warn_of_redefinition (pfile, node, macro2)
- cpp_reader *pfile;
+warn_of_redefinition (node, macro2)
const cpp_hashnode *node;
const cpp_macro *macro2;
{
if (node->flags & NODE_WARN)
return 1;
-#if 0
- if (! CPP_PEDANTIC (pfile))
- return 0;
-#endif
-
/* Redefinition of a macro is allowed if and only if the old and new
- definitions are the same. (6.10.3 paragraph 2). */
+ definitions are the same. (6.10.3 paragraph 2). */
macro1 = node->value.macro;
/* The quick failures. */
}
/* Free the definition of hashnode H. */
-
void
_cpp_free_definition (h)
cpp_hashnode *h;
/* Macros and assertions no longer have anything to free. */
h->type = NT_VOID;
/* Clear builtin flag in case of redefinition. */
- h->flags &= ~NODE_BUILTIN;
+ h->flags &= ~(NODE_BUILTIN | NODE_DISABLED);
}
+/* Save parameter NODE to the parameter list of macro MACRO. Returns
+ zero on success, non-zero if the parameter is a duplicate. */
static int
save_parameter (pfile, macro, node)
cpp_reader *pfile;
cpp_macro *macro;
cpp_hashnode *node;
{
- cpp_hashnode **dest;
-
/* Constraint 6.10.3.6 - duplicate parameter names. */
if (node->arg_index)
{
return 1;
}
- dest = ¯o->params[macro->paramc];
-
- /* Check we have room for the parameters. */
- if ((unsigned char *) (dest + 1) >= POOL_LIMIT (&pfile->macro_pool))
- {
- _cpp_next_chunk (&pfile->macro_pool, sizeof (cpp_hashnode *),
- (unsigned char **) ¯o->params);
- dest = ¯o->params[macro->paramc];
- }
+ if (BUFF_ROOM (pfile->a_buff)
+ < (macro->paramc + 1) * sizeof (cpp_hashnode *))
+ _cpp_extend_buff (pfile, &pfile->a_buff, sizeof (cpp_hashnode *));
- *dest = node;
- node->arg_index = ++macro->paramc;
+ ((cpp_hashnode **) BUFF_FRONT (pfile->a_buff))[macro->paramc++] = node;
+ node->arg_index = macro->paramc;
return 0;
}
+/* Check the syntax of the parameters in a MACRO definition. */
static int
parse_params (pfile, macro)
cpp_reader *pfile;
cpp_macro *macro;
{
- cpp_token token;
unsigned int prev_ident = 0;
- macro->params = (cpp_hashnode **) POOL_FRONT (&pfile->macro_pool);
for (;;)
{
- _cpp_lex_token (pfile, &token);
+ const cpp_token *token = _cpp_lex_token (pfile);
- switch (token.type)
+ switch (token->type)
{
default:
cpp_error (pfile, "\"%s\" may not appear in macro parameter list",
- cpp_token_as_text (pfile, &token));
+ cpp_token_as_text (pfile, token));
return 0;
case CPP_NAME:
}
prev_ident = 1;
- if (save_parameter (pfile, macro, token.val.node))
+ if (save_parameter (pfile, macro, token->val.node))
return 0;
continue;
case CPP_CLOSE_PAREN:
if (prev_ident || macro->paramc == 0)
- break;
+ return 1;
/* Fall through to pick up the error. */
case CPP_COMMA:
cpp_pedwarn (pfile, "ISO C does not permit named variadic macros");
/* We're at the end, and just expect a closing parenthesis. */
- _cpp_lex_token (pfile, &token);
- if (token.type == CPP_CLOSE_PAREN)
- break;
+ token = _cpp_lex_token (pfile);
+ if (token->type == CPP_CLOSE_PAREN)
+ return 1;
/* Fall through. */
case CPP_EOF:
cpp_error (pfile, "missing ')' in macro parameter list");
return 0;
}
-
- /* Success. Commit the parameter array. */
- POOL_COMMIT (&pfile->macro_pool,
- macro->paramc * sizeof (cpp_hashnode *));
- return 1;
}
}
-/* Lex a token from a macro's replacement list. Translate it to a
- CPP_MACRO_ARG if appropriate. */
+/* Allocate room for a token from a macro's replacement list. */
static cpp_token *
-lex_expansion_token (pfile, macro)
+alloc_expansion_token (pfile, macro)
cpp_reader *pfile;
cpp_macro *macro;
{
- cpp_token *token = ¯o->expansion[macro->count];
+ if (BUFF_ROOM (pfile->a_buff) < (macro->count + 1) * sizeof (cpp_token))
+ _cpp_extend_buff (pfile, &pfile->a_buff, sizeof (cpp_token));
- /* Check we have room for the token. */
- if ((unsigned char *) (token + 1) >= POOL_LIMIT (&pfile->macro_pool))
- {
- _cpp_next_chunk (&pfile->macro_pool, sizeof (cpp_token),
- (unsigned char **) ¯o->expansion);
- token = ¯o->expansion[macro->count];
- }
+ return &((cpp_token *) BUFF_FRONT (pfile->a_buff))[macro->count++];
+}
+
+/* Lex a token from the expansion of MACRO, but mark parameters as we
+ find them and warn of traditional stringification. */
+static cpp_token *
+lex_expansion_token (pfile, macro)
+ cpp_reader *pfile;
+ cpp_macro *macro;
+{
+ cpp_token *token;
- macro->count++;
- _cpp_lex_token (pfile, token);
+ pfile->cur_token = alloc_expansion_token (pfile, macro);
+ token = _cpp_lex_direct (pfile);
- /* Is this an argument? */
+ /* Is this a parameter? */
if (token->type == CPP_NAME && token->val.node->arg_index)
{
token->type = CPP_MACRO_ARG;
cpp_hashnode *node;
{
cpp_macro *macro;
- cpp_token *token;
+ cpp_token *token, *saved_cur_token;
+ const cpp_token *ctoken;
unsigned int i, ok = 1;
- macro = (cpp_macro *) _cpp_pool_alloc (&pfile->macro_pool,
- sizeof (cpp_macro));
- macro->file = pfile->buffer->nominal_fname;
- macro->line = pfile->directive_pos.line;
+ macro = (cpp_macro *) _cpp_aligned_alloc (pfile, sizeof (cpp_macro));
+ macro->line = pfile->directive_line;
macro->params = 0;
macro->paramc = 0;
- macro->fun_like = 0;
macro->variadic = 0;
macro->count = 0;
- macro->expansion = (cpp_token *) POOL_FRONT (&pfile->macro_pool);
+ macro->fun_like = 0;
/* Get the first token of the expansion (or the '(' of a
function-like macro). */
- token = lex_expansion_token (pfile, macro);
- if (token->type == CPP_OPEN_PAREN && !(token->flags & PREV_WHITE))
+ ctoken = _cpp_lex_token (pfile);
+
+ if (ctoken->type == CPP_OPEN_PAREN && !(ctoken->flags & PREV_WHITE))
{
- if (!(ok = parse_params (pfile, macro)))
- goto cleanup;
- macro->count = 0;
+ ok = parse_params (pfile, macro);
+ macro->params = (cpp_hashnode **) BUFF_FRONT (pfile->a_buff);
+ if (!ok)
+ goto cleanup2;
+
+ /* Success. Commit the parameter array. */
+ BUFF_FRONT (pfile->a_buff) = (U_CHAR *) ¯o->params[macro->paramc];
macro->fun_like = 1;
- /* Some of the pool may have been used for the parameter store. */
- macro->expansion = (cpp_token *) POOL_FRONT (&pfile->macro_pool);
- token = lex_expansion_token (pfile, macro);
}
- else if (token->type != CPP_EOF && !(token->flags & PREV_WHITE))
+ else if (ctoken->type != CPP_EOF && !(ctoken->flags & PREV_WHITE))
cpp_pedwarn (pfile, "ISO C requires whitespace after the macro name");
- /* Setting it here means we don't catch leading comments. */
- pfile->state.save_comments = ! CPP_OPTION (pfile, discard_comments);
+ saved_cur_token = pfile->cur_token;
+
+ if (macro->fun_like)
+ token = lex_expansion_token (pfile, macro);
+ else
+ {
+ token = alloc_expansion_token (pfile, macro);
+ *token = *ctoken;
+ }
for (;;)
{
{
ok = 0;
cpp_error (pfile, "'#' is not followed by a macro parameter");
- goto cleanup;
+ goto cleanup1;
}
}
ok = 0;
cpp_error (pfile,
"'##' cannot appear at either end of a macro expansion");
- goto cleanup;
+ goto cleanup1;
}
token[-1].flags |= PASTE_LEFT;
- /* Give it a PREV_WHITE for -dM etc. */
- token->flags |= PREV_WHITE;
}
token = lex_expansion_token (pfile, macro);
}
+ macro->expansion = (cpp_token *) BUFF_FRONT (pfile->a_buff);
+
/* Don't count the CPP_EOF. */
macro->count--;
- /* Clear the whitespace flag from the leading token. */
- macro->expansion[0].flags &= ~PREV_WHITE;
+ /* Clear whitespace on first token for warn_of_redefinition(). */
+ if (macro->count)
+ macro->expansion[0].flags &= ~PREV_WHITE;
+
+ /* Commit the memory. */
+ BUFF_FRONT (pfile->a_buff) = (U_CHAR *) ¯o->expansion[macro->count];
/* Implement the macro-defined-to-itself optimisation. */
- macro->disabled = (macro->count == 1 && !macro->fun_like
- && macro->expansion[0].type == CPP_NAME
- && macro->expansion[0].val.node == node);
+ if (macro->count == 1 && !macro->fun_like
+ && macro->expansion[0].type == CPP_NAME
+ && macro->expansion[0].val.node == node)
+ node->flags |= NODE_DISABLED;
/* To suppress some diagnostics. */
- macro->syshdr = pfile->buffer->sysp != 0;
-
- /* Commit the memory. */
- POOL_COMMIT (&pfile->macro_pool, macro->count * sizeof (cpp_token));
+ macro->syshdr = pfile->map->sysp != 0;
if (node->type != NT_VOID)
{
- if (warn_of_redefinition (pfile, node, macro))
+ if (warn_of_redefinition (node, macro))
{
- cpp_pedwarn_with_line (pfile, pfile->directive_pos.line,
- pfile->directive_pos.col,
+ cpp_pedwarn_with_line (pfile, pfile->directive_line, 0,
"\"%s\" redefined", NODE_NAME (node));
if (node->type == NT_MACRO && !(node->flags & NODE_BUILTIN))
- cpp_pedwarn_with_file_and_line (pfile,
- node->value.macro->file,
- node->value.macro->line, 1,
+ cpp_pedwarn_with_line (pfile, node->value.macro->line, 0,
"this is the location of the previous definition");
}
_cpp_free_definition (node);
if (! ustrncmp (NODE_NAME (node), DSC ("__STDC_")))
node->flags |= NODE_WARN;
- cleanup:
+ cleanup1:
+
+ /* Set type for SEEN_EOL() in cpplib.c, restore the lexer position. */
+ saved_cur_token[-1].type = pfile->cur_token[-1].type;
+ pfile->cur_token = saved_cur_token;
+
+ cleanup2:
/* Stop the lexer accepting __VA_ARGS__. */
pfile->state.va_args_ok = 0;
return ok;
}
-/* Warn if a token in `string' matches one of the function macro
- arguments in `info'. This function assumes that the macro is a
- function macro and not an object macro. */
+/* Warn if a token in STRING matches one of a function-like MACRO's
+ parameters. */
static void
check_trad_stringification (pfile, macro, string)
cpp_reader *pfile;
&& !memcmp (p, NODE_NAME (node), len))
{
cpp_warning (pfile,
- "macro argument \"%s\" would be stringified with -traditional.",
+ "macro argument \"%s\" would be stringified with -traditional",
NODE_NAME (node));
break;
}
debugging info. e.g. "PASTE(X, Y) X ## Y", or "MACNAME EXPANSION".
Caller is expected to generate the "#define" bit if needed. The
returned text is temporary, and automatically freed later. */
-
const unsigned char *
cpp_macro_definition (pfile, node)
cpp_reader *pfile;
len = NODE_LEN (node) + 1; /* ' ' */
if (macro->fun_like)
{
- len += 3; /* "()" plus possible final "." of named
- varargs (we have + 2 below). */
+ len += 4; /* "()" plus possible final ".." of named
+ varargs (we have + 1 below). */
for (i = 0; i < macro->paramc; i++)
- len += NODE_LEN (macro->params[i]) + 2; /* ", " */
+ len += NODE_LEN (macro->params[i]) + 1; /* "," */
}
for (i = 0; i < macro->count; i++)
}
if (i + 1 < macro->paramc)
- *buffer++ = ',', *buffer++ = ' ';
+ /* Don't emit a space after the comma here; we're trying
+ to emit a Dwarf-friendly definition, and the Dwarf spec
+ forbids spaces in the argument list. */
+ *buffer++ = ',';
else if (macro->variadic)
*buffer++ = '.', *buffer++ = '.', *buffer++ = '.';
}
*buffer++ = ')';
}
+ /* The Dwarf spec requires a space after the macro name, even if the
+ definition is the empty string. */
+ *buffer++ = ' ';
+
/* Expansion tokens. */
if (macro->count)
{
- *buffer++ = ' ';
for (i = 0; i < macro->count; i++)
{
cpp_token *token = ¯o->expansion[i];
/* CPP main program, using CPP Library.
- Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001
+ Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
Written by Per Bothner, 1994-95.
cpp_get_token back into a text file. */
struct printer
{
- FILE *outf; /* stream to write to. */
- const char *last_fname; /* previous file name. */
- const char *syshdr_flags; /* system header flags, if any. */
- unsigned int lineno; /* line currently being written. */
- unsigned char printed; /* nonzero if something output at lineno. */
+ FILE *outf; /* Stream to write to. */
+ const struct line_map *map; /* Logical to physical line mappings. */
+ const cpp_token *prev; /* Previous token. */
+ const cpp_token *source; /* Source token for spacing. */
+ unsigned int line; /* Line currently being written. */
+ unsigned char printed; /* Nonzero if something output at line. */
};
int main PARAMS ((int, char **));
static void setup_callbacks PARAMS ((void));
/* General output routines. */
-static void scan_buffer PARAMS ((cpp_reader *));
-static void check_multiline_token PARAMS ((cpp_string *));
-static int printer_init PARAMS ((cpp_reader *));
+static void scan_translation_unit PARAMS ((cpp_reader *));
+static void check_multiline_token PARAMS ((const cpp_string *));
static int dump_macro PARAMS ((cpp_reader *, cpp_hashnode *, void *));
-static void print_line PARAMS ((const char *));
-static void maybe_print_line PARAMS ((unsigned int));
+static void print_line PARAMS ((const struct line_map *, unsigned int,
+ const char *));
+static void maybe_print_line PARAMS ((const struct line_map *, unsigned int));
/* Callback routines for the parser. Most of these are active only
in specific modes. */
-static void cb_define PARAMS ((cpp_reader *, cpp_hashnode *));
-static void cb_undef PARAMS ((cpp_reader *, cpp_hashnode *));
-static void cb_include PARAMS ((cpp_reader *, const unsigned char *,
- const cpp_token *));
-static void cb_ident PARAMS ((cpp_reader *, const cpp_string *));
-static void cb_file_change PARAMS ((cpp_reader *, const cpp_file_change *));
-static void cb_def_pragma PARAMS ((cpp_reader *));
+static void cb_line_change PARAMS ((cpp_reader *, const cpp_token *, int));
+static void cb_define PARAMS ((cpp_reader *, unsigned int, cpp_hashnode *));
+static void cb_undef PARAMS ((cpp_reader *, unsigned int, cpp_hashnode *));
+static void cb_include PARAMS ((cpp_reader *, unsigned int,
+ const unsigned char *, const cpp_token *));
+static void cb_ident PARAMS ((cpp_reader *, unsigned int,
+ const cpp_string *));
+static void cb_file_change PARAMS ((cpp_reader *, const struct line_map *));
+static void cb_def_pragma PARAMS ((cpp_reader *, unsigned int));
const char *progname; /* Needs to be global. */
static cpp_reader *pfile; /* An opaque handle. */
{
general_init (argv[0]);
- /* Contruct a reader with default language GNU C89. */
- pfile = cpp_create_reader (NULL, CLK_GNUC89);
+ /* Construct a reader with default language GNU C89. */
+ pfile = cpp_create_reader (CLK_GNUC89);
options = cpp_get_options (pfile);
-
+
do_preprocessing (argc, argv);
- /* Call to cpp_destroy () omitted for performance reasons. */
- if (cpp_errors (pfile))
+ if (cpp_destroy (pfile))
return FATAL_EXIT_CODE;
return SUCCESS_EXIT_CODE;
xmalloc_set_program_name (progname);
-/* LC_CTYPE determines the character set used by the terminal so it
- has to be set to output messages correctly. */
-
-#ifdef HAVE_LC_MESSAGES
- setlocale (LC_CTYPE, "");
- setlocale (LC_MESSAGES, "");
-#else
- setlocale (LC_ALL, "");
-#endif
-
- (void) bindtextdomain (PACKAGE, localedir);
- (void) textdomain (PACKAGE);
+ hex_init ();
+ gcc_init_libintl ();
}
/* Handle switches, preprocess and output. */
return;
if (argi < argc)
- cpp_fatal (pfile, "Invalid option %s", argv[argi]);
- else
- cpp_post_options (pfile);
+ {
+ cpp_fatal (pfile, "invalid option %s", argv[argi]);
+ return;
+ }
+ cpp_post_options (pfile);
if (CPP_FATAL_ERRORS (pfile))
return;
if (options->help_only)
return;
+ /* Initialize the printer structure. Setting print.line to -1 here
+ is a trick to guarantee that the first token of the file will
+ cause a linemarker to be output by maybe_print_line. */
+ print.line = (unsigned int) -1;
+ print.printed = 0;
+ print.prev = 0;
+ print.map = 0;
+
/* Open the output now. We must do so even if no_output is on,
because there may be other output than from the actual
preprocessing (e.g. from -dM). */
- if (printer_init (pfile))
- return;
+ if (options->out_fname[0] == '\0')
+ print.outf = stdout;
+ else
+ {
+ print.outf = fopen (options->out_fname, "w");
+ if (print.outf == NULL)
+ {
+ cpp_notice_from_errno (pfile, options->out_fname);
+ return;
+ }
+ }
setup_callbacks ();
- if (cpp_start_read (pfile, options->in_fname))
+ if (cpp_read_main_file (pfile, options->in_fname, NULL))
{
- /* A successful cpp_start_read guarantees that we can call
- cpp_scan_buffer_nooutput or cpp_get_token next. */
+ cpp_finish_options (pfile);
+
+ /* A successful cpp_read_main_file guarantees that we can call
+ cpp_scan_nooutput or cpp_get_token next. */
if (options->no_output)
- cpp_scan_buffer_nooutput (pfile, 1);
+ cpp_scan_nooutput (pfile);
else
- scan_buffer (pfile);
+ scan_translation_unit (pfile);
/* -dM command line option. Should this be in cpp_finish? */
if (options->dump_macros == dump_only)
if (! options->no_output)
{
- cb->ident = cb_ident;
- cb->def_pragma = cb_def_pragma;
+ cb->line_change = cb_line_change;
+ /* Don't emit #pragma or #ident directives if we are processing
+ assembly language; the assembler may choke on them. */
+ if (options->lang != CLK_ASM)
+ {
+ cb->ident = cb_ident;
+ cb->def_pragma = cb_def_pragma;
+ }
if (! options->no_line_commands)
cb->file_change = cb_file_change;
}
{
cb->define = cb_define;
cb->undef = cb_undef;
- cb->poison = cb_def_pragma;
}
}
-/* Writes out the preprocessed file. Alternates between two tokens,
- so that we can avoid accidental token pasting. */
+/* Writes out the preprocessed file, handling spacing and paste
+ avoidance issues. */
static void
-scan_buffer (pfile)
+scan_translation_unit (pfile)
cpp_reader *pfile;
{
- unsigned int index, line;
- cpp_token tokens[2], *token;
+ bool avoid_paste = false;
- do
+ print.source = NULL;
+ for (;;)
{
- for (index = 0;; index = 1 - index)
+ const cpp_token *token = cpp_get_token (pfile);
+
+ if (token->type == CPP_PADDING)
+ {
+ avoid_paste = true;
+ if (print.source == NULL
+ || (!(print.source->flags & PREV_WHITE)
+ && token->val.source == NULL))
+ print.source = token->val.source;
+ continue;
+ }
+
+ if (token->type == CPP_EOF)
+ break;
+
+ /* Subtle logic to output a space if and only if necessary. */
+ if (avoid_paste)
{
- token = &tokens[index];
- cpp_get_token (pfile, token);
-
- if (token->type == CPP_EOF)
- break;
-
- line = cpp_get_line (pfile)->output_line;
- if (print.lineno != line)
- {
- unsigned int col = cpp_get_line (pfile)->col;
-
- /* Supply enough whitespace to put this token in its original
- column. Don't bother trying to reconstruct tabs; we can't
- get it right in general, and nothing ought to care. (Yes,
- some things do care; the fault lies with them.) */
- maybe_print_line (line);
- if (col > 1)
- {
- if (token->flags & PREV_WHITE)
- col--;
- while (--col)
- putc (' ', print.outf);
- }
- }
- else if ((token->flags & (PREV_WHITE | AVOID_LPASTE))
- == AVOID_LPASTE
- && cpp_avoid_paste (pfile, &tokens[1 - index], token))
- token->flags |= PREV_WHITE;
- /* Special case '# <directive name>': insert a space between
- the # and the token. This will prevent it from being
- treated as a directive when this code is re-preprocessed.
- XXX Should do this only at the beginning of a line, but how? */
- else if (token->type == CPP_NAME && token->val.node->directive_index
- && tokens[1 - index].type == CPP_HASH)
- token->flags |= PREV_WHITE;
-
- cpp_output_token (token, print.outf);
- print.printed = 1;
- if (token->type == CPP_STRING || token->type == CPP_WSTRING
- || token->type == CPP_COMMENT
- /* SDCC _asm specific */
- || token->type == CPP_ASM)
- check_multiline_token (&token->val.str);
+ if (print.source == NULL)
+ print.source = token;
+ if (print.source->flags & PREV_WHITE
+ || (print.prev && cpp_avoid_paste (pfile, print.prev, token))
+ || (print.prev == NULL && token->type == CPP_HASH))
+ putc (' ', print.outf);
}
+ else if (token->flags & PREV_WHITE)
+ putc (' ', print.outf);
+
+ avoid_paste = false;
+ print.source = NULL;
+ print.prev = token;
+ cpp_output_token (token, print.outf);
+
+ if (token->type == CPP_STRING || token->type == CPP_WSTRING
+ || token->type == CPP_COMMENT
+ /* SDCC _asm specific */
+ || token->type == CPP_ASM)
+ check_multiline_token (&token->val.str);
}
- while (cpp_pop_buffer (pfile) != 0);
}
-/* Adjust print.lineno for newlines embedded in tokens. */
+/* Adjust print.line for newlines embedded in tokens. */
static void
check_multiline_token (str)
- cpp_string *str;
+ const cpp_string *str;
{
unsigned int i;
for (i = 0; i < str->len; i++)
if (str->text[i] == '\n')
- print.lineno++;
+ print.line++;
}
-/* Initialize a cpp_printer structure. As a side effect, open the
- output file. */
-static int
-printer_init (pfile)
- cpp_reader *pfile;
-{
- print.last_fname = 0;
- print.lineno = 0;
- print.printed = 0;
-
- if (options->out_fname[0] == '\0')
- print.outf = stdout;
- else
- {
- print.outf = fopen (options->out_fname, "w");
- if (! print.outf)
- {
- cpp_notice_from_errno (pfile, options->out_fname);
- return 1;
- }
- }
-
- return 0;
-}
-
-/* Newline-terminate any output line currently in progress. If
- appropriate, write the current line number to the output, or pad
- with newlines so the output line matches the current line. */
+/* If the token read on logical line LINE needs to be output on a
+ different line to the current one, output the required newlines or
+ a line marker, and return 1. Otherwise return 0. */
static void
-maybe_print_line (line)
+maybe_print_line (map, line)
+ const struct line_map *map;
unsigned int line;
{
- /* End the previous line of text (probably only needed until we get
- multi-line tokens fixed). */
+ /* End the previous line of text. */
if (print.printed)
{
putc ('\n', print.outf);
- print.lineno++;
+ print.line++;
print.printed = 0;
}
- if (options->no_line_commands)
- {
- print.lineno = line;
- return;
- }
-
- /* print.lineno is zero if this is the first token of the file. We
- handle this specially, so that a first line of "# 1 "foo.c" in
- file foo.i outputs just the foo.c line, and not a foo.i line. */
- if (line >= print.lineno && line < print.lineno + 8 && print.lineno)
+ if (line >= print.line && line < print.line + 8)
{
- while (line > print.lineno)
+ while (line > print.line)
{
putc ('\n', print.outf);
- print.lineno++;
+ print.line++;
}
}
else
- {
- print.lineno = line;
- print_line ("");
- }
+ print_line (map, line, "");
}
+/* Output a line marker for logical line LINE. Special flags are "1"
+ or "2" indicating entering or leaving a file. */
static void
-print_line (special_flags)
- const char *special_flags;
+print_line (map, line, special_flags)
+ const struct line_map *map;
+ unsigned int line;
+ const char *special_flags;
{
/* End any previous line of text. */
if (print.printed)
putc ('\n', print.outf);
print.printed = 0;
- fprintf (print.outf, "# %u \"%s\"%s%s\n",
- print.lineno, print.last_fname, special_flags, print.syshdr_flags);
+ print.line = line;
+ if (! options->no_line_commands)
+ {
+ size_t to_file_len = strlen (map->to_file);
+ unsigned char *to_file_quoted = alloca (to_file_len * 4 + 1);
+ unsigned char *p;
+
+ /* cpp_quote_string does not nul-terminate, so we have to do it
+ ourselves. */
+ p = cpp_quote_string (to_file_quoted,
+ (unsigned char *)map->to_file, to_file_len);
+ *p = '\0';
+ fprintf (print.outf, "# %u \"%s\"%s",
+ SOURCE_LINE (map, print.line), to_file_quoted, special_flags);
+
+ if (map->sysp == 2)
+ fputs (" 3 4", print.outf);
+ else if (map->sysp == 1)
+ fputs (" 3", print.outf);
+
+ putc ('\n', print.outf);
+ }
}
-/* Callbacks. */
+/* Called when a line of output is started. TOKEN is the first token
+ of the line, and at end of file will be CPP_EOF. */
+static void
+cb_line_change (pfile, token, parsing_args)
+ cpp_reader *pfile ATTRIBUTE_UNUSED;
+ const cpp_token *token;
+ int parsing_args;
+{
+ if (token->type == CPP_EOF || parsing_args)
+ return;
+
+ maybe_print_line (print.map, token->line);
+ print.printed = 1;
+ print.prev = 0;
+ print.source = 0;
+
+ /* Supply enough spaces to put this token in its original column,
+ one space per column greater than 2, since scan_translation_unit
+ will provide a space if PREV_WHITE. Don't bother trying to
+ reconstruct tabs; we can't get it right in general, and nothing
+ ought to care. Some things do care; the fault lies with them. */
+ if (token->col > 2)
+ {
+ unsigned int spaces = token->col - 2;
+
+ while (spaces--)
+ putc (' ', print.outf);
+ }
+}
static void
-cb_ident (pfile, str)
+cb_ident (pfile, line, str)
cpp_reader *pfile ATTRIBUTE_UNUSED;
+ unsigned int line;
const cpp_string * str;
{
- maybe_print_line (cpp_get_line (pfile)->output_line);
+ maybe_print_line (print.map, line);
fprintf (print.outf, "#ident \"%s\"\n", str->text);
- print.lineno++;
+ print.line++;
}
static void
-cb_define (pfile, node)
+cb_define (pfile, line, node)
cpp_reader *pfile;
+ unsigned int line;
cpp_hashnode *node;
{
- maybe_print_line (cpp_get_line (pfile)->output_line);
+ maybe_print_line (print.map, line);
fputs ("#define ", print.outf);
/* -dD command line option. */
fputs ((const char *) NODE_NAME (node), print.outf);
putc ('\n', print.outf);
- print.lineno++;
+ print.line++;
}
static void
-cb_undef (pfile, node)
- cpp_reader *pfile;
+cb_undef (pfile, line, node)
+ cpp_reader *pfile ATTRIBUTE_UNUSED;
+ unsigned int line;
cpp_hashnode *node;
{
- maybe_print_line (cpp_get_line (pfile)->output_line);
+ maybe_print_line (print.map, line);
fprintf (print.outf, "#undef %s\n", NODE_NAME (node));
- print.lineno++;
+ print.line++;
}
static void
-cb_include (pfile, dir, header)
- cpp_reader *pfile ATTRIBUTE_UNUSED;
+cb_include (pfile, line, dir, header)
+ cpp_reader *pfile;
+ unsigned int line;
const unsigned char *dir;
const cpp_token *header;
{
- maybe_print_line (cpp_get_line (pfile)->output_line);
+ maybe_print_line (print.map, line);
fprintf (print.outf, "#%s %s\n", dir, cpp_token_as_text (pfile, header));
- print.lineno++;
+ print.line++;
}
+/* The file name, line number or system header flags have changed, as
+ described in MAP. From this point on, the old print.map might be
+ pointing to freed memory, and so must not be dereferenced. */
+
static void
-cb_file_change (pfile, fc)
+cb_file_change (pfile, map)
cpp_reader *pfile ATTRIBUTE_UNUSED;
- const cpp_file_change *fc;
+ const struct line_map *map;
{
- /* Bring current file to correct line (except first file). */
- if (fc->reason == FC_ENTER && fc->from.filename)
- maybe_print_line (fc->from.lineno);
-
- print.last_fname = fc->to.filename;
- if (fc->externc)
- print.syshdr_flags = " 3 4";
- else if (fc->sysp)
- print.syshdr_flags = " 3";
- else
- print.syshdr_flags = "";
+ const char *flags = "";
- if (print.lineno)
+ /* First time? */
+ if (print.map == NULL)
+ {
+ /* Avoid printing foo.i when the main file is foo.c. */
+ if (!options->preprocessed)
+ print_line (map, map->from_line, flags);
+ }
+ else
{
- const char *flags = "";
+ /* Bring current file to correct line when entering a new file. */
+ if (map->reason == LC_ENTER)
+ maybe_print_line (map - 1, map->from_line - 1);
- print.lineno = fc->to.lineno;
- if (fc->reason == FC_ENTER)
+ if (map->reason == LC_ENTER)
flags = " 1";
- else if (fc->reason == FC_LEAVE)
+ else if (map->reason == LC_LEAVE)
flags = " 2";
-
- if (! options->no_line_commands)
- print_line (flags);
+ print_line (map, map->from_line, flags);
}
+
+ print.map = map;
}
+/* Copy a #pragma directive to the preprocessed output. */
static void
-cb_def_pragma (pfile)
+cb_def_pragma (pfile, line)
cpp_reader *pfile;
+ unsigned int line;
{
- maybe_print_line (cpp_get_line (pfile)->output_line);
+ maybe_print_line (print.map, line);
fputs ("#pragma ", print.outf);
cpp_output_line (pfile, print.outf);
- print.lineno++;
+ print.line++;
}
void
fputs ("#define ", print.outf);
fputs ((const char *) cpp_macro_definition (pfile, node), print.outf);
putc ('\n', print.outf);
- print.lineno++;
+ print.line++;
}
return 1;
--- /dev/null
+/* Exception Handling interface routines.
+ Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Free Software Foundation, Inc.
+ Contributed by Mike Stump <mrs@cygnus.com>.
+
+This file is part of GCC.
+
+GCC 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.
+
+GCC 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 GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+
+#ifndef GCC_VARRAY_H
+struct varray_head_tag;
+#define varray_type struct varray_head_tag *
+#endif
+
+struct function;
+
+struct inline_remap;
+
+/* Per-function EH data. Used only in except.c, but GC and others
+ manipulate pointers to the opaque type. */
+struct eh_status;
+
+/* Internal structure describing a region. */
+struct eh_region;
+
+/* Test: is exception handling turned on? */
+extern int doing_eh PARAMS ((int));
+
+/* Start an exception handling region. All instructions emitted after
+ this point are considered to be part of the region until an
+ expand_eh_region_end variant is invoked. */
+extern void expand_eh_region_start PARAMS ((void));
+
+/* End an exception handling region for a cleanup. HANDLER is an
+ expression to expand for the cleanup. */
+extern void expand_eh_region_end_cleanup PARAMS ((tree));
+
+/* End an exception handling region for a try block, and prepares
+ for subsequent calls to expand_start_catch. */
+extern void expand_start_all_catch PARAMS ((void));
+
+/* Begin a catch clause. TYPE is an object to be matched by the
+ runtime, or a list of such objects, or null if this is a catch-all
+ clause. */
+extern void expand_start_catch PARAMS ((tree));
+
+/* End a catch clause. Control will resume after the try/catch block. */
+extern void expand_end_catch PARAMS ((void));
+
+/* End a sequence of catch handlers for a try block. */
+extern void expand_end_all_catch PARAMS ((void));
+
+/* End an exception region for an exception type filter. ALLOWED is a
+ TREE_LIST of TREE_VALUE objects to be matched by the runtime.
+ FAILURE is a function to invoke if a mismatch occurs. */
+extern void expand_eh_region_end_allowed PARAMS ((tree, tree));
+
+/* End an exception region for a must-not-throw filter. FAILURE is a
+ function to invoke if an uncaught exception propagates this far. */
+extern void expand_eh_region_end_must_not_throw PARAMS ((tree));
+
+/* End an exception region for a throw. No handling goes on here,
+ but it's the easiest way for the front-end to indicate what type
+ is being thrown. */
+extern void expand_eh_region_end_throw PARAMS ((tree));
+
+/* End a fixup region. Within this region the cleanups for the immediately
+ enclosing region are _not_ run. This is used for goto cleanup to avoid
+ destroying an object twice. */
+extern void expand_eh_region_end_fixup PARAMS ((tree));
+
+/* Begin a region that will contain entries created with
+ add_partial_entry. */
+extern void begin_protect_partials PARAMS ((void));
+
+/* Create a new exception region and add the handler for the region
+ onto a list. These regions will be ended (and their handlers emitted)
+ when end_protect_partials is invoked. */
+extern void add_partial_entry PARAMS ((tree));
+
+/* End all of the pending exception regions that have handlers added with
+ add_partial_entry. */
+extern void end_protect_partials PARAMS ((void));
+
+/* Invokes CALLBACK for every exception handler label. Only used by old
+ loop hackery; should not be used by new code. */
+extern void for_each_eh_label PARAMS ((void (*) (rtx)));
+
+/* Determine if the given INSN can throw an exception. */
+extern bool can_throw_internal PARAMS ((rtx));
+extern bool can_throw_external PARAMS ((rtx));
+
+/* Return nonzero if nothing in this function can throw. */
+extern bool nothrow_function_p PARAMS ((void));
+
+/* After initial rtl generation, call back to finish generating
+ exception support code. */
+extern void finish_eh_generation PARAMS ((void));
+
+extern void init_eh PARAMS ((void));
+extern void init_eh_for_function PARAMS ((void));
+
+extern rtx reachable_handlers PARAMS ((rtx));
+extern void maybe_remove_eh_handler PARAMS ((rtx));
+
+extern void convert_from_eh_region_ranges PARAMS ((void));
+extern void convert_to_eh_region_ranges PARAMS ((void));
+extern void find_exception_handler_labels PARAMS ((void));
+extern bool current_function_has_exception_handlers PARAMS ((void));
+extern void output_function_exception_table PARAMS ((void));
+
+extern void expand_builtin_unwind_init PARAMS ((void));
+extern rtx expand_builtin_eh_return_data_regno PARAMS ((tree));
+extern rtx expand_builtin_extract_return_addr PARAMS ((tree));
+extern void expand_builtin_init_dwarf_reg_sizes PARAMS ((tree));
+extern rtx expand_builtin_frob_return_addr PARAMS ((tree));
+extern rtx expand_builtin_dwarf_fp_regnum PARAMS ((void));
+extern void expand_builtin_eh_return PARAMS ((tree, tree));
+extern void expand_eh_return PARAMS ((void));
+extern rtx get_exception_pointer PARAMS ((struct function *));
+extern int duplicate_eh_regions PARAMS ((struct function *,
+ struct inline_remap *));
+
+extern void sjlj_emit_function_exit_after PARAMS ((rtx));
+
+
+/* If non-NULL, this is a function that returns an expression to be
+ executed if an unhandled exception is propagated out of a cleanup
+ region. For example, in C++, an exception thrown by a destructor
+ during stack unwinding is required to result in a call to
+ `std::terminate', so the C++ version of this function returns a
+ CALL_EXPR for `std::terminate'. */
+extern tree (*lang_protect_cleanup_actions) PARAMS ((void));
+
+/* Return true if type A catches type B. */
+extern int (*lang_eh_type_covers) PARAMS ((tree a, tree b));
+
+/* Map a type to a runtime object to match type. */
+extern tree (*lang_eh_runtime_type) PARAMS ((tree));
+
+#ifndef GCC_VARRAY_H
+#undef varray_type
+#endif
+
+
+/* Just because the user configured --with-sjlj-exceptions=no doesn't
+ mean that we can use call frame exceptions. Detect that the target
+ has appropriate support. */
+
+#if ! (defined (EH_RETURN_DATA_REGNO) \
+ && (defined (IA64_UNWIND_INFO) \
+ || (DWARF2_UNWIND_INFO \
+ && defined (EH_RETURN_STACKADJ_RTX) \
+ && (defined (EH_RETURN_HANDLER_RTX) \
+ || defined (HAVE_eh_return)))))
+#define MUST_USE_SJLJ_EXCEPTIONS 1
+#else
+#define MUST_USE_SJLJ_EXCEPTIONS 0
+#endif
+
+#ifdef CONFIG_SJLJ_EXCEPTIONS
+# if CONFIG_SJLJ_EXCEPTIONS == 1
+# define USING_SJLJ_EXCEPTIONS 1
+# endif
+# if CONFIG_SJLJ_EXCEPTIONS == 0
+# define USING_SJLJ_EXCEPTIONS 0
+# ifndef EH_RETURN_DATA_REGNO
+ #error "EH_RETURN_DATA_REGNO required"
+# endif
+# ifndef EH_RETURN_STACKADJ_RTX
+ #error "EH_RETURN_STACKADJ_RTX required"
+# endif
+# if !defined(EH_RETURN_HANDLER_RTX) && !defined(HAVE_eh_return)
+ #error "EH_RETURN_HANDLER_RTX or eh_return required"
+# endif
+# if !defined(DWARF2_UNWIND_INFO) && !defined(IA64_UNWIND_INFO)
+ #error "{DWARF2,IA64}_UNWIND_INFO required"
+# endif
+# endif
+#else
+# define USING_SJLJ_EXCEPTIONS MUST_USE_SJLJ_EXCEPTIONS
+#endif
return table;
}
+/* Frees all memory associated with a hash table. */
+
+void
+ht_destroy (table)
+ hash_table *table;
+{
+ obstack_free (&table->stack, NULL);
+ free (table->entries);
+ free (table);
+}
+
/* Returns the hash entry for the a STR of length LEN. If that string
already exists in the table, returns the existing entry, and, if
INSERT is CPP_ALLOCED, frees the last obstack object. If the
HT_LEN (node) = len;
if (insert == HT_ALLOC)
- HT_STR (node) = obstack_copy (&table->stack, str, len + 1);
+ HT_STR (node) = obstack_copy0 (&table->stack, str, len);
else
HT_STR (node) = str;
nids++;
}
while (++p < limit);
-
+
nelts = table->nelements;
overhead = obstack_memory_used (&table->stack) - total_bytes;
headers = table->nslots * sizeof (hashnode);
};
extern void gcc_obstack_init PARAMS ((struct obstack *));
+
/* Initialise the hashtable with 2 ^ order entries. */
extern hash_table *ht_create PARAMS ((unsigned int order));
+
+/* Frees all memory associated with a hash table. */
+extern void ht_destroy PARAMS ((hash_table *));
+
extern hashnode ht_lookup PARAMS ((hash_table *, const unsigned char *,
unsigned int, enum ht_lookup_option));
/* HOST_WIDE_INT definitions for the GNU compiler.
Copyright (C) 1998 Free Software Foundation, Inc.
- This file is part of GNU CC.
+ This file is part of GCC.
Provide definitions for macros which depend on HOST_BITS_PER_INT
- and HOST_BITS_PER_LONG. */
+ and HOST_BITS_PER_LONG. */
#ifndef GCC_HWINT_H
#define GCC_HWINT_H
#ifdef HAVE_LONG_LONG
# define HOST_BITS_PER_LONGLONG (CHAR_BIT * SIZEOF_LONG_LONG)
#else
+#ifdef HAVE___INT64
+# define HOST_BITS_PER_LONGLONG (CHAR_BIT * SIZEOF___INT64)
+#else
/* If we're here and we're GCC, assume this is stage 2+ of a bootstrap
and 'long long' has the width of the *target*'s long long. */
# if GCC_VERSION > 3000
# define HOST_BITS_PER_LONGLONG LONG_LONG_TYPE_SIZE
# endif /* gcc */
+#endif
#endif /* no long long */
/* Find the largest host integer type and set its size and type. */
+++ /dev/null
-/* intl.c - internationalization */
-
-#include "auto-host.h"
-#include "ansidecl.h"
-#include "intl.h"
-
-const char localedir[] = LOCALEDIR;
/* intl.h - internationalization
- Copyright 1998 Free Software Foundation, Inc.
+ Copyright 1998, 2001 Free Software Foundation, Inc.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
- 02111-1307, USA. */
+ 02111-1307, USA. */
+
+#ifndef GCC_INTL_H
+#define GCC_INTL_H
#ifdef HAVE_LOCALE_H
# include <locale.h>
# define setlocale(category, locale) (locale)
#endif
-#ifdef ENABLE_NLS
-# include <libintl.h>
- extern const char localedir[];
+#ifdef USE_INCLUDED_LIBINTL
+# include <intl/libgnuintl.h>
#else
-/* Stubs that do something close enough. */
-# ifdef textdomain
-# undef textdomain
+# ifdef HAVE_LIBINTL_H
+# include <libintl.h>
+# else
+# undef ENABLE_NLS
# endif
+#endif
+
+#ifdef ENABLE_NLS
+extern void gcc_init_libintl PARAMS ((void));
+#else
+/* Stubs. */
+# undef textdomain
# define textdomain(domain) (domain)
-# ifdef bindtextdomain
-# undef bindtextdomain
-# endif
+# undef bindtextdomain
# define bindtextdomain(domain, directory) (domain)
-# ifdef gettext
-# undef gettext
-# endif
+# undef gettext
# define gettext(msgid) (msgid)
+# define gcc_init_libintl() /* nothing */
#endif
#ifndef _
#ifndef N_
# define N_(msgid) (msgid)
#endif
+
+#endif /* intl.h */
-/* nada */
+/* Function declarations for libiberty.
+
+ Copyright 2001, 2002, 2005 Free Software Foundation, Inc.
+
+ Note - certain prototypes declared in this header file are for
+ functions whoes implementation copyright does not belong to the
+ FSF. Those prototypes are present in this file for reference
+ purposes only and their presence in this file should not construed
+ as an indication of ownership by the FSF of the implementation of
+ those functions in any way or form whatsoever.
+
+ 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 Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program 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 this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+ Written by Cygnus Support, 1994.
+
+ The libiberty library provides a number of functions which are
+ missing on some operating systems. We do not declare those here,
+ to avoid conflicts with the system header files on operating
+ systems that do support those functions. In this file we only
+ declare those functions which are specific to libiberty. */
+
+#ifndef LIBIBERTY_H
+#define LIBIBERTY_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "ansidecl.h"
+
+/* Get a definition for size_t. */
+#include <stddef.h>
+/* Get a definition for va_list. */
+#include <stdarg.h>
+
+#include <stdio.h>
+
+/* If the OS supports it, ensure that the supplied stream is setup to
+ avoid any multi-threaded locking. Otherwise leave the FILE pointer
+ unchanged. If the stream is NULL do nothing. */
+
+extern void unlock_stream (FILE *);
+
+/* If the OS supports it, ensure that the standard I/O streams, stdin,
+ stdout and stderr are setup to avoid any multi-threaded locking.
+ Otherwise do nothing. */
+
+extern void unlock_std_streams (void);
+
+/* Open and return a FILE pointer. If the OS supports it, ensure that
+ the stream is setup to avoid any multi-threaded locking. Otherwise
+ return the FILE pointer unchanged. */
+
+extern FILE *fopen_unlocked (const char *, const char *);
+extern FILE *fdopen_unlocked (int, const char *);
+extern FILE *freopen_unlocked (const char *, const char *, FILE *);
+
+/* Build an argument vector from a string. Allocates memory using
+ malloc. Use freeargv to free the vector. */
+
+extern char **buildargv (const char *) ATTRIBUTE_MALLOC;
+
+/* Free a vector returned by buildargv. */
+
+extern void freeargv (char **);
+
+/* Duplicate an argument vector. Allocates memory using malloc. Use
+ freeargv to free the vector. */
+
+extern char **dupargv (char **) ATTRIBUTE_MALLOC;
+
+/* Expand "@file" arguments in argv. */
+
+extern void expandargv PARAMS ((int *, char ***));
+
+/* Return the last component of a path name. Note that we can't use a
+ prototype here because the parameter is declared inconsistently
+ across different systems, sometimes as "char *" and sometimes as
+ "const char *" */
+
+/* HAVE_DECL_* is a three-state macro: undefined, 0 or 1. If it is
+ undefined, we haven't run the autoconf check so provide the
+ declaration without arguments. If it is 0, we checked and failed
+ to find the declaration so provide a fully prototyped one. If it
+ is 1, we found it so don't provide any declaration at all. */
+#if !HAVE_DECL_BASENAME
+#if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined (__FreeBSD__) || defined (__OpenBSD__) || defined(__NetBSD__) || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) || defined (HAVE_DECL_BASENAME)
+extern char *basename (const char *);
+#else
+/* Do not allow basename to be used if there is no prototype seen. We
+ either need to use the above prototype or have one from
+ autoconf which would result in HAVE_DECL_BASENAME being set. */
+#define basename basename_cannot_be_used_without_a_prototype
+#endif
+#endif
+
+/* A well-defined basename () that is always compiled in. */
+
+extern const char *lbasename (const char *);
+
+/* A well-defined realpath () that is always compiled in. */
+
+extern char *lrealpath (const char *);
+
+/* Concatenate an arbitrary number of strings. You must pass NULL as
+ the last argument of this function, to terminate the list of
+ strings. Allocates memory using xmalloc. */
+
+extern char *concat (const char *, ...) ATTRIBUTE_MALLOC ATTRIBUTE_SENTINEL;
+
+/* Concatenate an arbitrary number of strings. You must pass NULL as
+ the last argument of this function, to terminate the list of
+ strings. Allocates memory using xmalloc. The first argument is
+ not one of the strings to be concatenated, but if not NULL is a
+ pointer to be freed after the new string is created, similar to the
+ way xrealloc works. */
+
+extern char *reconcat (char *, const char *, ...) ATTRIBUTE_MALLOC ATTRIBUTE_SENTINEL;
+
+/* Determine the length of concatenating an arbitrary number of
+ strings. You must pass NULL as the last argument of this function,
+ to terminate the list of strings. */
+
+extern unsigned long concat_length (const char *, ...) ATTRIBUTE_SENTINEL;
+
+/* Concatenate an arbitrary number of strings into a SUPPLIED area of
+ memory. You must pass NULL as the last argument of this function,
+ to terminate the list of strings. The supplied memory is assumed
+ to be large enough. */
+
+extern char *concat_copy (char *, const char *, ...) ATTRIBUTE_SENTINEL;
+
+/* Concatenate an arbitrary number of strings into a GLOBAL area of
+ memory. You must pass NULL as the last argument of this function,
+ to terminate the list of strings. The supplied memory is assumed
+ to be large enough. */
+
+extern char *concat_copy2 (const char *, ...) ATTRIBUTE_SENTINEL;
+
+/* This is the global area used by concat_copy2. */
+
+extern char *libiberty_concat_ptr;
+
+/* Concatenate an arbitrary number of strings. You must pass NULL as
+ the last argument of this function, to terminate the list of
+ strings. Allocates memory using alloca. The arguments are
+ evaluated twice! */
+#define ACONCAT(ACONCAT_PARAMS) \
+ (libiberty_concat_ptr = (char *) alloca (concat_length ACONCAT_PARAMS + 1), \
+ concat_copy2 ACONCAT_PARAMS)
+
+/* Check whether two file descriptors refer to the same file. */
+
+extern int fdmatch (int fd1, int fd2);
+
+/* Return the position of the first bit set in the argument. */
+/* Prototypes vary from system to system, so we only provide a
+ prototype on systems where we know that we need it. */
+#if defined (HAVE_DECL_FFS) && !HAVE_DECL_FFS
+extern int ffs(int);
+#endif
+
+/* Get the working directory. The result is cached, so don't call
+ chdir() between calls to getpwd(). */
+
+extern char * getpwd (void);
+
+/* Get the current time. */
+/* Prototypes vary from system to system, so we only provide a
+ prototype on systems where we know that we need it. */
+#ifdef __MINGW32__
+/* Forward declaration to avoid #include <sys/time.h>. */
+struct timeval;
+extern int gettimeofday (struct timeval *, void *);
+#endif
+
+/* Get the amount of time the process has run, in microseconds. */
+
+extern long get_run_time (void);
+
+/* Generate a relocated path to some installation directory. Allocates
+ return value using malloc. */
+
+extern char *make_relative_prefix (const char *, const char *,
+ const char *) ATTRIBUTE_MALLOC;
+
+/* Choose a temporary directory to use for scratch files. */
+
+extern char *choose_temp_base (void) ATTRIBUTE_MALLOC;
+
+/* Return a temporary file name or NULL if unable to create one. */
+
+extern char *make_temp_file (const char *) ATTRIBUTE_MALLOC;
+
+/* Remove a link to a file unless it is special. */
+
+extern int unlink_if_ordinary (const char *);
+
+/* Allocate memory filled with spaces. Allocates using malloc. */
+
+extern const char *spaces (int count);
+
+/* Return the maximum error number for which strerror will return a
+ string. */
+
+extern int errno_max (void);
+
+/* Return the name of an errno value (e.g., strerrno (EINVAL) returns
+ "EINVAL"). */
+
+extern const char *strerrno (int);
+
+/* Given the name of an errno value, return the value. */
+
+extern int strtoerrno (const char *);
+
+/* ANSI's strerror(), but more robust. */
+
+extern char *xstrerror (int);
+
+/* Return the maximum signal number for which strsignal will return a
+ string. */
+
+extern int signo_max (void);
+
+/* Return a signal message string for a signal number
+ (e.g., strsignal (SIGHUP) returns something like "Hangup"). */
+/* This is commented out as it can conflict with one in system headers.
+ We still document its existence though. */
+
+/*extern const char *strsignal (int);*/
+
+/* Return the name of a signal number (e.g., strsigno (SIGHUP) returns
+ "SIGHUP"). */
+
+extern const char *strsigno (int);
+
+/* Given the name of a signal, return its number. */
+
+extern int strtosigno (const char *);
+
+/* Register a function to be run by xexit. Returns 0 on success. */
+
+extern int xatexit (void (*fn) (void));
+
+/* Exit, calling all the functions registered with xatexit. */
+
+extern void xexit (int status) ATTRIBUTE_NORETURN;
+
+#if 0 /* SDCC specific */
+/* Set the program name used by xmalloc. */
+
+extern void xmalloc_set_program_name (const char *);
+#endif
+
+/* Report an allocation failure. */
+extern void xmalloc_failed (size_t) ATTRIBUTE_NORETURN;
+
+/* Allocate memory without fail. If malloc fails, this will print a
+ message to stderr (using the name set by xmalloc_set_program_name,
+ if any) and then call xexit. */
+
+extern void *xmalloc (size_t) ATTRIBUTE_MALLOC;
+
+/* Reallocate memory without fail. This works like xmalloc. Note,
+ realloc type functions are not suitable for attribute malloc since
+ they may return the same address across multiple calls. */
+
+extern void *xrealloc (void *, size_t);
+
+/* Allocate memory without fail and set it to zero. This works like
+ xmalloc. */
+
+extern void *xcalloc (size_t, size_t) ATTRIBUTE_MALLOC;
+
+/* Copy a string into a memory buffer without fail. */
+
+extern char *xstrdup (const char *) ATTRIBUTE_MALLOC;
+
+/* Copy at most N characters from string into a buffer without fail. */
+
+extern char *xstrndup (const char *, size_t) ATTRIBUTE_MALLOC;
+
+/* Copy an existing memory buffer to a new memory buffer without fail. */
+
+extern void *xmemdup (const void *, size_t, size_t) ATTRIBUTE_MALLOC;
+
+/* Physical memory routines. Return values are in BYTES. */
+extern double physmem_total (void);
+extern double physmem_available (void);
+
+
+/* These macros provide a K&R/C89/C++-friendly way of allocating structures
+ with nice encapsulation. The XDELETE*() macros are technically
+ superfluous, but provided here for symmetry. Using them consistently
+ makes it easier to update client code to use different allocators such
+ as new/delete and new[]/delete[]. */
+
+/* Scalar allocators. */
+
+#define XNEW(T) ((T *) xmalloc (sizeof (T)))
+#define XCNEW(T) ((T *) xcalloc (1, sizeof (T)))
+#define XDELETE(P) free ((void*) (P))
+
+/* Array allocators. */
+
+#define XNEWVEC(T, N) ((T *) xmalloc (sizeof (T) * (N)))
+#define XCNEWVEC(T, N) ((T *) xcalloc ((N), sizeof (T)))
+#define XRESIZEVEC(T, P, N) ((T *) xrealloc ((void *) (P), sizeof (T) * (N)))
+#define XDELETEVEC(P) free ((void*) (P))
+
+/* Allocators for variable-sized structures and raw buffers. */
+
+#define XNEWVAR(T, S) ((T *) xmalloc ((S)))
+#define XCNEWVAR(T, S) ((T *) xcalloc (1, (S)))
+#define XRESIZEVAR(T, P, S) ((T *) xrealloc ((P), (S)))
+
+/* Type-safe obstack allocator. */
+
+#define XOBNEW(O, T) ((T *) obstack_alloc ((O), sizeof (T)))
+#define XOBFINISH(O, T) ((T) obstack_finish ((O)))
+
+/* hex character manipulation routines */
+
+#define _hex_array_size 256
+#define _hex_bad 99
+extern const unsigned char _hex_value[_hex_array_size];
+extern void hex_init (void);
+#define hex_p(c) (hex_value (c) != _hex_bad)
+/* If you change this, note well: Some code relies on side effects in
+ the argument being performed exactly once. */
+#define hex_value(c) ((unsigned int) _hex_value[(unsigned char) (c)])
+
+/* Flags for pex_init. These are bits to be or'ed together. */
+
+/* Record subprocess times, if possible. */
+#define PEX_RECORD_TIMES 0x1
+
+/* Use pipes for communication between processes, if possible. */
+#define PEX_USE_PIPES 0x2
+
+/* Save files used for communication between processes. */
+#define PEX_SAVE_TEMPS 0x4
+
+/* Prepare to execute one or more programs, with standard output of
+ each program fed to standard input of the next.
+ FLAGS As above.
+ PNAME The name of the program to report in error messages.
+ TEMPBASE A base name to use for temporary files; may be NULL to
+ use a random name.
+ Returns NULL on error. */
+
+extern struct pex_obj *pex_init (int flags, const char *pname,
+ const char *tempbase);
+
+/* Flags for pex_run. These are bits to be or'ed together. */
+
+/* Last program in pipeline. Standard output of program goes to
+ OUTNAME, or, if OUTNAME is NULL, to standard output of caller. Do
+ not set this if you want to call pex_read_output. After this is
+ set, pex_run may no longer be called with the same struct
+ pex_obj. */
+#define PEX_LAST 0x1
+
+/* Search for program in executable search path. */
+#define PEX_SEARCH 0x2
+
+/* OUTNAME is a suffix. */
+#define PEX_SUFFIX 0x4
+
+/* Send program's standard error to standard output. */
+#define PEX_STDERR_TO_STDOUT 0x8
+
+/* Input file should be opened in binary mode. This flag is ignored
+ on Unix. */
+#define PEX_BINARY_INPUT 0x10
+
+/* Output file should be opened in binary mode. This flag is ignored
+ on Unix. For proper behaviour PEX_BINARY_INPUT and
+ PEX_BINARY_OUTPUT have to match appropriately--i.e., a call using
+ PEX_BINARY_OUTPUT should be followed by a call using
+ PEX_BINARY_INPUT. */
+#define PEX_BINARY_OUTPUT 0x20
+
+/* Execute one program. Returns NULL on success. On error returns an
+ error string (typically just the name of a system call); the error
+ string is statically allocated.
+
+ OBJ Returned by pex_init.
+
+ FLAGS As above.
+
+ EXECUTABLE The program to execute.
+
+ ARGV NULL terminated array of arguments to pass to the program.
+
+ OUTNAME Sets the output file name as follows:
+
+ PEX_SUFFIX set (OUTNAME may not be NULL):
+ TEMPBASE parameter to pex_init not NULL:
+ Output file name is the concatenation of TEMPBASE
+ and OUTNAME.
+ TEMPBASE is NULL:
+ Output file name is a random file name ending in
+ OUTNAME.
+ PEX_SUFFIX not set:
+ OUTNAME not NULL:
+ Output file name is OUTNAME.
+ OUTNAME NULL, TEMPBASE not NULL:
+ Output file name is randomly chosen using
+ TEMPBASE.
+ OUTNAME NULL, TEMPBASE NULL:
+ Output file name is randomly chosen.
+
+ If PEX_LAST is not set, the output file name is the
+ name to use for a temporary file holding stdout, if
+ any (there will not be a file if PEX_USE_PIPES is set
+ and the system supports pipes). If a file is used, it
+ will be removed when no longer needed unless
+ PEX_SAVE_TEMPS is set.
+
+ If PEX_LAST is set, and OUTNAME is not NULL, standard
+ output is written to the output file name. The file
+ will not be removed. If PEX_LAST and PEX_SUFFIX are
+ both set, TEMPBASE may not be NULL.
+
+ ERRNAME If not NULL, this is the name of a file to which
+ standard error is written. If NULL, standard error of
+ the program is standard error of the caller.
+
+ ERR On an error return, *ERR is set to an errno value, or
+ to 0 if there is no relevant errno.
+*/
+
+extern const char *pex_run (struct pex_obj *obj, int flags,
+ const char *executable, char * const *argv,
+ const char *outname, const char *errname,
+ int *err);
+
+/* As for pex_run (), but takes an extra parameter to enable the
+ environment for the child process to be specified.
+
+ ENV The environment for the child process, specified as
+ an array of character pointers. Each element of the
+ array should point to a string of the form VAR=VALUE,
+ with the exception of the last element which must be
+ a null pointer.
+*/
+
+extern const char *pex_run_in_environment (struct pex_obj *obj, int flags,
+ const char *executable,
+ char * const *argv,
+ char * const *env,
+ const char *outname,
+ const char *errname, int *err);
+
+/* Return a `FILE' pointer FP for the standard input of the first
+ program in the pipeline; FP is opened for writing. You must have
+ passed `PEX_USE_PIPES' to the `pex_init' call that returned OBJ.
+ You must close FP yourself with `fclose' to indicate that the
+ pipeline's input is complete.
+
+ The file descriptor underlying FP is marked not to be inherited by
+ child processes.
+
+ This call is not supported on systems which do not support pipes;
+ it returns with an error. (We could implement it by writing a
+ temporary file, but then you would need to write all your data and
+ close FP before your first call to `pex_run' -- and that wouldn't
+ work on systems that do support pipes: the pipe would fill up, and
+ you would block. So there isn't any easy way to conceal the
+ differences between the two types of systems.)
+
+ If you call both `pex_write_input' and `pex_read_output', be
+ careful to avoid deadlock. If the output pipe fills up, so that
+ each program in the pipeline is waiting for the next to read more
+ data, and you fill the input pipe by writing more data to FP, then
+ there is no way to make progress: the only process that could read
+ data from the output pipe is you, but you are blocked on the input
+ pipe. */
+
+extern FILE *pex_write_input (struct pex_obj *obj, int binary);
+
+/* Return a stream for a temporary file to pass to the first program
+ in the pipeline as input. The file name is chosen as for pex_run.
+ pex_run closes the file automatically; don't close it yourself. */
+
+extern FILE *pex_input_file (struct pex_obj *obj, int flags,
+ const char *in_name);
+
+/* Return a stream for a pipe connected to the standard input of the
+ first program in the pipeline. You must have passed
+ `PEX_USE_PIPES' to `pex_init'. Close the returned stream
+ yourself. */
+
+extern FILE *pex_input_pipe (struct pex_obj *obj, int binary);
+
+/* Read the standard output of the last program to be executed.
+ pex_run can not be called after this. BINARY should be non-zero if
+ the file should be opened in binary mode; this is ignored on Unix.
+ Returns NULL on error. Don't call fclose on the returned FILE; it
+ will be closed by pex_free. */
+
+extern FILE *pex_read_output (struct pex_obj *, int binary);
+
+/* Return exit status of all programs in VECTOR. COUNT indicates the
+ size of VECTOR. The status codes in the vector are in the order of
+ the calls to pex_run. Returns 0 on error, 1 on success. */
+
+extern int pex_get_status (struct pex_obj *, int count, int *vector);
+
+/* Return times of all programs in VECTOR. COUNT indicates the size
+ of VECTOR. struct pex_time is really just struct timeval, but that
+ is not portable to all systems. Returns 0 on error, 1 on
+ success. */
+
+struct pex_time
+{
+ unsigned long user_seconds;
+ unsigned long user_microseconds;
+ unsigned long system_seconds;
+ unsigned long system_microseconds;
+};
+
+extern int pex_get_times (struct pex_obj *, int count,
+ struct pex_time *vector);
+
+/* Clean up a pex_obj. */
+
+extern void pex_free (struct pex_obj *);
+
+/* Just execute one program. Return value is as for pex_run.
+ FLAGS Combination of PEX_SEARCH and PEX_STDERR_TO_STDOUT.
+ EXECUTABLE As for pex_run.
+ ARGV As for pex_run.
+ PNAME As for pex_init.
+ OUTNAME As for pex_run when PEX_LAST is set.
+ ERRNAME As for pex_run.
+ STATUS Set to exit status on success.
+ ERR As for pex_run.
+*/
+
+extern const char *pex_one (int flags, const char *executable,
+ char * const *argv, const char *pname,
+ const char *outname, const char *errname,
+ int *status, int *err);
+
+/* pexecute and pwait are the old pexecute interface, still here for
+ backward compatibility. Don't use these for new code. Instead,
+ use pex_init/pex_run/pex_get_status/pex_free, or pex_one. */
+
+/* Definitions used by the pexecute routine. */
+
+#define PEXECUTE_FIRST 1
+#define PEXECUTE_LAST 2
+#define PEXECUTE_ONE (PEXECUTE_FIRST + PEXECUTE_LAST)
+#define PEXECUTE_SEARCH 4
+#define PEXECUTE_VERBOSE 8
+
+/* Execute a program. */
+
+extern int pexecute (const char *, char * const *, const char *,
+ const char *, char **, char **, int);
+
+/* Wait for pexecute to finish. */
+
+extern int pwait (int, int *, int);
+
+#if !HAVE_DECL_ASPRINTF
+/* Like sprintf but provides a pointer to malloc'd storage, which must
+ be freed by the caller. */
+
+extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2;
+#endif
+
+#if !HAVE_DECL_VASPRINTF
+/* Like vsprintf but provides a pointer to malloc'd storage, which
+ must be freed by the caller. */
+
+extern int vasprintf (char **, const char *, va_list) ATTRIBUTE_PRINTF(2,0);
+#endif
+
+#if defined(HAVE_DECL_SNPRINTF) && !HAVE_DECL_SNPRINTF
+/* Like sprintf but prints at most N characters. */
+extern int snprintf (char *, size_t, const char *, ...) ATTRIBUTE_PRINTF_3;
+#endif
+
+#if defined(HAVE_DECL_VSNPRINTF) && !HAVE_DECL_VSNPRINTF
+/* Like vsprintf but prints at most N characters. */
+extern int vsnprintf (char *, size_t, const char *, va_list) ATTRIBUTE_PRINTF(3,0);
+#endif
+
+#if defined(HAVE_DECL_STRVERSCMP) && !HAVE_DECL_STRVERSCMP
+/* Compare version strings. */
+extern int strverscmp (const char *, const char *);
+#endif
+
+#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
+
+#ifndef _WIN32
+/* Drastically simplified alloca configurator. If we're using GCC,
+ we use __builtin_alloca; otherwise we use the C alloca. The C
+ alloca is always available. You can override GCC by defining
+ USE_C_ALLOCA yourself. The canonical autoconf macro C_ALLOCA is
+ also set/unset as it is often used to indicate whether code needs
+ to call alloca(0). */
+extern void *C_alloca (size_t) ATTRIBUTE_MALLOC;
+#undef alloca
+#if GCC_VERSION >= 2000 && !defined USE_C_ALLOCA
+# define alloca(x) __builtin_alloca(x)
+# undef C_ALLOCA
+# define ASTRDUP(X) \
+ (__extension__ ({ const char *const libiberty_optr = (X); \
+ const unsigned long libiberty_len = strlen (libiberty_optr) + 1; \
+ char *const libiberty_nptr = (char *const) alloca (libiberty_len); \
+ (char *) memcpy (libiberty_nptr, libiberty_optr, libiberty_len); }))
+#else
+# define alloca(x) C_alloca(x)
+# undef USE_C_ALLOCA
+# define USE_C_ALLOCA 1
+# undef C_ALLOCA
+# define C_ALLOCA 1
+extern const char *libiberty_optr;
+extern char *libiberty_nptr;
+extern unsigned long libiberty_len;
+# define ASTRDUP(X) \
+ (libiberty_optr = (X), \
+ libiberty_len = strlen (libiberty_optr) + 1, \
+ libiberty_nptr = (char *) alloca (libiberty_len), \
+ (char *) memcpy (libiberty_nptr, libiberty_optr, libiberty_len))
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* ! defined (LIBIBERTY_H) */
--- /dev/null
+/* Concatenate variable number of strings.
+ Copyright (C) 1991, 1994, 2001 Free Software Foundation, Inc.
+ Written by Fred Fish @ Cygnus Support
+
+This file is part of the libiberty library.
+Libiberty is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+Libiberty 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with libiberty; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
+Boston, MA 02110-1301, USA. */
+
+
+/*
+
+@deftypefn Extension char* concat (const char *@var{s1}, const char *@var{s2}, @dots{}, @code{NULL})
+
+Concatenate zero or more of strings and return the result in freshly
+@code{xmalloc}ed memory. Returns @code{NULL} if insufficient memory is
+available. The argument list is terminated by the first @code{NULL}
+pointer encountered. Pointers to empty strings are ignored.
+
+@end deftypefn
+
+NOTES
+
+ This function uses xmalloc() which is expected to be a front end
+ function to malloc() that deals with low memory situations. In
+ typical use, if malloc() returns NULL then xmalloc() diverts to an
+ error handler routine which never returns, and thus xmalloc will
+ never return a NULL pointer. If the client application wishes to
+ deal with low memory situations itself, it should supply an xmalloc
+ that just directly invokes malloc and blindly returns whatever
+ malloc returns.
+
+*/
+
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include "ansidecl.h"
+#include "libiberty.h"
+#include <sys/types.h> /* size_t */
+
+#include <stdarg.h>
+
+# if HAVE_STRING_H
+# include <string.h>
+# else
+# if HAVE_STRINGS_H
+# include <strings.h>
+# endif
+# endif
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+static inline unsigned long vconcat_length (const char *, va_list);
+static inline unsigned long
+vconcat_length (const char *first, va_list args)
+{
+ unsigned long length = 0;
+ const char *arg;
+
+ for (arg = first; arg ; arg = va_arg (args, const char *))
+ length += strlen (arg);
+
+ return length;
+}
+
+static inline char *
+vconcat_copy (char *dst, const char *first, va_list args)
+{
+ char *end = dst;
+ const char *arg;
+
+ for (arg = first; arg ; arg = va_arg (args, const char *))
+ {
+ unsigned long length = strlen (arg);
+ memcpy (end, arg, length);
+ end += length;
+ }
+ *end = '\000';
+
+ return dst;
+}
+
+/* @undocumented concat_length */
+
+unsigned long
+concat_length (const char *first, ...)
+{
+ unsigned long length;
+
+ VA_OPEN (args, first);
+ VA_FIXEDARG (args, const char *, first);
+ length = vconcat_length (first, args);
+ VA_CLOSE (args);
+
+ return length;
+}
+
+/* @undocumented concat_copy */
+
+char *
+concat_copy (char *dst, const char *first, ...)
+{
+ char *save_dst;
+
+ VA_OPEN (args, first);
+ VA_FIXEDARG (args, char *, dst);
+ VA_FIXEDARG (args, const char *, first);
+ vconcat_copy (dst, first, args);
+ save_dst = dst; /* With K&R C, dst goes out of scope here. */
+ VA_CLOSE (args);
+
+ return save_dst;
+}
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+char *libiberty_concat_ptr;
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+/* @undocumented concat_copy2 */
+
+char *
+concat_copy2 (const char *first, ...)
+{
+ VA_OPEN (args, first);
+ VA_FIXEDARG (args, const char *, first);
+ vconcat_copy (libiberty_concat_ptr, first, args);
+ VA_CLOSE (args);
+
+ return libiberty_concat_ptr;
+}
+
+char *
+concat (const char *first, ...)
+{
+ char *newstr;
+
+ /* First compute the size of the result and get sufficient memory. */
+ VA_OPEN (args, first);
+ VA_FIXEDARG (args, const char *, first);
+ newstr = XNEWVEC (char, vconcat_length (first, args) + 1);
+ VA_CLOSE (args);
+
+ /* Now copy the individual pieces to the result string. */
+ VA_OPEN (args, first);
+ VA_FIXEDARG (args, const char *, first);
+ vconcat_copy (newstr, first, args);
+ VA_CLOSE (args);
+
+ return newstr;
+}
+
+/*
+
+@deftypefn Extension char* reconcat (char *@var{optr}, const char *@var{s1}, @dots{}, @code{NULL})
+
+Same as @code{concat}, except that if @var{optr} is not @code{NULL} it
+is freed after the string is created. This is intended to be useful
+when you're extending an existing string or building up a string in a
+loop:
+
+@example
+ str = reconcat (str, "pre-", str, NULL);
+@end example
+
+@end deftypefn
+
+*/
+
+char *
+reconcat (char *optr, const char *first, ...)
+{
+ char *newstr;
+
+ /* First compute the size of the result and get sufficient memory. */
+ VA_OPEN (args, first);
+ VA_FIXEDARG (args, char *, optr);
+ VA_FIXEDARG (args, const char *, first);
+ newstr = XNEWVEC (char, vconcat_length (first, args) + 1);
+ VA_CLOSE (args);
+
+ /* Now copy the individual pieces to the result string. */
+ VA_OPEN (args, first);
+ VA_FIXEDARG (args, char *, optr);
+ VA_FIXEDARG (args, const char *, first);
+ vconcat_copy (newstr, first, args);
+ if (optr) /* Done before VA_CLOSE so optr stays in scope for K&R C. */
+ free (optr);
+ VA_CLOSE (args);
+
+ return newstr;
+}
+
+#ifdef MAIN
+#define NULLP (char *)0
+
+/* Simple little test driver. */
+
+#include <stdio.h>
+
+int
+main (void)
+{
+ printf ("\"\" = \"%s\"\n", concat (NULLP));
+ printf ("\"a\" = \"%s\"\n", concat ("a", NULLP));
+ printf ("\"ab\" = \"%s\"\n", concat ("a", "b", NULLP));
+ printf ("\"abc\" = \"%s\"\n", concat ("a", "b", "c", NULLP));
+ printf ("\"abcd\" = \"%s\"\n", concat ("ab", "cd", NULLP));
+ printf ("\"abcde\" = \"%s\"\n", concat ("ab", "c", "de", NULLP));
+ printf ("\"abcdef\" = \"%s\"\n", concat ("", "a", "", "bcd", "ef", NULLP));
+ return 0;
+}
+
+#endif
--- /dev/null
+/* Macros for taking apart, interpreting and processing file names.
+
+ These are here because some non-Posix (a.k.a. DOSish) systems have
+ drive letter brain-damage at the beginning of an absolute file name,
+ use forward- and back-slash in path names interchangeably, and
+ some of them have case-insensitive file names.
+
+ Copyright 2000, 2001 Free Software Foundation, Inc.
+
+This file is part of BFD, the Binary File Descriptor library.
+
+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 Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifndef FILENAMES_H
+#define FILENAMES_H
+
+#if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) || defined (__CYGWIN__)
+
+#ifndef HAVE_DOS_BASED_FILE_SYSTEM
+#define HAVE_DOS_BASED_FILE_SYSTEM 1
+#endif
+
+#define IS_DIR_SEPARATOR(c) ((c) == '/' || (c) == '\\')
+/* Note that IS_ABSOLUTE_PATH accepts d:foo as well, although it is
+ only semi-absolute. This is because the users of IS_ABSOLUTE_PATH
+ want to know whether to prepend the current working directory to
+ a file name, which should not be done with a name like d:foo. */
+#define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]) || (((f)[0]) && ((f)[1] == ':')))
+#define FILENAME_CMP(s1, s2) strcasecmp(s1, s2)
+
+#else /* not DOSish */
+
+#define IS_DIR_SEPARATOR(c) ((c) == '/')
+#define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]))
+#define FILENAME_CMP(s1, s2) strcmp(s1, s2)
+
+#endif /* not DOSish */
+
+#endif /* FILENAMES_H */
--- /dev/null
+/* Hex character manipulation support.
+ Copyright (C) 1995, 2001 Free Software Foundation, Inc.
+
+This file is part of the libiberty library.
+Libiberty is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+Libiberty 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with libiberty; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
+Boston, MA 02110-1301, USA. */
+
+#include <stdio.h> /* for EOF */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include "libiberty.h"
+#include "safe-ctype.h" /* for HOST_CHARSET_ASCII */
+
+#if EOF != -1
+ #error "hex.c requires EOF == -1"
+#endif
+
+/*
+
+@deftypefn Extension void hex_init (void)
+
+Initializes the array mapping the current character set to
+corresponding hex values. This function must be called before any
+call to @code{hex_p} or @code{hex_value}. If you fail to call it, a
+default ASCII-based table will normally be used on ASCII systems.
+
+@end deftypefn
+
+@deftypefn Extension int hex_p (int @var{c})
+
+Evaluates to non-zero if the given character is a valid hex character,
+or zero if it is not. Note that the value you pass will be cast to
+@code{unsigned char} within the macro.
+
+@end deftypefn
+
+@deftypefn Extension {unsigned int} hex_value (int @var{c})
+
+Returns the numeric equivalent of the given character when interpreted
+as a hexidecimal digit. The result is undefined if you pass an
+invalid hex digit. Note that the value you pass will be cast to
+@code{unsigned char} within the macro.
+
+The @code{hex_value} macro returns @code{unsigned int}, rather than
+signed @code{int}, to make it easier to use in parsing addresses from
+hex dump files: a signed @code{int} would be sign-extended when
+converted to a wider unsigned type --- like @code{bfd_vma}, on some
+systems.
+
+@end deftypefn
+
+@undocumented _hex_array_size
+@undocumented _hex_bad
+@undocumented _hex_value
+
+*/
+
+
+/* Are we ASCII? */
+#if HOST_CHARSET == HOST_CHARSET_ASCII
+
+const unsigned char _hex_value[_hex_array_size] =
+{
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* NUL SOH STX ETX */
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* EOT ENQ ACK BEL */
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* BS HT LF VT */
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* FF CR SO SI */
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* DLE DC1 DC2 DC3 */
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* DC4 NAK SYN ETB */
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* CAN EM SUB ESC */
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* FS GS RS US */
+
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* SP ! " # */
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* $ % & ' */
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* ( ) * + */
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* , - . / */
+ 0, 1, 2, 3, /* 0 1 2 3 */
+ 4, 5, 6, 7, /* 4 5 6 7 */
+ 8, 9, _hex_bad, _hex_bad, /* 8 9 : ; */
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* < = > ? */
+
+ _hex_bad, 10, 11, 12, /* @ A B C */
+ 13, 14, 15, _hex_bad, /* D E F G */
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* H I J K */
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* L M N O */
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* P Q R S */
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* T U V W */
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* X Y Z [ */
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* \ ] ^ _ */
+
+ _hex_bad, 10, 11, 12, /* ` a b c */
+ 13, 14, 15, _hex_bad, /* d e f g */
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* h i j k */
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* l m n o */
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* p q r s */
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* t u v w */
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* x y z { */
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad, /* | } ~ DEL */
+
+ /* The high half of unsigned char, all values are _hex_bad. */
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad,
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad,
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad,
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad,
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad,
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad,
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad,
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad,
+
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad,
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad,
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad,
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad,
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad,
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad,
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad,
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad,
+
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad,
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad,
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad,
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad,
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad,
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad,
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad,
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad,
+
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad,
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad,
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad,
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad,
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad,
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad,
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad,
+ _hex_bad, _hex_bad, _hex_bad, _hex_bad,
+};
+#define HEX_TABLE_INITIALIZED
+
+#else
+
+unsigned char _hex_value[_hex_array_size];
+
+#endif /* not ASCII */
+
+void
+hex_init (void)
+{
+#ifndef HEX_TABLE_INITIALIZED
+ int i;
+
+ for (i=0; i<_hex_array_size; i++)
+ {
+ switch (i)
+ {
+ case '0': _hex_value[i] = 0; break;
+ case '1': _hex_value[i] = 1; break;
+ case '2': _hex_value[i] = 2; break;
+ case '3': _hex_value[i] = 3; break;
+ case '4': _hex_value[i] = 4; break;
+ case '5': _hex_value[i] = 5; break;
+ case '6': _hex_value[i] = 6; break;
+ case '7': _hex_value[i] = 7; break;
+ case '8': _hex_value[i] = 8; break;
+ case '9': _hex_value[i] = 9; break;
+
+ case 'a': case 'A': _hex_value[i] = 10; break;
+ case 'b': case 'B': _hex_value[i] = 11; break;
+ case 'c': case 'C': _hex_value[i] = 12; break;
+ case 'd': case 'D': _hex_value[i] = 13; break;
+ case 'e': case 'E': _hex_value[i] = 14; break;
+ case 'f': case 'F': _hex_value[i] = 15; break;
+
+ default:
+ _hex_value[i] = _hex_bad;
+ break;
+ }
+ }
+#endif
+}
/* Libiberty basename. Like basename, but is not overridden by the
system C library.
- Copyright (C) 2001 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002 Free Software Foundation, Inc.
This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or
You should have received a copy of the GNU Library General Public
License along with libiberty; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
+not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
+Boston, MA 02110-1301, USA. */
/*
-NAME
- lbasename -- return pointer to last component of a pathname
-SYNOPSIS
- char *lbasename (const char *name)
+@deftypefn Replacement {const char*} lbasename (const char *@var{name})
-DESCRIPTION
- Given a pointer to a string containing a typical pathname
- (/usr/src/cmd/ls/ls.c for example), returns a pointer to the
- last component of the pathname ("ls.c" in this case). The
- returned pointer is guaranteed to lie within the original
- string. This latter fact is not true of many vendor C
- libraries, which return special strings or modify the passed
- strings for particular input.
+Given a pointer to a string containing a typical pathname
+(@samp{/usr/src/cmd/ls/ls.c} for example), returns a pointer to the
+last component of the pathname (@samp{ls.c} in this case). The
+returned pointer is guaranteed to lie within the original
+string. This latter fact is not true of many vendor C
+libraries, which return special strings or modify the passed
+strings for particular input.
+
+In particular, the empty string returns the same empty string,
+and a path ending in @code{/} returns the empty string after it.
+
+@end deftypefn
- In particular, the empty string returns the same empty string,
- and a path ending in '/' returns the empty string after it.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include "ansidecl.h"
#include "libiberty.h"
#include "safe-ctype.h"
+#include "filenames.h"
-#ifndef DIR_SEPARATOR
-# define DIR_SEPARATOR '/'
-#endif
-
-#if defined (_WIN32) || defined (__MSDOS__) \
- || defined (__DJGPP__) || defined (__OS2__)
-# define HAVE_DOS_BASED_FILE_SYSTEM
-# ifndef DIR_SEPARATOR_2
-# define DIR_SEPARATOR_2 '\\'
-# endif
-#endif
-
-/* Define IS_DIR_SEPARATOR. VMS uses '::', ':', '[...]' and '<...>' to
- separate the different components of a file specification. It's a
- bit of a stretch to call ':', ']' and '>' directory separators, so
- just define the test to find the file name component. */
-#ifdef VMS
-# define IS_DIR_SEPARATOR(ch) ((ch) == ':' || (ch) == ']' || (ch) == '>')
-#else
-# ifndef DIR_SEPARATOR_2
-# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
-# else
-# define IS_DIR_SEPARATOR(ch) \
- (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
-# endif
-#endif
-
-char *
-lbasename (name)
- const char *name;
+const char *
+lbasename (const char *name)
{
const char *base;
if (IS_DIR_SEPARATOR (*name))
base = name + 1;
- return (char *) base;
+ return base;
}
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
USA. */
#ifdef HAVE_CONFIG_H
#ifndef ELIDE_CODE
-#if defined (__STDC__) && __STDC__
#define POINTER void *
-#else
-#define POINTER char *
-#endif
/* Determine default alignment. */
struct fooalign {char x; double d;};
jump to the handler pointed to by `obstack_alloc_failed_handler'.
This variable by default points to the internal function
`print_and_abort'. */
-#if defined (__STDC__) && __STDC__
static void print_and_abort (void);
void (*obstack_alloc_failed_handler) (void) = print_and_abort;
-#else
-static void print_and_abort ();
-void (*obstack_alloc_failed_handler) () = print_and_abort;
-#endif
/* Exit value used when `print_and_abort' is used. */
#if defined __GNU_LIBRARY__ || defined HAVE_STDLIB_H
free up some memory, then call this again. */
int
-_obstack_begin (h, size, alignment, chunkfun, freefun)
- struct obstack *h;
- int size;
- int alignment;
-#if defined (__STDC__) && __STDC__
- POINTER (*chunkfun) (long);
- void (*freefun) (void *);
-#else
- POINTER (*chunkfun) ();
- void (*freefun) ();
-#endif
+_obstack_begin (struct obstack *h, int size, int alignment,
+ POINTER (*chunkfun) (long), void (*freefun) (void *))
{
register struct _obstack_chunk *chunk; /* points to new chunk */
size = 4096 - extra;
}
-#if defined (__STDC__) && __STDC__
h->chunkfun = (struct _obstack_chunk * (*)(void *, long)) chunkfun;
h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun;
-#else
- h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun;
- h->freefun = freefun;
-#endif
h->chunk_size = size;
h->alignment_mask = alignment - 1;
h->use_extra_arg = 0;
}
int
-_obstack_begin_1 (h, size, alignment, chunkfun, freefun, arg)
- struct obstack *h;
- int size;
- int alignment;
-#if defined (__STDC__) && __STDC__
- POINTER (*chunkfun) (POINTER, long);
- void (*freefun) (POINTER, POINTER);
-#else
- POINTER (*chunkfun) ();
- void (*freefun) ();
-#endif
- POINTER arg;
+_obstack_begin_1 (struct obstack *h, int size, int alignment,
+ POINTER (*chunkfun) (POINTER, long),
+ void (*freefun) (POINTER, POINTER), POINTER arg)
{
register struct _obstack_chunk *chunk; /* points to new chunk */
size = 4096 - extra;
}
-#if defined(__STDC__) && __STDC__
h->chunkfun = (struct _obstack_chunk * (*)(void *,long)) chunkfun;
h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun;
-#else
- h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun;
- h->freefun = freefun;
-#endif
h->chunk_size = size;
h->alignment_mask = alignment - 1;
h->extra_arg = arg;
to the beginning of the new one. */
void
-_obstack_newchunk (h, length)
- struct obstack *h;
- int length;
+_obstack_newchunk (struct obstack *h, int length)
{
register struct _obstack_chunk *old_chunk = h->chunk;
register struct _obstack_chunk *new_chunk;
This is here for debugging.
If you use it in a program, you are probably losing. */
-#if defined (__STDC__) && __STDC__
/* Suppress -Wmissing-prototypes warning. We don't want to declare this in
obstack.h because it is just for debugging. */
int _obstack_allocated_p (struct obstack *h, POINTER obj);
-#endif
int
-_obstack_allocated_p (h, obj)
- struct obstack *h;
- POINTER obj;
+_obstack_allocated_p (struct obstack *h, POINTER obj)
{
register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */
register struct _obstack_chunk *plp; /* point to previous chunk if any */
This is the first one, called from non-ANSI code. */
void
-_obstack_free (h, obj)
- struct obstack *h;
- POINTER obj;
+_obstack_free (struct obstack *h, POINTER obj)
{
register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */
register struct _obstack_chunk *plp; /* point to previous chunk if any */
/* This function is used from ANSI code. */
void
-obstack_free (h, obj)
- struct obstack *h;
- POINTER obj;
+obstack_free (struct obstack *h, POINTER obj)
{
register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */
register struct _obstack_chunk *plp; /* point to previous chunk if any */
}
\f
int
-_obstack_memory_used (h)
- struct obstack *h;
+_obstack_memory_used (struct obstack *h)
{
register struct _obstack_chunk* lp;
register int nbytes = 0;
\f
/* Define the error handler. */
#ifndef _
-# ifdef HAVE_LIBINTL_H
+# if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC
# include <libintl.h>
# ifndef _
# define _(Str) gettext (Str)
#endif
static void
-print_and_abort ()
+print_and_abort (void)
{
fputs (_("memory exhausted\n"), stderr);
exit (obstack_exit_failure);
/* Now define the functional versions of the obstack macros.
Define them to simply use the corresponding macros to do the job. */
-#if defined (__STDC__) && __STDC__
-/* These function definitions do not work with non-ANSI preprocessors;
- they won't pass through the macro names in parentheses. */
-
/* The function names appear in parentheses in order to prevent
the macro-definitions of the names from being expanded there. */
-POINTER (obstack_base) (obstack)
- struct obstack *obstack;
+POINTER (obstack_base) (struct obstack *obstack)
{
return obstack_base (obstack);
}
-POINTER (obstack_next_free) (obstack)
- struct obstack *obstack;
+POINTER (obstack_next_free) (struct obstack *obstack)
{
return obstack_next_free (obstack);
}
-int (obstack_object_size) (obstack)
- struct obstack *obstack;
+int (obstack_object_size) (struct obstack *obstack)
{
return obstack_object_size (obstack);
}
-int (obstack_room) (obstack)
- struct obstack *obstack;
+int (obstack_room) (struct obstack *obstack)
{
return obstack_room (obstack);
}
-int (obstack_make_room) (obstack, length)
- struct obstack *obstack;
- int length;
+int (obstack_make_room) (struct obstack *obstack, int length)
{
return obstack_make_room (obstack, length);
}
-void (obstack_grow) (obstack, pointer, length)
- struct obstack *obstack;
- POINTER pointer;
- int length;
+void (obstack_grow) (struct obstack *obstack, POINTER pointer, int length)
{
obstack_grow (obstack, pointer, length);
}
-void (obstack_grow0) (obstack, pointer, length)
- struct obstack *obstack;
- POINTER pointer;
- int length;
+void (obstack_grow0) (struct obstack *obstack, POINTER pointer, int length)
{
obstack_grow0 (obstack, pointer, length);
}
-void (obstack_1grow) (obstack, character)
- struct obstack *obstack;
- int character;
+void (obstack_1grow) (struct obstack *obstack, int character)
{
obstack_1grow (obstack, character);
}
-void (obstack_blank) (obstack, length)
- struct obstack *obstack;
- int length;
+void (obstack_blank) (struct obstack *obstack, int length)
{
obstack_blank (obstack, length);
}
-void (obstack_1grow_fast) (obstack, character)
- struct obstack *obstack;
- int character;
+void (obstack_1grow_fast) (struct obstack *obstack, int character)
{
obstack_1grow_fast (obstack, character);
}
-void (obstack_blank_fast) (obstack, length)
- struct obstack *obstack;
- int length;
+void (obstack_blank_fast) (struct obstack *obstack, int length)
{
obstack_blank_fast (obstack, length);
}
-POINTER (obstack_finish) (obstack)
- struct obstack *obstack;
+POINTER (obstack_finish) (struct obstack *obstack)
{
return obstack_finish (obstack);
}
-POINTER (obstack_alloc) (obstack, length)
- struct obstack *obstack;
- int length;
+POINTER (obstack_alloc) (struct obstack *obstack, int length)
{
return obstack_alloc (obstack, length);
}
-POINTER (obstack_copy) (obstack, pointer, length)
- struct obstack *obstack;
- POINTER pointer;
- int length;
+POINTER (obstack_copy) (struct obstack *obstack, POINTER pointer, int length)
{
return obstack_copy (obstack, pointer, length);
}
-POINTER (obstack_copy0) (obstack, pointer, length)
- struct obstack *obstack;
- POINTER pointer;
- int length;
+POINTER (obstack_copy0) (struct obstack *obstack, POINTER pointer, int length)
{
return obstack_copy0 (obstack, pointer, length);
}
-#endif /* __STDC__ */
-
#endif /* 0 */
#endif /* !ELIDE_CODE */
/* obstack.h - object stack macros
Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998,
- 1999, 2000
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
USA. */
/* Summary:
#if defined _LIBC || defined HAVE_STRING_H
# include <string.h>
-# if defined __STDC__ && __STDC__
-# define _obstack_memcpy(To, From, N) memcpy ((To), (From), (N))
-# else
-# define _obstack_memcpy(To, From, N) memcpy ((To), (char *)(From), (N))
-# endif
+# define _obstack_memcpy(To, From, N) memcpy ((To), (From), (N))
#else
# ifdef memcpy
# define _obstack_memcpy(To, From, N) memcpy ((To), (char *)(From), (N))
char *chunk_limit; /* address of char after current chunk */
PTR_INT_TYPE temp; /* Temporary for some macros. */
int alignment_mask; /* Mask of alignment for each object. */
-#if defined __STDC__ && __STDC__
/* These prototypes vary based on `use_extra_arg', and we use
casts to the prototypeless function type in all assignments,
but having prototypes here quiets -Wstrict-prototypes. */
struct _obstack_chunk *(*chunkfun) (void *, long);
void (*freefun) (void *, struct _obstack_chunk *);
void *extra_arg; /* first arg for chunk alloc/dealloc funcs */
-#else
- struct _obstack_chunk *(*chunkfun) (); /* User's fcn to allocate a chunk. */
- void (*freefun) (); /* User's function to free a chunk. */
- char *extra_arg; /* first arg for chunk alloc/dealloc funcs */
-#endif
unsigned use_extra_arg:1; /* chunk alloc/dealloc funcs take extra arg */
unsigned maybe_empty_object:1;/* There is a possibility that the current
chunk contains a zero-length object. This
/* Declare the external functions we use; they are in obstack.c. */
-#if defined __STDC__ && __STDC__
extern void _obstack_newchunk (struct obstack *, int);
extern void _obstack_free (struct obstack *, void *);
extern int _obstack_begin (struct obstack *, int, int,
void *(*) (void *, long),
void (*) (void *, void *), void *);
extern int _obstack_memory_used (struct obstack *);
-#else
-extern void _obstack_newchunk ();
-extern void _obstack_free ();
-extern int _obstack_begin ();
-extern int _obstack_begin_1 ();
-extern int _obstack_memory_used ();
-#endif
\f
-#if defined __STDC__ && __STDC__
-
/* Do the function-declarations after the structs
but before defining the macros. */
int obstack_chunk_size (struct obstack *obstack);
int obstack_memory_used (struct obstack *obstack);
-#endif /* __STDC__ */
-
-/* Non-ANSI C cannot really support alternative functions for these macros,
- so we do not declare them. */
-
/* Error handler called when `obstack_chunk_alloc' failed to allocate
more memory. This can be set to a user defined function. The
default action is to print a message and abort. */
-#if defined __STDC__ && __STDC__
extern void (*obstack_alloc_failed_handler) (void);
-#else
-extern void (*obstack_alloc_failed_handler) ();
-#endif
/* Exit value used when `print_and_abort' is used. */
extern int obstack_exit_failure;
/* To prevent prototype warnings provide complete argument list in
standard C version. */
-#if defined __STDC__ && __STDC__
-
# define obstack_init(h) \
_obstack_begin ((h), 0, 0, \
(void *(*) (long)) obstack_chunk_alloc, (void (*) (void *)) obstack_chunk_free)
# define obstack_freefun(h, newfreefun) \
((h) -> freefun = (void (*)(void *, struct _obstack_chunk *)) (newfreefun))
-#else
-
-# define obstack_init(h) \
- _obstack_begin ((h), 0, 0, \
- (void *(*) ()) obstack_chunk_alloc, (void (*) ()) obstack_chunk_free)
-
-# define obstack_begin(h, size) \
- _obstack_begin ((h), (size), 0, \
- (void *(*) ()) obstack_chunk_alloc, (void (*) ()) obstack_chunk_free)
-
-# define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \
- _obstack_begin ((h), (size), (alignment), \
- (void *(*) ()) (chunkfun), (void (*) ()) (freefun))
-
-# define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \
- _obstack_begin_1 ((h), (size), (alignment), \
- (void *(*) ()) (chunkfun), (void (*) ()) (freefun), (arg))
-
-# define obstack_chunkfun(h, newchunkfun) \
- ((h) -> chunkfun = (struct _obstack_chunk *(*)()) (newchunkfun))
-
-# define obstack_freefun(h, newfreefun) \
- ((h) -> freefun = (void (*)()) (newfreefun))
-
-#endif
-
-#define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = achar)
+#define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = (achar))
#define obstack_blank_fast(h,n) ((h)->next_free += (n))
({ struct obstack *__o = (OBSTACK); \
if (__o->next_free + 1 > __o->chunk_limit) \
_obstack_newchunk (__o, 1); \
- *(__o->next_free)++ = (datum); \
+ obstack_1grow_fast (__o, datum); \
(void) 0; })
/* These assume that the obstack alignment is good enough for pointers or ints,
({ struct obstack *__o = (OBSTACK); \
if (__o->next_free + sizeof (void *) > __o->chunk_limit) \
_obstack_newchunk (__o, sizeof (void *)); \
- *((void **)__o->next_free)++ = ((void *)datum); \
- (void) 0; })
+ obstack_ptr_grow_fast (__o, datum); })
# define obstack_int_grow(OBSTACK,datum) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
if (__o->next_free + sizeof (int) > __o->chunk_limit) \
_obstack_newchunk (__o, sizeof (int)); \
- *((int *)__o->next_free)++ = ((int)datum); \
+ obstack_int_grow_fast (__o, datum); })
+
+# define obstack_ptr_grow_fast(OBSTACK,aptr) \
+__extension__ \
+({ struct obstack *__o1 = (OBSTACK); \
+ *(const void **) __o1->next_free = (aptr); \
+ __o1->next_free += sizeof (const void *); \
(void) 0; })
-# define obstack_ptr_grow_fast(h,aptr) (*((void **) (h)->next_free)++ = (void *)aptr)
-# define obstack_int_grow_fast(h,aint) (*((int *) (h)->next_free)++ = (int) aint)
+# define obstack_int_grow_fast(OBSTACK,aint) \
+__extension__ \
+({ struct obstack *__o1 = (OBSTACK); \
+ *(int *) __o1->next_free = (aint); \
+ __o1->next_free += sizeof (int); \
+ (void) 0; })
# define obstack_blank(OBSTACK,length) \
__extension__ \
int __len = (length); \
if (__o->chunk_limit - __o->next_free < __len) \
_obstack_newchunk (__o, __len); \
- __o->next_free += __len; \
+ obstack_blank_fast (__o, __len); \
(void) 0; })
# define obstack_alloc(OBSTACK,length) \
# define obstack_free(OBSTACK, OBJ) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
- void *__obj = (OBJ); \
+ void *__obj = (void *) (OBJ); \
if (__obj > (void *)__o->chunk && __obj < (void *)__o->chunk_limit) \
- __o->next_free = __o->object_base = __obj; \
+ __o->next_free = __o->object_base = (char *) __obj; \
else (obstack_free) (__o, __obj); })
\f
#else /* not __GNUC__ or not __STDC__ */
# define obstack_1grow(h,datum) \
( (((h)->next_free + 1 > (h)->chunk_limit) \
? (_obstack_newchunk ((h), 1), 0) : 0), \
- (*((h)->next_free)++ = (datum)))
+ obstack_1grow_fast (h, datum))
# define obstack_ptr_grow(h,datum) \
( (((h)->next_free + sizeof (char *) > (h)->chunk_limit) \
? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \
- (*((char **) (((h)->next_free+=sizeof(char *))-sizeof(char *))) = ((char *) datum)))
+ obstack_ptr_grow_fast (h, datum))
# define obstack_int_grow(h,datum) \
( (((h)->next_free + sizeof (int) > (h)->chunk_limit) \
? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \
- (*((int *) (((h)->next_free+=sizeof(int))-sizeof(int))) = ((int) datum)))
+ obstack_int_grow_fast (h, datum))
+
+# define obstack_ptr_grow_fast(h,aptr) \
+ (((const void **) ((h)->next_free += sizeof (void *)))[-1] = (aptr))
-# define obstack_ptr_grow_fast(h,aptr) (*((char **) (h)->next_free)++ = (char *) aptr)
-# define obstack_int_grow_fast(h,aint) (*((int *) (h)->next_free)++ = (int) aint)
+# define obstack_int_grow_fast(h,aint) \
+ (((int *) ((h)->next_free += sizeof (int)))[-1] = (aptr))
# define obstack_blank(h,length) \
( (h)->temp = (length), \
(((h)->chunk_limit - (h)->next_free < (h)->temp) \
? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \
- ((h)->next_free += (h)->temp))
+ obstack_blank_fast (h, (h)->temp))
# define obstack_alloc(h,length) \
(obstack_blank ((h), (length)), obstack_finish ((h)))
(h)->object_base = (h)->next_free, \
__INT_TO_PTR ((h)->temp))
-# if defined __STDC__ && __STDC__
-# define obstack_free(h,obj) \
+# define obstack_free(h,obj) \
( (h)->temp = (char *) (obj) - (char *) (h)->chunk, \
(((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
? (int) ((h)->next_free = (h)->object_base \
= (h)->temp + (char *) (h)->chunk) \
: (((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0), 0)))
-# else
-# define obstack_free(h,obj) \
-( (h)->temp = (char *) (obj) - (char *) (h)->chunk, \
- (((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
- ? (int) ((h)->next_free = (h)->object_base \
- = (h)->temp + (char *) (h)->chunk) \
- : (_obstack_free ((h), (h)->temp + (char *) (h)->chunk), 0)))
-# endif
#endif /* not __GNUC__ or not __STDC__ */
/* <ctype.h> replacement macros.
- Copyright (C) 2000 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2002, 2003, 2004,
+ 2005 Free Software Foundation, Inc.
Contributed by Zack Weinberg <zackw@stanford.edu>.
This file is part of the libiberty library.
You should have received a copy of the GNU Library General Public
License along with libiberty; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-/* This is a compatible replacement of the standard C library's <ctype.h>
- with the following properties:
-
- - Implements all isxxx() macros required by C99.
- - Also implements some character classes useful when
- parsing C-like languages.
- - Does not change behavior depending on the current locale.
- - Behaves properly for all values in the range of a signed or
- unsigned char. */
+not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
+Boston, MA 02110-1301, USA. */
+
+/*
+
+@defvr Extension HOST_CHARSET
+This macro indicates the basic character set and encoding used by the
+host: more precisely, the encoding used for character constants in
+preprocessor @samp{#if} statements (the C "execution character set").
+It is defined by @file{safe-ctype.h}, and will be an integer constant
+with one of the following values:
+
+@ftable @code
+@item HOST_CHARSET_UNKNOWN
+The host character set is unknown - that is, not one of the next two
+possibilities.
+
+@item HOST_CHARSET_ASCII
+The host character set is ASCII.
+
+@item HOST_CHARSET_EBCDIC
+The host character set is some variant of EBCDIC. (Only one of the
+nineteen EBCDIC varying characters is tested; exercise caution.)
+@end ftable
+@end defvr
+
+@deffn Extension ISALPHA (@var{c})
+@deffnx Extension ISALNUM (@var{c})
+@deffnx Extension ISBLANK (@var{c})
+@deffnx Extension ISCNTRL (@var{c})
+@deffnx Extension ISDIGIT (@var{c})
+@deffnx Extension ISGRAPH (@var{c})
+@deffnx Extension ISLOWER (@var{c})
+@deffnx Extension ISPRINT (@var{c})
+@deffnx Extension ISPUNCT (@var{c})
+@deffnx Extension ISSPACE (@var{c})
+@deffnx Extension ISUPPER (@var{c})
+@deffnx Extension ISXDIGIT (@var{c})
+
+These twelve macros are defined by @file{safe-ctype.h}. Each has the
+same meaning as the corresponding macro (with name in lowercase)
+defined by the standard header @file{ctype.h}. For example,
+@code{ISALPHA} returns true for alphabetic characters and false for
+others. However, there are two differences between these macros and
+those provided by @file{ctype.h}:
+
+@itemize @bullet
+@item These macros are guaranteed to have well-defined behavior for all
+values representable by @code{signed char} and @code{unsigned char}, and
+for @code{EOF}.
+
+@item These macros ignore the current locale; they are true for these
+fixed sets of characters:
+@multitable {@code{XDIGIT}} {yada yada yada yada yada yada yada yada}
+@item @code{ALPHA} @tab @kbd{A-Za-z}
+@item @code{ALNUM} @tab @kbd{A-Za-z0-9}
+@item @code{BLANK} @tab @kbd{space tab}
+@item @code{CNTRL} @tab @code{!PRINT}
+@item @code{DIGIT} @tab @kbd{0-9}
+@item @code{GRAPH} @tab @code{ALNUM || PUNCT}
+@item @code{LOWER} @tab @kbd{a-z}
+@item @code{PRINT} @tab @code{GRAPH ||} @kbd{space}
+@item @code{PUNCT} @tab @kbd{`~!@@#$%^&*()_-=+[@{]@}\|;:'",<.>/?}
+@item @code{SPACE} @tab @kbd{space tab \n \r \f \v}
+@item @code{UPPER} @tab @kbd{A-Z}
+@item @code{XDIGIT} @tab @kbd{0-9A-Fa-f}
+@end multitable
+
+Note that, if the host character set is ASCII or a superset thereof,
+all these macros will return false for all values of @code{char} outside
+the range of 7-bit ASCII. In particular, both ISPRINT and ISCNTRL return
+false for characters with numeric values from 128 to 255.
+@end itemize
+@end deffn
+
+@deffn Extension ISIDNUM (@var{c})
+@deffnx Extension ISIDST (@var{c})
+@deffnx Extension IS_VSPACE (@var{c})
+@deffnx Extension IS_NVSPACE (@var{c})
+@deffnx Extension IS_SPACE_OR_NUL (@var{c})
+@deffnx Extension IS_ISOBASIC (@var{c})
+These six macros are defined by @file{safe-ctype.h} and provide
+additional character classes which are useful when doing lexical
+analysis of C or similar languages. They are true for the following
+sets of characters:
+
+@multitable {@code{SPACE_OR_NUL}} {yada yada yada yada yada yada yada yada}
+@item @code{IDNUM} @tab @kbd{A-Za-z0-9_}
+@item @code{IDST} @tab @kbd{A-Za-z_}
+@item @code{VSPACE} @tab @kbd{\r \n}
+@item @code{NVSPACE} @tab @kbd{space tab \f \v \0}
+@item @code{SPACE_OR_NUL} @tab @code{VSPACE || NVSPACE}
+@item @code{ISOBASIC} @tab @code{VSPACE || NVSPACE || PRINT}
+@end multitable
+@end deffn
+
+*/
#include "ansidecl.h"
#include <safe-ctype.h>
#include <stdio.h> /* for EOF */
+#if EOF != -1
+ #error "<safe-ctype.h> requires EOF == -1"
+#endif
+
/* Shorthand */
#define bl _sch_isblank
#define cn _sch_iscntrl
#define xd _sch_isxdigit
/* Masks. */
-#define L lo|is |pr /* lower case letter */
-#define XL lo|is|xd|pr /* lowercase hex digit */
-#define U up|is |pr /* upper case letter */
-#define XU up|is|xd|pr /* uppercase hex digit */
-#define D di |xd|pr /* decimal digit */
-#define P pn |pr /* punctuation */
-#define _ pn|is |pr /* underscore */
-
-#define C cn /* control character */
-#define Z nv |cn /* NUL */
-#define M nv|sp |cn /* cursor movement: \f \v */
-#define V vs|sp |cn /* vertical space: \r \n */
-#define T nv|sp|bl|cn /* tab */
-#define S nv|sp|bl|pr /* space */
+#define L (const unsigned short) (lo|is |pr) /* lower case letter */
+#define XL (const unsigned short) (lo|is|xd|pr) /* lowercase hex digit */
+#define U (const unsigned short) (up|is |pr) /* upper case letter */
+#define XU (const unsigned short) (up|is|xd|pr) /* uppercase hex digit */
+#define D (const unsigned short) (di |xd|pr) /* decimal digit */
+#define P (const unsigned short) (pn |pr) /* punctuation */
+#define _ (const unsigned short) (pn|is |pr) /* underscore */
+
+#define C (const unsigned short) ( cn) /* control character */
+#define Z (const unsigned short) (nv |cn) /* NUL */
+#define M (const unsigned short) (nv|sp |cn) /* cursor movement: \f \v */
+#define V (const unsigned short) (vs|sp |cn) /* vertical space: \r \n */
+#define T (const unsigned short) (nv|sp|bl|cn) /* tab */
+#define S (const unsigned short) (nv|sp|bl|pr) /* space */
/* Are we ASCII? */
-#if '\n' == 0x0A && ' ' == 0x20 && '0' == 0x30 \
- && 'A' == 0x41 && 'a' == 0x61 && '!' == 0x21 \
- && EOF == -1
+#if HOST_CHARSET == HOST_CHARSET_ASCII
const unsigned short _sch_istable[256] =
{
};
#else
- #error "Unsupported host character set"
-#endif /* not ASCII */
+# if HOST_CHARSET == HOST_CHARSET_EBCDIC
+ #error "FIXME: write tables for EBCDIC"
+# else
+ #error "Unrecognized host character set"
+# endif
+#endif
You should have received a copy of the GNU Library General Public
License along with libiberty; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
+not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
+Boston, MA 02110-1301, USA. */
/* This is a compatible replacement of the standard C library's <ctype.h>
with the following properties:
#ifdef isalpha
#error "safe-ctype.h and ctype.h may not be used simultaneously"
+#endif
+
+/* Determine host character set. */
+#define HOST_CHARSET_UNKNOWN 0
+#define HOST_CHARSET_ASCII 1
+#define HOST_CHARSET_EBCDIC 2
+
+#if '\n' == 0x0A && ' ' == 0x20 && '0' == 0x30 \
+ && 'A' == 0x41 && 'a' == 0x61 && '!' == 0x21
+# define HOST_CHARSET HOST_CHARSET_ASCII
#else
+# if '\n' == 0x15 && ' ' == 0x40 && '0' == 0xF0 \
+ && 'A' == 0xC1 && 'a' == 0x81 && '!' == 0x5A
+# define HOST_CHARSET HOST_CHARSET_EBCDIC
+# else
+# define HOST_CHARSET HOST_CHARSET_UNKNOWN
+# endif
+#endif
/* Categories. */
_sch_isalnum = _sch_isalpha|_sch_isdigit, /* A-Za-z0-9 */
_sch_isidnum = _sch_isidst|_sch_isdigit, /* A-Za-z0-9_ */
_sch_isgraph = _sch_isalnum|_sch_ispunct, /* isprint and not space */
- _sch_iscppsp = _sch_isvsp|_sch_isnvsp /* isspace + \0 */
+ _sch_iscppsp = _sch_isvsp|_sch_isnvsp, /* isspace + \0 */
+ _sch_isbasic = _sch_isprint|_sch_iscppsp /* basic charset of ISO C
+ (plus ` and @) */
};
/* Character classification. */
#define ISIDNUM(c) _sch_test(c, _sch_isidnum)
#define ISIDST(c) _sch_test(c, _sch_isidst)
+#define IS_ISOBASIC(c) _sch_test(c, _sch_isbasic)
#define IS_VSPACE(c) _sch_test(c, _sch_isvsp)
#define IS_NVSPACE(c) _sch_test(c, _sch_isnvsp)
#define IS_SPACE_OR_NUL(c) _sch_test(c, _sch_iscppsp)
#define TOUPPER(c) _sch_toupper[(c) & 0xff]
#define TOLOWER(c) _sch_tolower[(c) & 0xff]
-#endif /* no ctype.h */
#endif /* SAFE_CTYPE_H */
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. */
+the Free Software Foundation, 51 Franklin Street - Fifth Floor,
+Boston, MA 02110-1301, USA. */
/* For an easily readable description of splay-trees, see:
#include "libiberty.h"
#include "splay-tree.h"
-static void splay_tree_delete_helper PARAMS((splay_tree,
- splay_tree_node));
-static void splay_tree_splay PARAMS((splay_tree,
- splay_tree_key));
-static splay_tree_node splay_tree_splay_helper
- PARAMS((splay_tree,
- splay_tree_key,
- splay_tree_node*,
- splay_tree_node*,
- splay_tree_node*));
-static int splay_tree_foreach_helper PARAMS((splay_tree,
- splay_tree_node,
- splay_tree_foreach_fn,
- void*));
+static void splay_tree_delete_helper (splay_tree, splay_tree_node);
+static inline void rotate_left (splay_tree_node *,
+ splay_tree_node, splay_tree_node);
+static inline void rotate_right (splay_tree_node *,
+ splay_tree_node, splay_tree_node);
+static void splay_tree_splay (splay_tree, splay_tree_key);
+static int splay_tree_foreach_helper (splay_tree, splay_tree_node,
+ splay_tree_foreach_fn, void*);
/* Deallocate NODE (a member of SP), and all its sub-trees. */
static void
-splay_tree_delete_helper (sp, node)
- splay_tree sp;
- splay_tree_node node;
+splay_tree_delete_helper (splay_tree sp, splay_tree_node node)
{
+ splay_tree_node pending = 0;
+ splay_tree_node active = 0;
+
if (!node)
return;
- splay_tree_delete_helper (sp, node->left);
- splay_tree_delete_helper (sp, node->right);
-
- if (sp->delete_key)
- (*sp->delete_key)(node->key);
- if (sp->delete_value)
- (*sp->delete_value)(node->value);
-
- free ((char*) node);
-}
-
-/* Help splay SP around KEY. PARENT and GRANDPARENT are the parent
- and grandparent, respectively, of NODE. */
+#define KDEL(x) if (sp->delete_key) (*sp->delete_key)(x);
+#define VDEL(x) if (sp->delete_value) (*sp->delete_value)(x);
-static splay_tree_node
-splay_tree_splay_helper (sp, key, node, parent, grandparent)
- splay_tree sp;
- splay_tree_key key;
- splay_tree_node *node;
- splay_tree_node *parent;
- splay_tree_node *grandparent;
-{
- splay_tree_node *next;
- splay_tree_node n;
- int comparison;
-
- n = *node;
+ KDEL (node->key);
+ VDEL (node->value);
- if (!n)
- return *parent;
+ /* We use the "key" field to hold the "next" pointer. */
+ node->key = (splay_tree_key)pending;
+ pending = (splay_tree_node)node;
- comparison = (*sp->comp) (key, n->key);
+ /* Now, keep processing the pending list until there aren't any
+ more. This is a little more complicated than just recursing, but
+ it doesn't toast the stack for large trees. */
- if (comparison == 0)
- /* We've found the target. */
- next = 0;
- else if (comparison < 0)
- /* The target is to the left. */
- next = &n->left;
- else
- /* The target is to the right. */
- next = &n->right;
-
- if (next)
+ while (pending)
{
- /* Continue down the tree. */
- n = splay_tree_splay_helper (sp, key, next, node, parent);
+ active = pending;
+ pending = 0;
+ while (active)
+ {
+ splay_tree_node temp;
- /* The recursive call will change the place to which NODE
- points. */
- if (*node != n)
- return n;
- }
+ /* active points to a node which has its key and value
+ deallocated, we just need to process left and right. */
- if (!parent)
- /* NODE is the root. We are done. */
- return n;
+ if (active->left)
+ {
+ KDEL (active->left->key);
+ VDEL (active->left->value);
+ active->left->key = (splay_tree_key)pending;
+ pending = (splay_tree_node)(active->left);
+ }
+ if (active->right)
+ {
+ KDEL (active->right->key);
+ VDEL (active->right->value);
+ active->right->key = (splay_tree_key)pending;
+ pending = (splay_tree_node)(active->right);
+ }
- /* First, handle the case where there is no grandparent (i.e.,
- *PARENT is the root of the tree.) */
- if (!grandparent)
- {
- if (n == (*parent)->left)
- {
- *node = n->right;
- n->right = *parent;
- }
- else
- {
- *node = n->left;
- n->left = *parent;
+ temp = active;
+ active = (splay_tree_node)(temp->key);
+ (*sp->deallocate) ((char*) temp, sp->allocate_data);
}
- *parent = n;
- return n;
}
+#undef KDEL
+#undef VDEL
+}
- /* Next handle the cases where both N and *PARENT are left children,
- or where both are right children. */
- if (n == (*parent)->left && *parent == (*grandparent)->left)
- {
- splay_tree_node p = *parent;
-
- (*grandparent)->left = p->right;
- p->right = *grandparent;
- p->left = n->right;
- n->right = p;
- *grandparent = n;
- return n;
- }
- else if (n == (*parent)->right && *parent == (*grandparent)->right)
- {
- splay_tree_node p = *parent;
-
- (*grandparent)->right = p->left;
- p->left = *grandparent;
- p->right = n->left;
- n->left = p;
- *grandparent = n;
- return n;
- }
+/* Rotate the edge joining the left child N with its parent P. PP is the
+ grandparents pointer to P. */
- /* Finally, deal with the case where N is a left child, but *PARENT
- is a right child, or vice versa. */
- if (n == (*parent)->left)
- {
- (*parent)->left = n->right;
- n->right = *parent;
- (*grandparent)->right = n->left;
- n->left = *grandparent;
- *grandparent = n;
- return n;
- }
- else
- {
- (*parent)->right = n->left;
- n->left = *parent;
- (*grandparent)->left = n->right;
- n->right = *grandparent;
- *grandparent = n;
- return n;
- }
+static inline void
+rotate_left (splay_tree_node *pp, splay_tree_node p, splay_tree_node n)
+{
+ splay_tree_node tmp;
+ tmp = n->right;
+ n->right = p;
+ p->left = tmp;
+ *pp = n;
+}
+
+/* Rotate the edge joining the right child N with its parent P. PP is the
+ grandparents pointer to P. */
+
+static inline void
+rotate_right (splay_tree_node *pp, splay_tree_node p, splay_tree_node n)
+{
+ splay_tree_node tmp;
+ tmp = n->left;
+ n->left = p;
+ p->right = tmp;
+ *pp = n;
}
-/* Splay SP around KEY. */
+/* Bottom up splay of key. */
static void
-splay_tree_splay (sp, key)
- splay_tree sp;
- splay_tree_key key;
+splay_tree_splay (splay_tree sp, splay_tree_key key)
{
if (sp->root == 0)
return;
- splay_tree_splay_helper (sp, key, &sp->root,
- /*grandparent=*/0, /*parent=*/0);
+ do {
+ int cmp1, cmp2;
+ splay_tree_node n, c;
+
+ n = sp->root;
+ cmp1 = (*sp->comp) (key, n->key);
+
+ /* Found. */
+ if (cmp1 == 0)
+ return;
+
+ /* Left or right? If no child, then we're done. */
+ if (cmp1 < 0)
+ c = n->left;
+ else
+ c = n->right;
+ if (!c)
+ return;
+
+ /* Next one left or right? If found or no child, we're done
+ after one rotation. */
+ cmp2 = (*sp->comp) (key, c->key);
+ if (cmp2 == 0
+ || (cmp2 < 0 && !c->left)
+ || (cmp2 > 0 && !c->right))
+ {
+ if (cmp1 < 0)
+ rotate_left (&sp->root, n, c);
+ else
+ rotate_right (&sp->root, n, c);
+ return;
+ }
+
+ /* Now we have the four cases of double-rotation. */
+ if (cmp1 < 0 && cmp2 < 0)
+ {
+ rotate_left (&n->left, c, c->left);
+ rotate_left (&sp->root, n, n->left);
+ }
+ else if (cmp1 > 0 && cmp2 > 0)
+ {
+ rotate_right (&n->right, c, c->right);
+ rotate_right (&sp->root, n, n->right);
+ }
+ else if (cmp1 < 0 && cmp2 > 0)
+ {
+ rotate_right (&n->left, c, c->right);
+ rotate_left (&sp->root, n, n->left);
+ }
+ else if (cmp1 > 0 && cmp2 < 0)
+ {
+ rotate_left (&n->right, c, c->left);
+ rotate_right (&sp->root, n, n->right);
+ }
+ } while (1);
}
/* Call FN, passing it the DATA, for every node below NODE, all of
value is returned. Otherwise, this function returns 0. */
static int
-splay_tree_foreach_helper (sp, node, fn, data)
- splay_tree sp;
- splay_tree_node node;
- splay_tree_foreach_fn fn;
- void* data;
+splay_tree_foreach_helper (splay_tree sp, splay_tree_node node,
+ splay_tree_foreach_fn fn, void *data)
{
int val;
return splay_tree_foreach_helper (sp, node->right, fn, data);
}
+
+/* An allocator and deallocator based on xmalloc. */
+static void *
+splay_tree_xmalloc_allocate (int size, void *data ATTRIBUTE_UNUSED)
+{
+ return (void *) xmalloc (size);
+}
+
+static void
+splay_tree_xmalloc_deallocate (void *object, void *data ATTRIBUTE_UNUSED)
+{
+ free (object);
+}
+
+
+/* Allocate a new splay tree, using COMPARE_FN to compare nodes,
+ DELETE_KEY_FN to deallocate keys, and DELETE_VALUE_FN to deallocate
+ values. Use xmalloc to allocate the splay tree structure, and any
+ nodes added. */
+
+splay_tree
+splay_tree_new (splay_tree_compare_fn compare_fn,
+ splay_tree_delete_key_fn delete_key_fn,
+ splay_tree_delete_value_fn delete_value_fn)
+{
+ return (splay_tree_new_with_allocator
+ (compare_fn, delete_key_fn, delete_value_fn,
+ splay_tree_xmalloc_allocate, splay_tree_xmalloc_deallocate, 0));
+}
+
+
/* Allocate a new splay tree, using COMPARE_FN to compare nodes,
DELETE_KEY_FN to deallocate keys, and DELETE_VALUE_FN to deallocate
values. */
splay_tree
-splay_tree_new (compare_fn, delete_key_fn, delete_value_fn)
- splay_tree_compare_fn compare_fn;
- splay_tree_delete_key_fn delete_key_fn;
- splay_tree_delete_value_fn delete_value_fn;
+splay_tree_new_with_allocator (splay_tree_compare_fn compare_fn,
+ splay_tree_delete_key_fn delete_key_fn,
+ splay_tree_delete_value_fn delete_value_fn,
+ splay_tree_allocate_fn allocate_fn,
+ splay_tree_deallocate_fn deallocate_fn,
+ void *allocate_data)
{
- splay_tree sp = (splay_tree) xmalloc (sizeof (struct splay_tree_s));
+ splay_tree sp = (splay_tree) (*allocate_fn) (sizeof (struct splay_tree_s),
+ allocate_data);
sp->root = 0;
sp->comp = compare_fn;
sp->delete_key = delete_key_fn;
sp->delete_value = delete_value_fn;
+ sp->allocate = allocate_fn;
+ sp->deallocate = deallocate_fn;
+ sp->allocate_data = allocate_data;
return sp;
}
/* Deallocate SP. */
void
-splay_tree_delete (sp)
- splay_tree sp;
+splay_tree_delete (splay_tree sp)
{
splay_tree_delete_helper (sp, sp->root);
- free ((char*) sp);
+ (*sp->deallocate) ((char*) sp, sp->allocate_data);
}
/* Insert a new node (associating KEY with DATA) into SP. If a
with the new value. Returns the new node. */
splay_tree_node
-splay_tree_insert (sp, key, value)
- splay_tree sp;
- splay_tree_key key;
- splay_tree_value value;
+splay_tree_insert (splay_tree sp, splay_tree_key key, splay_tree_value value)
{
int comparison = 0;
/* Create a new node, and insert it at the root. */
splay_tree_node node;
- node = (splay_tree_node) xmalloc (sizeof (struct splay_tree_node_s));
+ node = ((splay_tree_node)
+ (*sp->allocate) (sizeof (struct splay_tree_node_s),
+ sp->allocate_data));
node->key = key;
node->value = value;
/* Remove KEY from SP. It is not an error if it did not exist. */
void
-splay_tree_remove (sp, key)
- splay_tree sp;
- splay_tree_key key;
+splay_tree_remove (splay_tree sp, splay_tree_key key)
{
splay_tree_splay (sp, key);
/* Delete the root node itself. */
if (sp->delete_value)
(*sp->delete_value) (sp->root->value);
- free (sp->root);
+ (*sp->deallocate) (sp->root, sp->allocate_data);
/* One of the children is now the root. Doesn't matter much
which, so long as we preserve the properties of the tree. */
otherwise. */
splay_tree_node
-splay_tree_lookup (sp, key)
- splay_tree sp;
- splay_tree_key key;
+splay_tree_lookup (splay_tree sp, splay_tree_key key)
{
splay_tree_splay (sp, key);
/* Return the node in SP with the greatest key. */
splay_tree_node
-splay_tree_max (sp)
- splay_tree sp;
+splay_tree_max (splay_tree sp)
{
splay_tree_node n = sp->root;
/* Return the node in SP with the smallest key. */
splay_tree_node
-splay_tree_min (sp)
- splay_tree sp;
+splay_tree_min (splay_tree sp)
{
splay_tree_node n = sp->root;
predecessor. KEY need not be present in the tree. */
splay_tree_node
-splay_tree_predecessor (sp, key)
- splay_tree sp;
- splay_tree_key key;
+splay_tree_predecessor (splay_tree sp, splay_tree_key key)
{
int comparison;
splay_tree_node node;
if (comparison < 0)
return sp->root;
- /* Otherwise, find the leftmost element of the right subtree. */
+ /* Otherwise, find the rightmost element of the left subtree. */
node = sp->root->left;
if (node)
while (node->right)
}
/* Return the immediate successor KEY, or NULL if there is no
- predecessor. KEY need not be present in the tree. */
+ successor. KEY need not be present in the tree. */
splay_tree_node
-splay_tree_successor (sp, key)
- splay_tree sp;
- splay_tree_key key;
+splay_tree_successor (splay_tree sp, splay_tree_key key)
{
int comparison;
splay_tree_node node;
- /* If the tree is empty, there is certainly no predecessor. */
+ /* If the tree is empty, there is certainly no successor. */
if (!sp->root)
return NULL;
if (comparison > 0)
return sp->root;
- /* Otherwise, find the rightmost element of the left subtree. */
+ /* Otherwise, find the leftmost element of the right subtree. */
node = sp->root->right;
if (node)
while (node->left)
Otherwise, this function returns 0. */
int
-splay_tree_foreach (sp, fn, data)
- splay_tree sp;
- splay_tree_foreach_fn fn;
- void *data;
+splay_tree_foreach (splay_tree sp, splay_tree_foreach_fn fn, void *data)
{
return splay_tree_foreach_helper (sp, sp->root, fn, data);
}
/* Splay-tree comparison function, treating the keys as ints. */
int
-splay_tree_compare_ints (k1, k2)
- splay_tree_key k1;
- splay_tree_key k2;
+splay_tree_compare_ints (splay_tree_key k1, splay_tree_key k2)
{
if ((int) k1 < (int) k2)
return -1;
/* Splay-tree comparison function, treating the keys as pointers. */
int
-splay_tree_compare_pointers (k1, k2)
- splay_tree_key k1;
- splay_tree_key k2;
+splay_tree_compare_pointers (splay_tree_key k1, splay_tree_key k2)
{
if ((char*) k1 < (char*) k2)
return -1;
/* A splay-tree datatype.
- Copyright 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
Contributed by Mark Mitchell (mark@markmitchell.com).
-This file is part of GNU CC.
+This file is part of GCC.
-GNU CC is free software; you can redistribute it and/or modify it
+GCC 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
+GCC 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. */
+along with GCC; see the file COPYING. If not, write to
+the Free Software Foundation, 51 Franklin Street - Fifth Floor,
+Boston, MA 02110-1301, USA. */
/* For an easily readable description of splay-trees, see:
extern "C" {
#endif /* __cplusplus */
-#include <ansidecl.h>
+#include "ansidecl.h"
+
+#ifndef GTY
+#define GTY(X)
+#endif
/* Use typedefs for the key and data types to facilitate changing
these types, if necessary. These types should be sufficiently wide
/* The type of a function which compares two splay-tree keys. The
function should return values as for qsort. */
-typedef int (*splay_tree_compare_fn) PARAMS((splay_tree_key, splay_tree_key));
+typedef int (*splay_tree_compare_fn) (splay_tree_key, splay_tree_key);
/* The type of a function used to deallocate any resources associated
with the key. */
-typedef void (*splay_tree_delete_key_fn) PARAMS((splay_tree_key));
+typedef void (*splay_tree_delete_key_fn) (splay_tree_key);
/* The type of a function used to deallocate any resources associated
with the value. */
-typedef void (*splay_tree_delete_value_fn) PARAMS((splay_tree_value));
+typedef void (*splay_tree_delete_value_fn) (splay_tree_value);
/* The type of a function used to iterate over the tree. */
-typedef int (*splay_tree_foreach_fn) PARAMS((splay_tree_node, void*));
+typedef int (*splay_tree_foreach_fn) (splay_tree_node, void*);
+
+/* The type of a function used to allocate memory for tree root and
+ node structures. The first argument is the number of bytes needed;
+ the second is a data pointer the splay tree functions pass through
+ to the allocator. This function must never return zero. */
+typedef void *(*splay_tree_allocate_fn) (int, void *);
+
+/* The type of a function used to free memory allocated using the
+ corresponding splay_tree_allocate_fn. The first argument is the
+ memory to be freed; the latter is a data pointer the splay tree
+ functions pass through to the freer. */
+typedef void (*splay_tree_deallocate_fn) (void *, void *);
/* The nodes in the splay tree. */
-struct splay_tree_node_s
+struct splay_tree_node_s GTY(())
{
/* The key. */
- splay_tree_key key;
+ splay_tree_key GTY ((use_param1)) key;
/* The value. */
- splay_tree_value value;
+ splay_tree_value GTY ((use_param2)) value;
/* The left and right children, respectively. */
- splay_tree_node left;
- splay_tree_node right;
+ splay_tree_node GTY ((use_params)) left;
+ splay_tree_node GTY ((use_params)) right;
};
/* The splay tree itself. */
-typedef struct splay_tree_s
+struct splay_tree_s GTY(())
{
/* The root of the tree. */
- splay_tree_node root;
+ splay_tree_node GTY ((use_params)) root;
/* The comparision function. */
splay_tree_compare_fn comp;
/* The deallocate-value function. NULL if no cleanup is necessary. */
splay_tree_delete_value_fn delete_value;
-} *splay_tree;
-
-extern splay_tree splay_tree_new PARAMS((splay_tree_compare_fn,
- splay_tree_delete_key_fn,
- splay_tree_delete_value_fn));
-extern void splay_tree_delete PARAMS((splay_tree));
-extern splay_tree_node splay_tree_insert
- PARAMS((splay_tree,
- splay_tree_key,
- splay_tree_value));
-extern void splay_tree_remove PARAMS((splay_tree,
- splay_tree_key));
-extern splay_tree_node splay_tree_lookup
- PARAMS((splay_tree,
- splay_tree_key));
-extern splay_tree_node splay_tree_predecessor
- PARAMS((splay_tree,
- splay_tree_key));
-extern splay_tree_node splay_tree_successor
- PARAMS((splay_tree,
- splay_tree_key));
-extern splay_tree_node splay_tree_max
- PARAMS((splay_tree));
-extern splay_tree_node splay_tree_min
- PARAMS((splay_tree));
-extern int splay_tree_foreach PARAMS((splay_tree,
- splay_tree_foreach_fn,
- void*));
-extern int splay_tree_compare_ints PARAMS((splay_tree_key,
- splay_tree_key));
-extern int splay_tree_compare_pointers PARAMS((splay_tree_key,
- splay_tree_key));
+
+ /* Allocate/free functions, and a data pointer to pass to them. */
+ splay_tree_allocate_fn allocate;
+ splay_tree_deallocate_fn deallocate;
+ void * GTY((skip)) allocate_data;
+
+};
+typedef struct splay_tree_s *splay_tree;
+
+extern splay_tree splay_tree_new (splay_tree_compare_fn,
+ splay_tree_delete_key_fn,
+ splay_tree_delete_value_fn);
+extern splay_tree splay_tree_new_with_allocator (splay_tree_compare_fn,
+ splay_tree_delete_key_fn,
+ splay_tree_delete_value_fn,
+ splay_tree_allocate_fn,
+ splay_tree_deallocate_fn,
+ void *);
+extern void splay_tree_delete (splay_tree);
+extern splay_tree_node splay_tree_insert (splay_tree,
+ splay_tree_key,
+ splay_tree_value);
+extern void splay_tree_remove (splay_tree, splay_tree_key);
+extern splay_tree_node splay_tree_lookup (splay_tree, splay_tree_key);
+extern splay_tree_node splay_tree_predecessor (splay_tree, splay_tree_key);
+extern splay_tree_node splay_tree_successor (splay_tree, splay_tree_key);
+extern splay_tree_node splay_tree_max (splay_tree);
+extern splay_tree_node splay_tree_min (splay_tree);
+extern int splay_tree_foreach (splay_tree, splay_tree_foreach_fn, void*);
+extern int splay_tree_compare_ints (splay_tree_key, splay_tree_key);
+extern int splay_tree_compare_pointers (splay_tree_key, splay_tree_key);
#ifdef __cplusplus
}
--- /dev/null
+/* Map logical line numbers to (source file, line number) pairs.
+ Copyright (C) 2001
+ Free Software Foundation, Inc.
+
+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
+Free Software Foundation; either version 2, or (at your option) any
+later version.
+
+This program 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 this program; if not, write to the Free Software
+Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ In other words, you are welcome to use, share and improve this program.
+ You are forbidden to forbid anyone else to use, share and improve
+ what you give them. Help stamp out software-hoarding! */
+
+#include "config.h"
+#include "system.h"
+#include "line-map.h"
+#include "intl.h"
+
+static void trace_include
+ PARAMS ((const struct line_maps *, const struct line_map *));
+
+/* Initialize a line map set. */
+
+void
+init_line_maps (set)
+ struct line_maps *set;
+{
+ set->maps = 0;
+ set->allocated = 0;
+ set->used = 0;
+ set->last_listed = -1;
+ set->trace_includes = false;
+ set->depth = 0;
+}
+
+/* Free a line map set. */
+
+void
+free_line_maps (set)
+ struct line_maps *set;
+{
+ if (set->maps)
+ {
+ struct line_map *map;
+
+ /* Depending upon whether we are handling preprocessed input or
+ not, this can be a user error or an ICE. */
+ for (map = CURRENT_LINE_MAP (set); ! MAIN_FILE_P (map);
+ map = INCLUDED_FROM (set, map))
+ fprintf (stderr, "line-map.c: file \"%s\" entered but not left\n",
+ map->to_file);
+
+ free (set->maps);
+ }
+}
+
+/* Add a mapping of logical source line to physical source file and
+ line number. Ther text pointed to by TO_FILE must have a lifetime
+ at least as long as the final call to lookup_line ().
+
+ FROM_LINE should be monotonic increasing across calls to this
+ function. */
+
+const struct line_map *
+add_line_map (set, reason, sysp, from_line, to_file, to_line)
+ struct line_maps *set;
+ enum lc_reason reason;
+ unsigned int sysp;
+ unsigned int from_line;
+ const char *to_file;
+ unsigned int to_line;
+{
+ struct line_map *map;
+
+ if (set->used && from_line < set->maps[set->used - 1].from_line)
+ abort ();
+
+ if (set->used == set->allocated)
+ {
+ set->allocated = 2 * set->allocated + 256;
+ set->maps = (struct line_map *)
+ xrealloc (set->maps, set->allocated * sizeof (struct line_map));
+ }
+
+ map = &set->maps[set->used++];
+
+ /* If we don't keep our line maps consistent, we can easily
+ segfault. Don't rely on the client to do it for us. */
+ if (set->depth == 0)
+ reason = LC_ENTER;
+ else if (reason == LC_LEAVE)
+ {
+ struct line_map *from;
+ bool error;
+
+ if (MAIN_FILE_P (map - 1))
+ {
+ error = true;
+ reason = LC_RENAME;
+ from = map - 1;
+ }
+ else
+ {
+ from = INCLUDED_FROM (set, map - 1);
+ error = to_file && strcmp (from->to_file, to_file);
+ }
+
+ /* Depending upon whether we are handling preprocessed input or
+ not, this can be a user error or an ICE. */
+ if (error)
+ fprintf (stderr, "line-map.c: file \"%s\" left but not entered\n",
+ to_file);
+
+ /* A TO_FILE of NULL is special - we use the natural values. */
+ if (error || to_file == NULL)
+ {
+ to_file = from->to_file;
+ to_line = LAST_SOURCE_LINE (from) + 1;
+ sysp = from->sysp;
+ }
+ }
+
+ map->reason = reason;
+ map->sysp = sysp;
+ map->from_line = from_line;
+ map->to_file = to_file;
+ map->to_line = to_line;
+
+ if (reason == LC_ENTER)
+ {
+ set->depth++;
+ map->included_from = set->used - 2;
+ if (set->trace_includes)
+ trace_include (set, map);
+ }
+ else if (reason == LC_RENAME)
+ map->included_from = map[-1].included_from;
+ else if (reason == LC_LEAVE)
+ {
+ set->depth--;
+ map->included_from = INCLUDED_FROM (set, map - 1)->included_from;
+ }
+
+ return map;
+}
+
+/* Given a logical line, returns the map from which the corresponding
+ (source file, line) pair can be deduced. Since the set is built
+ chronologically, the logical lines are monotonic increasing, and so
+ the list is sorted and we can use a binary search. */
+
+const struct line_map *
+lookup_line (set, line)
+ struct line_maps *set;
+ unsigned int line;
+{
+ unsigned int md, mn = 0, mx = set->used;
+
+ if (mx == 0)
+ abort ();
+
+ while (mx - mn > 1)
+ {
+ md = (mn + mx) / 2;
+ if (set->maps[md].from_line > line)
+ mx = md;
+ else
+ mn = md;
+ }
+
+ return &set->maps[mn];
+}
+
+/* Print the file names and line numbers of the #include commands
+ which led to the map MAP, if any, to stderr. Nothing is output if
+ the most recently listed stack is the same as the current one. */
+
+void
+print_containing_files (set, map)
+ struct line_maps *set;
+ const struct line_map *map;
+{
+ if (MAIN_FILE_P (map) || set->last_listed == map->included_from)
+ return;
+
+ set->last_listed = map->included_from;
+ map = INCLUDED_FROM (set, map);
+
+ fprintf (stderr, _("In file included from %s:%u"),
+ map->to_file, LAST_SOURCE_LINE (map));
+
+ while (! MAIN_FILE_P (map))
+ {
+ map = INCLUDED_FROM (set, map);
+ /* Translators note: this message is used in conjunction
+ with "In file included from %s:%ld" and some other
+ tricks. We want something like this:
+
+ | In file included from sys/select.h:123,
+ | from sys/types.h:234,
+ | from userfile.c:31:
+ | bits/select.h:45: <error message here>
+
+ with all the "from"s lined up.
+ The trailing comma is at the beginning of this message,
+ and the trailing colon is not translated. */
+ fprintf (stderr, _(",\n from %s:%u"),
+ map->to_file, LAST_SOURCE_LINE (map));
+ }
+
+ fputs (":\n", stderr);
+}
+
+/* Print an include trace, for e.g. the -H option of the preprocessor. */
+
+static void
+trace_include (set, map)
+ const struct line_maps *set;
+ const struct line_map *map;
+{
+ unsigned int i = set->depth;
+
+ while (--i)
+ putc ('.', stderr);
+ fprintf (stderr, " %s\n", map->to_file);
+}
--- /dev/null
+/* Map logical line numbers to (source file, line number) pairs.
+ Copyright (C) 2001
+ Free Software Foundation, Inc.
+
+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
+Free Software Foundation; either version 2, or (at your option) any
+later version.
+
+This program 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 this program; if not, write to the Free Software
+Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ In other words, you are welcome to use, share and improve this program.
+ You are forbidden to forbid anyone else to use, share and improve
+ what you give them. Help stamp out software-hoarding! */
+
+#ifndef GCC_LINE_MAP_H
+#define GCC_LINE_MAP_H
+
+/* Reason for adding a line change with add_line_map (). LC_ENTER is
+ when including a new file, e.g. a #include directive in C.
+ LC_LEAVE is when reaching a file's end. LC_RENAME is when a file
+ name or line number changes for neither of the above reasons
+ (e.g. a #line directive in C). */
+enum lc_reason {LC_ENTER = 0, LC_LEAVE, LC_RENAME};
+
+/* The logical line FROM_LINE maps to physical source file TO_FILE at
+ line TO_LINE, and subsequently one-to-one until the next line_map
+ structure in the set. INCLUDED_FROM is an index into the set that
+ gives the line mapping at whose end the current one was included.
+ File(s) at the bottom of the include stack have this set to -1.
+ REASON is the reason for creation of this line map, SYSP is one for
+ a system header, two for a C system header file that therefore
+ needs to be extern "C" protected in C++, and zero otherwise. */
+struct line_map
+{
+ const char *to_file;
+ unsigned int to_line;
+ unsigned int from_line;
+ int included_from;
+ ENUM_BITFIELD (lc_reason) reason : CHAR_BIT;
+ unsigned char sysp;
+};
+
+/* A set of chronological line_map structures. */
+struct line_maps
+{
+ struct line_map *maps;
+ unsigned int allocated;
+ unsigned int used;
+
+ /* The most recently listed include stack, if any, starts with
+ LAST_LISTED as the topmost including file. -1 indicates nothing
+ has been listed yet. */
+ int last_listed;
+
+ /* Depth of the include stack, including the current file. */
+ unsigned int depth;
+
+ /* If true, prints an include trace a la -H. */
+ bool trace_includes;
+};
+
+/* Initialize a line map set. */
+extern void init_line_maps
+ PARAMS ((struct line_maps *));
+
+/* Free a line map set. */
+extern void free_line_maps
+ PARAMS ((struct line_maps *));
+
+/* Add a mapping of logical source line to physical source file and
+ line number. The text pointed to by TO_FILE must have a lifetime
+ at least as long as the line maps. If reason is LC_LEAVE, and
+ TO_FILE is NULL, then TO_FILE, TO_LINE and SYSP are given their
+ natural values considering the file we are returning to.
+
+ FROM_LINE should be monotonic increasing across calls to this
+ function. A call to this function can relocate the previous set of
+ maps, so any stored line_map pointers should not be used. */
+extern const struct line_map *add_line_map
+ PARAMS ((struct line_maps *, enum lc_reason, unsigned int sysp,
+ unsigned int from_line, const char *to_file, unsigned int to_line));
+
+/* Given a logical line, returns the map from which the corresponding
+ (source file, line) pair can be deduced. */
+extern const struct line_map *lookup_line
+ PARAMS ((struct line_maps *, unsigned int));
+
+/* Print the file names and line numbers of the #include commands
+ which led to the map MAP, if any, to stderr. Nothing is output if
+ the most recently listed stack is the same as the current one. */
+extern void print_containing_files
+ PARAMS ((struct line_maps *, const struct line_map *));
+
+/* Converts a map and logical line to source line. */
+#define SOURCE_LINE(MAP, LINE) ((LINE) + (MAP)->to_line - (MAP)->from_line)
+
+/* Returns the last source line within a map. This is the (last) line
+ of the #include, or other directive, that caused a map change. */
+#define LAST_SOURCE_LINE(MAP) SOURCE_LINE ((MAP), (MAP)[1].from_line - 1)
+
+/* Returns the map a given map was included from. */
+#define INCLUDED_FROM(SET, MAP) (&(SET)->maps[(MAP)->included_from])
+
+/* Non-zero if the map is at the bottom of the include stack. */
+#define MAIN_FILE_P(MAP) ((MAP)->included_from < 0)
+
+/* The current line map. Saves a call to lookup_line if the caller is
+ sure he is in the scope of the current map. */
+#define CURRENT_LINE_MAP(MAPS) ((MAPS)->maps + (MAPS)->used - 1)
+
+#endif /* !GCC_LINE_MAP_H */
/* Multibyte Character Functions.
Copyright (C) 1998 Free Software Foundation, Inc.
-This file is part of GNU CC.
+This file is part of GCC.
-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.
+GCC 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.
+GCC 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. */
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
/* Note regarding cross compilation:
if (s == NULL)
{
save_state = ASCII;
- /* State-dependent. */
+ /* State-dependent. */
return 1;
}
return 1;
#else
- /* This must be the "C" locale or unknown locale. */
+ /* This must be the "C" locale or unknown locale. */
return mbtowc (pwc, s, n);
#endif
}
/* Various declarations for functions found in mbchar.c
Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
-This file is part of GNU CC.
+This file is part of GCC.
-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.
+GCC 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.
+GCC 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. */
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
#ifndef GCC_MBCHAR_H
#define GCC_MBCHAR_H
not properly handled. It isn't possible to get this right in any
current version of Make. (??? Still true? Old comment referred to
3.76.1.) */
-
+
static const char *
munge (filename)
const char *filename;
is quoted for MAKE. */
void
deps_add_default_target (pfile, tgt)
- cpp_reader *pfile;
- const char *tgt;
+ cpp_reader *pfile;
+ const char *tgt;
{
+ struct deps *d = pfile->deps;
+
/* Only if we have no targets. */
- if (pfile->deps->ntargets)
+ if (d->ntargets)
return;
if (tgt[0] == '\0')
- deps_add_target (pfile->deps, "-", 1);
+ deps_add_target (d, "-", 1);
else
{
#ifndef TARGET_OBJECT_SUFFIX
# define TARGET_OBJECT_SUFFIX ".o"
#endif
- char *start = lbasename (tgt);
+ const char *start = lbasename (tgt);
char *o;
char *suffix;
const char *obj_ext;
suffix = o + strlen (o);
strcpy (suffix, obj_ext);
- deps_add_target (pfile->deps, o, 1);
+ deps_add_target (d, o, 1);
}
}
}
putc ('\n', fp);
}
-
+
void
deps_phony_targets (d, fp)
const struct deps *d;
/* Declarations for insn-output.c. These functions are defined in recog.c,
final.c, and varasm.c.
Copyright (C) 1987, 1991, 1994, 1997, 1998,
- 1999, 2000 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
-This file is part of GNU CC.
+This file is part of GCC.
-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.
+GCC 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.
+GCC 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. */
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
+
+/* Compute branch alignments based on frequency information in the CFG. */
+extern void compute_alignments PARAMS ((void));
/* Initialize data in final at the beginning of a compilation. */
extern void init_final PARAMS ((const char *));
Called from varasm.c before most kinds of output. */
extern void app_disable PARAMS ((void));
-/* Return the number of slots filled in the current
+/* Return the number of slots filled in the current
delayed branch sequence (we don't count the insn needing the
delay slot). Zero if not in a delayed branch sequence. */
extern int dbr_sequence_length PARAMS ((void));
/* Output assembler code for the end of a function.
For clarity, args are same as those of `final_start_function'
even though not all of them are needed. */
-extern void final_end_function PARAMS ((rtx, FILE *, int));
+extern void final_end_function PARAMS ((void));
/* Output assembler code for some insns: all or part of a function. */
extern void final PARAMS ((rtx, FILE *, int, int));
/* Replace a SUBREG with a REG or a MEM, based on the thing it is a
subreg of. */
-extern rtx alter_subreg PARAMS ((rtx));
+extern rtx alter_subreg PARAMS ((rtx *));
/* Report inconsistency between the assembler template and the operands.
In an `asm', it's the user's fault; otherwise, the compiler's fault. */
-extern void output_operand_lossage PARAMS ((const char *));
+extern void output_operand_lossage PARAMS ((const char *, ...)) ATTRIBUTE_PRINTF_1;
/* Output a string of assembler code, substituting insn operands.
Defined in final.c. */
/* Return nonzero if this function has no function calls. */
extern int leaf_function_p PARAMS ((void));
+/* Return 1 if branch is an forward branch.
+ Uses insn_shuid array, so it works only in the final pass. May be used by
+ output templates to add branch prediction hints, for example. */
+extern int final_forward_branch_p PARAMS ((rtx));
+
/* Return 1 if this function uses only the registers that can be
safely renumbered. */
extern int only_leaf_regs_used PARAMS ((void));
/* Locate the proper template for the given insn-code. */
extern const char *get_insn_template PARAMS ((int, rtx));
+/* Add function NAME to the weak symbols list. VALUE is a weak alias
+ associated with NAME. */
+extern int add_weak PARAMS ((const char *, const char *));
+
/* Functions in flow.c */
extern void allocate_for_life_analysis PARAMS ((void));
-extern int regno_uninitialized PARAMS ((int));
+extern int regno_uninitialized PARAMS ((unsigned int));
extern int regno_clobbered_at_setjmp PARAMS ((int));
extern void find_basic_blocks PARAMS ((rtx, int, FILE *));
-extern void cleanup_cfg PARAMS ((void));
+extern bool cleanup_cfg PARAMS ((int));
extern void check_function_return_warnings PARAMS ((void));
#endif
the text section. */
extern void readonly_data_section PARAMS ((void));
-/* Determine if we're in the text section. */
+/* Determine if we're in the text section. */
extern int in_text_section PARAMS ((void));
-#ifdef EH_FRAME_SECTION_ASM_OP
-extern void eh_frame_section PARAMS ((void));
-#endif
-
#ifdef CTORS_SECTION_ASM_OP
extern void ctors_section PARAMS ((void));
#endif
extern void fini_section PARAMS ((void));
#endif
+#ifdef EXPORTS_SECTION_ASM_OP
+extern void exports_section PARAMS ((void));
+#endif
+
#ifdef TDESC_SECTION_ASM_OP
extern void tdesc_section PARAMS ((void));
#endif
+#ifdef DRECTVE_SECTION_ASM_OP
+extern void drectve_section PARAMS ((void));
+#endif
+
+#ifdef SDATA_SECTION_ASM_OP
+extern void sdata_section PARAMS ((void));
+#endif
+
+#ifdef RDATA_SECTION_ASM_OP
+extern void rdata_section PARAMS ((void));
+#endif
+
#ifdef TREE_CODE
/* Tell assembler to change to section NAME for DECL.
If DECL is NULL, just switch to section NAME.
/* Tell assembler to switch to the section for function DECL. */
extern void function_section PARAMS ((tree));
-/* Tell assembler to switch to the section for the exception table. */
-extern void exception_section PARAMS ((void));
+/* Tell assembler to switch to the section for string merging. */
+extern void mergeable_string_section PARAMS ((tree, unsigned HOST_WIDE_INT,
+ unsigned int));
+
+/* Tell assembler to switch to the section for constant merging. */
+extern void mergeable_constant_section PARAMS ((enum machine_mode,
+ unsigned HOST_WIDE_INT,
+ unsigned int));
/* Declare DECL to be a weak symbol. */
extern void declare_weak PARAMS ((tree));
+/* Merge weak status. */
+extern void merge_weak PARAMS ((tree, tree));
#endif /* TREE_CODE */
/* Emit any pending weak declarations. */
extern void assemble_external PARAMS ((tree));
#endif /* TREE_CODE */
-/* Record an element in the table of global destructors.
- How this is done depends on what sort of assembler and linker
- are in use.
-
- NAME should be the name of a global function to be called
- at exit time. This name is output using assemble_name. */
-extern void assemble_destructor PARAMS ((const char *));
-
-/* Likewise for global constructors. */
-extern void assemble_constructor PARAMS ((const char *));
-
-/* Likewise for entries we want to record for garbage collection.
- Garbage collection is still under development. */
-extern void assemble_gc_entry PARAMS ((const char *));
-
/* Assemble code to leave SIZE bytes of zeros. */
extern void assemble_zeros PARAMS ((int));
Many macros in the tm file are defined to call this function. */
extern void assemble_name PARAMS ((FILE *, const char *));
+/* Return the assembler directive for creating a given kind of integer
+ object. SIZE is the number of bytes in the object and ALIGNED_P
+ indicates whether it is known to be aligned. Return NULL if the
+ assembly dialect has no such directive.
+
+ The returned string should be printed at the start of a new line and
+ be followed immediately by the object's initial value. */
+extern const char *integer_asm_op PARAMS ((int, int));
+
#ifdef RTX_CODE
-/* Assemble the integer constant X into an object of SIZE bytes.
- X must be either a CONST_INT or CONST_DOUBLE.
+/* Use directive OP to assemble an integer object X. Print OP at the
+ start of the line, followed immediately by the value of X. */
+extern void assemble_integer_with_op PARAMS ((const char *, rtx));
+
+/* The default implementation of the asm_out.integer target hook. */
+extern bool default_assemble_integer PARAMS ((rtx, unsigned int, int));
+
+/* Assemble the integer constant X into an object of SIZE bytes. ALIGN is
+ the alignment of the integer in bits. Return 1 if we were able to output
+ the constant, otherwise 0. If FORCE is non-zero, abort if we can't output
+ the constant. */
+extern bool assemble_integer PARAMS ((rtx, unsigned, unsigned, int));
- Return 1 if we were able to output the constant, otherwise 0. If FORCE is
- non-zero, abort if we can't output the constant. */
-extern int assemble_integer PARAMS ((rtx, int, int));
-extern int assemble_eh_integer PARAMS ((rtx, int, int));
+/* An interface to assemble_integer for the common case in which a value is
+ fully aligned and must be printed. VALUE is the value of the integer
+ object and SIZE is the number of bytes it contains. */
+#define assemble_aligned_integer(SIZE, VALUE) \
+ assemble_integer (VALUE, SIZE, (SIZE) * BITS_PER_UNIT, 1)
#ifdef REAL_VALUE_TYPE
/* Assemble the floating-point constant D into an object of size MODE. */
extern void assemble_real PARAMS ((REAL_VALUE_TYPE,
- enum machine_mode));
+ enum machine_mode,
+ unsigned));
#endif
#endif
Assumes output_addressed_constants has been done on EXP already.
Generate exactly SIZE bytes of assembler data, padding at the end
- with zeros if necessary. SIZE must always be specified. */
-extern void output_constant PARAMS ((tree, int));
+ with zeros if necessary. SIZE must always be specified.
+
+ ALIGN is the alignment in bits that may be assumed for the data. */
+extern void output_constant PARAMS ((tree, HOST_WIDE_INT,
+ unsigned int));
#endif
#ifdef RTX_CODE
extern rtx final_sequence;
#endif
-/* The line number of the beginning of the current function.
- sdbout.c needs this so that it can output relative linenumbers. */
+/* The line number of the beginning of the current function. Various
+ md code needs this so that it can output relative linenumbers. */
#ifdef SDB_DEBUGGING_INFO /* Avoid undef sym in certain broken linkers. */
extern int sdb_begin_function_line;
/* Nonzero if function being compiled doesn't contain any calls
(ignoring the prologue and epilogue). This is set prior to
local register allocation and is valid for the remaining
- compiler passes. */
+ compiler passes. */
extern int current_function_is_leaf;
/* Nonzero if function being compiled doesn't modify the stack pointer
(ignoring the prologue and epilogue). This is only valid after
- life_analysis has run. */
+ life_analysis has run. */
extern int current_function_sp_is_unchanging;
#define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \
(VAR) = ((SYMBOL_NAME) + ((SYMBOL_NAME)[0] == '*'))
#endif
-/* Assign unique numbers to labels generated for profiling. */
-extern int profile_label_no;
+/* Default target function prologue and epilogue assembler output. */
+extern void default_function_pro_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
+
+/* Tell assembler to switch to the section for the exception table. */
+extern void default_exception_section PARAMS ((void));
+
+/* Tell assembler to switch to the section for the EH frames. */
+extern void default_eh_frame_section PARAMS ((void));
+
+/* Default target hook that outputs nothing to a stream. */
+extern void no_asm_to_stream PARAMS ((FILE *));
+
+/* Flags controling properties of a section. */
+#define SECTION_ENTSIZE 0x000ff /* entity size in section */
+#define SECTION_CODE 0x00100 /* contains code */
+#define SECTION_WRITE 0x00200 /* data is writable */
+#define SECTION_DEBUG 0x00400 /* contains debug data */
+#define SECTION_LINKONCE 0x00800 /* is linkonce */
+#define SECTION_SMALL 0x01000 /* contains "small data" */
+#define SECTION_BSS 0x02000 /* contains zeros only */
+#define SECTION_FORGET 0x04000 /* forget that we've entered the section */
+#define SECTION_MERGE 0x08000 /* contains mergeable data */
+#define SECTION_STRINGS 0x10000 /* contains zero terminated strings without
+ embedded zeros */
+#define SECTION_OVERRIDE 0x20000 /* allow override of default flags */
+#define SECTION_MACH_DEP 0x40000 /* subsequent bits reserved for target */
+
+extern unsigned int get_named_section_flags PARAMS ((const char *));
+extern bool set_named_section_flags PARAMS ((const char *, unsigned int));
+extern void named_section_flags PARAMS ((const char *, unsigned int));
+extern bool named_section_first_declaration PARAMS((const char *));
+
+union tree_node;
+extern unsigned int default_section_type_flags PARAMS ((union tree_node *,
+ const char *, int));
+
+extern void default_no_named_section PARAMS ((const char *, unsigned int));
+extern void default_elf_asm_named_section PARAMS ((const char *, unsigned int));
+extern void default_coff_asm_named_section PARAMS ((const char *,
+ unsigned int));
+extern void default_pe_asm_named_section PARAMS ((const char *, unsigned int));
+
+extern void default_stabs_asm_out_destructor PARAMS ((struct rtx_def *, int));
+extern void default_named_section_asm_out_destructor PARAMS ((struct rtx_def *,
+ int));
+extern void default_dtor_section_asm_out_destructor PARAMS ((struct rtx_def *,
+ int));
+extern void default_stabs_asm_out_constructor PARAMS ((struct rtx_def *, int));
+extern void default_named_section_asm_out_constructor PARAMS ((struct rtx_def *,
+ int));
+extern void default_ctor_section_asm_out_constructor PARAMS ((struct rtx_def *,
+ int));
+
+/* Emit data for vtable gc for GNU binutils. */
+extern void assemble_vtable_entry PARAMS ((struct rtx_def *, HOST_WIDE_INT));
+extern void assemble_vtable_inherit PARAMS ((struct rtx_def *,
+ struct rtx_def *));
/* Utility to update paths from internal to external forms.
- Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
-This file is part of GNU CC.
+This file is part of GCC.
-GNU CC is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU Library General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
be considered a "key" and looked up as follows:
-- If this is a Win32 OS, then the Registry will be examined for
- an entry of "key" in
+ an entry of "key" in
HKEY_LOCAL_MACHINE\SOFTWARE\Free Software Foundation\<KEY>
as an environment variable, whose value will be returned.
Once all this is done, any '/' will be converted to DIR_SEPARATOR,
- if they are different.
+ if they are different.
NOTE: using resolve_keyed_path under Win32 requires linking with
advapi32.dll. */
static const char *std_prefix = PREFIX;
static const char *get_key_value PARAMS ((char *));
-static const char *translate_name PARAMS ((const char *));
+static char *translate_name PARAMS ((char *));
static char *save_string PARAMS ((const char *, int));
+static void tr PARAMS ((char *, int, int));
char *concat VPARAMS ((const char *first, ...));
#if defined(_WIN32) && defined(ENABLE_WIN32_REGISTRY)
return prefix;
}
-/* Concatenate a sequence of strings, returning the result.
-
- This function is based on the one in libiberty. */
-
-char *
-concat VPARAMS ((const char *first, ...))
-{
- register int length;
- register char *newstr;
- register char *end;
- register const char *arg;
- va_list args;
-#ifndef ANSI_PROTOTYPES
- const char *first;
-#endif
-
- /* First compute the size of the result and get sufficient memory. */
-
- VA_START (args, first);
-#ifndef ANSI_PROTOTYPES
- first = va_arg (args, const char *);
-#endif
-
- arg = first;
- length = 0;
-
- while (arg != 0)
- {
- length += strlen (arg);
- arg = va_arg (args, const char *);
- }
-
- newstr = (char *) xmalloc (length + 1);
- va_end (args);
-
- /* Now copy the individual pieces to the result string. */
-
- VA_START (args, first);
-#ifndef ANSI_PROTOTYPES
- first = va_arg (args, char *);
-#endif
-
- end = newstr;
- arg = first;
- while (arg != 0)
- {
- while (*arg)
- *end++ = *arg++;
- arg = va_arg (args, const char *);
- }
- *end = '\000';
- va_end (args);
-
- return (newstr);
-}
-
/* Return a copy of a string that has been placed in the heap. */
static char *
const char *s;
int len;
{
- register char *result = xmalloc (len + 1);
+ char *result = xmalloc (len + 1);
memcpy (result, s, len);
result[len] = 0;
}
#endif
-/* If NAME starts with a '@' or '$', apply the translation rules above
- and return a new name. Otherwise, return the given name. */
+/* If NAME, a malloc-ed string, starts with a '@' or '$', apply the
+ translation rules above and return a newly malloc-ed name.
+ Otherwise, return the given name. */
-static const char *
+static char *
translate_name (name)
- const char *name;
+ char *name;
{
- char code = name[0];
- char *key;
- const char *prefix = 0;
+ char code;
+ char *key, *old_name;
+ const char *prefix;
int keylen;
- if (code != '@' && code != '$')
- return name;
-
- for (keylen = 0;
- (name[keylen + 1] != 0 && !IS_DIR_SEPARATOR (name[keylen + 1]));
- keylen++)
- ;
+ for (;;)
+ {
+ code = name[0];
+ if (code != '@' && code != '$')
+ break;
+
+ for (keylen = 0;
+ (name[keylen + 1] != 0 && !IS_DIR_SEPARATOR (name[keylen + 1]));
+ keylen++)
+ ;
+
+ key = (char *) alloca (keylen + 1);
+ strncpy (key, &name[1], keylen);
+ key[keylen] = 0;
+
+ if (code == '@')
+ {
+ prefix = get_key_value (key);
+ if (prefix == 0)
+ prefix = std_prefix;
+ }
+ else
+ prefix = getenv (key);
- key = (char *) alloca (keylen + 1);
- strncpy (key, &name[1], keylen);
- key[keylen] = 0;
+ if (prefix == 0)
+ prefix = PREFIX;
- name = &name[keylen + 1];
+ /* We used to strip trailing DIR_SEPARATORs here, but that can
+ sometimes yield a result with no separator when one was coded
+ and intended by the user, causing two path components to run
+ together. */
- if (code == '@')
- {
- prefix = get_key_value (key);
- if (prefix == 0)
- prefix = std_prefix;
+ old_name = name;
+ name = concat (prefix, &name[keylen + 1], NULL);
+ free (old_name);
}
- else
- prefix = getenv (key);
- if (prefix == 0)
- prefix = PREFIX;
-
- /* We used to strip trailing DIR_SEPARATORs here, but that can
- sometimes yield a result with no separator when one was coded
- and intended by the user, causing two path components to run
- together. */
+ return name;
+}
- return concat (prefix, name, NULL);
+/* In a NUL-terminated STRING, replace character C1 with C2 in-place. */
+static void
+tr (string, c1, c2)
+ char *string;
+ int c1, c2;
+{
+ do
+ {
+ if (*string == c1)
+ *string = c2;
+ }
+ while (*string++);
}
-/* Update PATH using KEY if PATH starts with PREFIX. */
+/* Update PATH using KEY if PATH starts with PREFIX. The returned
+ string is always malloc-ed, and the caller is responsible for
+ freeing it. */
-const char *
+char *
update_path (path, key)
const char *path;
const char *key;
{
+ char *result;
+
if (! strncmp (path, std_prefix, strlen (std_prefix)) && key != 0)
{
- if (key[0] != '$')
- key = concat ("@", key, NULL);
+ bool free_key = false;
- path = concat (key, &path[strlen (std_prefix)], NULL);
-
- while (path[0] == '@' || path[0] == '$')
- path = translate_name (path);
+ if (key[0] != '$')
+ {
+ key = concat ("@", key, NULL);
+ free_key = true;
+ }
+
+ result = concat (key, &path[strlen (std_prefix)], NULL);
+ if (free_key)
+ free ((char *) key);
+ result = translate_name (result);
}
+ else
+ result = xstrdup (path);
#ifdef UPDATE_PATH_HOST_CANONICALIZE
-/* Perform host dependant canonicalization when needed. */
-UPDATE_PATH_HOST_CANONICALIZE (path, key);
+ /* Perform host dependent canonicalization when needed. */
+ UPDATE_PATH_HOST_CANONICALIZE (path);
#endif
#ifdef DIR_SEPARATOR_2
- /* Convert DIR_SEPARATOR_2 to DIR_SEPARATOR. */
- if (DIR_SEPARATOR != DIR_SEPARATOR_2)
- {
- char *new_path = xstrdup (path);
- path = new_path;
- do {
- if (*new_path == DIR_SEPARATOR_2)
- *new_path = DIR_SEPARATOR;
- } while (*new_path++);
- }
+ /* Convert DIR_SEPARATOR_2 to DIR_SEPARATOR. */
+ if (DIR_SEPARATOR_2 != DIR_SEPARATOR)
+ tr (result, DIR_SEPARATOR_2, DIR_SEPARATOR);
#endif
-
+
#if defined (DIR_SEPARATOR) && !defined (DIR_SEPARATOR_2)
if (DIR_SEPARATOR != '/')
- {
- char *new_path = xstrdup (path);
- path = new_path;
- do {
- if (*new_path == '/')
- *new_path = DIR_SEPARATOR;
- } while (*new_path++);
- }
+ tr (result, '/', DIR_SEPARATOR);
#endif
- return path;
+ return result;
}
/* Reset the standard prefix */
/* Provide prototypes for functions exported from prefix.c.
Copyright (C) 1999 Free Software Foundation, Inc.
-This file is part of GNU CC.
+This file is part of GCC.
-GNU CC is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU Library General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
#ifndef GCC_PREFIX_H
#define GCC_PREFIX_H
-extern const char *update_path PARAMS ((const char *, const char *));
+/* Update PATH using KEY if PATH starts with PREFIX. The returned
+ string is always malloc-ed, and the caller is responsible for
+ freeing it. */
+extern char *update_path PARAMS ((const char *path, const char *key));
extern void set_std_prefix PARAMS ((const char *, int));
#endif /* ! GCC_PREFIX_H */
#define xmalloc_set_program_name(n) /* nada */
#define xstrerror(e) strerror(e)
-extern char *lbasename(const char *path);
-
/* Define results of standard character escape sequences. */
#define TARGET_BELL 007
#define TARGET_BS 010
#define TARGET_VT 013
#define TARGET_FF 014
#define TARGET_CR 015
+# define TARGET_ESC 033
#define CHAR_TYPE_SIZE 8
#define WCHAR_TYPE_SIZE 32 /* ? maybe ? */
#define TARGET_OBJECT_SUFFIX ".rel"
+#ifndef WCHAR_UNSIGNED
+#define WCHAR_UNSIGNED 0
+#endif
+
#ifdef _WIN32
#define HAVE_DOS_BASED_FILE_SYSTEM
#endif
# PROP Intermediate_Dir "Debug"\r
# PROP Ignore_Export_Lib 0\r
# PROP Target_Dir ""\r
-# ADD BASE CPP /nologo /MLd /W3 /Gm /GX /ZI /Od /I "." /I ".\libiberty" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "HAVE_CONFIG_H"/FR /FD /GZ /c\r
-# ADD CPP /nologo /MLd /W3 /Gm /GX /ZI /Od /I "." /I ".\libiberty" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "HAVE_CONFIG_H" /FR /FD /GZ /c\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I ".\libiberty" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR /FD /D /GZ "HAVE_CONFIG_H" /c\r
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I ".\libiberty" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "HAVE_CONFIG_H" /FR /FD /GZ /c\r
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32\r
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32\r
# ADD BASE RSC /l 0x409 /d "_DEBUG"\r
# PROP Intermediate_Dir "Release"\r
# PROP Ignore_Export_Lib 0\r
# PROP Target_Dir ""\r
-# ADD BASE CPP /nologo /ML /W3 /GX /O2 /I "." /I ".\libiberty" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c\r
-# ADD CPP /nologo /ML /W3 /GX /O2 /I "." /I ".\libiberty" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "HAVE_CONFIG_H" /D "_WIN32" /FD /c\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /I "." /I ".\libiberty" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c\r
+# ADD CPP /nologo /W3 /GX /O2 /I "." /I ".\libiberty" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "HAVE_CONFIG_H" /D "_WIN32" /FD /c\r
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32\r
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32\r
# ADD BASE RSC /l 0x409 /d "NDEBUG"\r
\r
# Begin Target\r
\r
-# Name "sdcpp - Win32 Release"\r
# Name "sdcpp - Win32 Debug"\r
+# Name "sdcpp - Win32 Release"\r
# Begin Group "Source Files"\r
\r
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"\r
# Begin Source File\r
\r
+SOURCE=.\libiberty\concat.c\r
+# End Source File\r
+# Begin Source File\r
+\r
SOURCE=.\cppdefault.c\r
# End Source File\r
# Begin Source File\r
# End Source File\r
# Begin Source File\r
\r
-SOURCE=.\intl.c\r
+SOURCE=.\libiberty\hex.c\r
# End Source File\r
# Begin Source File\r
\r
# End Source File\r
# Begin Source File\r
\r
+SOURCE=".\line-map.c"\r
+# End Source File\r
+# Begin Source File\r
+\r
SOURCE=.\mbchar.c\r
# End Source File\r
# Begin Source File\r
# End Source File\r
# Begin Source File\r
\r
+SOURCE=".\line-map.h"\r
+# End Source File\r
+# Begin Source File\r
+\r
SOURCE=.\mkdeps.h\r
# End Source File\r
# Begin Source File\r
/* Get common system includes and various definitions and declarations based
on autoconf macros.
- Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
-This file is part of GNU CC.
+This file is part of GCC.
-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.
+GCC 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.
+GCC 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. */
+along with GCC; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA. */
#ifndef GCC_SYSTEM_H
#include "ansidecl.h"
-/* We must include stdarg.h/varargs.h before stdio.h. */
+/* We must include stdarg.h/varargs.h before stdio.h. */
#ifdef ANSI_PROTOTYPES
#include <stdarg.h>
#else
#include <safe-ctype.h>
#endif
-/* Define a default escape character; it's different for EBCDIC. */
-#ifndef TARGET_ESC
-#define TARGET_ESC 033
-#endif
-
#include <sys/types.h>
#include <errno.h>
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
+/* We use this identifier later and it appears in some vendor param.h's. */
+# undef PREFETCH
#endif
#if HAVE_LIMITS_H
/* Get definitions of HOST_WIDE_INT and HOST_WIDEST_INT. */
#include "hwint.h"
+/* A macro to determine whether a VALUE lies inclusively within a
+ certain range without evaluating the VALUE more than once. This
+ macro won't warn if the VALUE is unsigned and the LOWER bound is
+ zero, as it would e.g. with "VALUE >= 0 && ...". Note the LOWER
+ bound *is* evaluated twice, and LOWER must not be greater than
+ UPPER. However the bounds themselves can be either positive or
+ negative. */
+#define IN_RANGE(VALUE, LOWER, UPPER) \
+ ((unsigned HOST_WIDE_INT) ((VALUE) - (LOWER)) <= ((UPPER) - (LOWER)))
+
/* Infrastructure for defining missing _MAX and _MIN macros. Note that
macros defined with these cannot be used in #if. */
# define STDERR_FILENO 2
#endif
-/* Some systems have mkdir that takes a single argument. */
+/* Some systems have mkdir that takes a single argument. */
#ifdef MKDIR_TAKES_ONE_ARG
# define mkdir(a,b) mkdir(a)
#endif
(IS_DIR_SEPARATOR ((STR)[0]) || (STR)[0] == '$')
#endif
-/* Get libiberty declarations. */
-/* #include "libiberty.h" */
+/* Get libiberty declarations. */
+#include "libiberty.h"
#include "sdcc.h"
#include "symcat.h"
#endif
#ifndef offsetof
-#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *) 0)->MEMBER)
#endif
/* 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
+ if you intend to initialize 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}
#endif /* ! __FUNCTION__ */
#endif
+/* __builtin_expect(A, B) evaluates to A, but notifies the compiler that
+ the most likely value of A is B. This feature was added at some point
+ between 2.95 and 3.0. Let's use 3.0 as the lower bound for now. */
+#if (GCC_VERSION < 3000)
+#define __builtin_expect(a, b) (a)
+#endif
+
+/* Provide some sort of boolean type. We use stdbool.h if it's
+ available. This must be after all inclusion of system headers,
+ as some of them will mess us up. */
+#undef bool
+#undef true
+#undef false
+#undef TRUE
+#undef FALSE
+
+#ifdef HAVE_STDBOOL_H
+# include <stdbool.h>
+#else
+# if !HAVE__BOOL
+typedef char _Bool;
+# endif
+# define bool _Bool
+# define true 1
+# define false 0
+#endif
+
+#define TRUE true
+#define FALSE false
+
/* As the last action in this file, we poison the identifiers that
shouldn't be used. Note, luckily gcc-3.0's token-based integrated
preprocessor won't trip on poisoned identifiers that arrive from
#undef calloc
#undef strdup
#pragma GCC poison malloc realloc calloc strdup
+
+/* Old target macros that have moved to the target hooks structure. */
+ #pragma GCC poison ASM_OPEN_PAREN ASM_CLOSE_PAREN \
+ FUNCTION_PROLOGUE FUNCTION_EPILOGUE \
+ FUNCTION_END_PROLOGUE FUNCTION_BEGIN_EPILOGUE \
+ DECL_MACHINE_ATTRIBUTES COMP_TYPE_ATTRIBUTES INSERT_ATTRIBUTES \
+ VALID_MACHINE_DECL_ATTRIBUTE VALID_MACHINE_TYPE_ATTRIBUTE \
+ SET_DEFAULT_TYPE_ATTRIBUTES SET_DEFAULT_DECL_ATTRIBUTES \
+ MERGE_MACHINE_TYPE_ATTRIBUTES MERGE_MACHINE_DECL_ATTRIBUTES \
+ MD_INIT_BUILTINS MD_EXPAND_BUILTIN ASM_OUTPUT_CONSTRUCTOR \
+ ASM_OUTPUT_DESTRUCTOR SIGNED_CHAR_SPEC
+
+/* And other obsolete target macros, or macros that used to be in target
+ headers and were not used, and may be obsolete or may never have
+ been used. */
+ #pragma GCC poison INT_ASM_OP ASM_OUTPUT_EH_REGION_BEG \
+ ASM_OUTPUT_EH_REGION_END ASM_OUTPUT_LABELREF_AS_INT \
+ DOESNT_NEED_UNWINDER EH_TABLE_LOOKUP OBJC_SELECTORS_WITHOUT_LABELS \
+ OMIT_EH_TABLE EASY_DIV_EXPR IMPLICIT_FIX_EXPR \
+ LONGJMP_RESTORE_FROM_STACK MAX_INT_TYPE_SIZE ASM_IDENTIFY_GCC \
+ STDC_VALUE TRAMPOLINE_ALIGN ASM_IDENTIFY_GCC_AFTER_SOURCE \
+ SLOW_ZERO_EXTEND SUBREG_REGNO_OFFSET DWARF_LINE_MIN_INSTR_LENGTH
+
#endif /* IN_GCC */
/* Note: not all uses of the `index' token (e.g. variable names and
#include "ansidecl.h"
#include "version.h"
-const char *const version_string = "3.1 20010625 (experimental) + SDCC";
+const char *const version_string = "3.1 + SDCC";