Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.85k stars 527 forks source link

[PATCH 5.5.64] pointer type warnings #1138

Closed p5pRT closed 20 years ago

p5pRT commented 24 years ago

Migrated from rt.perl.org#2099 (status was 'resolved')

Searchable as RT2099$

p5pRT commented 24 years ago

From rmb1@cise.npl.co.uk

Created by rmb1@cise.npl.co.uk

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

Perl Info ``` 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 ```