This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC] [PATCH] Move cpplib out of the gcc directory


Here is an attempt to move cpplib to the toplevel.

Problematic points:
- I decided to move hashtable.c to libiberty (it looks useful enough).
  This means K&R'ing it.
- java depends on libcpp.a to use mkdeps.o (nothing terrible, nm
  confirms that it does not bring in the whole preprocessor).
  Maybe the same will be needed for Fortran 90?  (I have not
  checked yet).
- Some autoconf macros are moved to the toplevel config directory.
  Some configure tests can be removed from gcc.
- I needed depcomp for automake's dependency tracking, and I got
  it from boehm-gc.  (Does boehm-gc really use it?!?)
- I used a separate i18n domain, and mapped _ to dgettext.  I attach
  a tarball of the translations, which I extracted from the gcc PO
  files.
- The snapshot script must create the .gmo files.  Gerald, can
  you help here?

The diff was made after moving the files.  I bootstrapped this
on i686-pc-linux-gnu (C/C++/Java/ObjC only since it is not the
definitive version of the patch).  I have not regtested it.

Comments are welcome. Thanks,

Paolo

ChangeLog:

2004-05-18 Paolo Bonzini <bonzini@gnu.org>

        * Makefile.def (host_modules): add libcpp.
        * Makefile.tpl: Add dependencies on and for libcpp.
        * Makefile.in: Regenerate.
        * depcomp: Moved from boehm-gc.

boehm-gc/ChangeLog:

2004-05-18 Paolo Bonzini <bonzini@gnu.org>

        * Makefile.direct: Remove reference to depcomp.
        * depcomp: Removed.

config/ChangeLog:

2004-05-18 Paolo Bonzini <bonzini@gnu.org>

        * acx.m4 (ACX_HEADER_STDBOOL, ACX_HEADER_STRING):
        From gcc.

gcc/ChangeLog:

2004-05-18 Paolo Bonzini <bonzini@gnu.org>

	Move libcpp to the toplevel.
        * Makefile.in: Remove references to libcpp files,
        use LIBCPP instead.
        * aclocal.m4 (gcc_AC_HEADER_STDBOOL,
        gcc_AC_HEADER_STRING, gcc_AC_C__BOOL): Remove.
        * configure.ac (gcc_AC_C__BOOL, HAVE_UCHAR): Remove tests.
	* configure: Regenerate.
	* config.in: Regenerate.
        * cppcharset.c: Removed.
        * cpperror.c: Removed.
        * cppexp.c: Removed.
        * cppfiles.c: Removed.
        * cpphash.c: Removed.
        * cpphash.h: Removed.
        * cppinit.c: Removed.
        * cpplex.c: Removed.
        * cpplib.c: Removed.
        * cpplib.h: Removed.
        * cppmacro.c: Removed.
        * cpppch.c: Removed.
        * cpptrad.c: Removed.
        * cppucnid.h: Removed.
        * cppucnid.pl: Removed.
        * cppucnid.tab: Removed.
        * line-map.c: Removed.
        * line-map.h: Removed.
        * mkdeps.c: Removed.
        * mkdeps.h: Removed.
        * system.h (O_NONBLOCK, O_NOCTTY): Do not define.

gcc/cp/ChangeLog:

* Make-lang.in: Use $(LIBCPP) instead of libcpp.a.

gcc/java/ChangeLog:

* Make-lang.in: Use $(LIBCPP) instead of mkdeps.o.

include/ChangeLog:

2004-05-18 Paolo Bonzini <bonzini@gnu.org>

* include/hashtable.h: Moved from gcc.

libcpp/ChangeLog:

2004-05-18 Paolo Bonzini <bonzini@gnu.org>

	Moved libcpp from the gcc subdirectory to the toplevel.
        * Makefile.am: New file.
	* Makefile.in: Regenerate.
        * configure.ac: New file.
	* configure: Regenerate.
	* config.in: Regenerate.
        * cppcharset.c: Moved from gcc.
        * cpperror.c: Moved from gcc.  Do not include intl.h.
        * cppexp.c: Moved from gcc.
        * cppfiles.c: Moved from gcc.  Do not include intl.h.
        Remove #define of O_BINARY, it is in system.h.
        * cpphash.c: Moved from gcc.
        * cpphash.h: Moved from gcc.
        * cppinit.c: Moved from gcc.
        * cpplex.c: Moved from gcc.
        * cpplib.c: Moved from gcc.
        * cpplib.h: Moved from gcc.
        * cppmacro.c: Moved from gcc.
        * cpppch.c: Moved from gcc.  Do not include intl.h.
        * cpptrad.c: Moved from gcc.
        * cppucnid.h: Moved from gcc.
        * cppucnid.pl: Moved from gcc.
        * cppucnid.tab: Moved from gcc.
        * line-map.c: Moved from gcc.  Do not include intl.h.
        * line-map.h: Moved from gcc.
        * mkdeps.c: Moved from gcc.
        * mkdeps.h: Moved from gcc.
        * system.h: New file.

libcpp/po/ChangeLog:

2004-05-18 Paolo Bonzini <bonzini@gnu.org>

        * be.po: Extracted from gcc/po/be.po.
        * ca.po: Extracted from gcc/po/ca.po.
        * da.po: Extracted from gcc/po/da.po.
        * de.po: Extracted from gcc/po/de.po.
        * el.po: Extracted from gcc/po/el.po.
        * es.po: Extracted from gcc/po/es.po.
        * fr.po: Extracted from gcc/po/fr.po.
        * ja.po: Extracted from gcc/po/ja.po.
        * nl.po: Extracted from gcc/po/nl.po.
        * sv.po: Extracted from gcc/po/sv.po.
        * tr.po: Extracted from gcc/po/tr.po.

libiberty/ChangeLog:

2004-05-18 Paolo Bonzini <bonzini@gnu.org>

        * Makefile.in (CFILES): Add hashtable.c.
        (REQUIRED_OFILES): Add hashtable.o.
        (INSTALLED_HEADERS): Add hashtable.h.
	Regenerate dependencies.
        * hashtable.c: Moved from gcc.  Remove dependencies
        on system.h and convert functions to K&R.

Attachment: cpplib-po-files.tar.gz
Description: application/gzip

diff -ru gcc-save/Makefile.def gcc/Makefile.def
--- gcc-save/Makefile.def	2004-03-22 12:55:53.000000000 +0100
+++ gcc/Makefile.def	2004-05-18 20:30:35.000000000 +0200
@@ -58,6 +58,7 @@
                 missing=mostlyclean; };
 host_modules= { module= itcl; };
 host_modules= { module= ld; };
+host_modules= { module= libcpp; bootstrap=yes; no_install= true; no_check= true; };
 host_modules= { module= libgui; };
 host_modules= { module= libiberty; };
 host_modules= { module= libtool; };
