Dual-Life / Time-Piece

Object Oriented time objects
Other
15 stars 33 forks source link

sun compiler doesn't allow extern inline functions to call static inline functions #5

Closed plicease closed 10 years ago

plicease commented 10 years ago

gcc does allow this, and I double checked that the macro I am using is NOT defined in gcc on sun

Here is the error without this patch:

sun% make
Skip blib/lib/Time/Seconds.pm (unchanged)
Skip blib/lib/Time/Piece.pm (unchanged)
Running Mkbootstrap for Time::Piece ()
chmod 644 Piece.bs
/home/ollisg/opt/perl/5.16.2/bin/perl /home/ollisg/perl5/5.16.2/lib/perl5/ExtUtils/xsubpp  -typemap /home/ollisg/opt/perl/5.16.2/lib/5.16.2/ExtUtils/typemap  Piece.xs > Piece.xsc && mv Piece.xsc Piece.c
cc -c   -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DPERL_USE_SAFE_PUTENV -O   -DVERSION=\"1.26\" -DXS_VERSION=\"1.26\" -KPIC "-I/home/ollisg/opt/perl/5.16.2/lib/5.16.2/i86pc-solaris/CORE"   Piece.c
"Piece.xs", line 966: reference to static identifier "_strptime" in extern inline function
"Piece.c", line 1309: warning: statement not reached
"Piece.c", line 1347: warning: statement not reached
"Piece.c", line 1392: warning: statement not reached
"Piece.c", line 1433: warning: statement not reached
cc: acomp failed for Piece.c
make: *** [Piece.o] Error 1
bulk88 commented 10 years ago

This should be rebased into 1 commit. There is also a HPUX CC build failure being reported by Tux, but that might be a separate fix.

plicease commented 10 years ago

This fix will definitely not address HP-UX, as the C macro is for the sun compiler. I'm not sure what the error message is and don't have access to an HP-UX box, but it is possible that the HP compiler doesn't like to mix static and extern inline as well. One comment I read when researching this issue was that the standard doesn't allow it but gcc does.

It may be cleaner to make our_strptime static everywhere rather than doing it in the TP_INLINE macro for sun, but my initial take was to be cautious and avoid possible breakages elsewhere. I'm happy to amend the pull-request and test on sun (but not HP-UX) if that is the right thing to do.

plicease commented 10 years ago

Thanks for fixing this.