diff options
author | Tim Jenness <t.jenness@jach.hawaii.edu> | 2009-07-07 11:49:11 -1000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2009-07-10 14:10:25 +0100 |
commit | f72737b02c0aeac57b5ea5ea89b80d6703d9e852 (patch) | |
tree | 8d5db8bff51403fc765834288336f804d6901bb9 | |
parent | f4a0f0dc00472ba1806a1c1c87e2a3b7110ab924 (diff) | |
download | perl-f72737b02c0aeac57b5ea5ea89b80d6703d9e852.tar.gz |
Fix compiler warning when cuserid is absent and sizeof(int) != sizeof(pointer)
The attached patch fixes a compilation warning from POSIX.xs when cuserid
is missing and ints and pointers have different size. eg on Mac OSX when
using 64-bit mode.
gcc-4.2 -c -fno-common -DPERL_DARWIN -no-cpp-precomp -arch x86_64 -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector
-I/usr/local/include -I/opt/local/include -O3 -g -DVERSION=\"1.17\"
-DXS_VERSION=\"1.17\" "-I../.." POSIX.c
POSIX.c: In function 'XS_POSIX_cuserid':
POSIX.c:4096: warning: cast to pointer from integer of different size
Running Mkbootstrap for POSIX ()
chmod 644 POSIX.bs
rm -f ../../lib/auto/POSIX/POSIX.bundle
Also relevant for 5.10.1.
Signed-off-by: H.Merijn Brand <h.m.brand@xs4all.nl>
(cherry picked from commit 56f4542c0225628c386228d839cd4db214424a79)
-rw-r--r-- | ext/POSIX/POSIX.xs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs index 4c26d7d94b..4484377382 100644 --- a/ext/POSIX/POSIX.xs +++ b/ext/POSIX/POSIX.xs @@ -249,16 +249,12 @@ typedef struct termios* POSIX__Termios; #endif /* Possibly needed prototypes */ -char *cuserid (char *); #ifndef WIN32 double strtod (const char *, char **); long strtol (const char *, char **, int); unsigned long strtoul (const char *, char **, int); #endif -#ifndef HAS_CUSERID -#define cuserid(a) (char *) not_here("cuserid") -#endif #ifndef HAS_DIFFTIME #ifndef difftime #define difftime(a,b) not_here("difftime") @@ -1847,6 +1843,15 @@ ctermid(s = 0) char * cuserid(s = 0) char * s = 0; + CODE: +#ifdef HAS_CUSERID + RETVAL = cuserid(s); +#else + RETVAL = 0; + not_here("cuserid"); +#endif + OUTPUT: + RETVAL SysRetLong fpathconf(fd, name) |