diff -ru gcc-save/Makefile.tpl gcc/Makefile.tpl
--- gcc-save/Makefile.tpl	2004-04-23 17:35:54.000000000 +0200
+++ gcc/Makefile.tpl	2004-05-18 20:31:07.000000000 +0200
@@ -1616,6 +1616,7 @@
 # GCC needs to identify certain tools.
 # GCC also needs the information exported by the intl configure script.
 configure-gcc: maybe-configure-intl maybe-configure-binutils maybe-configure-gas maybe-configure-ld maybe-configure-bison maybe-configure-flex
-all-gcc: maybe-all-libiberty maybe-all-intl maybe-all-bison maybe-all-byacc maybe-all-binutils maybe-all-gas maybe-all-ld maybe-all-zlib
+all-gcc: maybe-all-libiberty maybe-all-intl maybe-all-bison maybe-all-byacc maybe-all-binutils maybe-all-gas maybe-all-ld maybe-all-zlib maybe-all-libcpp
+configure-libcpp: maybe-configure-libiberty maybe-configure-intl
+all-libcpp: maybe-all-libiberty maybe-all-intl
 # This is a slightly kludgy method of getting dependencies on 
 # all-build-libiberty correct; it would be better to build it every time.
 all-gcc: maybe-all-build-libiberty
diff -ru gcc-save/config/acx.m4 gcc/config/acx.m4
--- gcc-save/config/acx.m4	2004-04-17 08:48:32.000000000 +0200
+++ gcc/config/acx.m4	2004-05-18 20:49:29.000000000 +0200
@@ -193,3 +193,37 @@
   have_gnat=no
 fi
 ])
