diff options
author | Zefram <zefram@fysh.org> | 2010-12-11 18:18:12 +0000 |
---|---|---|
committer | Zefram <zefram@fysh.org> | 2010-12-11 18:23:16 +0000 |
commit | c33e8be1506a75e393304af89d64e3f46e0ca7cb (patch) | |
tree | 064f08620e62d11eca50f73b7439564b702f47ad | |
parent | d6f31ecf904f01f8a2aab2bca55e33b1b51e0b4d (diff) | |
download | perl-c33e8be1506a75e393304af89d64e3f46e0ca7cb.tar.gz |
fix various compiler warnings from XS code
Trivial changes to fix warnings of types
* unclear precedence
* assignment as conditional
* signed/unsigned mixing
* unused parameter/variable
* value computed not used
* wrong argument type for a printf format
* variable may be used uninitialised (due to unhandled switch case)
-rw-r--r-- | cpan/Unicode-Normalize/Normalize.xs | 4 | ||||
-rw-r--r-- | dist/Cwd/Cwd.xs | 4 | ||||
-rw-r--r-- | dist/Data-Dumper/Dumper.xs | 2 | ||||
-rw-r--r-- | dist/ExtUtils-ParseXS/t/XSMore.xs | 2 | ||||
-rw-r--r-- | dist/ExtUtils-ParseXS/t/XSUsage.xs | 4 | ||||
-rw-r--r-- | dist/IO/IO.xs | 2 | ||||
-rw-r--r-- | dist/Storable/Storable.xs | 10 | ||||
-rw-r--r-- | dist/threads-shared/shared.xs | 13 | ||||
-rw-r--r-- | dist/threads/threads.xs | 2 | ||||
-rw-r--r-- | ext/B/B.xs | 9 | ||||
-rw-r--r-- | ext/Devel-Peek/Peek.xs | 7 | ||||
-rw-r--r-- | ext/Fcntl/Fcntl.xs | 2 | ||||
-rw-r--r-- | ext/File-Glob/Glob.xs | 1 | ||||
-rw-r--r-- | ext/Hash-Util-FieldHash/FieldHash.xs | 32 | ||||
-rw-r--r-- | ext/Opcode/Opcode.xs | 4 | ||||
-rw-r--r-- | ext/POSIX/POSIX.xs | 38 | ||||
-rw-r--r-- | ext/PerlIO-encoding/encoding.xs | 2 | ||||
-rw-r--r-- | ext/PerlIO-scalar/scalar.xs | 9 | ||||
-rw-r--r-- | ext/PerlIO-via/via.xs | 5 | ||||
-rw-r--r-- | ext/SDBM_File/sdbm/pair.c | 2 | ||||
-rw-r--r-- | ext/Socket/Socket.xs | 2 | ||||
-rw-r--r-- | ext/XS-APItest/APItest.xs | 31 |
22 files changed, 129 insertions, 58 deletions
diff --git a/cpan/Unicode-Normalize/Normalize.xs b/cpan/Unicode-Normalize/Normalize.xs index f4bbca7907..5f5357cbd8 100644 --- a/cpan/Unicode-Normalize/Normalize.xs +++ b/cpan/Unicode-Normalize/Normalize.xs @@ -380,8 +380,8 @@ U8* pv_utf8_compose(U8* s, STRLEN slen, U8* d, STRLEN dlen, bool iscontig) bool composed; /* blocked */ - if (iscontig && cc_pos || /* discontiguous combination */ - curCC != 0 && preCC == curCC || /* blocked by same CC */ + if ((iscontig && cc_pos) || /* discontiguous combination */ + (curCC != 0 && preCC == curCC) || /* blocked by same CC */ preCC > curCC) /* blocked by higher CC: revised D2 */ composed = FALSE; diff --git a/dist/Cwd/Cwd.xs b/dist/Cwd/Cwd.xs index 123be683ea..421c9df8b4 100644 --- a/dist/Cwd/Cwd.xs +++ b/dist/Cwd/Cwd.xs @@ -106,7 +106,7 @@ bsd_realpath(const char *path, char resolved[MAXPATHLEN]) */ p = strchr(left, '/'); s = p ? p : left + left_len; - if (s - left >= sizeof(next_token)) { + if ((STRLEN)(s - left) >= (STRLEN)sizeof(next_token)) { errno = ENAMETOOLONG; return (NULL); } @@ -190,7 +190,7 @@ bsd_realpath(const char *path, char resolved[MAXPATHLEN]) */ if (p != NULL) { if (symlink[slen - 1] != '/') { - if (slen + 1 >= sizeof(symlink)) { + if ((STRLEN)(slen + 1) >= (STRLEN)sizeof(symlink)) { errno = ENAMETOOLONG; return (NULL); } diff --git a/dist/Data-Dumper/Dumper.xs b/dist/Data-Dumper/Dumper.xs index ce38ec019d..56b3378e61 100644 --- a/dist/Data-Dumper/Dumper.xs +++ b/dist/Data-Dumper/Dumper.xs @@ -706,7 +706,7 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, keysv = svp ? *svp : sv_mortalcopy(&PL_sv_undef); key = SvPV(keysv, keylen); svp = hv_fetch((HV*)ival, key, - SvUTF8(keysv) ? -(I32)keylen : keylen, 0); + SvUTF8(keysv) ? -(I32)keylen : (I32)keylen, 0); hval = svp ? *svp : sv_mortalcopy(&PL_sv_undef); } else { diff --git a/dist/ExtUtils-ParseXS/t/XSMore.xs b/dist/ExtUtils-ParseXS/t/XSMore.xs index f2fe902fbe..0777f89eac 100644 --- a/dist/ExtUtils-ParseXS/t/XSMore.xs +++ b/dist/ExtUtils-ParseXS/t/XSMore.xs @@ -16,6 +16,7 @@ outlist(int* a, int* b){ STATIC int len(const char* const s, int const l){ + PERL_UNUSED_ARG(s); return l; } @@ -84,6 +85,7 @@ int myabs(...) OVERLOAD: abs CODE: + PERL_UNUSED_VAR(items); RETVAL = 42; OUTPUT: RETVAL diff --git a/dist/ExtUtils-ParseXS/t/XSUsage.xs b/dist/ExtUtils-ParseXS/t/XSUsage.xs index ec663f8653..1e59635ee0 100644 --- a/dist/ExtUtils-ParseXS/t/XSUsage.xs +++ b/dist/ExtUtils-ParseXS/t/XSUsage.xs @@ -6,8 +6,8 @@ int xsusage_one() { return 1; } int xsusage_two() { return 2; } int xsusage_three() { return 3; } int xsusage_four() { return 4; } -int xsusage_five(int i) { return 5; } -int xsusage_six(int i) { return 6; } +int xsusage_five(int i) { PERL_UNUSED_ARG(i); return 5; } +int xsusage_six(int i) { PERL_UNUSED_ARG(i); return 6; } MODULE = XSUsage PACKAGE = XSUsage PREFIX = xsusage_ diff --git a/dist/IO/IO.xs b/dist/IO/IO.xs index 08fefb0b6b..e8e9e556e8 100644 --- a/dist/IO/IO.xs +++ b/dist/IO/IO.xs @@ -226,7 +226,7 @@ new_tmpfile(packname = "IO::File") #endif gv = (GV*)SvREFCNT_inc(newGVgen(packname)); if (gv) - hv_delete(GvSTASH(gv), GvNAME(gv), GvNAMELEN(gv), G_DISCARD); + (void) hv_delete(GvSTASH(gv), GvNAME(gv), GvNAMELEN(gv), G_DISCARD); if (gv && do_open(gv, "+>&", 3, FALSE, 0, 0, fp)) { ST(0) = sv_2mortal(newRV((SV*)gv)); sv_bless(ST(0), gv_stashpv(packname, TRUE)); diff --git a/dist/Storable/Storable.xs b/dist/Storable/Storable.xs index fa510b00b9..35788256c8 100644 --- a/dist/Storable/Storable.xs +++ b/dist/Storable/Storable.xs @@ -1736,6 +1736,7 @@ static void pkg_hide( const char *method) { const char *hvname = HvNAME_get(pkg); + PERL_UNUSED_ARG(method); (void) hv_store(cache, hvname, strlen(hvname), newSVsv(&PL_sv_undef), 0); } @@ -1752,6 +1753,7 @@ static void pkg_uncache( const char *method) { const char *hvname = HvNAME_get(pkg); + PERL_UNUSED_ARG(method); (void) hv_delete(cache, hvname, strlen(hvname), G_DISCARD); } @@ -2367,7 +2369,7 @@ static int store_hash(pTHX_ stcxt_t *cxt, HV *hv) SV *key; if (!he) - CROAK(("Hash %p inconsistent - expected %d keys, %dth is NULL", hv, len, i)); + CROAK(("Hash %p inconsistent - expected %d keys, %dth is NULL", hv, (int)len, (int)i)); key = hv_iterkeysv(he); av_store(av, AvFILLp(av)+1, key); /* av_push(), really */ } @@ -3882,6 +3884,7 @@ static SV *mbuf2sv(pTHX) */ static SV *retrieve_other(pTHX_ stcxt_t *cxt, const char *cname) { + PERL_UNUSED_ARG(cname); if ( cxt->ver_major != STORABLE_BIN_MAJOR && cxt->ver_minor != STORABLE_BIN_MINOR @@ -3912,6 +3915,7 @@ static SV *retrieve_idx_blessed(pTHX_ stcxt_t *cxt, const char *cname) SV **sva; SV *sv; + PERL_UNUSED_ARG(cname); TRACEME(("retrieve_idx_blessed (#%d)", cxt->tagnum)); ASSERT(!cname, ("no bless-into class given here, got %s", cname)); @@ -3954,6 +3958,7 @@ static SV *retrieve_blessed(pTHX_ stcxt_t *cxt, const char *cname) char *classname = buf; char *malloced_classname = NULL; + PERL_UNUSED_ARG(cname); TRACEME(("retrieve_blessed (#%d)", cxt->tagnum)); ASSERT(!cname, ("no bless-into class given here, got %s", cname)); @@ -4035,6 +4040,7 @@ static SV *retrieve_hook(pTHX_ stcxt_t *cxt, const char *cname) char mtype = '\0'; unsigned int extra_type = 0; + PERL_UNUSED_ARG(cname); TRACEME(("retrieve_hook (#%d)", cxt->tagnum)); ASSERT(!cname, ("no bless-into class given here, got %s", cname)); @@ -5484,6 +5490,7 @@ static SV *old_retrieve_array(pTHX_ stcxt_t *cxt, const char *cname) SV *sv; int c; + PERL_UNUSED_ARG(cname); TRACEME(("old_retrieve_array (#%d)", cxt->tagnum)); /* @@ -5546,6 +5553,7 @@ static SV *old_retrieve_hash(pTHX_ stcxt_t *cxt, const char *cname) int c; SV *sv_h_undef = (SV *) 0; /* hv_store() bug */ + PERL_UNUSED_ARG(cname); TRACEME(("old_retrieve_hash (#%d)", cxt->tagnum)); /* diff --git a/dist/threads-shared/shared.xs b/dist/threads-shared/shared.xs index 6ead3bae43..e92d33d06e 100644 --- a/dist/threads-shared/shared.xs +++ b/dist/threads-shared/shared.xs @@ -210,6 +210,8 @@ recursive_lock_release(pTHX_ recursive_lock_t *lock) void recursive_lock_acquire(pTHX_ recursive_lock_t *lock, char *file, int line) { + PERL_UNUSED_ARG(file); + PERL_UNUSED_ARG(line); assert(aTHX); MUTEX_LOCK(&lock->mutex); if (lock->owner == aTHX) { @@ -278,6 +280,7 @@ int sharedsv_userlock_free(pTHX_ SV *sv, MAGIC *mg) { user_lock *ul = (user_lock *) mg->mg_ptr; + PERL_UNUSED_ARG(sv); assert(aTHX == PL_sharedsv_space); if (ul) { recursive_lock_destroy(aTHX_ &ul->lock); @@ -805,6 +808,7 @@ sharedsv_scalar_mg_set(pTHX_ SV *sv, MAGIC *mg) int sharedsv_scalar_mg_free(pTHX_ SV *sv, MAGIC *mg) { + PERL_UNUSED_ARG(sv); S_sharedsv_dec(aTHX_ (SV*)mg->mg_ptr); return (0); } @@ -815,6 +819,7 @@ sharedsv_scalar_mg_free(pTHX_ SV *sv, MAGIC *mg) int sharedsv_scalar_mg_dup(pTHX_ MAGIC *mg, CLONE_PARAMS *param) { + PERL_UNUSED_ARG(param); SvREFCNT_inc_void(mg->mg_ptr); return (0); } @@ -986,7 +991,7 @@ sharedsv_elem_mg_DELETE(pTHX_ SV *sv, MAGIC *mg) } } SHARED_CONTEXT; - hv_delete((HV*) saggregate, key, len, G_DISCARD); + (void) hv_delete((HV*) saggregate, key, len, G_DISCARD); } CALLER_CONTEXT; LEAVE_LOCK; @@ -999,6 +1004,7 @@ sharedsv_elem_mg_DELETE(pTHX_ SV *sv, MAGIC *mg) int sharedsv_elem_mg_dup(pTHX_ MAGIC *mg, CLONE_PARAMS *param) { + PERL_UNUSED_ARG(param); SvREFCNT_inc_void(S_sharedsv_from_obj(aTHX_ mg->mg_obj)); assert(mg->mg_flags & MGf_DUP); return (0); @@ -1027,6 +1033,7 @@ sharedsv_array_mg_FETCHSIZE(pTHX_ SV *sv, MAGIC *mg) dTHXc; SV *ssv = (SV *) mg->mg_ptr; U32 val; + PERL_UNUSED_ARG(sv); SHARED_EDIT; if (SvTYPE(ssv) == SVt_PVAV) { val = av_len((AV*) ssv); @@ -1045,6 +1052,7 @@ sharedsv_array_mg_CLEAR(pTHX_ SV *sv, MAGIC *mg) { dTHXc; SV *ssv = (SV *) mg->mg_ptr; + PERL_UNUSED_ARG(sv); SHARED_EDIT; if (SvTYPE(ssv) == SVt_PVAV) { av_clear((AV*) ssv); @@ -1060,6 +1068,7 @@ sharedsv_array_mg_CLEAR(pTHX_ SV *sv, MAGIC *mg) int sharedsv_array_mg_free(pTHX_ SV *sv, MAGIC *mg) { + PERL_UNUSED_ARG(sv); S_sharedsv_dec(aTHX_ (SV*)mg->mg_ptr); return (0); } @@ -1082,6 +1091,7 @@ sharedsv_array_mg_copy(pTHX_ SV *sv, MAGIC* mg, MAGIC *nmg = sv_magicext(nsv,mg->mg_obj, toLOWER(mg->mg_type),&sharedsv_elem_vtbl, name, namlen); + PERL_UNUSED_ARG(sv); nmg->mg_flags |= MGf_DUP; return (1); } @@ -1091,6 +1101,7 @@ sharedsv_array_mg_copy(pTHX_ SV *sv, MAGIC* mg, int sharedsv_array_mg_dup(pTHX_ MAGIC *mg, CLONE_PARAMS *param) { + PERL_UNUSED_ARG(param); SvREFCNT_inc_void((SV*)mg->mg_ptr); assert(mg->mg_flags & MGf_DUP); return (0); diff --git a/dist/threads/threads.xs b/dist/threads/threads.xs index 71fc7a7881..029540cda3 100644 --- a/dist/threads/threads.xs +++ b/dist/threads/threads.xs @@ -363,6 +363,7 @@ int ithread_mg_free(pTHX_ SV *sv, MAGIC *mg) { ithread *thread = (ithread *)mg->mg_ptr; + PERL_UNUSED_ARG(sv); MUTEX_LOCK(&thread->mutex); S_ithread_free(aTHX_ thread); /* Releases MUTEX */ return (0); @@ -371,6 +372,7 @@ ithread_mg_free(pTHX_ SV *sv, MAGIC *mg) int ithread_mg_dup(pTHX_ MAGIC *mg, CLONE_PARAMS *param) { + PERL_UNUSED_ARG(param); S_ithread_count_inc(aTHX_ (ithread *)mg->mg_ptr); return (0); } diff --git a/ext/B/B.xs b/ext/B/B.xs index b439236abb..c5d971ba89 100644 --- a/ext/B/B.xs +++ b/ext/B/B.xs @@ -258,7 +258,7 @@ make_sv_object(pTHX_ SV *sv) IV iv; dMY_CXT; - for (iv = 0; iv < sizeof(specialsv_list)/sizeof(SV*); iv++) { + for (iv = 0; iv < (IV)(sizeof(specialsv_list)/sizeof(SV*)); iv++) { if (sv == specialsv_list[iv]) { type = "B::SPECIAL"; break; @@ -959,6 +959,9 @@ next(o) ret = sv_2mortal(newSVpv(*((char **)ptr), 0)); break; #endif + default: + croak("Illegal alias 0x%08x for B::*next", (unsigned)ix); + } ST(0) = ret; XSRETURN(1); @@ -1516,6 +1519,8 @@ IVX(sv) case (U8)(sv_U16p >> 16): ret = sv_2mortal(newSVuv(*((U16 *)ptr))); break; + default: + croak("Illegal alias 0x%08x for B::*IVX", (unsigned)ix); } ST(0) = ret; XSRETURN(1); @@ -1808,6 +1813,8 @@ SV(gv) case (U8)(line_tp >> 16): ret = sv_2mortal(newSVuv(*((line_t *)ptr))); break; + default: + croak("Illegal alias 0x%08x for B::*SV", (unsigned)ix); } ST(0) = ret; XSRETURN(1); diff --git a/ext/Devel-Peek/Peek.xs b/ext/Devel-Peek/Peek.xs index d555ab7d08..3dcba4780e 100644 --- a/ext/Devel-Peek/Peek.xs +++ b/ext/Devel-Peek/Peek.xs @@ -294,18 +294,25 @@ mstats2hash(SV *sv, SV *rv, int level) static void fill_mstats(SV *sv, int level) { + PERL_UNUSED_ARG(sv); + PERL_UNUSED_ARG(level); croak("Cannot report mstats without Perl malloc"); } static void mstats_fillhash(SV *sv, int level) { + PERL_UNUSED_ARG(sv); + PERL_UNUSED_ARG(level); croak("Cannot report mstats without Perl malloc"); } static void mstats2hash(SV *sv, SV *rv, int level) { + PERL_UNUSED_ARG(sv); + PERL_UNUSED_ARG(rv); + PERL_UNUSED_ARG(level); croak("Cannot report mstats without Perl malloc"); } #endif /* defined(MYMALLOC) */ diff --git a/ext/Fcntl/Fcntl.xs b/ext/Fcntl/Fcntl.xs index d650994df3..36703a8545 100644 --- a/ext/Fcntl/Fcntl.xs +++ b/ext/Fcntl/Fcntl.xs @@ -53,7 +53,7 @@ XS_Fcntl_S_ISREG(pTHX_ CV* cv) mode = &PL_sv_undef; EXTEND(SP, 1); } - PUSHs(((SvUV(mode) & S_IFMT) == ix) ? &PL_sv_yes : &PL_sv_no); + PUSHs(((SvUV(mode) & S_IFMT) == (UV)ix) ? &PL_sv_yes : &PL_sv_no); PUTBACK; } diff --git a/ext/File-Glob/Glob.xs b/ext/File-Glob/Glob.xs index d4b453c39d..56f76eba8a 100644 --- a/ext/File-Glob/Glob.xs +++ b/ext/File-Glob/Glob.xs @@ -21,6 +21,7 @@ START_MY_CXT #else static int errfunc(const char *foo, int bar) { + PERL_UNUSED_ARG(foo); return !(bar == EACCES || bar == ENOENT || bar == ENOTDIR); } #endif diff --git a/ext/Hash-Util-FieldHash/FieldHash.xs b/ext/Hash-Util-FieldHash/FieldHash.xs index 2c9664660b..c7df46bcb5 100644 --- a/ext/Hash-Util-FieldHash/FieldHash.xs +++ b/ext/Hash-Util-FieldHash/FieldHash.xs @@ -116,6 +116,7 @@ AV* HUF_get_trigger_content(SV* trigger) { * the uf_set field of the uvar magic of a trigger. */ I32 HUF_destroy_obj(pTHX_ IV index, SV* trigger) { + PERL_UNUSED_ARG(index); /* Do nothing if the weakref wasn't undef'd. Also don't bother * during global destruction. (MY_CXT.ob_reg is sometimes funny there) */ if (!SvROK(trigger) && (!PL_in_clean_all)) { @@ -125,15 +126,15 @@ I32 HUF_destroy_obj(pTHX_ IV index, SV* trigger) { HV* field_tab = (HV*) *av_fetch(cont, 1, 0); HE* ent; hv_iterinit(field_tab); - while (ent = hv_iternext(field_tab)) { + while ((ent = hv_iternext(field_tab))) { SV* field_ref = HeVAL(ent); SV* field = SvRV(field_ref); - hv_delete_ent((HV*)field, ob_id, 0, 0); + (void) hv_delete_ent((HV*)field, ob_id, 0, 0); } /* make it safe in case we must run in global clenaup, after all */ if (PL_in_clean_all) HUF_global(HUF_RESET); /* shoudn't be needed */ - hv_delete_ent(MY_CXT.ob_reg, ob_id, 0, 0); + (void) hv_delete_ent(MY_CXT.ob_reg, ob_id, 0, 0); } return 0; } @@ -154,7 +155,7 @@ SV* HUF_new_trigger(SV* obj, SV* ob_id) { av_store(cont, 0, SvREFCNT_inc(ob_id)); av_store(cont, 1, (SV*)newHV()); HUF_add_uvar_magic(trigger, NULL, &HUF_destroy_obj, 0, (SV*)cont); - hv_store_ent(MY_CXT.ob_reg, ob_id, trigger, 0); + (void) hv_store_ent(MY_CXT.ob_reg, ob_id, trigger, 0); return trigger; } @@ -162,7 +163,7 @@ SV* HUF_new_trigger(SV* obj, SV* ob_id) { SV* HUF_ask_trigger(SV* ob_id) { dMY_CXT; HE* ent; - if (ent = hv_fetch_ent(MY_CXT.ob_reg, ob_id, 0, 0)) + if ((ent = hv_fetch_ent(MY_CXT.ob_reg, ob_id, 0, 0))) return HeVAL(ent); return NULL; } @@ -190,7 +191,7 @@ void HUF_mark_field(SV* trigger, SV* field) { HV* field_tab = (HV*) *av_fetch(cont, 1, 0); SV* field_ref = newRV_inc(field); UV field_addr = PTR2UV(field); - hv_store(field_tab, (char *)&field_addr, sizeof(field_addr), field_ref, 0); + (void) hv_store(field_tab, (char *)&field_addr, sizeof(field_addr), field_ref, 0); } /* Determine, from the value of action, whether this call may create a new @@ -213,7 +214,7 @@ I32 HUF_watch_key_safe(pTHX_ IV action, SV* field) { } else if (HUF_WOULD_CREATE_KEY(action)) { /* string key */ /* registered as object id? */ SV* trigger; - if ( trigger = HUF_ask_trigger(keysv)) + if (( trigger = HUF_ask_trigger(keysv))) HUF_mark_field( trigger, field); } } else { @@ -225,6 +226,7 @@ I32 HUF_watch_key_safe(pTHX_ IV action, SV* field) { I32 HUF_watch_key_id(pTHX_ IV action, SV* field) { MAGIC* mg = mg_find(field, PERL_MAGIC_uvar); SV* keysv; + PERL_UNUSED_ARG(action); if (mg && (keysv = mg->mg_obj)) { if (SvROK(keysv)) /* ref key */ mg->mg_obj = HUF_obj_id(keysv); /* key replacement */ @@ -282,16 +284,16 @@ void HUF_fix_trigger(SV* trigger, SV* new_id) { HE* ent; SV* old_id = *av_fetch(cont, 0, 0); hv_iterinit(field_tab); - while (ent = hv_iternext(field_tab)) { + while ((ent = hv_iternext(field_tab))) { SV* field_ref = HeVAL(ent); HV* field = (HV*)SvRV(field_ref); UV field_addr = PTR2UV(field); SV* val; /* recreate field tab entry */ - hv_store(new_tab, (char *)&field_addr, sizeof(field_addr), SvREFCNT_inc(field_ref), 0); + (void) hv_store(new_tab, (char *)&field_addr, sizeof(field_addr), SvREFCNT_inc(field_ref), 0); /* recreate field entry, if any */ - if (val = hv_delete_ent(field, old_id, 0, 0)) - hv_store_ent(field, new_id, SvREFCNT_inc(val), 0); + if ((val = hv_delete_ent(field, old_id, 0, 0))) + (void) hv_store_ent(field, new_id, SvREFCNT_inc(val), 0); } /* update the trigger */ av_store(cont, 0, SvREFCNT_inc(new_id)); @@ -307,7 +309,7 @@ void HUF_fix_objects(void) { HE* ent; AV* oblist = (AV*)sv_2mortal((SV*)newAV()); hv_iterinit(MY_CXT.ob_reg); - while(ent = hv_iternext(MY_CXT.ob_reg)) + while((ent = hv_iternext(MY_CXT.ob_reg))) av_push(oblist, SvREFCNT_inc(hv_iterkeysv(ent))); len = av_len(oblist); for (i = 0; i <= len; ++i) { @@ -328,7 +330,7 @@ void HUF_fix_objects(void) { } HUF_fix_trigger(trigger, new_id); - hv_store_ent(MY_CXT.ob_reg, new_id, SvREFCNT_inc(trigger), 0); + (void) hv_store_ent(MY_CXT.ob_reg, new_id, SvREFCNT_inc(trigger), 0); } } @@ -336,6 +338,8 @@ void HUF_fix_objects(void) { static SV* counter; I32 HUF_inc_var(pTHX_ IV index, SV* which) { + PERL_UNUSED_ARG(index); + PERL_UNUSED_ARG(which); sv_setiv(counter, 1 + SvIV(counter)); return 0; } @@ -435,7 +439,7 @@ PPCODE: HV* field_tab = (HV*) *av_fetch(cont, 1, 0); HE* ent; hv_iterinit(field_tab); - while (ent = hv_iternext(field_tab)) { + while ((ent = hv_iternext(field_tab))) { HV* field = (HV*)SvRV(HeVAL(ent)); if (hv_exists_ent(field, ob_id, 0)) XPUSHs(sv_2mortal(newRV_inc((SV*)field))); diff --git a/ext/Opcode/Opcode.xs b/ext/Opcode/Opcode.xs index 4d6df48ab7..1e5f8c22db 100644 --- a/ext/Opcode/Opcode.xs +++ b/ext/Opcode/Opcode.xs @@ -52,7 +52,7 @@ op_names_init(pTHX) for(i=0; i < PL_maxo; ++i) { SV * const sv = newSViv(i); SvREADONLY_on(sv); - hv_store(op_named_bits, op_names[i], strlen(op_names[i]), sv, 0); + (void) hv_store(op_named_bits, op_names[i], strlen(op_names[i]), sv, 0); } put_op_bitspec(aTHX_ STR_WITH_LEN(":none"), sv_2mortal(new_opset(aTHX_ Nullsv))); @@ -264,7 +264,7 @@ PPCODE: if (strNE(HvNAME_get(hv),"main")) { /* make it think it's in main:: */ hv_name_set(hv, "main", 4, 0); - hv_store(hv,"_",1,(SV *)PL_defgv,0); /* connect _ to global */ + (void) hv_store(hv,"_",1,(SV *)PL_defgv,0); /* connect _ to global */ SvREFCNT_inc((SV *)PL_defgv); /* want to keep _ around! */ } LEAVE; diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs index 2b9af9501a..92ab1bcded 100644 --- a/ext/POSIX/POSIX.xs +++ b/ext/POSIX/POSIX.xs @@ -936,7 +936,7 @@ WEXITSTATUS(status) #endif break; default: - Perl_croak(aTHX_ "Illegal alias %d for POSIX::W*", ix); + Perl_croak(aTHX_ "Illegal alias %d for POSIX::W*", (int)ix); } OUTPUT: RETVAL @@ -1118,65 +1118,65 @@ localeconv() if ((lcbuf = localeconv())) { /* the strings */ if (lcbuf->decimal_point && *lcbuf->decimal_point) - hv_store(RETVAL, "decimal_point", 13, + (void) hv_store(RETVAL, "decimal_point", 13, newSVpv(lcbuf->decimal_point, 0), 0); if (lcbuf->thousands_sep && *lcbuf->thousands_sep) - hv_store(RETVAL, "thousands_sep", 13, + (void) hv_store(RETVAL, "thousands_sep", 13, newSVpv(lcbuf->thousands_sep, 0), 0); #ifndef NO_LOCALECONV_GROUPING if (lcbuf->grouping && *lcbuf->grouping) - hv_store(RETVAL, "grouping", 8, + (void) hv_store(RETVAL, "grouping", 8, newSVpv(lcbuf->grouping, 0), 0); #endif if (lcbuf->int_curr_symbol && *lcbuf->int_curr_symbol) - hv_store(RETVAL, "int_curr_symbol", 15, + (void) hv_store(RETVAL, "int_curr_symbol", 15, newSVpv(lcbuf->int_curr_symbol, 0), 0); if (lcbuf->currency_symbol && *lcbuf->currency_symbol) - hv_store(RETVAL, "currency_symbol", 15, + (void) hv_store(RETVAL, "currency_symbol", 15, newSVpv(lcbuf->currency_symbol, 0), 0); if (lcbuf->mon_decimal_point && *lcbuf->mon_decimal_point) - hv_store(RETVAL, "mon_decimal_point", 17, + (void) hv_store(RETVAL, "mon_decimal_point", 17, newSVpv(lcbuf->mon_decimal_point, 0), 0); #ifndef NO_LOCALECONV_MON_THOUSANDS_SEP if (lcbuf->mon_thousands_sep && *lcbuf->mon_thousands_sep) - hv_store(RETVAL, "mon_thousands_sep", 17, + (void) hv_store(RETVAL, "mon_thousands_sep", 17, newSVpv(lcbuf->mon_thousands_sep, 0), 0); #endif #ifndef NO_LOCALECONV_MON_GROUPING if (lcbuf->mon_grouping && *lcbuf->mon_grouping) - hv_store(RETVAL, "mon_grouping", 12, + (void) hv_store(RETVAL, "mon_grouping", 12, newSVpv(lcbuf->mon_grouping, 0), 0); #endif if (lcbuf->positive_sign && *lcbuf->positive_sign) - hv_store(RETVAL, "positive_sign", 13, + (void) hv_store(RETVAL, "positive_sign", 13, newSVpv(lcbuf->positive_sign, 0), 0); if (lcbuf->negative_sign && *lcbuf->negative_sign) - hv_store(RETVAL, "negative_sign", 13, + (void) hv_store(RETVAL, "negative_sign", 13, newSVpv(lcbuf->negative_sign, 0), 0); /* the integers */ if (lcbuf->int_frac_digits != CHAR_MAX) - hv_store(RETVAL, "int_frac_digits", 15, + (void) hv_store(RETVAL, "int_frac_digits", 15, newSViv(lcbuf->int_frac_digits), 0); if (lcbuf->frac_digits != CHAR_MAX) - hv_store(RETVAL, "frac_digits", 11, + (void) hv_store(RETVAL, "frac_digits", 11, newSViv(lcbuf->frac_digits), 0); if (lcbuf->p_cs_precedes != CHAR_MAX) - hv_store(RETVAL, "p_cs_precedes", 13, + (void) hv_store(RETVAL, "p_cs_precedes", 13, newSViv(lcbuf->p_cs_precedes), 0); if (lcbuf->p_sep_by_space != CHAR_MAX) - hv_store(RETVAL, "p_sep_by_space", 14, + (void) hv_store(RETVAL, "p_sep_by_space", 14, newSViv(lcbuf->p_sep_by_space), 0); if (lcbuf->n_cs_precedes != CHAR_MAX) - hv_store(RETVAL, "n_cs_precedes", 13, + (void) hv_store(RETVAL, "n_cs_precedes", 13, newSViv(lcbuf->n_cs_precedes), 0); if (lcbuf->n_sep_by_space != CHAR_MAX) - hv_store(RETVAL, "n_sep_by_space", 14, + (void) hv_store(RETVAL, "n_sep_by_space", 14, newSViv(lcbuf->n_sep_by_space), 0); if (lcbuf->p_sign_posn != CHAR_MAX) - hv_store(RETVAL, "p_sign_posn", 11, + (void) hv_store(RETVAL, "p_sign_posn", 11, newSViv(lcbuf->p_sign_posn), 0); if (lcbuf->n_sign_posn != CHAR_MAX) - hv_store(RETVAL, "n_sign_posn", 11, + (void) hv_store(RETVAL, "n_sign_posn", 11, newSViv(lcbuf->n_sign_posn), 0); } #else diff --git a/ext/PerlIO-encoding/encoding.xs b/ext/PerlIO-encoding/encoding.xs index 2d515b6540..e94555ce95 100644 --- a/ext/PerlIO-encoding/encoding.xs +++ b/ext/PerlIO-encoding/encoding.xs @@ -58,6 +58,8 @@ PerlIOEncode_getarg(pTHX_ PerlIO * f, CLONE_PARAMS * param, int flags) { PerlIOEncode *e = PerlIOSelf(f, PerlIOEncode); SV *sv = &PL_sv_undef; + PERL_UNUSED_ARG(param); + PERL_UNUSED_ARG(flags); if (e->enc) { dSP; /* Not 100% sure stack swap is right thing to do during dup ... */ diff --git a/ext/PerlIO-scalar/scalar.xs b/ext/PerlIO-scalar/scalar.xs index 6fe551d34c..e081c17f50 100644 --- a/ext/PerlIO-scalar/scalar.xs +++ b/ext/PerlIO-scalar/scalar.xs @@ -84,6 +84,7 @@ PerlIOScalar_close(pTHX_ PerlIO * f) IV PerlIOScalar_fileno(pTHX_ PerlIO * f) { + PERL_UNUSED_ARG(f); return -1; } @@ -156,7 +157,7 @@ PerlIOScalar_read(pTHX_ PerlIO *f, void *vbuf, Size_t count) got = len - (STRLEN)(s->posn); if (got <= 0) return 0; - if (got > (STRLEN)count) + if ((STRLEN)got > (STRLEN)count) got = (STRLEN)count; Copy(p + (STRLEN)(s->posn), vbuf, got, STDCHAR); s->posn += (Off_t)got; @@ -201,12 +202,14 @@ PerlIOScalar_write(pTHX_ PerlIO * f, const void *vbuf, Size_t count) IV PerlIOScalar_fill(pTHX_ PerlIO * f) { + PERL_UNUSED_ARG(f); return -1; } IV PerlIOScalar_flush(pTHX_ PerlIO * f) { + PERL_UNUSED_ARG(f); return 0; } @@ -260,6 +263,7 @@ void PerlIOScalar_set_ptrcnt(pTHX_ PerlIO * f, STDCHAR * ptr, SSize_t cnt) { PerlIOScalar *s = PerlIOSelf(f, PerlIOScalar); + PERL_UNUSED_ARG(ptr); SvGETMAGIC(s->var); s->posn = SvCUR(s->var) - cnt; } @@ -270,6 +274,9 @@ PerlIOScalar_open(pTHX_ PerlIO_funcs * self, PerlIO_list_t * layers, IV n, PerlIO * f, int narg, SV ** args) { SV *arg = (narg > 0) ? *args : PerlIOArg; + PERL_UNUSED_ARG(fd); + PERL_UNUSED_ARG(imode); + PERL_UNUSED_ARG(perm); if (SvROK(arg) || SvPOK(arg)) { if (!f) { f = PerlIO_allocate(aTHX); diff --git a/ext/PerlIO-via/via.xs b/ext/PerlIO-via/via.xs index a811578ca2..56889bfef6 100644 --- a/ext/PerlIO-via/via.xs +++ b/ext/PerlIO-via/via.xs @@ -93,7 +93,7 @@ PerlIOVia_method(pTHX_ PerlIO * f, const char *method, CV ** save, int flags, s->io = GvIOp(gv); if (gv) { /* shamelessly stolen from IO::File's new_tmpfile() */ - hv_delete(GvSTASH(gv), GvNAME(gv), GvNAMELEN(gv), G_DISCARD); + (void) hv_delete(GvSTASH(gv), GvNAME(gv), GvNAMELEN(gv), G_DISCARD); } } IoIFP(s->io) = PerlIONext(f); @@ -536,6 +536,7 @@ void PerlIOVia_set_ptrcnt(pTHX_ PerlIO * f, STDCHAR * ptr, SSize_t cnt) { PerlIOVia *s = PerlIOSelf(f, PerlIOVia); + PERL_UNUSED_ARG(ptr); s->cnt = cnt; } @@ -577,6 +578,8 @@ SV * PerlIOVia_getarg(pTHX_ PerlIO * f, CLONE_PARAMS * param, int flags) { PerlIOVia *s = PerlIOSelf(f, PerlIOVia); + PERL_UNUSED_ARG(param); + PERL_UNUSED_ARG(flags); return PerlIOVia_method(aTHX_ f, MYMethod(GETARG), G_SCALAR, Nullsv); } diff --git a/ext/SDBM_File/sdbm/pair.c b/ext/SDBM_File/sdbm/pair.c index 42b130db19..993a361186 100644 --- a/ext/SDBM_File/sdbm/pair.c +++ b/ext/SDBM_File/sdbm/pair.c @@ -281,7 +281,7 @@ chkpage(char *pag) register int off; register short *ino = (short *) pag; - if ((n = ino[0]) < 0 || n > PBLKSIZ / sizeof(short)) + if ((n = ino[0]) < 0 || n > (int)(PBLKSIZ / sizeof(short))) return 0; if (n > 0) { diff --git a/ext/Socket/Socket.xs b/ext/Socket/Socket.xs index ce6ec34d89..dcf6715727 100644 --- a/ext/Socket/Socket.xs +++ b/ext/Socket/Socket.xs @@ -385,7 +385,7 @@ unpack_sockaddr_un(sun_sv) addr_len = (char *)&addr - (char *)&(addr.sun_path) + sockaddrlen; } else { for (addr_len = 0; addr.sun_path[addr_len] - && addr_len < sizeof addr.sun_path; addr_len++); + && addr_len < (int)sizeof(addr.sun_path); addr_len++); } ST(0) = newSVpvn_flags(addr.sun_path, addr_len, SVs_TEMP); diff --git a/ext/XS-APItest/APItest.xs b/ext/XS-APItest/APItest.xs index 71551ee696..03bbc921f8 100644 --- a/ext/XS-APItest/APItest.xs +++ b/ext/XS-APItest/APItest.xs @@ -95,8 +95,8 @@ test_freeent(freeent_function *f) { #else /* Storing then deleting something should ensure that a hash entry is available. */ - hv_store(test_hash, "", 0, &PL_sv_yes, 0); - hv_delete(test_hash, "", 0, 0); + (void) hv_store(test_hash, "", 0, &PL_sv_yes, 0); + (void) hv_delete(test_hash, "", 0, 0); /* We need to "inline" new_he here as it's static, and the functions we test expect to be able to call del_HE on the HE */ @@ -124,7 +124,7 @@ test_freeent(freeent_function *f) { i = 0; do { mPUSHu(results[i]); - } while (++i < sizeof(results)/sizeof(results[0])); + } while (++i < (int)(sizeof(results)/sizeof(results[0]))); /* Goodbye to our extra reference. */ SvREFCNT_dec(test_scalar); @@ -135,6 +135,7 @@ static I32 bitflip_key(pTHX_ IV action, SV *field) { MAGIC *mg = mg_find(field, PERL_MAGIC_uvar); SV *keysv; + PERL_UNUSED_ARG(action); if (mg && (keysv = mg->mg_obj)) { STRLEN len; const char *p = SvPV(keysv, len); @@ -170,6 +171,7 @@ static I32 rot13_key(pTHX_ IV action, SV *field) { MAGIC *mg = mg_find(field, PERL_MAGIC_uvar); SV *keysv; + PERL_UNUSED_ARG(action); if (mg && (keysv = mg->mg_obj)) { STRLEN len; const char *p = SvPV(keysv, len); @@ -252,6 +254,8 @@ rot13_key(pTHX_ IV action, SV *field) { STATIC I32 rmagical_a_dummy(pTHX_ IV idx, SV *sv) { + PERL_UNUSED_ARG(idx); + PERL_UNUSED_ARG(sv); return 0; } @@ -263,6 +267,7 @@ blockhook_csc_start(pTHX_ int full) dMY_CXT; AV *const cur = GvAV(MY_CXT.cscgv); + PERL_UNUSED_ARG(full); SAVEGENERICSV(GvAV(MY_CXT.cscgv)); if (cur) { @@ -282,6 +287,7 @@ blockhook_csc_pre_end(pTHX_ OP **o) { dMY_CXT; + PERL_UNUSED_ARG(o); /* if we hit the end of a scope we missed the start of, we need to * unconditionally clear @CSC */ if (GvAV(MY_CXT.cscgv) == MY_CXT.cscav && MY_CXT.cscav) { @@ -309,6 +315,7 @@ blockhook_test_pre_end(pTHX_ OP **o) { dMY_CXT; + PERL_UNUSED_ARG(o); if (MY_CXT.bhk_record) av_push(MY_CXT.bhkav, newSVpvs("pre_end")); } @@ -318,6 +325,7 @@ blockhook_test_post_end(pTHX_ OP **o) { dMY_CXT; + PERL_UNUSED_ARG(o); if (MY_CXT.bhk_record) av_push(MY_CXT.bhkav, newSVpvs("post_end")); } @@ -381,6 +389,8 @@ my_rpeep (pTHX_ OP *o) STATIC OP * THX_ck_entersub_args_lists(pTHX_ OP *entersubop, GV *namegv, SV *ckobj) { + PERL_UNUSED_ARG(namegv); + PERL_UNUSED_ARG(ckobj); return ck_entersub_args_list(entersubop); } @@ -388,6 +398,8 @@ STATIC OP * THX_ck_entersub_args_scalars(pTHX_ OP *entersubop, GV *namegv, SV *ckobj) { OP *aop = cUNOPx(entersubop)->op_first; + PERL_UNUSED_ARG(namegv); + PERL_UNUSED_ARG(ckobj); if (!aop->op_sibling) aop = cUNOPx(aop)->op_first; for (aop = aop->op_sibling; aop->op_sibling; aop = aop->op_sibling) { @@ -401,6 +413,8 @@ THX_ck_entersub_multi_sum(pTHX_ OP *entersubop, GV *namegv, SV *ckobj) { OP *sumop = NULL; OP *pushop = cUNOPx(entersubop)->op_first; + PERL_UNUSED_ARG(namegv); + PERL_UNUSED_ARG(ckobj); if (!pushop->op_sibling) pushop = cUNOPx(pushop)->op_first; while (1) { @@ -561,7 +575,7 @@ THX_ck_entersub_establish_cleanup(pTHX_ OP *entersubop, GV *namegv, SV *ckobj) STATIC OP * THX_ck_entersub_postinc(pTHX_ OP *entersubop, GV *namegv, SV *ckobj) { - OP *pushop, *argop, *estop; + OP *pushop, *argop; ck_entersub_args_proto(entersubop, namegv, ckobj); pushop = cUNOPx(entersubop)->op_first; if(!pushop->op_sibling) pushop = cUNOPx(pushop)->op_first; @@ -952,7 +966,7 @@ bytes_cmp_utf8(bytes, utf8) MODULE = XS::APItest:Overload PACKAGE = XS::APItest::Overload -SV * +void amagic_deref_call(sv, what) SV *sv int what @@ -963,7 +977,7 @@ amagic_deref_call(sv, what) # I'd certainly like to discourage the use of this macro, given that we now # have amagic_deref_call -SV * +void tryAMAGICunDEREF_var(sv, what) SV *sv int what @@ -1463,7 +1477,7 @@ xop_build_optree () av_push(MY_CXT.xop_record, newSVpvf("NAME:%s", OP_NAME((OP*)unop))); av_push(MY_CXT.xop_record, newSVpvf("DESC:%s", OP_DESC((OP*)unop))); - av_push(MY_CXT.xop_record, newSVpvf("CLASS:%d", OP_CLASS((OP*)unop))); + av_push(MY_CXT.xop_record, newSVpvf("CLASS:%d", (int)OP_CLASS((OP*)unop))); PL_rpeepp(aTHX_ kid); @@ -1512,6 +1526,7 @@ void CLONE(...) CODE: MY_CXT_CLONE; + PERL_UNUSED_VAR(items); MY_CXT.sv = newSVpv("initial_clone",0); MY_CXT.cscgv = gv_fetchpvs("XS::APItest::COMPILE_SCOPE_CONTAINER", GV_ADDMULTI, SVt_PVAV); @@ -2652,6 +2667,7 @@ void establish_cleanup(...) PROTOTYPE: $ CODE: + PERL_UNUSED_VAR(items); croak("establish_cleanup called as a function"); BOOT: @@ -2664,6 +2680,7 @@ void postinc(...) PROTOTYPE: $ CODE: + PERL_UNUSED_VAR(items); croak("postinc called as a function"); BOOT: |