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]

Re: [PATCH] Fix PACKAGE_* redefined warnings in libjava.


Kelly,

Just FYI: "gc_config.h" was introduced partly to avoid the PACKAGE_* redefinition warnings. gc_config.h.in was deliberately not autoheader-generated, so that it only exported a few symbols that needed to be "public" ie visibile to clients outside the GC - ie libjava. Is there any reason why gc_config.h.in must be an autoheader generated file?

Regards

Bryce


Kelley Cook wrote:


Just a ping here... there's a huge amount of warnings building gcc
trunk as of 20041004..
Number of warnings per file:
    424 include/gc_config.h
    424 include/config.h
...
Number of warning types:
    426 this is the location of the previous definition
    106 \`PACKAGE_VERSION' redefined
    106 \`PACKAGE_TARNAME' redefined
    106 \`PACKAGE_STRING' redefined
    106 \`PACKAGE_NAME' redefined


D'oh, this looks like this is a result of making autoheader work again in boehm-gc.

Unfortunately, under the pretense that the configured header should remain private, autoconf 2.59 unconditionally DEFINEs the PACKAGE macros within a configured header. But, libjava breaks this pretense by including gc_config.h which causes the warnings.

I can think of two options to fix this:

Revert the previous patch (http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02772.html)

or (better IMO)

Apply the attached patch which uses a sed script to create a gc_config.h suitable for use within libjava (ie without the HAVE_* and PACKAGE_* definitions mirroring the version generated prior to my last patch).

Kelley Cook


------------------------------------------------------------------------


2004-10-07 Kelley Cook <kcook@gcc.gnu.org>

	* configure.ac: Rename generated header to config.h
	* include/gc.h: Include config.h instead of gc_config.h.
	* include/Makefile.am (noinst_HEADERS): Add in config.h.
	(all-local): Always build gc_config.h
	(gc_config.h, stamp-gcconfig): New rules to generate an exportable
	gc_config.h.
	(DISTCLEANFILES): Clean them up.
	* gc_config.h.in: Delete.
	* configure, Makefile.in, include/Makefile.in: Regenerate.
	* config.h.in: Newly generated file.

diff -prud /home/kcook34/gcc-orig/boehm-gc/configure.ac ./configure.ac
--- /home/kcook34/gcc-orig/boehm-gc/configure.ac	2004-10-07 12:52:06.452387500 -0400
+++ ./configure.ac	2004-10-07 11:49:56.518982500 -0400
@@ -467,7 +467,7 @@ else
  multilib_arg=
fi

-AC_CONFIG_HEADERS([include/gc_config.h])
+AC_CONFIG_HEADERS([include/config.h])

AC_CONFIG_FILES(Makefile include/Makefile)
AC_OUTPUT
diff -prud /home/kcook34/gcc-orig/boehm-gc/include/Makefile.am ./include/Makefile.am
--- /home/kcook34/gcc-orig/boehm-gc/include/Makefile.am	2002-12-31 12:52:25.000000000 -0500
+++ ./include/Makefile.am	2004-10-07 12:39:02.546390600 -0400
@@ -1,7 +1,15 @@
AUTOMAKE_OPTIONS = foreign

noinst_HEADERS = gc.h gc_backptr.h gc_local_alloc.h \
-  gc_pthread_redirects.h gc_cpp.h
+  gc_pthread_redirects.h gc_cpp.h config.h

+all-local: gc_config.h
+
+gc_config.h: stamp-gcconfig

+stamp-gcconfig: config.h
+	sed -e "/ \(PACKAGE\|HAVE\)_/d" < config.h > tmp-gc-config
+	$(SHELL) $(top_srcdir)/../move-if-change tmp-gc-config gc_config.h
+	touch $@

+DISTCLEANFILES = stamp-gcconfig gc_config.h
diff -prud /home/kcook34/gcc-orig/boehm-gc/include/gc.h ./include/gc.h
--- /home/kcook34/gcc-orig/boehm-gc/include/gc.h	2004-08-13 19:05:32.000000000 -0400
+++ ./include/gc.h	2004-10-07 11:47:19.337668900 -0400
@@ -30,7 +30,7 @@

# define _GC_H

-# include <gc_config.h>
+# include <config.h>
# include "gc_config_macros.h"

# if defined(__STDC__) || defined(__cplusplus)




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