This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: FYI: PACKAGE_* compile warning redux
- From: Bryce McKinlay <mckinlay at redhat dot com>
- To: java-patches at gcc dot gnu dot org
- Date: Sat, 01 Jan 2005 22:33:31 -0500
- Subject: Patch: FYI: PACKAGE_* compile warning redux
Here is hopefully the final fix for the redefinition warnings problem.
This isn't particularly elegent but I think it is the approach least
likely to produce surprising behaviour later and create maintainance
headaches. The ideal fix would be for gc.h (and other externally-visible
GC headers) to not include the configuration headers, but doing that is
far from trivial - just look at gc_pthread_redirects.h.
I've regression tested this, and I'm checking it in to HEAD.
Regards
Bryce
2005-01-01 Bryce McKinlay <mckinlay@redhat.com>
* include/boehm-gc.h: Include gc_ext_config.h, not gc_config.h.
2005-01-01 Bryce McKinlay <mckinlay@redhat.com>
* configure.ac (AC_CONFIG_HEADERS): Build both include/gc_config.h
and include/gc_ext_config.h.
* include/gc_ext_config.h: New file. Define only THREAD_LOCAL_ALLOC.
* include/gc.h: Undef PACKAGE_* before including gc_config.h.
Index: libjava/include/boehm-gc.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/include/boehm-gc.h,v
retrieving revision 1.9
diff -u -r1.9 boehm-gc.h
--- libjava/include/boehm-gc.h 18 Nov 2004 05:37:13 -0000 1.9
+++ libjava/include/boehm-gc.h 2 Jan 2005 02:07:03 -0000
@@ -26,7 +26,7 @@
#include <java/lang/Class.h>
#include <string.h>
-#include <gc_config.h>
+#include <gc_ext_config.h> // for THREAD_LOCAL_ALLOC
extern "C" void * GC_gcj_malloc(size_t, void *);
extern "C" void * GC_malloc_atomic(size_t);
Index: boehm-gc/configure.ac
===================================================================
RCS file: /cvs/gcc/gcc/boehm-gc/configure.ac,v
retrieving revision 1.10
diff -u -r1.10 configure.ac
--- boehm-gc/configure.ac 30 Nov 2004 00:38:55 -0000 1.10
+++ boehm-gc/configure.ac 2 Jan 2005 02:07:05 -0000
@@ -468,7 +468,7 @@
multilib_arg=
fi
-AC_CONFIG_HEADERS([include/gc_config.h])
+AC_CONFIG_HEADERS([include/gc_config.h include/gc_ext_config.h])
AC_CONFIG_FILES(Makefile include/Makefile)
AC_OUTPUT
Index: boehm-gc/include/gc.h
===================================================================
RCS file: /cvs/gcc/gcc/boehm-gc/include/gc.h,v
retrieving revision 1.14
diff -u -r1.14 gc.h
--- boehm-gc/include/gc.h 30 Nov 2004 00:38:57 -0000 1.14
+++ boehm-gc/include/gc.h 2 Jan 2005 02:07:05 -0000
@@ -30,6 +30,28 @@
# define _GC_H
+/*
+ * As this header includes gc_config.h, preprocessor conflicts can occur with
+ * clients that include their own autoconf headers. The following #undef's
+ * work around some likely conflicts.
+ */
+
+# ifdef PACKAGE_NAME
+# undef PACKAGE_NAME
+# endif
+# ifdef PACKAGE_BUGREPORT
+# undef PACKAGE_BUGREPORT
+# endif
+# ifdef PACKAGE_STRING
+# undef PACKAGE_STRING
+# endif
+# ifdef PACKAGE_TARNAME
+# undef PACKAGE_TARNAME
+# endif
+# ifdef PACKAGE_VERSION
+# undef PACKAGE_VERSION
+# endif
+
# include <gc_config.h>
# include "gc_config_macros.h"
Index: boehm-gc/include/gc_ext_config.h.in
===================================================================
RCS file: boehm-gc/include/gc_ext_config.h.in
diff -N boehm-gc/include/gc_ext_config.h.in
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ boehm-gc/include/gc_ext_config.h.in 2 Jan 2005 02:07:05 -0000
@@ -0,0 +1,5 @@
+/* include/gc_ext_config.h.in. This contains definitions needed by
+external clients that do not want to include the full gc.h. Currently this
+is used by libjava/include/boehm-gc.h. */
+
+#undef THREAD_LOCAL_ALLOC