This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[v3] Fix Werror breakage (maintainer-mode)
- From: Ralf Wildenhues <Ralf dot Wildenhues at gmx dot de>
- To: gcc-patches at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
- Date: Sun, 6 Jul 2008 11:44:23 +0200
- Subject: [v3] Fix Werror breakage (maintainer-mode)
Configuring with --enable-maintainer-mode turns on -Werror in
libstdc++-v3. This leads to PR 34780 and also to this failure:
/bin/sh ../libtool --tag CXX --mode=compile /tmp/gcc/build/./gcc/xgcc -shared-libgcc -B/tmp/gcc/build/./gcc -nostdinc++ -L/tmp/gcc/build/x86_64-unknown-linux-gnu/libstdc++-v3/src -L/tmp/gcc/build/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs -B/tmp/gcc-test/x86_64-unknown-linux-gnu/bin/ -B/tmp/gcc-test/x86_64-unknown-linux-gnu/lib/ -isystem /tmp/gcc-test/x86_64-unknown-linux-gnu/include -isystem /tmp/gcc-test/x86_64-unknown-linux-gnu/sys-include -I/tmp/gcc/build/x86_64-unknown-linux-gnu/libstdc++-v3/include/x86_64-unknown-linux-gnu -I/tmp/gcc/build/x86_64-unknown-linux-gnu/libstdc++-v3/include -I/tmp/gcc/gcc/libstdc++-v3/libsupc++ -fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Werror -fdiagnostics-show-location=once -ffunction-sections -fdata-sections -g -O2 -D_GNU_SOURCE -c -o locale_init.lo ../../../../gcc/libstdc++-v3/src/locale_init.cc
libtool: compile: /tmp/gcc/build/./gcc/xgcc -shared-libgcc -B/tmp/gcc/build/./gcc -nostdinc++ -L/tmp/gcc/build/x86_64-unknown-linux-gnu/libstdc++-v3/src -L/tmp/gcc/build/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs -B/tmp/gcc-test/x86_64-unknown-linux-gnu/bin/ -B/tmp/gcc-test/x86_64-unknown-linux-gnu/lib/ -isystem /tmp/gcc-test/x86_64-unknown-linux-gnu/include -isystem /tmp/gcc-test/x86_64-unknown-linux-gnu/sys-include -I/tmp/gcc/build/x86_64-unknown-linux-gnu/libstdc++-v3/include/x86_64-unknown-linux-gnu -I/tmp/gcc/build/x86_64-unknown-linux-gnu/libstdc++-v3/include -I/tmp/gcc/gcc/libstdc++-v3/libsupc++ -fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Werror -fdiagnostics-show-location=once -ffunction-sections -fdata-sections -g -O2 -D_GNU_SOURCE -c ../../../../gcc/libstdc++-v3/src/locale_init.cc -fPIC -DPIC -o .libs/locale_init.o
cc1plus: warnings being treated as errors
../../../../gcc/libstdc++-v3/src/locale_init.cc: In static member function 'static const std::locale& std::locale::classic()':
../../../../gcc/libstdc++-v3/src/locale_init.cc:247: error: dereferencing type-punned pointer will break strict-aliasing rules
make[2]: *** [locale_init.lo] Error 1
make[2]: Leaving directory `/tmp/gcc/build/x86_64-unknown-linux-gnu/libstdc++-v3/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/gcc/build/x86_64-unknown-linux-gnu/libstdc++-v3'
make: *** [all] Error 2
Now, the unwind-pe.h patch below should fix the PR. But I'm not sure
how to fix the cast, so the patch below is a cheap GNU make-specific
hack to work around the issue.
Can somebody enlighten me as to a proper locale_init.cc fix?
OK to apply the gcc/ patch to trunk? What about 4.3 (that was what the
report was against)?
This survived some bootstraps & regtests on i686-pc-linux-gnu.
Thanks,
Ralf
gcc/ChangeLog:
2008-07-06 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
PR target/34780
* unwind-pe.h (size_of_encoded_value): add attribute unused.
libstdc++-v3/ChangeLog:
2008-07-06 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* src/Makefile.am (locale_init_lo): New variable, to fool automake.
locale_init.lo: Add -Wno-error to AM_CXXFLAGS.
* src/Makefile.in: Regenerate.
diff --git a/gcc/unwind-pe.h b/gcc/unwind-pe.h
index 9c56af0..6924e8c 100644
--- a/gcc/unwind-pe.h
+++ b/gcc/unwind-pe.h
@@ -71,6 +71,9 @@
include leb128. */
static unsigned int
+size_of_encoded_value (unsigned char encoding) __attribute__ ((unused));
+
+static unsigned int
size_of_encoded_value (unsigned char encoding)
{
if (encoding == DW_EH_PE_omit)
diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am
index fa1e7c8..aa9eb34 100644
--- a/libstdc++-v3/src/Makefile.am
+++ b/libstdc++-v3/src/Makefile.am
@@ -205,6 +205,9 @@ libstdc___la_DEPENDENCIES = ${version_dep} $(libstdc___la_LIBADD)
libstdc___la_LDFLAGS = \
-version-info $(libtool_VERSION) ${version_arg} -lm
+locale_init_lo = locale_init.lo
+$(locale_init_lo): AM_CXXFLAGS += -Wno-error
+
# Use special rules for the deprecated source files so that they find
# deprecated include files.
GLIBCXX_INCLUDE_DIR=$(glibcxx_builddir)/include