+
+dnl See whether we can include both string.h and strings.h.
+AC_DEFUN([ACX_HEADER_STRING],
+[AC_CACHE_CHECK([whether string.h and strings.h may both be included],
+  gcc_cv_header_string,
+[AC_TRY_COMPILE([#include <string.h>
+#include <strings.h>], , gcc_cv_header_string=yes, gcc_cv_header_string=no)])
+if test $gcc_cv_header_string = yes; then
+  AC_DEFINE(STRING_WITH_STRINGS, 1, [Define if you can safely include both <string.h> and <strings.h>.])
+fi
+])
+
+dnl See if stdbool.h properly defines bool and true/false.
+dnl Check whether _Bool is built-in.
+AC_DEFUN([ACX_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
+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
+])
+
diff -ru gcc-save/boehm-gc/Makefile.direct gcc/boehm-gc/Makefile.direct
--- gcc-save/boehm-gc/Makefile.direct	2004-02-20 02:48:51.000000000 +0100
+++ gcc/boehm-gc/Makefile.direct	2004-05-19 00:06:22.000000000 +0200
@@ -326,7 +326,7 @@
 		 ltconfig aclocal.m4 config.sub config.guess \
 		 include/Makefile.am include/Makefile.in \
 		 doc/Makefile.am doc/Makefile.in \
-		 ltmain.sh mkinstalldirs depcomp missing
+		 ltmain.sh mkinstalldirs missing
 
 OTHER_MAKEFILES= OS2_MAKEFILE NT_MAKEFILE NT_THREADS_MAKEFILE gc.mak \
 		 BCC_MAKEFILE EMX_MAKEFILE WCC_MAKEFILE Makefile.dj \
diff -ru gcc-save/gcc/Makefile.in gcc/gcc/Makefile.in
--- gcc-save/gcc/Makefile.in	2004-04-23 11:55:08.000000000 +0200
+++ gcc/gcc/Makefile.in	2004-05-18 21:17:15.000000000 +0200
@@ -349,6 +349,7 @@
 FIBHEAP_H   = $(srcdir)/../include/fibheap.h
 PARTITION_H = $(srcdir)/../include/partition.h
 MD5_H	    = $(srcdir)/../include/md5.h
+HASHTABLE_H = $(srcdir)/../include/hashtable.h
 
 # Default native SYSTEM_HEADER_DIR, to be overridden by targets.
 NATIVE_SYSTEM_HEADER_DIR = /usr/include
@@ -686,7 +687,7 @@
 C_TREE_H = c-tree.h $(C_COMMON_H)
 SYSTEM_H = system.h hwint.h $(srcdir)/../include/libiberty.h
 PREDICT_H = predict.h predict.def
-CPPLIB_H = cpplib.h line-map.h
+CPPLIB_H = $(srcdir)/../libcpp/cpplib.h $(srcdir)/../libcpp/line-map.h
 PRETTY_PRINT_H = pretty-print.h input.h $(OBSTACK_H)
 DIAGNOSTIC_H = diagnostic.h diagnostic.def $(PRETTY_PRINT_H)
 C_PRETTY_PRINT_H = $(PRETTY_PRINT_H) $(C_COMMON_H) $(TREE_H)
@@ -710,10 +711,11 @@
 # Build and host support libraries.  FORBUILD is either
 # .. or ../$(build_alias) depending on whether host != build.
 LIBIBERTY = ../libiberty/libiberty.a
+LIBCPP = ../libcpp/libcpp.a
 BUILD_LIBIBERTY = @FORBUILD@/libiberty/libiberty.a
 
 # Dependencies on the intl and portability libraries.
-LIBDEPS= $(LIBIBERTY) $(LIBINTL_DEP) $(LIBICONV_DEP) libcpp.a
+LIBDEPS= $(LIBIBERTY) $(LIBINTL_DEP) $(LIBICONV_DEP) $(LIBCPP)
 
 # Likewise, for use in the tools that must run on this machine
 # even if we are cross-building GCC.
@@ -721,7 +723,7 @@
 
 # How to link with both our special library facilities
 # and the system's installed libraries.
-LIBS = @LIBS@ libcpp.a $(LIBIBERTY) $(LIBINTL) $(LIBICONV)
+LIBS = @LIBS@ $(LIBCPP) $(LIBIBERTY) $(LIBINTL) $(LIBICONV)
 
 # Any system libraries needed just for GNAT.
 SYSLIBS = @GNAT_LIBEXC@
@@ -750,7 +752,7 @@
 # currently being compiled, in both source trees, to be examined as well.
 # libintl.h will be found in ../intl if we are using the included libintl.
 INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
-	   -I$(srcdir)/../include @INCINTL@
+	   -I$(srcdir)/../libcpp -I$(srcdir)/../include @INCINTL@
 
 .c.o:
 	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
@@ -869,7 +871,7 @@
  et-forest.o cfghooks.o bt-load.o pretty-print.o $(GGC) web.o passes.o
 
 OBJS-md = $(out_object_file)
-OBJS-archive = $(EXTRA_OBJS) $(host_hook_obj) hashtable.o tree-inline.o	   \
+OBJS-archive = $(EXTRA_OBJS) $(host_hook_obj) tree-inline.o		   \
   tree-optimize.o cgraph.o cgraphunit.o
 
 OBJS = $(OBJS-common) $(out_object_file) $(OBJS-archive)
@@ -898,7 +900,7 @@
  protoize$(exeext) unprotoize$(exeext) \
  $(SPECS) collect2$(exeext) \
  gcov-iov$(build_exeext) gcov$(exeext) gcov-dump$(exeext) \
- *.[0-9][0-9].* *.[si] libcpp.a libbackend.a libgcc.mk \
+ *.[0-9][0-9].* *.[si] libbackend.a libgcc.mk \
  $(LANG_STAGESTUFF)
 
 # Defined in libgcc2.c, included only in the static library.
@@ -1090,7 +1092,7 @@
 # This is used only if the user explicitly asks for it.
 compilations: $(BACKEND)
 
-# Like libcpp.a, this archive is strictly for the host.
+# This archive is strictly for the host.
 libbackend.a: $(OBJS@onestep@)
 	-rm -rf libbackend.a
 	$(AR) $(AR_FLAGS) libbackend.a $(OBJS@onestep@)
@@ -1320,7 +1322,7 @@
     c-pragma.h input.h intl.h flags.h toplev.h output.h \
     $(CPPLIB_H) $(EXPR_H) $(TM_P_H)
 c-ppoutput.o : c-ppoutput.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
-    $(C_COMMON_H) $(TREE_H) $(CPPLIB_H) cpphash.h $(TM_P_H) c-pragma.h
+    $(C_COMMON_H) $(TREE_H) $(CPPLIB_H) $(srcdir)/../libcpp/cpphash.h $(TM_P_H) c-pragma.h
 c-objc-common.o : c-objc-common.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
     $(C_TREE_H) $(RTL_H) insn-config.h $(INTEGRATE_H) $(EXPR_H) $(C_TREE_H) \
     flags.h toplev.h tree-inline.h $(DIAGNOSTIC_H) $(VARRAY_H) \
@@ -2078,10 +2080,10 @@
 	$(SHELL) $(srcdir)/../move-if-change tmp-preds.h tm-preds.h
 	$(STAMP) s-preds
 
-GTFILES = $(srcdir)/input.h $(srcdir)/coretypes.h $(srcdir)/cpplib.h \
+GTFILES = $(srcdir)/input.h $(srcdir)/coretypes.h $(srcdir)/../libcpp/cpplib.h \
   $(host_xm_file_list) $(tm_file_list) $(HASHTAB_H) $(SPLAY_TREE_H) \
   $(srcdir)/bitmap.h $(srcdir)/coverage.c $(srcdir)/function.h  $(srcdir)/rtl.h \
-  $(srcdir)/optabs.h $(srcdir)/tree.h $(srcdir)/libfuncs.h $(srcdir)/hashtable.h \
+  $(srcdir)/optabs.h $(srcdir)/tree.h $(srcdir)/libfuncs.h $(HASHTABLE_H) \
   $(srcdir)/real.h $(srcdir)/varray.h $(srcdir)/insn-addr.h \
   $(srcdir)/cselib.h $(srcdir)/basic-block.h  $(srcdir)/cgraph.h \
   $(srcdir)/c-common.h $(srcdir)/c-tree.h \
@@ -2356,42 +2358,12 @@
   -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
   @TARGET_SYSTEM_ROOT_DEFINE@
 
-LIBCPP_OBJS =	cpplib.o cpplex.o cppmacro.o cppexp.o cppfiles.o cpptrad.o \
-		cpphash.o cpperror.o cppinit.o cppcharset.o \
-		hashtable.o line-map.o mkdeps.o cpppch.o
-
-LIBCPP_DEPS =	$(CPPLIB_H) cpphash.h line-map.h hashtable.h intl.h \
-		$(OBSTACK_H) $(CONFIG_H) $(SYSTEM_H)
-
-# Most of the other archives built/used by this makefile are for
-# targets.  This one is strictly for the host.
-libcpp.a: $(LIBCPP_OBJS)
-	-rm -rf libcpp.a
-	$(AR) $(AR_FLAGS) libcpp.a $(LIBCPP_OBJS)
-	-$(RANLIB) libcpp.a
-
-cppcharset.o: cppcharset.c $(LIBCPP_DEPS) cppucnid.h
-cpperror.o: cpperror.c $(LIBCPP_DEPS)
-cppexp.o:   cppexp.c   $(LIBCPP_DEPS)
-cpplex.o:   cpplex.c   $(LIBCPP_DEPS)
-cppmacro.o: cppmacro.c $(LIBCPP_DEPS)
-cpplib.o:   cpplib.c   $(LIBCPP_DEPS)
-cpphash.o:  cpphash.c  $(LIBCPP_DEPS)
-cpptrad.o:  cpptrad.c  $(LIBCPP_DEPS)
-cppfiles.o: cppfiles.c $(LIBCPP_DEPS) $(HASHTAB_H) $(MD5_H) mkdeps.h
-cppinit.o:  cppinit.c  $(LIBCPP_DEPS) mkdeps.h
-cpppch.o:   cpppch.c   $(LIBCPP_DEPS) mkdeps.h
-
 cppdefault.o: cppdefault.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
 	cppdefault.h Makefile
 	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
 	  $(PREPROCESSOR_DEFINES) \
 	  -c $(srcdir)/cppdefault.c $(OUTPUT_OPTION)
 
-mkdeps.o: mkdeps.c $(CONFIG_H) $(SYSTEM_H) mkdeps.h
-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)
-
 # Note for the stamp targets, we run the program `true' instead of
 # having an empty command (nothing following the semicolon).
 
@@ -2605,7 +2577,7 @@
 # This is nominally a 'build' program, but it's run only when host==build,
 # so we can (indeed, must) use $(LIBDEPS) and $(LIBS).
 fix-header$(build_exeext): fix-header.o scan-decls.o scan.o xsys-protos.h \
-           c-incpath.o cppdefault.o prefix.o $(LIBDEPS) libcpp.a
+           c-incpath.o cppdefault.o prefix.o $(LIBDEPS) $(LIBCPP)
 	$(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ fix-header.o \
 	c-incpath.o cppdefault.o scan-decls.o prefix.o scan.o $(LIBS)
 
diff -ru gcc-save/gcc/aclocal.m4 gcc/gcc/aclocal.m4
--- gcc-save/gcc/aclocal.m4	2004-03-11 06:01:16.000000000 +0100
+++ gcc/gcc/aclocal.m4	2004-05-18 20:08:05.000000000 +0200
@@ -3,30 +3,6 @@
 sinclude(../config/gettext.m4)
 sinclude(../config/progtest.m4)
 
-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],
-  gcc_cv_header_string,
-[AC_TRY_COMPILE([#include <string.h>
-#include <strings.h>], , gcc_cv_header_string=yes, gcc_cv_header_string=no)])
-if test $gcc_cv_header_string = yes; then
-  AC_DEFINE(STRING_WITH_STRINGS, 1, [Define if you can safely include both <string.h> and <strings.h>.])
-fi
-])
-
 dnl See whether we need a declaration for a function.
 dnl The result is highly dependent on the INCLUDES passed in, so make sure.
 dnl to use a different cache variable name in this macro if it is invoked
@@ -198,18 +174,6 @@
 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],
diff -ru gcc-save/gcc/configure.ac gcc/gcc/configure.ac
--- gcc-save/gcc/configure.ac	2004-04-17 08:48:33.000000000 +0200
+++ gcc/gcc/configure.ac	2004-05-18 20:16:06.000000000 +0200
@@ -278,7 +278,6 @@
 AC_C_INLINE
 
 gcc_AC_C_LONG_LONG
-gcc_AC_C__BOOL
 
 # sizeof(char) is 1 by definition.
 AC_COMPILE_CHECK_SIZEOF(void *)
@@ -798,8 +797,8 @@
 
 AC_HEADER_STDC
 AC_HEADER_TIME
-gcc_AC_HEADER_STDBOOL
-gcc_AC_HEADER_STRING
+ACX_HEADER_STDBOOL
+ACX_HEADER_STRING
 AC_HEADER_SYS_WAIT
 AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h \
 		 fcntl.h unistd.h sys/file.h sys/time.h sys/mman.h \
@@ -1031,19 +1025,6 @@
   [Define if <time.h> defines clock_t.])
 fi
 
-AC_CACHE_CHECK(for uchar, gcc_cv_type_uchar,
-[AC_TRY_COMPILE([
-#include "ansidecl.h"
-#include "system.h"
-], 
-[if ((uchar *)0) return 0;
- if (sizeof(uchar)) return 0;],
-ac_cv_type_uchar=yes, ac_cv_type_uchar=no)])
-if test $ac_cv_type_uchar = yes; then
-  AC_DEFINE(HAVE_UCHAR, 1,
-  [Define if <sys/types.h> defines \`uchar'.])
-fi
-
 # Restore CFLAGS from before the gcc_AC_NEED_DECLARATIONS tests.
 CFLAGS="$saved_CFLAGS"
 
diff -ru gcc-save/gcc/system.h gcc/gcc/system.h
--- gcc-save/gcc/system.h	2004-03-19 01:52:24.000000000 +0100
+++ gcc/gcc/system.h	2004-05-18 20:19:52.000000000 +0200
@@ -421,16 +421,6 @@
 # endif
 #endif
 
-/* Approximate O_NONBLOCK.  */
-#ifndef O_NONBLOCK
-#define O_NONBLOCK O_NDELAY
-#endif
-
-/* Approximate O_NOCTTY.  */
-#ifndef O_NOCTTY
-#define O_NOCTTY 0
-#endif
-
 /* Define well known filenos if the system does not define them.  */
 #ifndef STDIN_FILENO
 # define STDIN_FILENO   0
diff -ru gcc-save/libiberty/Makefile.in gcc/libiberty/Makefile.in
--- gcc-save/libiberty/Makefile.in	2004-03-18 02:40:15.000000000 +0100
+++ gcc/libiberty/Makefile.in	2004-05-18 20:33:39.000000000 +0200
@@ -133,7 +133,7 @@
 	dyn-string.c							\
 	fdmatch.c ffs.c fibheap.c floatformat.c fnmatch.c		\
 	getcwd.c getopt.c getopt1.c getpagesize.c getpwd.c getruntime.c	\
-	hashtab.c hex.c							\
+	hashtab.c hashtable.c hex.c					\
 	index.c insque.c						\
 	lbasename.c							\
 	lrealpath.c							\
@@ -163,7 +163,7 @@
 	./dyn-string.o							\
 	./fdmatch.o ./fibheap.o ./floatformat.o ./fnmatch.o		\
 	./getopt.o ./getopt1.o ./getpwd.o ./getruntime.o		\
-	./hashtab.o ./hex.o						\
+	./hashtab.o ./hashtable.o ./hex.o				\
 	./lbasename.o ./lrealpath.o					\
 	./make-relative-prefix.o ./make-temp-file.o			\
 	./objalloc.o ./obstack.o					\
@@ -207,6 +207,7 @@
 	$(INCDIR)/fibheap.h                                             \
 	$(INCDIR)/floatformat.h                                         \
 	$(INCDIR)/hashtab.h                                             \
+	$(INCDIR)/hashtable.h                                           \
 	$(INCDIR)/libiberty.h                                           \
 	$(INCDIR)/objalloc.h                                            \
 	$(INCDIR)/partition.h                                           \
@@ -620,6 +621,13 @@
 	else true; fi
 	$(COMPILE.c) $(srcdir)/hashtab.c $(OUTPUT_OPTION)
 
+./hashtable.o: $(srcdir)/hashtable.c config.h $(INCDIR)/hashtable.h \
+	$(INCDIR)/obstack.h
+	if [ x"$(PICFLAG)" != x ]; then \
+	  $(COMPILE.c) $(PICFLAG) $(srcdir)/hashtable.c -o pic/$@; \
+	else true; fi
+	$(COMPILE.c) $(srcdir)/hashtable.c $(OUTPUT_OPTION)
+
 ./hex.o: $(srcdir)/hex.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
 	$(INCDIR)/safe-ctype.h
 	if [ x"$(PICFLAG)" != x ]; then \
diff -ru gcc-save/gcc/cp/Make-lang.in gcc/gcc/cp/Make-lang.in
--- gcc-save/gcc/cp/Make-lang.in	2004-03-24 01:13:29.000000000 +0100
+++ gcc/gcc/cp/Make-lang.in	2004-05-18 23:05:52.000000000 +0200
@@ -86,9 +86,9 @@
 cp-warn = $(STRICT_WARN) $(WERROR)
 
 cc1plus$(exeext): $(CXX_OBJS) $(CXX_C_OBJS) $(BACKEND) \
-		  libcpp.a $(LIBDEPS)
+		  $(LIBCPP) $(LIBDEPS)
 	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
-	      $(CXX_OBJS) $(CXX_C_OBJS) $(BACKEND) libcpp.a $(LIBS)
+	      $(CXX_OBJS) $(CXX_C_OBJS) $(BACKEND) $(LIBCPP) $(LIBS)
 
 # Special build rules.
 $(srcdir)/cp/cfns.h: $(srcdir)/cp/cfns.gperf
diff -ru gcc-save/gcc/java/Make-lang.in gcc/gcc/java/Make-lang.in
--- gcc-save/gcc/java/Make-lang.in	2004-02-17 06:20:25.000000000 +0100
+++ gcc/gcc/java/Make-lang.in	2004-05-18 23:15:08.000000000 +0200
@@ -105,16 +105,16 @@
   java/zextract.o java/jcf-io.o java/win32-host.o java/jcf-parse.o java/mangle.o \
   java/mangle_name.o java/builtins.o java/resource.o \
   java/jcf-write.o java/buffer.o java/check-init.o java/jcf-depend.o \
-  java/jcf-path.o java/xref.o java/boehm.o java/java-tree-inline.o mkdeps.o
+  java/jcf-path.o java/xref.o java/boehm.o java/java-tree-inline.o
 
 GCJH_OBJS = java/gjavah.o java/jcf-io.o java/jcf-depend.o java/jcf-path.o \
-  java/win32-host.o java/zextract.o version.o mkdeps.o errors.o ggc-none.o \
+  java/win32-host.o java/zextract.o version.o errors.o ggc-none.o \
   intl.o
 
 JVSCAN_OBJS = java/parse-scan.o java/jv-scan.o version.o intl.o
 
 JCFDUMP_OBJS = java/jcf-dump.o java/jcf-io.o java/jcf-depend.o java/jcf-path.o \
-		java/win32-host.o java/zextract.o errors.o version.o mkdeps.o ggc-none.o intl.o
+		java/win32-host.o java/zextract.o errors.o version.o ggc-none.o intl.o
 
 JVGENMAIN_OBJS = java/jvgenmain.o java/mangle_name.o errors.o intl.o
 
@@ -126,11 +126,11 @@
 jc1$(exeext): $(JAVA_OBJS) $(BACKEND) $(LIBDEPS)
 	rm -f $@
 	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
-		$(JAVA_OBJS) $(BACKEND) $(ZLIB) $(LIBICONV) $(LIBS)
+		$(JAVA_OBJS) $(BACKEND) $(ZLIB) $(LIBCPP) $(LIBICONV) $(LIBS)
 
 gcjh$(exeext): $(GCJH_OBJS) $(LIBDEPS)
 	rm -f $@
-	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(GCJH_OBJS) $(ZLIB) $(LIBS)
+	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(GCJH_OBJS) $(LIBCPP) $(ZLIB) $(LIBS)
 
 jv-scan$(exeext): $(JVSCAN_OBJS) $(LIBDEPS)
 	rm -f $@
@@ -139,7 +139,7 @@
 jcf-dump$(exeext): $(JCFDUMP_OBJS) $(LIBDEPS)
 	rm -f $@
 	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(JCFDUMP_OBJS) \
-		$(ZLIB) $(LDEXP_LIB) $(LIBS)
+		$(LIBCPP) $(ZLIB) $(LDEXP_LIB) $(LIBS)
 
 jvgenmain$(exeext): $(JVGENMAIN_OBJS) $(LIBDEPS)
 	rm -f $@
diff -ru gcc-save/libiberty/hashtable.c gcc/libiberty/hashtable.c
--- gcc-save/libiberty/hashtable.c	2004-05-16 09:45:30.000000000 +0200
+++ gcc/libiberty/hashtable.c	2004-05-18 20:39:22.000000000 +0200
@@ -20,8 +20,17 @@
  what you give them.   Help stamp out software-hoarding!  */
 
 #include "config.h"
-#include "system.h"
 #include "hashtable.h"
+#include "libiberty.h"
+#include <stdio.h>
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
 
 /* The code below is a specialization of Vladimir Makarov's expandable
    hash tables (see libiberty/hashtab.c).  The abstraction penalty was
@@ -30,14 +39,16 @@
    existing entry with a potential new one.  Also, the ability to
    delete members from the table has been removed.  */
 
-static unsigned int calc_hash (const unsigned char *, size_t);
-static void ht_expand (hash_table *);
-static double approx_sqrt (double);
+static unsigned int calc_hash PARAMS ((const unsigned char *, size_t));
+static void ht_expand PARAMS ((hash_table *));
+static double approx_sqrt PARAMS ((double));
 
 /* Calculate the hash of the string STR of length LEN.  */
 
 static unsigned int
-calc_hash (const unsigned char *str, size_t len)
+calc_hash (str, len)
+     const unsigned char *str;
+     size_t len;
 {
   size_t n = len;
   unsigned int r = 0;
@@ -53,7 +64,8 @@
 /* Initialize an identifier hashtable.  */
 
 hash_table *
-ht_create (unsigned int order)
+ht_create (order)
+     unsigned int order;
 {
   unsigned int nslots = 1 << order;
   hash_table *table;
@@ -75,7 +87,8 @@
 /* Frees all memory associated with a hash table.  */
 
 void
-ht_destroy (hash_table *table)
+ht_destroy (table)
+     hash_table *table;
 {
   obstack_free (&table->stack, NULL);
   free (table->entries);
@@ -91,8 +104,11 @@
    CPP_ALLOCED and the item is assumed to be at the top of the
    obstack.  */
 hashnode
-ht_lookup (hash_table *table, const unsigned char *str, size_t len,
-	   enum ht_lookup_option insert)
+ht_lookup (table, str, len, insert)
+     hash_table *table;
+     const unsigned char *str;
+     size_t len;
+     enum ht_lookup_option insert;
 {
   unsigned int hash = calc_hash (str, len);
   unsigned int hash2;
@@ -167,7 +183,8 @@
 /* Double the size of a hash table, re-hashing existing entries.  */
 
 static void
-ht_expand (hash_table *table)
+ht_expand (table)
+     hash_table *table;
 {
   hashnode *nentries, *p, *limit;
   unsigned int size, sizemask;
@@ -207,7 +224,10 @@
 /* For all nodes in TABLE, callback CB with parameters TABLE->PFILE,
    the node, and V.  */
 void
-ht_forall (hash_table *table, ht_cb cb, const void *v)
+ht_forall (table, cb, v)
+     hash_table *table;
+     ht_cb cb;
+     const void *v;
 {
   hashnode *p, *limit;
 
@@ -225,7 +245,8 @@
 /* Dump allocation statistics to stderr.  */
 
 void
-ht_dump_statistics (hash_table *table)
+ht_dump_statistics (table)
+     hash_table *table;
 {
   size_t nelts, nids, overhead, headers;
   size_t total_bytes, longest, sum_of_squares;
@@ -290,7 +311,8 @@
 /* Return the approximate positive square root of a number N.  This is for
    statistical reports, not code generation.  */
 static double
-approx_sqrt (double x)
+approx_sqrt (x)
+     double x;
 {
   double s, d;
 
diff -rNu gcc-save/libcpp/Makefile.am gcc/libcpp/Makefile.am
--- gcc-save/libcpp/Makefile.am	1970-01-01 01:00:00.000000000 +0100
+++ gcc/libcpp/Makefile.am	2004-05-18 22:41:25.000000000 +0200
@@ -0,0 +1,70 @@
+ACLOCAL_AMFLAGS = -I ../config
+AM_CPPFLAGS = -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/../intl
+
+lib_LIBRARIES = libcpp.a
+libcpp_a_SOURCES = \
+	cppcharset.c cpperror.c cppexp.c cppfiles.c cpphash.c cppinit.c cpplex.c \
+	cpplib.c cppmacro.c cpppch.c cpptrad.c line-map.c mkdeps.c
+
+include_HEADERS = cpplib.h line-map.h cpphash.h mkdeps.h
+
+XGETTEXT = @XGETTEXT@
+GMSGFMT = @GMSGFMT@
+MSGMERGE = msgmerge
+CATALOGS = @CATALOGS@
+
+if ENABLE_NLS
+build-po: $(CATALOGS)
+update-po: $(CATALOGS:.gmo=.pox)
+else
+build-po:
+update-po:
+endif
+
+# N.B. We do not attempt to copy these into $(srcdir).
+.po.gmo:
+	-test -d $(srcdir)/po || mkdir $(srcdir)/po
+	$(GMSGFMT) --statistics -o $@ $<
+
+# The new .po has to be gone over by hand, so we deposit it into
+# build/po with a different extension.
+# If build/po/$(PACKAGE).pot exists, use it (it was just created),
+# else use the one in srcdir.
+.po.pox:
+	-test -d $(srcdir)/po || mkdir $(srcdir)/po
+	$(MSGMERGE) $< `if test -f po/$(PACKAGE).pot; \
+	                then echo po/$(PACKAGE).pot; \
+	                else echo $(srcdir)/po/$(PACKAGE).pot; fi` -o $@
+
+# This rule has to look for .gmo modules in both srcdir and
+# the cwd, and has to check that we actually have a catalog
+# for each language, in case they weren't built or included
+# with the distribution.
+install-data-local:
+	$(mkinstalldirs) $(DESTDIR)$(datadir)
+	cats="$(CATALOGS)"; for cat in $$cats; do \
+	  lang=`basename $$cat | sed 's/\.gmo$$//'`; \
+	  if [ -f $$cat ]; then :; \
+	  elif [ -f $(srcdir)/$$cat ]; then cat=$(srcdir)/$$cat; \
+	  else continue; \
+	  fi; \
+	  dir=$(localedir)/$$lang/LC_MESSAGES; \
+	  echo $(mkinstalldirs) $(DESTDIR)$$dir; \
+	  $(mkinstalldirs) $(DESTDIR)$$dir || exit 1; \
+	  echo $(INSTALL_DATA) $$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
+	  $(INSTALL_DATA) $$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
+	done
+
+# Rule for regenerating the message template (gcc.pot).
+# Instead of forcing everyone to edit POTFILES.in, which proved impractical,
+# this rule has no dependencies and always regenerates libcpp.pot.  This is
+# relatively harmless since the .po files do not directly depend on it.
+.PHONY: po/$(PACKAGE).pot
+po/$(PACKAGE).pot: $(libcpp_a_SOURCES) $(noinst_HEADERS)
+	-test -d $(srcdir)/po || mkdir $(srcdir)/po
+	$(XGETTEXT) --default-domain=$(PACKAGE) \
+	  --keyword=cpp_error,3 --keyword=cpp_errno,3 \
+	  --keyword=cpp_error_with_line,5 \
+	  --copyright-holder="Free Software Foundation, Inc." \
+	  --msgid-bugs-address="http://gcc.gnu.org/bugs.html"; \
+	  --language=c -o po/$(PACKAGE).pot $^
diff -rNu gcc-save/libcpp/configure.ac gcc/libcpp/configure.ac
--- gcc-save/libcpp/configure.ac	1970-01-01 01:00:00.000000000 +0100
+++ gcc/libcpp/configure.ac	2004-05-18 22:36:25.000000000 +0200
@@ -0,0 +1,96 @@
+#                                               -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.57)
+AC_INIT(cpplib, [ ], gcc-bugs@gcc.gnu.org, cpplib)
+AC_CONFIG_SRCDIR(cpplib.c)
+AC_CANONICAL_SYSTEM
+AM_INIT_AUTOMAKE(foreign)
+AM_MAINTAINER_MODE
+
+# Checks for programs.
+AC_PROG_CC
+AC_PROG_RANLIB
+
+# Checks for header files.
+AC_HEADER_TIME
+ACX_HEADER_STRING
+ACX_HEADER_STDBOOL
+AC_CHECK_HEADERS(iconv.h locale.h fcntl.h limits.h stddef.h \
+	stdlib.h strings.h string.h sys/file.h unistd.h)
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_C_INLINE
+AC_FUNC_OBSTACK
+AC_TYPE_OFF_T
+AC_TYPE_SIZE_T
+AC_STRUCT_TM
+AC_CHECK_SIZEOF(int)
+AC_CHECK_SIZEOF(long)
+AC_CHECK_FUNCS(putc_unlocked fputc_unlocked fputs_unlocked \
+        fwrite_unlocked fprintf_unlocked)
+AC_CHECK_DECLS([abort, errno, putc_unlocked, fputc_unlocked,
+        fputs_unlocked, fwrite_unlocked, fprintf_unlocked])
+
+# Checks for library functions.
+AC_FUNC_ALLOCA
+AC_HEADER_STDC
+AM_LANGINFO_CODESET
+ZW_GNU_GETTEXT_SISTER_DIR
+
+AC_CACHE_CHECK(for uchar, gcc_cv_type_uchar,
+[AC_TRY_COMPILE([
+#include "ansidecl.h"
+#include "system.h"
+],
+[if ((uchar *)0) return 0;
+ if (sizeof(uchar)) return 0;],
+ac_cv_type_uchar=yes, ac_cv_type_uchar=no)])
+if test $ac_cv_type_uchar = yes; then
+  AC_DEFINE(HAVE_UCHAR, 1,
+  [Define if <sys/types.h> defines \`uchar'.])
+fi
+
+AM_ICONV
+AM_CONDITIONAL(ENABLE_NLS, [test "x$enable_nls" != xno])
+AC_ARG_ENABLE(checking,
+[  --enable-checking      enable expensive run-time checks],,
+enable_checking=no)
+
+if test $enable_checking != no ; then
+  AC_DEFINE(ENABLE_CHECKING, 1,
+[Define if you want more run-time sanity checks.])
+fi
+
+case $target in
+	alpha*-*-* | \
+	x86_64-*-* | \
+	ia64-*-* | \
+	hppa*64*-*-* | parisc*64*-*-* | \
+	mips*-*-* | \
+	mmix-*-* | \
+	powerpc*-*-* | \
+	rs6000*-*-* | \
+	s390*-*-* | \
+	sparc64*-*-* | ultrasparc-*-freebsd* | \
+	sparcv9-*-solaris2* | \
+	sparc-*-solaris2.[789] | sparc-*-solaris2.1[0-9] | \
+	sh[123456789l]*-*-*)
+		need_64bit_hwint=yes ;;
+	*)
+		need_64bit_hwint=no ;;
+esac
+
+case $need_64bit_hwint:$ac_cv_sizeof_long in
+	*:8 | no:*) host_wide_int=long ;;
+	*) host_wide_int='long long' ;;
+esac
+
+AC_DEFINE_UNQUOTED(HOST_WIDE_INT, $host_wide_int,
+[Define to the widest efficient host integer type at least
+   as wide as the target's size_t type.])
+
+AC_CONFIG_HEADERS(config.h:config.in)
+AC_CONFIG_FILES(Makefile)
+AC_OUTPUT
diff -rNu gcc-save/libcpp/cpperror.c gcc/libcpp/cpperror.c
--- gcc-save/libcpp/cpperror.c	2004-05-16 09:45:28.000000000 +0200
+++ gcc/libcpp/cpperror.c	2004-05-18 21:14:18.000000000 +0200
@@ -27,7 +27,6 @@
 #include "system.h"
 #include "cpplib.h"
 #include "cpphash.h"
-#include "intl.h"
 
 static void print_location (cpp_reader *, source_location, unsigned int);
 
diff -rNu gcc-save/libcpp/cppfiles.c gcc/libcpp/cppfiles.c
--- gcc-save/libcpp/cppfiles.c	2004-05-16 09:45:28.000000000 +0200
+++ gcc/libcpp/cppfiles.c	2004-05-18 21:14:20.000000000 +0200
@@ -25,7 +25,6 @@
 #include "system.h"
 #include "cpplib.h"
 #include "cpphash.h"
-#include "intl.h"
 #include "mkdeps.h"
 #include "hashtab.h"
 #include "md5.h"
@@ -48,10 +47,6 @@
 #  define set_stdin_to_binary_mode() /* Nothing */
 #endif
 
-#ifndef O_BINARY
-# define O_BINARY 0
-#endif
-
 /* This structure represents a file searched for by CPP, whether it
    exists or not.  An instance may be pointed to by more than one
    file_hash_entry; at present no reference count is kept.  */
diff -rNu gcc-save/libcpp/cpppch.c gcc/libcpp/cpppch.c
--- gcc-save/libcpp/cpppch.c	2004-05-16 09:45:28.000000000 +0200
+++ gcc/libcpp/cpppch.c	2004-05-18 21:14:22.000000000 +0200
@@ -19,7 +19,6 @@
 #include "system.h"
 #include "cpplib.h"
 #include "cpphash.h"
-#include "intl.h"
 #include "hashtab.h"
 #include "mkdeps.h"
 
diff -rNu gcc-save/libcpp/line-map.c gcc/libcpp/line-map.c
--- gcc-save/libcpp/line-map.c	2004-05-16 09:45:30.000000000 +0200
+++ gcc/libcpp/line-map.c	2004-05-18 21:14:24.000000000 +0200
@@ -23,7 +23,6 @@
 #include "config.h"
 #include "system.h"
 #include "line-map.h"
-#include "intl.h"
 
 static void trace_include (const struct line_maps *, const struct line_map *);
 
diff -rNu gcc-save/libcpp/system.h gcc/libcpp/system.h
--- gcc-save/libcpp/system.h	1970-01-01 01:00:00.000000000 +0100
+++ gcc/libcpp/system.h	2004-05-18 21:20:25.000000000 +0200
@@ -0,0 +1,364 @@
+/* Get common system includes and various definitions and declarations based
+   on autoconf macros.
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
+   Free Software Foundation, Inc.
+
+This file is part of libcpp (aka cpplib).
+
+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 LIBCPP_SYSTEM_H
+#define LIBCPP_SYSTEM_H
+
+/* We must include stdarg.h before stdio.h.  */
+#include <stdarg.h>
+
+#ifdef HAVE_STDDEF_H
+# include <stddef.h>
+#endif
+
+#include <stdio.h>
+
+/* Define a generic NULL if one hasn't already been defined.  */
+#ifndef NULL
+#define NULL 0
+#endif
+
+/* The compiler is not a multi-threaded application and therefore we
+   do not have to use the locking functions.  In fact, using the locking
+   functions can cause the compiler to be significantly slower under
+   I/O bound conditions (such as -g -O0 on very large source files).
+
+   HAVE_DECL_PUTC_UNLOCKED actually indicates whether or not the stdio
+   code is multi-thread safe by default.  If it is set to 0, then do
+   not worry about using the _unlocked functions.
+
+   fputs_unlocked, fwrite_unlocked, and fprintf_unlocked are
+   extensions and need to be prototyped by hand (since we do not
+   define _GNU_SOURCE).  */
+
+#if defined HAVE_DECL_PUTC_UNLOCKED && HAVE_DECL_PUTC_UNLOCKED
+
+# ifdef HAVE_PUTC_UNLOCKED
+#  undef putc
+#  define putc(C, Stream) putc_unlocked (C, Stream)
+# endif
+# ifdef HAVE_FPUTC_UNLOCKED
+#  undef fputc
+#  define fputc(C, Stream) fputc_unlocked (C, Stream)
+# endif
+
+# ifdef HAVE_FPUTS_UNLOCKED
+#  undef fputs
+#  define fputs(String, Stream) fputs_unlocked (String, Stream)
+#  if defined (HAVE_DECL_FPUTS_UNLOCKED) && !HAVE_DECL_FPUTS_UNLOCKED
+extern int fputs_unlocked (const char *, FILE *);
+#  endif
+# endif
+# ifdef HAVE_FWRITE_UNLOCKED
+#  undef fwrite
+#  define fwrite(Ptr, Size, N, Stream) fwrite_unlocked (Ptr, Size, N, Stream)
+#  if defined (HAVE_DECL_FWRITE_UNLOCKED) && !HAVE_DECL_FWRITE_UNLOCKED
+extern int fwrite_unlocked (const void *, size_t, size_t, FILE *);
+#  endif
+# endif
+# ifdef HAVE_FPRINTF_UNLOCKED
+#  undef fprintf
+/* We can't use a function-like macro here because we don't know if
+   we have varargs macros.  */
+#  define fprintf fprintf_unlocked
+#  if defined (HAVE_DECL_FPRINTF_UNLOCKED) && !HAVE_DECL_FPRINTF_UNLOCKED
+extern int fprintf_unlocked (FILE *, const char *, ...);
+#  endif
+# endif
+
+#endif
+
+/* ??? Glibc's fwrite/fread_unlocked macros cause
+   "warning: signed and unsigned type in conditional expression".  */
+#undef fread_unlocked
+#undef fwrite_unlocked
+
+#include <sys/types.h>
+#include <errno.h>
+
+#if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO
+extern int errno;
+#endif
+
+/* Some of glibc's string inlines cause warnings.  Plus we'd rather
+   rely on (and therefore test) GCC's string builtins.  */
+#define __NO_STRING_INLINES
+
+#ifdef STRING_WITH_STRINGS
+# include <string.h>
+# include <strings.h>
+#else
+# ifdef HAVE_STRING_H
+#  include <string.h>
+# else
+#  ifdef HAVE_STRINGS_H
+#   include <strings.h>
+#  endif
+# endif
+#endif
+
+#ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_LIMITS_H
+# include <limits.h>
+#endif
+
+/* Infrastructure for defining missing _MAX and _MIN macros.  Note that
+   macros defined with these cannot be used in #if.  */
+
+/* The extra casts work around common compiler bugs.  */
+#define INTTYPE_SIGNED(t) (! ((t) 0 < (t) -1))
+/* The outer cast is needed to work around a bug in Cray C 5.0.3.0.
+   It is necessary at least when t == time_t.  */
+#define INTTYPE_MINIMUM(t) ((t) (INTTYPE_SIGNED (t) \
+                             ? ~ (t) 0 << (sizeof(t) * CHAR_BIT - 1) : (t) 0))
+#define INTTYPE_MAXIMUM(t) ((t) (~ (t) 0 - INTTYPE_MINIMUM (t)))
+
+/* Use that infrastructure to provide a few constants.  */
+#ifndef UCHAR_MAX
+# define UCHAR_MAX INTTYPE_MAXIMUM (unsigned char)
+#endif
+
+#ifdef TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  ifdef HAVE_TIME_H
+#   include <time.h>
+#  endif
+# endif
+#endif
+
+#ifdef HAVE_FCNTL_H
+# include <fcntl.h>
+#else
+# ifdef HAVE_SYS_FILE_H
+#  include <sys/file.h>
+# endif
+#endif
+
+#ifdef HAVE_LOCALE_H
+# include <locale.h>
+#endif
+
+#ifdef HAVE_LANGINFO_CODESET
+# include <langinfo.h>
+#endif
+
+#ifndef HAVE_SETLOCALE
+# define setlocale(category, locale) (locale)
+#endif
+
+#ifdef ENABLE_NLS
+#include <libintl.h>
+#else
+/* Stubs.  */
+# undef dgettext
+# define dgettext(msgid) (msgid)
+#endif
+
+#ifndef _
+# define _(msgid) dgettext (PACKAGE, msgid)
+#endif
+
+#ifndef N_
+# define N_(msgid) msgid
+#endif
+
+/* Some systems define these in, e.g., param.h.  We undefine these names
+   here to avoid the warnings.  We prefer to use our definitions since we
+   know they are correct.  */
+
+#undef MIN
+#undef MAX
+#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
+#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
+
+/* The HAVE_DECL_* macros are three-state, undefined, 0 or 1.  If they
+   are defined to 0 then we must provide the relevant declaration
+   here.  These checks will be in the undefined state while configure
+   is running so be careful to test "defined (HAVE_DECL_*)".  */
+
+#if defined (HAVE_DECL_ABORT) && !HAVE_DECL_ABORT
+extern void abort (void);
+#endif
+
+/* 1 if we have C99 designated initializers.  */
+#if !defined(HAVE_DESIGNATED_INITIALIZERS)
+#define HAVE_DESIGNATED_INITIALIZERS \
+  ((GCC_VERSION >= 2007) || (__STDC_VERSION__ >= 199901L))
+#endif
+
+/* 1 if we have _Bool.  */
+#ifndef HAVE__BOOL
+# define HAVE__BOOL \
+   ((GCC_VERSION >= 3000) || (__STDC_VERSION__ >= 199901L))
+#endif
+
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+/* Test if something is a normal file.  */
+#ifndef S_ISREG
+#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
+#endif
+
+/* Test if something is a directory.  */
+#ifndef S_ISDIR
+#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+#endif
+
+/* Test if something is a character special file.  */
+#ifndef S_ISCHR
+#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
+#endif
+
+/* Test if something is a block special file.  */
+#ifndef S_ISBLK
+#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
+#endif
+
+/* Test if something is a socket.  */
+#ifndef S_ISSOCK
+# ifdef S_IFSOCK
+#   define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
+# else
+#   define S_ISSOCK(m) 0
+# endif
+#endif
+
+/* Test if something is a FIFO.  */
+#ifndef S_ISFIFO
+# ifdef S_IFIFO
+#  define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
+# else
+#  define S_ISFIFO(m) 0
+# endif
+#endif
+
+/* Approximate O_NOCTTY.  */
+#ifndef O_NOCTTY
+#define O_NOCTTY 0
+#endif
+
+/* Approximate O_NOCTTY.  */
+#ifndef O_BINARY
+# define O_BINARY 0
+#endif
+
+/* Filename handling macros.  */
+#include "filenames.h"
+
+/* Get libiberty declarations.  */
+#include "libiberty.h"
+
+/* Be conservative and only use enum bitfields with GCC.
+   FIXME: provide a complete autoconf test for buggy enum bitfields.  */
+
+#if (GCC_VERSION > 2000)
+#define ENUM_BITFIELD(TYPE) __extension__ enum TYPE
+#else
+#define ENUM_BITFIELD(TYPE) unsigned int
+#endif
+
+/* We only use bool bitfields with gcc3.  Some supposedly C99
+   compilers don't handle them correctly.  */
+#if (GCC_VERSION >= 3000)
+#define BOOL_BITFIELD _Bool
+#else
+#define BOOL_BITFIELD unsigned int
+#endif
+
+#ifndef offsetof
+#define offsetof(TYPE, MEMBER)	((size_t) &((TYPE *) 0)->MEMBER)
+#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
+
+#if (GCC_VERSION >= 3000)
+#undef calloc
+#undef strdup
+#undef malloc
+#undef realloc
+ #pragma GCC poison calloc strdup
+ #pragma GCC poison malloc realloc
+
+/* Libiberty macros that are no longer used in GCC.  */
+#undef ANSI_PROTOTYPES
+#undef PTR_CONST
+#undef LONG_DOUBLE
+#undef VPARAMS
+#undef VA_OPEN
+#undef VA_FIXEDARG
+#undef VA_CLOSE
+#undef VA_START
+ #pragma GCC poison ANSI_PROTOTYPES PTR_CONST LONG_DOUBLE VPARAMS VA_OPEN \
+  VA_FIXEDARG VA_CLOSE VA_START
+
+/* Note: not all uses of the `index' token (e.g. variable names and
+   structure members) have been eliminated.  */
+#undef bcopy
+#undef bzero
+#undef bcmp
+#undef rindex
+ #pragma GCC poison bcopy bzero bcmp rindex
+
+#endif /* GCC >= 3.0 */
+
+#endif /* ! LIBCPP_SYSTEM_H */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]