Lint support
authorAndy Lester <andy@petdance.com>
Thu, 16 Jun 2005 09:35:21 +0000 (04:35 -0500)
committerH.Merijn Brand <h.m.brand@xs4all.nl>
Thu, 16 Jun 2005 14:33:10 +0000 (14:33 +0000)
Message-ID: <20050616143521.GB22188@petdance.com>

p4raw-id: //depot/perl@24873

XSUB.h
perl.h
universal.c

diff --git a/XSUB.h b/XSUB.h
index 52f66a6..bec91a8 100644 (file)
--- a/XSUB.h
+++ b/XSUB.h
@@ -82,6 +82,15 @@ is a lexical $_ in scope.
 =cut
 */
 
+#ifndef LINT_UNUSED_ARG
+#  ifdef lint
+#    include <note.h>
+#    define LINT_UNUSED_ARG(x) NOTE(ARGUNUSED(x))
+#  else
+#    define LINT_UNUSED_ARG(x)
+#  endif
+#endif
+
 #define ST(off) PL_stack_base[ax + (off)]
 
 #undef XS
@@ -107,7 +116,8 @@ is a lexical $_ in scope.
 
 #define dITEMS I32 items = SP - MARK
 
-#define dXSARGS                                \
+#define dXSARGS \
+       LINT_UNUSED_ARG(cv) \
        dSP; dAXMARK; dITEMS
 
 #define dXSTARG SV * const targ = ((PL_op->op_private & OPpENTERSUB_HASTARG) \
@@ -601,3 +611,13 @@ Rethrows a previously caught exception.  See L<perlguts/"Exception Handling">.
 #endif  /* PERL_IMPLICIT_SYS && !PERL_CORE */
 
 #endif /* _INC_PERL_XSUB_H */          /* include guard */
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: t
+ * End:
+ *
+ * ex: set ts=8 sts=4 sw=4 noet:
+ */
diff --git a/perl.h b/perl.h
index 5eff7de..c85543d 100644 (file)
--- a/perl.h
+++ b/perl.h
  */
 #define PERL_UNUSED_VAR(var) ((void)var)
 
+#ifndef LINT_UNUSED_ARG
+#  ifdef lint
+#    include <note.h>
+#    define LINT_UNUSED_ARG(x) NOTE(ARGUNUSED(x))
+#  else
+#    define LINT_UNUSED_ARG(x)
+#  endif
+#endif
+
 #define NOOP (void)0
 #define dNOOP extern int Perl___notused PERL_UNUSED_DECL
 
index 1564b59..99a3dd9 100644 (file)
@@ -819,6 +819,7 @@ XS(XS_Internals_hv_clear_placehold)
 
 XS(XS_Regexp_DESTROY)
 {
+    LINT_UNUSED_ARG(cv)
 }
 
 XS(XS_PerlIO_get_layers)
@@ -951,7 +952,8 @@ XS(XS_Internals_hash_seed)
     /* Using dXSARGS would also have dITEM and dSP,
      * which define 2 unused local variables.  */
     dAXMARK;
-    (void)mark;
+    LINT_UNUSED_ARG(cv)
+    PERL_UNUSED_VAR(mark);
     XSRETURN_UV(PERL_HASH_SEED);
 }
 
@@ -960,7 +962,8 @@ XS(XS_Internals_rehash_seed)
     /* Using dXSARGS would also have dITEM and dSP,
      * which define 2 unused local variables.  */
     dAXMARK;
-    (void)mark;
+    LINT_UNUSED_ARG(cv)
+    PERL_UNUSED_VAR(mark);
     XSRETURN_UV(PL_rehash_seed);
 }