develooper Front page | perl.perl5.porters | Postings from February 2000

[ID 20000204.003] [PATCH 5.5.64] pointer type warnings

From:
Robin Barker
Date:
February 4, 2000 05:59
Subject:
[ID 20000204.003] [PATCH 5.5.64] pointer type warnings
Message ID:
200002041358.NAA01358@tempest.npl.co.uk

This is a bug report for perl from rmb1@cise.npl.co.uk,
generated with the help of perlbug 1.27 running under perl 5.00564.


-----------------------------------------------------------------
[Please enter your report here]

making perl5.5.64 with threads gave gcc warnings:

sv.c: In function `Perl_ptr_table_fetch':
sv.c:6401: warning: cast from pointer to integer of different size
sv.c: In function `Perl_ptr_table_store':
sv.c:6418: warning: cast from pointer to integer of different size
sv.c: In function `Perl_ptr_table_split':
sv.c:6458: warning: cast from pointer to integer of different size
make: [extra.pods] Error 1 (ignored)
ODBM_File.c: In function `XS_ODBM_File_TIEHASH':
ODBM_File.c:92: warning: passing arg 1 of `Perl_Gcurinterp_ptr' from 
incompatible pointer type
ODBM_File.c:92: warning: passing arg 1 of `Perl_Gcurinterp_ptr' from 
incompatible pointer type
ODBM_File.c:92: warning: passing arg 1 of `Perl_Gcurinterp_ptr' from 
incompatible pointer type
[snipped]

Thread.xs:25: warning: `struct perl_thread' declared inside parameter list
Thread.xs:25: warning: its scope is only this definition or declaration, 
which is probably not what you want.

The patch below fixes the problems in sv.c and ODBM_File.c.  I am 
happy with the patches to sv.c but less happy with what I have done 
to ODBM_File.xs.  I have not managed to fix the Thread.xs errors.

I also get warnings from Configure:
<poll.h> found.
Guessing which symbols your C compiler and preprocessor define...
:2: warning: `#ifdef' argument starts with a digit
:7: warning: `#ifdef' argument starts with a digit
tcsetattr() found.

Robin

--- sv.c	2000/02/04 12:11:32	1.1
+++ sv.c	2000/02/04 12:13:55
@@ -6398,7 +6398,7 @@
 Perl_ptr_table_fetch(pTHX_ PTR_TBL_t *tbl, void *sv)
 {
     PTR_TBL_ENT_t *tblent;
-    UV hash = (UV)sv;
+    UV hash = PTR2UV(sv);
     assert(tbl);
     tblent = tbl->tbl_ary[hash & tbl->tbl_max];
     for (; tblent; tblent = tblent->next) {
@@ -6415,7 +6415,7 @@
     /* XXX this may be pessimal on platforms where pointers aren't good
      * hash values e.g. if they grow faster in the most significant
      * bits */
-    UV hash = (UV)oldv;
+    UV hash = PTR2UV(oldv);
     bool i = 1;
 
     assert(tbl);
@@ -6455,7 +6455,7 @@
 	    continue;
 	curentp = ary + oldsize;
 	for (entp = ary, ent = *ary; ent; ent = *entp) {
-	    if ((newsize & (UV)ent->oldval) != i) {
+	    if ((newsize & PTR2UV(ent->oldval)) != i) {
 		*entp = ent->next;
 		ent->next = *curentp;
 		*curentp = ent;
--- ext/ODBM_File/ODBM_File.xs	2000/02/04 12:55:36	1.1
+++ ext/ODBM_File/ODBM_File.xs	2000/02/04 12:56:01
@@ -2,9 +2,6 @@
 #include "perl.h"
 #include "XSUB.h"
 
-#ifdef NULL
-#undef NULL  /* XXX Why? */
-#endif
 #Ifdef I_DBM
 #  include <dbm.h>
 #else


[Please do not change anything below this line]
-----------------------------------------------------------------

---
Site configuration information for perl 5.00564:

Configured by rmb1 at Fri Feb  4 13:31:09 GMT 2000.

Summary of my perl5 (revision 5.0 version 5 subversion 640) configuration:
  Platform:
    osname=solaris, osvers=2.7, archname=sun4-solaris-thread-multi
    uname='sunos tempest 5.7 generic_106541-04 sun4u sparc sunw,ultra-5_10 '
    config_args='-des -Dcc=gcc -Dprefix=/home/rmb1/appl -Dscriptdir=/home/rmb1/appl/bin -Dman1dir=none -Dman3dir=none -Duseperlio -Uinstallusrbinperl -Dcf_email=rmb1@cise.npl.co.uk -Doptimize=-O -g -Duse64bits -Dusethreads'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define
    usesocks=undef useperlio=define d_sfio=undef
    use64bits=define uselargefiles=define usemultiplicity=define
  Compiler:
    cc='gcc', optimize='-O -g', gccversion=2.95.1 19990816 (release)
    cppflags='-D_REENTRANT -DDEBUGGING -fno-strict-aliasing -I/usr/local/include'
    ccflags ='-D_REENTRANT -DDEBUGGING -fno-strict-aliasing -I/usr/local/include -DUSE_LONG_LONG -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -L/usr/local/lib '
    libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -ldl -lm -lposix4 -lpthread -lc -lcrypt -lsec
    libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib'

Locally applied patches:
    

---
@INC for perl 5.00564:
    lib
    /home/rmb1/appl/lib/perl5/site_perl/5.005
    /home/rmb1/appl/lib/perl5/5.5.640/sun4-solaris-thread-multi
    /home/rmb1/appl/lib/perl5/5.5.640
    /home/rmb1/appl/lib/perl5/site_perl/5.5.640/sun4-solaris-thread-multi
    /home/rmb1/appl/lib/perl5/site_perl/5.5.640
    .

---
Environment for perl 5.00564:
    HOME=/home/rmb1
    LANG=C
    LANGUAGE (unset)
    LD_LIBRARY_PATH=/usr/lib
    LOGDIR (unset)
    PATH=/home/rmb1/appl/script:/usr/tempest/bin:/usr/local/bin:/usr/local/Admigration/exec:/usr/local/hotjava/bin:/usr/openwin/bin:/usr/dt/bin:/usr/ccs/bin:/usr/bin
    PERL5LIB=/home/rmb1/appl/lib/perl5/site_perl/5.005
    PERL_BADLANG (unset)
    SHELL=/bin/csh



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About