Subject: | [PATCH] Build failure on HP-UX 11.23/64 using HP C-ANSI-C |
For multiple versions of perl built with the native compiler (HP C-ANSI-
C), I get compiler errors. Patch at the end for a fix (passes all tests)
This is perl 5, version 14, subversion 2 (v5.14.2) built for
IA64.ARCHREV_0-LP64-ld
cc -c -Ae -DPERL_DONT_CREATE_GVSV +Z -z -D_HPUX_SOURCE -Wl,
+vnocompatwarnings +DD64 -I/pro/local/include -D_LARGEFILE_SOURCE -
D_FILE_OFFSET_BITS=64 +O2 +Onolimit -DVERSION=\"1.20\" -DXS_VERSION=
\"1.20\" +Z "-I/pro/lib/perl5/5.14.2/IA64.ARCHREV_0-LP64-ld/CORE"
Piece.c
"/pro/lib/perl5/5.14.2/IA64.ARCHREV_0-LP64-ld/CORE/regexp.h", line 329:
warning #2111-D:
statement is unreachable
return "?"; /* Unknown */
^
"Piece.xs", line 919: warning #2223-D: function "alloca" declared
implicitly
zonestr = (char *)alloca(cp - buf + 1);
^
"Piece.xs", line 919: error #4313-D: no prototype or definition in
scope for
call to memory allocation routine "alloca"
zonestr = (char *)alloca(cp - buf + 1);
^
1 error detected in the compilation of "Piece.c".
make: *** [Piece.o] Error 2
This is perl, v5.10.1 (*) built for IA64.ARCHREV_0-LP64
.cpan/build/Time-Piece-1.20-qJrNWj > make
cc -c -Ae -DPERL_DONT_CREATE_GVSV +Z -z -D_HPUX_SOURCE -Wl,
+vnocompatwarnings +DD64 -I/pro/local/include -D_LARGEFILE_SOURCE -
D_FILE_OFFSET_BITS=64 +O2 +Onolimit -DVERSION=\"1.20\" -DXS_VERSION=
\"1.20\" +Z "-I/pro/lib/perl5/5.10.1/IA64.ARCHREV_0-LP64/CORE" Piece.c
"Piece.xs", line 919: warning #2223-D: function "alloca" declared
implicitly
zonestr = (char *)alloca(cp - buf + 1);
^
"Piece.xs", line 919: error #4313-D: no prototype or definition in
scope for
call to memory allocation routine "alloca"
zonestr = (char *)alloca(cp - buf + 1);
^
1 error detected in the compilation of "Piece.c".
With GNU gcc compiled perl I get
This is perl 5, version 14, subversion 1 (v5.14.1) built for
IA64.ARCHREV_0-LP64-ld
gcc -c -mlp64 -DPERL_DONT_CREATE_GVSV -D_HPUX_SOURCE -fno-strict-
aliasing -pipe -I/pro/local/include -D_LARGEFILE_SOURCE -
D_FILE_OFFSET_BITS=64 -g -O -DVERSION=\"1.20\" -DXS_VERSION=\"1.20\" -
fPIC "-I/opt/perl64/lib/5.14.1/IA64.ARCHREV_0-LP64-ld/CORE" Piece.c
Piece.xs: In function '_strptime':
Piece.xs:919:23: warning: incompatible implicit declaration of built-in
function 'alloca' [enabled by default]
--8<--- Piece.xs.diff
--- Piece.xs.org 2012-02-07 15:02:44 +0100
+++ Piece.xs 2012-02-07 15:03:53 +0100
@@ -314,8 +314,8 @@ void * __cdecl _EXPFUNC alloca(_SIZE_T _
#define alloca _alloca
#endif
#else
-#if defined(_SGIAPI) || defined( __sgi ) || ( defined (__SVR4) &&
defined (__sun) )
-/* required for IRIX and Solaris */
+#if defined(_SGIAPI) || defined( __sgi ) || ( defined (__SVR4) &&
defined (__sun) ) || defined (__hpux)
+/* required for HP-UX, IRIX and Solaris */
#include <alloca.h>
#endif
#endif
-->8---