Bug 31957 - Build of compiler fails with 'error: #endif without #if'
Summary: Build of compiler fails with 'error: #endif without #if'
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: 4.2.1
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-16 16:07 UTC by Jörg Richter
Modified: 2007-07-05 11:46 UTC (History)
3 users (show)

See Also:
Host: powerpc-ibm-aix5.2.0.0
Target: powerpc-ibm-aix5.2.0.0
Build: powerpc-ibm-aix5.2.0.0
Known to work:
Known to fail:
Last reconfirmed: 2007-07-05 10:27:20


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jörg Richter 2007-05-16 16:07:40 UTC
$ configure --enable-languages=c,c++ --with-ld=/bin/ld --with-as=/bin/as
$ make

leads to:

In file included from .../obj/powerpc-ibm-aix5.2.0.0/libstdc++-v3/include/cctype:50,
                 from .../gcc-4.2.0/libstdc++-v3/include/precompiled/stdc++.h:38:
.../obj/powerpc-ibm-aix5.2.0.0/libstdc++-v3/include/powerpc-ibm-aix5.2.0.0/bits/c++config.h:1087:2: error: #endif without #if

While doing:
make[4]: Entering directory `/pdv/.ws/jrichter/gcc420/obj/powerpc-ibm-aix5.2.0.0/libstdc++-v3/include'
sed: 0602-429 No editing script was provided.
Usage:  sed [-n] Script [File ...]
        sed [-n] [-e Script] ... [-f Script_file] ... [File ...]
if [ ! -d "./powerpc-ibm-aix5.2.0.0/bits/stdc++.h.gch" ]; then \
  mkdir -p ./powerpc-ibm-aix5.2.0.0/bits/stdc++.h.gch; \
fi; \
/ws/jrichter/gcc420/obj/./gcc/xgcc -shared-libgcc -B/ws/jrichter/gcc420/obj/./gcc -nostdinc++ -L/ws/jrichter/gcc420/obj/powerpc-ibm-aix5.2.0.0/libstdc++-v3/src -L/ws/jrichter/gcc420/obj/powerpc-ibm-aix5.2.0.0/libstdc++-v3/src/.libs -B/usr/local/powerpc-ibm-aix5.2.0.0/bin/ -B/usr/local/powerpc-ibm-aix5.2.0.0/lib/ -isystem /usr/local/powerpc-ibm-aix5.2.0.0/include -isystem /usr/local/powerpc-ibm-aix5.2.0.0/sys-include -Winvalid-pch -Wno-deprecated -x c++-header -g -O2  -I/ws/jrichter/gcc420/obj/powerpc-ibm-aix5.2.0.0/libstdc++-v3/include/powerpc-ibm-aix5.2.0.0 -I/ws/jrichter/gcc420/obj/powerpc-ibm-aix5.2.0.0/libstdc++-v3/include -I/ws/jrichter/gcc420/gcc-4.2.0/libstdc++-v3/libsupc++ -O0 -g /ws/jrichter/gcc420/gcc-4.2.0/libstdc++-v3/include/precompiled/stdc++.h -o powerpc-ibm-aix5.2.0.0/bits/stdc++.h.gch/O0g.gch


the file .../powerpc-ibm-aix5.2.0.0/libstdc++-v3/include/powerpc-ibm-aix5.2.0.0/bits/c++config.h
has as the last line:
   #endif // _CXXCONFIG_
but no corresponding #ifndef/#define lines of his header guard
Comment 1 Jörg Richter 2007-05-30 08:47:11 UTC
AIX/sed doesn't allow sed -e ''.  
Can't currently attach patches.  Here is it inline:


--- libstdc++-v3/include/Makefile.in.old	2007-05-30 10:03:19.000000000 +0200
+++ libstdc++-v3/include/Makefile.in	2007-05-30 10:06:03.000000000 +0200
@@ -1372,7 +1372,7 @@
 	@date=`cat ${toplevel_srcdir}/gcc/DATESTAMP` ;\
 	nsa_version=`cat stamp-namespace-version` ;\
 	visibility=`cat stamp-visibility` ;\
-	ldbl_compat='' ;\
+	ldbl_compat='s,g,g,g' ;\
 	grep "^[ 	]*#[ 	]*define[ 	][ 	]*_GLIBCXX_LONG_DOUBLE_COMPAT[ 	][ 	]*1[ 	]*$$" \
 	${CONFIG_HEADER} > /dev/null 2>&1 \
 	&& ldbl_compat='s,^#undef _GLIBCXX_LONG_DOUBLE_COMPAT$$,#define _GLIBCXX_LONG_DOUBLE_COMPAT 1,' ;\
Comment 2 Benjamin Kosnik 2007-06-07 09:55:47 UTC
How is it that this tester can build on this target, and not you?

http://gcc.gnu.org/ml/gcc-testresults/2007-06/msg00309.html

I don't see a mention of AIX limitations for sed here:
http://gcc.gnu.org/install/specific.html#x-ibm-aix

-benjamin
Comment 3 Jörg Richter 2007-06-07 10:03:56 UTC
Well,

$ which sed
/usr/bin/sed

$ /usr/bin/sed -e ''
sed: 0602-429 No editing script was provided.
Usage:  sed [-n] Script [File ...]
        sed [-n] [-e Script] ... [-f Script_file] ... [File ...]

Can it be that everyone else is using GNU-sed?
Comment 4 Jörg Richter 2007-07-04 19:48:54 UTC
Any chance that this gets fixed with 4.2.1? This is the only thing on AIX that prevents an unpatched bootstrap.
Or perhaps its only missing documentation that GNU sed must be used.
Comment 5 Paolo Carlini 2007-07-04 20:39:17 UTC
David, can you have a quick look at this issue? Thanks.
Comment 6 David Edelsohn 2007-07-04 23:24:43 UTC
I use GNU Sed.  If we need to add that as a requirement, so be it.
Comment 7 Paolo Bonzini 2007-07-05 10:27:20 UTC
Using "s,g,g," or "s,^,," or even "b" as the default sed command doesn't seem to bad to me.
Comment 8 Paolo Carlini 2007-07-05 10:54:55 UTC
Thanks David and Paolo. Ok, I'm sanity checking 's,g,g,' on linux...
Comment 9 Jörg Richter 2007-07-05 11:00:58 UTC
I think the last g in 's,g,g,g' is the important one.
Comment 10 Paolo Carlini 2007-07-05 11:04:37 UTC
It isn't, as explained by Paolo off-line (by the way Paolo maintains GNU sed), essentially the same string is used in other projects to work around that AIX problem.
Comment 11 Paolo Bonzini 2007-07-05 11:13:39 UTC
Actually any no-op command would do, I think even "b" would be ok unless it triggers other bugs.  In particular, replacing one g with a g, or all g's with g's, should not matter. :-)
Comment 12 Jörg Richter 2007-07-05 11:17:43 UTC
Of course, you are right. :)

Just want to confirm, that all "s,g,g," and "s,^,," and "b" seem to work fine with AIX-sed.
Comment 13 paolo@gcc.gnu.org 2007-07-05 11:45:35 UTC
Subject: Bug 31957

Author: paolo
Date: Thu Jul  5 11:45:24 2007
New Revision: 126362

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126362
Log:
2007-07-05  Joerg Richter  <joerg.richter@pdv-fs.de>

	PR libstdc++/31957
	* include/Makefile.am: Work around an AIX sed oddity.
	* include/Makefile.in: Regenerate.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/Makefile.am
    trunk/libstdc++-v3/include/Makefile.in

Comment 14 paolo@gcc.gnu.org 2007-07-05 11:46:11 UTC
Subject: Bug 31957

Author: paolo
Date: Thu Jul  5 11:46:00 2007
New Revision: 126363

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126363
Log:
2007-07-05  Joerg Richter  <joerg.richter@pdv-fs.de>

	PR libstdc++/31957
	* include/Makefile.am: Work around an AIX sed oddity.
	* include/Makefile.in: Regenerate.

Modified:
    branches/gcc-4_2-branch/libstdc++-v3/ChangeLog
    branches/gcc-4_2-branch/libstdc++-v3/include/Makefile.am
    branches/gcc-4_2-branch/libstdc++-v3/include/Makefile.in

Comment 15 Paolo Carlini 2007-07-05 11:46:50 UTC
Fixed for 4.2.1.