Bug 51773 - error building libitm/aatree.cc on ARM
Summary: error building libitm/aatree.cc on ARM
Status: RESOLVED MOVED
Alias: None
Product: gcc
Classification: Unclassified
Component: libitm (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-06 09:50 UTC by Tom de Vries
Modified: 2012-01-11 22:49 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom de Vries 2012-01-06 09:50:11 UTC
build log:
...
libtool: compile:  /home/vries/local/glibc-arm/base/obj/gcc-mainline-0-arm-none-linux-gnueabi-i686-pc-linux-gnu/./gcc/g++ -B/home/vries/local/glibc-arm/base/obj/gcc-mainline-0-arm-none-linux-gnueabi-i686-pc\
-linux-gnu/./gcc/ -nostdinc++ -nostdinc++ -I/home/vries/local/glibc-arm/base/obj/gcc-mainline-0-arm-none-linux-gnueabi-i686-pc-linux-gnu/arm-none-linux-gnueabi/libstdc++-v3/include/arm-none-linux-gnueabi -I\
/home/vries/local/glibc-arm/base/obj/gcc-mainline-0-arm-none-linux-gnueabi-i686-pc-linux-gnu/arm-none-linux-gnueabi/libstdc++-v3/include -I/home/vries/local/glibc-arm/base/src/gcc-mainline/libstdc++-v3/libs\
upc++ -I/home/vries/local/glibc-arm/base/src/gcc-mainline/libstdc++-v3/include/backward -I/home/vries/local/glibc-arm/base/src/gcc-mainline/libstdc++-v3/testsuite/util -L/home/vries/local/glibc-arm/base/obj\
/gcc-mainline-0-arm-none-linux-gnueabi-i686-pc-linux-gnu/arm-none-linux-gnueabi/libstdc++-v3/src -L/home/vries/local/glibc-arm/base/obj/gcc-mainline-0-arm-none-linux-gnueabi-i686-pc-linux-gnu/arm-none-linux\
-gnueabi/libstdc++-v3/src/.libs -B/home/vries/local/glibc-arm/base/install/arm-none-linux-gnueabi/bin/ -B/home/vries/local/glibc-arm/base/install/arm-none-linux-gnueabi/lib/ -isystem /home/vries/local/glibc\
-arm/base/install/arm-none-linux-gnueabi/include -isystem /home/vries/local/glibc-arm/base/install/arm-none-linux-gnueabi/sys-include --sysroot=/home/vries/local/glibc-arm/base/install/arm-none-linux-gnueab\
i/libc -DHAVE_CONFIG_H -I. -I/home/vries/local/glibc-arm/base/src/gcc-mainline/libitm -I/home/vries/local/glibc-arm/base/src/gcc-mainline/libitm/config/linux/arm -I/home/vries/local/glibc-arm/base/src/gcc-m\
ainline/libitm/config/linux -I/home/vries/local/glibc-arm/base/src/gcc-mainline/libitm/config/arm -I/home/vries/local/glibc-arm/base/src/gcc-mainline/libitm/config/posix -I/home/vries/local/glibc-arm/base/s\
rc/gcc-mainline/libitm/config/generic -I/home/vries/local/glibc-arm/base/src/gcc-mainline/libitm --sysroot=/home/vries/local/glibc-arm/base/install/arm-none-linux-gnueabi/libc -ftls-model=initial-exec -Wall\
 -pthread -Werror -std=gnu++0x -funwind-tables -fno-exceptions -fno-rtti -fabi-version=4 -g -O2 -D_GNU_SOURCE -MT aatree.lo -MD -MP -MF .deps/aatree.Tpo -c /home/vries/local/glibc-arm/base/src/gcc-mainline/\
libitm/aatree.cc  -fPIC -DPIC -o .libs/aatree.oIn file included from /home/vries/local/glibc-arm/base/src/gcc-mainline/libitm/libitm_i.h:39:0,
                 from /home/vries/local/glibc-arm/base/src/gcc-mainline/libitm/aatree.cc:28:
/home/vries/local/glibc-arm/base/src/gcc-mainline/libitm/local_type_traits:885:21: error: expected identifier before 'sizeof'
/home/vries/local/glibc-arm/base/src/gcc-mainline/libitm/local_type_traits:885:21: error: expected ',' or '...' before 'sizeof'
/home/vries/local/glibc-arm/base/src/gcc-mainline/libitm/local_type_traits:886:52: error: ISO C++ forbids declaration of '_Static_assert' with no type [-fpermissive]
make[4]: *** [aatree.lo] Error 1
...

local_type_traits:
...
   881	  template<typename _Tp, typename... _Args>
   882	    struct __is_nary_constructible
   883	    : public __is_nary_constructible_impl<_Tp, _Args...>::type
   884	    {
   885	      static_assert(sizeof...(_Args) > 1,
   886	                    "Only useful for > 1 arguments");
   887	    };
   888	
...

revision: 182946

configure line:
...
/home/vries/local/glibc-arm/base/src/gcc-mainline/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi --enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --with-gnu-as --with-gnu-ld --enable-languages=c,c++,fortran --enable-shared --enable-lto --enable-symvers=gnu --enable-__cxa_atexit --disable-nls --prefix=/opt/codesourcery --with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc --with-build-sysroot=/home/vries/local/glibc-arm/base/install/arm-none-linux-gnueabi/libc --with-gmp=/home/vries/local/glibc-arm/base/obj/host-libs-mainline-0-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-mpfr=/home/vries/local/glibc-arm/base/obj/host-libs-mainline-0-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-mpc=/home/vries/local/glibc-arm/base/obj/host-libs-mainline-0-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-ppl=/home/vries/local/glibc-arm/base/obj/host-libs-mainline-0-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-cloog=/home/vries/local/glibc-arm/base/obj/host-libs-mainline-0-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-libelf=/home/vries/local/glibc-arm/base/obj/host-libs-mainline-0-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --disable-libgomp --enable-poison-system-directories --with-build-time-tools=/home/vries/local/glibc-arm/base/install/arm-none-linux-gnueabi/bin --with-build-time-tools=/home/vries/local/glibc-arm/base/install/arm-none-linux-gnueabi/bin
...
Comment 1 Jonathan Wakely 2012-01-06 10:50:24 UTC
(In reply to comment #0)
> /home/vries/local/glibc-arm/base/src/gcc-mainline/libitm/local_type_traits:886:52:
> error: ISO C++ forbids declaration of '_Static_assert' with no type

Looks a though someone has done a 

#define static_assert _Static-assert

Another glibc C11 change that breaks C++?
Comment 2 Tom de Vries 2012-01-06 10:51:51 UTC
Looks related to:

+       [BZ #13529]
+       * assert/assert.h (static_assert): Define.
+

diff --git a/assert/assert.h b/assert/assert.h
index 841f435..4022e28 100644
--- a/assert/assert.h
+++ b/assert/assert.h
@@ -113,3 +113,10 @@ __END_DECLS
 # endif
 
 #endif /* NDEBUG.  */
+
+
+#ifdef __USE_ISOC11
+/* Static assertion.  Requires support in the compiler.  */
+# undef static_assert
+# define static_assert _Static_assert
+#endif
Comment 3 Jonathan Wakely 2012-01-06 10:56:31 UTC
http://sourceware.org/bugzilla/show_bug.cgi?id=13529

should be reproducible with:

#include <assert.h>
static_assert( true, "valid C++" );


this could be fixed in libstdc++ by providing a fixed assert.h with #undef static_assert, but glibc shouldn't be defining the macro for __cplusplus in the first place

does glibc also define macros for alignof, true, false, bool etc. in C++ mode?
Comment 4 Jonathan Wakely 2012-01-06 11:06:50 UTC
this should be reported to glibc, like http://sourceware.org/bugzilla/show_bug.cgi?id=13566
Comment 5 jsm-csl@polyomino.org.uk 2012-01-06 11:47:15 UTC
On Fri, 6 Jan 2012, redi at gcc dot gnu.org wrote:

> does glibc also define macros for alignof, true, false, bool etc. in C++ mode?

Those C11 macros are defined in headers required to be provided by 
freestanding implementations, so provided by GCC, not glibc - but it was 
felt suitable to use assert.h for static_assert rather than creating a new 
stdstatic_assert.h header for that macro.  We already discussed C++ 
semantics for those headers, see 
<http://gcc.gnu.org/ml/gcc-patches/2011-11/msg00847.html>.
Comment 6 Jonathan Wakely 2012-01-06 12:08:11 UTC
(In reply to comment #5)
> We already discussed C++ 
> semantics for those headers, see 
> <http://gcc.gnu.org/ml/gcc-patches/2011-11/msg00847.html>.

Yep, I remember, I was just checking whether the new glibc changes altered things - glad to hear they don't.
Comment 7 jsm-csl@polyomino.org.uk 2012-01-06 15:28:16 UTC
On Fri, 6 Jan 2012, redi at gcc dot gnu.org wrote:

> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51773
> 
> --- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-01-06 12:08:11 UTC ---
> (In reply to comment #5)
> > We already discussed C++ 
> > semantics for those headers, see 
> > <http://gcc.gnu.org/ml/gcc-patches/2011-11/msg00847.html>.
> 
> Yep, I remember, I was just checking whether the new glibc changes altered
> things - glad to hear they don't.

You probably want to check all the C11 features in glibc (listed as 
dependencies of <http://sourceware.org/bugzilla/show_bug.cgi?id=13525> - 
my original list was 
<http://sourceware.org/ml/libc-alpha/2011-12/msg00051.html>) for whether 
the headers do what you think they should for C++ (both C++03 and C++11) - 
and update the glibc issues for anything needing more work for C++.
Comment 8 Jonathan Wakely 2012-01-06 15:33:16 UTC
I've already glanced over them and added one comment, I'll go through them properly asap
Comment 9 Jakub Jelinek 2012-01-06 15:43:19 UTC
I'm not sure if for -D_GNU_SOURCE we want a ::gets prototype in C++, it would be better to just have std::gets only.
Comment 10 jsm-csl@polyomino.org.uk 2012-01-06 15:51:20 UTC
On Fri, 6 Jan 2012, jakub at gcc dot gnu.org wrote:

> I'm not sure if for -D_GNU_SOURCE we want a ::gets prototype in C++, it would
> be better to just have std::gets only.

The trouble is we can't distinguish between a user's -D_GNU_SOURCE for C++ 
and the compiler's predefine (which it defines because the libstdc++ 
headers want to use C library functionality beyond that present in the 
standard).

I'm testing a glibc patch that reenables gets for C++ <= C++11, disables 
the static_assert define for C++ and disables the char16_t/char32_t 
typedefs in uchar.h for C++11 (since they are keywords in C++11).
Comment 11 Jakub Jelinek 2012-01-06 16:12:00 UTC
Sure, we'd need some coordination between glibc and libstdc++, or just a glibc version check and defining the std::gets prototype in libstdc++.
Comment 12 Tom de Vries 2012-01-09 11:33:46 UTC
(In reply to comment #10)
> I'm testing a glibc patch that reenables gets for C++ <= C++11, disables 
> the static_assert define for C++ and disables the char16_t/char32_t 
> typedefs in uchar.h for C++11 (since they are keywords in C++11).

2012-01-06  Joseph Myers  <joseph@codesourcery.com>

	[BZ #13566]
	* assert/assert.h (static_assert): Don't define for C++.
	* libio/stdio.h (gets): Do declare for C++ <= C++11.
	* wcsmbs/uchar.h (char16_t, char32_t): Don't typedef for C++11.

Given this checkin in glibc, marking this as resolved - moved.