From: Jarkko Hietaniemi Date: Wed, 2 Aug 2006 00:04:42 +0000 (+0300) Subject: g++ heavy shoveling X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b1e55cab83fc5b3a567d95fba8bca0592334b7a5;p=p5sagit%2Fp5-mst-13.2.git g++ heavy shoveling Message-ID: <44CFC1EA.2050702@iki.fi> p4raw-id: //depot/perl@28645 --- diff --git a/cflags.SH b/cflags.SH index 6c7c4c9..c32d5f8 100755 --- a/cflags.SH +++ b/cflags.SH @@ -88,6 +88,20 @@ Intel*) ;; # Haven't we been through this already? ;; esac +# If we have g++, we cannot have the -Wdeclaration-after-statement. +# Some g++s accept it but then whine about it with every file. +case "$cc" in +*g++*) warn="`echo $warn|sed 's/-Wdeclaration-after-statement/ /'`" ;; +esac + +extra='' + +# C and C++ have different rules for const strings; +# without the -fno-const-strings g++ cannot handle our habit +# of mixing char literals and char pointers. +case "$cc" in +*g++*) extra="$extra -fno-const-strings" ;; +esac stdflags='' @@ -104,6 +118,8 @@ $startsh warn="$warn" # Extra standardness. stdflags="$stdflags" +# Extra extra. +extra="$extra" !GROK!THIS! @@ -217,8 +233,8 @@ if test -f .patch; then fi : Can we perhaps use $ansi2knr here - echo "$cc -c -DPERL_CORE $ccflags $stdflags $optimize $warn" - eval "$also "'"$cc -DPERL_CORE -c $ccflags $stdflags $optimize $warn"' + echo "$cc -c -DPERL_CORE $ccflags $stdflags $optimize $warn $extra" + eval "$also "'"$cc -DPERL_CORE -c $ccflags $stdflags $optimize $warn $extra"' . $TOP/config.sh diff --git a/hints/linux.sh b/hints/linux.sh index 98bdc9c..f5c400b 100644 --- a/hints/linux.sh +++ b/hints/linux.sh @@ -131,6 +131,7 @@ cat >try.c <<'EOM' /* Test for whether ELF binaries are produced */ #include #include +#include main() { char buffer[4]; int i=open("a.out",O_RDONLY); @@ -352,3 +353,14 @@ $define|true|[yY]*) libswanted="$*" ;; esac + +# If we are using g++ we must use nm and force ourselves to use +# the /usr/lib/libc.a (resetting the libc below to an empty string +# makes Configure to look for the right one) because the symbol +# scanning tricks of Configure will crash and burn horribly. +case "$cc" in +*g++*) usenm=true + libc='' + ;; +esac + diff --git a/perl.h b/perl.h index 3c806e3..4f39f41 100644 --- a/perl.h +++ b/perl.h @@ -351,7 +351,10 @@ register struct op *Perl_op asm(stringify(OP_IN_REGISTER)); # endif #endif -#if defined(PERL_GCC_PEDANTIC) +/* gcc (-ansi) -pedantic doesn't allow gcc brace groups, + * g++ allows them but seems to have problems with them + * (insane errors ensue). */ +#if defined(PERL_GCC_PEDANTIC) || (defined(__GNUC__) && defined(__cplusplus)) # ifndef PERL_GCC_BRACE_GROUPS_FORBIDDEN # define PERL_GCC_BRACE_GROUPS_FORBIDDEN # endif