From: Andy Lester Date: Fri, 22 Apr 2005 17:39:47 +0000 (-0500) Subject: XS() __attribute__ X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=88d019551b04ba7828be67e8c0f62de7f769b5d5;p=p5sagit%2Fp5-mst-13.2.git XS() __attribute__ Message-ID: <20050422223947.GA4681@petdance.com> p4raw-id: //depot/perl@24333 --- diff --git a/XSUB.h b/XSUB.h index b611581..358a4b7 100644 --- a/XSUB.h +++ b/XSUB.h @@ -88,7 +88,11 @@ is a lexical $_ in scope. # define XS(name) EXPORT_C void name(pTHX_ CV* cv) #endif #ifndef XS -# define XS(name) void name(pTHX_ CV* cv) +# if defined(HASATTRIBUTE) +# define XS(name) void name(pTHX_ CV* cv __attribute__((unused))) +# else +# define XS(name) void name(pTHX_ CV* cv) +# endif #endif #define dAX I32 ax = MARK - PL_stack_base + 1 diff --git a/universal.c b/universal.c index e93a7c1..bf0a6fc 100644 --- a/universal.c +++ b/universal.c @@ -251,7 +251,6 @@ XS(XS_UNIVERSAL_isa) SV *sv; const char *name; STRLEN n_a; - (void)cv; if (items != 2) Perl_croak(aTHX_ "Usage: UNIVERSAL::isa(reference, kind)"); @@ -279,7 +278,6 @@ XS(XS_UNIVERSAL_can) SV *rv; HV *pkg = NULL; STRLEN n_a; - (void)cv; if (items != 2) Perl_croak(aTHX_ "Usage: UNIVERSAL::can(object-ref, method)"); @@ -323,7 +321,6 @@ XS(XS_UNIVERSAL_VERSION) GV *gv; SV *sv; const char *undef; - (void)cv; if (SvROK(ST(0))) { sv = (SV*)SvRV(ST(0)); @@ -393,7 +390,6 @@ XS(XS_UNIVERSAL_VERSION) XS(XS_version_new) { dXSARGS; - (void)cv; if (items > 3) Perl_croak(aTHX_ "Usage: version::new(class, version)"); SP -= items; @@ -420,7 +416,6 @@ XS(XS_version_new) XS(XS_version_stringify) { dXSARGS; - (void)cv; if (items < 1) Perl_croak(aTHX_ "Usage: version::stringify(lobj, ...)"); SP -= items; @@ -444,7 +439,6 @@ XS(XS_version_stringify) XS(XS_version_numify) { dXSARGS; - (void)cv; if (items < 1) Perl_croak(aTHX_ "Usage: version::numify(lobj, ...)"); SP -= items; @@ -468,7 +462,6 @@ XS(XS_version_numify) XS(XS_version_vcmp) { dXSARGS; - (void)cv; if (items < 1) Perl_croak(aTHX_ "Usage: version::vcmp(lobj, ...)"); SP -= items; @@ -514,7 +507,6 @@ XS(XS_version_vcmp) XS(XS_version_boolean) { dXSARGS; - (void)cv; if (items < 1) Perl_croak(aTHX_ "Usage: version::boolean(lobj, ...)"); SP -= items; @@ -543,7 +535,6 @@ XS(XS_version_boolean) XS(XS_version_noop) { dXSARGS; - (void)cv; if (items < 1) Perl_croak(aTHX_ "Usage: version::noop(lobj, ...)"); { @@ -567,7 +558,6 @@ XS(XS_version_noop) XS(XS_version_is_alpha) { dXSARGS; - (void)cv; if (items != 1) Perl_croak(aTHX_ "Usage: version::is_alpha(lobj)"); SP -= items; @@ -597,7 +587,6 @@ XS(XS_version_is_alpha) XS(XS_version_qv) { dXSARGS; - (void)cv; if (items != 1) Perl_croak(aTHX_ "Usage: version::qv(ver)"); SP -= items; @@ -635,7 +624,6 @@ XS(XS_version_qv) XS(XS_utf8_is_utf8) { dXSARGS; - (void)cv; if (items != 1) Perl_croak(aTHX_ "Usage: utf8::is_utf8(sv)"); { @@ -653,7 +641,6 @@ XS(XS_utf8_is_utf8) XS(XS_utf8_valid) { dXSARGS; - (void)cv; if (items != 1) Perl_croak(aTHX_ "Usage: utf8::valid(sv)"); { @@ -673,7 +660,6 @@ XS(XS_utf8_valid) XS(XS_utf8_encode) { dXSARGS; - (void)cv; if (items != 1) Perl_croak(aTHX_ "Usage: utf8::encode(sv)"); { @@ -687,7 +673,6 @@ XS(XS_utf8_encode) XS(XS_utf8_decode) { dXSARGS; - (void)cv; if (items != 1) Perl_croak(aTHX_ "Usage: utf8::decode(sv)"); { @@ -702,7 +687,6 @@ XS(XS_utf8_decode) XS(XS_utf8_upgrade) { dXSARGS; - (void)cv; if (items != 1) Perl_croak(aTHX_ "Usage: utf8::upgrade(sv)"); { @@ -719,7 +703,6 @@ XS(XS_utf8_upgrade) XS(XS_utf8_downgrade) { dXSARGS; - (void)cv; if (items < 1 || items > 2) Perl_croak(aTHX_ "Usage: utf8::downgrade(sv, failok=0)"); { @@ -737,7 +720,6 @@ XS(XS_utf8_native_to_unicode) { dXSARGS; const UV uv = SvUV(ST(0)); - (void)cv; if (items > 1) Perl_croak(aTHX_ "Usage: utf8::native_to_unicode(sv)"); @@ -750,7 +732,6 @@ XS(XS_utf8_unicode_to_native) { dXSARGS; const UV uv = SvUV(ST(0)); - (void)cv; if (items > 1) Perl_croak(aTHX_ "Usage: utf8::unicode_to_native(sv)"); @@ -763,7 +744,6 @@ XS(XS_Internals_SvREADONLY) /* This is dangerous stuff. */ { dXSARGS; SV *sv = SvRV(ST(0)); - (void)cv; if (items == 1) { if (SvREADONLY(sv)) @@ -789,7 +769,6 @@ XS(XS_Internals_SvREFCNT) /* This is dangerous stuff. */ { dXSARGS; SV *sv = SvRV(ST(0)); - (void)cv; if (items == 1) XSRETURN_IV(SvREFCNT(sv) - 1); /* Minus the ref created for us. */ @@ -805,7 +784,6 @@ XS(XS_Internals_hv_clear_placehold) { dXSARGS; HV *hv = (HV *) SvRV(ST(0)); - (void)cv; if (items != 1) Perl_croak(aTHX_ "Usage: UNIVERSAL::hv_clear_placeholders(hv)"); @@ -815,13 +793,11 @@ XS(XS_Internals_hv_clear_placehold) XS(XS_Regexp_DESTROY) { - (void)cv; } XS(XS_PerlIO_get_layers) { dXSARGS; - (void)cv; if (items < 1 || items % 2 == 0) Perl_croak(aTHX_ "Usage: PerlIO_get_layers(filehandle[,args])"); #ifdef USE_PERLIO @@ -949,7 +925,6 @@ XS(XS_Internals_hash_seed) /* Using dXSARGS would also have dITEM and dSP, * which define 2 unused local variables. */ dMARK; dAX; - (void)cv; XSRETURN_UV(PERL_HASH_SEED); } @@ -958,14 +933,12 @@ XS(XS_Internals_rehash_seed) /* Using dXSARGS would also have dITEM and dSP, * which define 2 unused local variables. */ dMARK; dAX; - (void)cv; XSRETURN_UV(PL_rehash_seed); } XS(XS_Internals_HvREHASH) /* Subject to change */ { dXSARGS; - (void)cv; if (SvROK(ST(0))) { const HV *hv = (HV *) SvRV(ST(0)); if (items == 1 && SvTYPE(hv) == SVt_PVHV) { diff --git a/xsutils.c b/xsutils.c index 4f7324f..c37c12b 100644 --- a/xsutils.c +++ b/xsutils.c @@ -160,7 +160,6 @@ XS(XS_attributes_bootstrap) { dXSARGS; const char file[] = __FILE__; - (void)cv; if( items > 1 ) Perl_croak(aTHX_ "Usage: attributes::bootstrap $module"); @@ -178,7 +177,6 @@ XS(XS_attributes__modify_attrs) { dXSARGS; SV *rv, *sv; - (void)cv; if (items < 1) { usage: @@ -201,7 +199,6 @@ XS(XS_attributes__fetch_attrs) dXSARGS; SV *rv, *sv; cv_flags_t cvflags; - (void)cv; if (items != 1) { usage: @@ -247,7 +244,6 @@ XS(XS_attributes__guess_stash) dXSARGS; SV *rv, *sv; dXSTARG; - (void)cv; if (items != 1) { usage: @@ -300,7 +296,6 @@ XS(XS_attributes_reftype) dXSARGS; SV *rv, *sv; dXSTARG; - (void)cv; if (items != 1) { usage: @@ -324,7 +319,6 @@ usage: XS(XS_attributes__warn_reserved) { dXSARGS; - (void)cv; if (items != 0) { Perl_croak(aTHX_