silence some clang warnings
authorDavid Mitchell <davem@iabyn.com>
Tue, 4 Dec 2012 13:22:41 +0000 (13:22 +0000)
committerDavid Mitchell <davem@iabyn.com>
Tue, 4 Dec 2012 13:39:55 +0000 (13:39 +0000)
principally, proto.h was sometimes being included twice - once before
a fn decl, and once after - giving rise to a 'decl after def' warning.

Also, S_croak_memory_wrap was declared static in every source file, but
not used in some. So selectively disable the unused-function warning.

dquote_static.c
dump.c
embed.fnc
embed.h
inline.h
proto.h

index a3f950f..868cd06 100644 (file)
@@ -8,7 +8,6 @@
 */
 
 #define PERL_IN_DQUOTE_STATIC_C
-#include "proto.h"
 #include "embed.h"
 
 /*
diff --git a/dump.c b/dump.c
index f1622a9..15beb69 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -26,7 +26,6 @@
 #define PERL_IN_DUMP_C
 #include "perl.h"
 #include "regcomp.h"
-#include "proto.h"
 
 
 static const char* const svtypenames[SVt_LAST] = {
index 337769f..4e3d825 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -715,7 +715,7 @@ Ap  |void   |vload_module|U32 flags|NN SV* name|NULLOK SV* ver|NULLOK va_list* args
 p      |OP*    |localize       |NN OP *o|I32 lex
 ApdR   |I32    |looks_like_number|NN SV *const sv
 Apd    |UV     |grok_bin       |NN const char* start|NN STRLEN* len_p|NN I32* flags|NULLOK NV *result
-#ifdef PERL_IN_DQUOTE_STATIC_C
+#if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_TOKE_C)
 EMsR   |char   |grok_bslash_c  |const char source|const bool utf8|const bool output_warning
 EMsR   |bool   |grok_bslash_o  |NN const char* s|NN UV* uv|NN STRLEN* len|NN const char** error_msg|const bool output_warning
 EMiR   |bool   |grok_bslash_x  |NN const char* s|NN UV* uv|NN STRLEN* len|NN const char** error_msg|const bool output_warning
@@ -1072,7 +1072,7 @@ Ap        |char*  |re_intuit_start|NN REGEXP * const rx|NULLOK SV* sv|NN char* strpos \
                                |NN char* strend|const U32 flags \
                                |NULLOK re_scream_pos_data *data
 Ap     |SV*    |re_intuit_string|NN REGEXP  *const r
-#if defined(PERL_IN_DQUOTE_STATIC_C)
+#if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_TOKE_C)
 EiPR   |I32    |regcurly       |NN const char *s
 #endif
 Ap     |I32    |regexec_flags  |NN REGEXP *const rx|NN char *stringarg \
diff --git a/embed.h b/embed.h
index e19a9df..da45a43 100644 (file)
--- a/embed.h
+++ b/embed.h
 #  if defined(PERL_ANY_COW)
 #define sv_setsv_cow(a,b)      Perl_sv_setsv_cow(aTHX_ a,b)
 #  endif
-#  if defined(PERL_IN_DQUOTE_STATIC_C)
-#define grok_bslash_c(a,b,c)   S_grok_bslash_c(aTHX_ a,b,c)
-#define grok_bslash_o(a,b,c,d,e)       S_grok_bslash_o(aTHX_ a,b,c,d,e)
-#define grok_bslash_x(a,b,c,d,e)       S_grok_bslash_x(aTHX_ a,b,c,d,e)
-#define regcurly(a)            S_regcurly(aTHX_ a)
-#  endif
 #  if defined(PERL_IN_REGCOMP_C)
 #define _append_range_to_invlist(a,b,c)        S__append_range_to_invlist(aTHX_ a,b,c)
 #define _invlist_array_init(a,b)       S__invlist_array_init(aTHX_ a,b)
 #  if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) || defined(PERL_IN_UTF8_C) || defined(PERL_IN_TOKE_C)
 #define _core_swash_init(a,b,c,d,e,f,g)        Perl__core_swash_init(aTHX_ a,b,c,d,e,f,g)
 #  endif
+#  if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_TOKE_C)
+#define grok_bslash_c(a,b,c)   S_grok_bslash_c(aTHX_ a,b,c)
+#define grok_bslash_o(a,b,c,d,e)       S_grok_bslash_o(aTHX_ a,b,c,d,e)
+#define grok_bslash_x(a,b,c,d,e)       S_grok_bslash_x(aTHX_ a,b,c,d,e)
+#define regcurly(a)            S_regcurly(aTHX_ a)
+#  endif
 #  if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_UTF8_C)
 #define _add_range_to_invlist(a,b,c)   Perl__add_range_to_invlist(aTHX_ a,b,c)
 #define _invlist_intersection_maybe_complement_2nd(a,b,c,d)    Perl__invlist_intersection_maybe_complement_2nd(aTHX_ a,b,c,d)
index 776a304..072d1b2 100644 (file)
--- a/inline.h
+++ b/inline.h
@@ -126,8 +126,11 @@ S_sv_or_pv_pos_u2b(pTHX_ SV *sv, const char *pv, STRLEN pos, STRLEN *lenp)
 /* ------------------------------- handy.h ------------------------------- */
 
 /* saves machine code for a common noreturn idiom typically used in Newx*() */
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunused-function"
 static void
 S_croak_memory_wrap(void)
 {
     Perl_croak_nocontext("%s",PL_memory_wrap);
 }
+#pragma clang diagnostic pop
diff --git a/proto.h b/proto.h
index 22210ab..0f19ccd 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -5513,36 +5513,6 @@ STATIC I32       S_do_trans_simple_utf8(pTHX_ SV * const sv)
        assert(sv)
 
 #endif
-#if defined(PERL_IN_DQUOTE_STATIC_C)
-STATIC char    S_grok_bslash_c(pTHX_ const char source, const bool utf8, const bool output_warning)
-                       __attribute__warn_unused_result__;
-
-STATIC bool    S_grok_bslash_o(pTHX_ const char* s, UV* uv, STRLEN* len, const char** error_msg, const bool output_warning)
-                       __attribute__warn_unused_result__
-                       __attribute__nonnull__(pTHX_1)
-                       __attribute__nonnull__(pTHX_2)
-                       __attribute__nonnull__(pTHX_3)
-                       __attribute__nonnull__(pTHX_4);
-#define PERL_ARGS_ASSERT_GROK_BSLASH_O \
-       assert(s); assert(uv); assert(len); assert(error_msg)
-
-PERL_STATIC_INLINE bool        S_grok_bslash_x(pTHX_ const char* s, UV* uv, STRLEN* len, const char** error_msg, const bool output_warning)
-                       __attribute__warn_unused_result__
-                       __attribute__nonnull__(pTHX_1)
-                       __attribute__nonnull__(pTHX_2)
-                       __attribute__nonnull__(pTHX_3)
-                       __attribute__nonnull__(pTHX_4);
-#define PERL_ARGS_ASSERT_GROK_BSLASH_X \
-       assert(s); assert(uv); assert(len); assert(error_msg)
-
-PERL_STATIC_INLINE I32 S_regcurly(pTHX_ const char *s)
-                       __attribute__warn_unused_result__
-                       __attribute__pure__
-                       __attribute__nonnull__(pTHX_1);
-#define PERL_ARGS_ASSERT_REGCURLY      \
-       assert(s)
-
-#endif
 #if defined(PERL_IN_DUMP_C)
 STATIC CV*     S_deb_curcv(pTHX_ const I32 ix);
 STATIC void    S_debprof(pTHX_ const OP *o)
@@ -6683,6 +6653,36 @@ PERL_CALLCONV SV*        Perl__core_swash_init(pTHX_ const char* pkg, const char* name,
        assert(pkg); assert(name); assert(listsv)
 
 #endif
+#if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_TOKE_C)
+STATIC char    S_grok_bslash_c(pTHX_ const char source, const bool utf8, const bool output_warning)
+                       __attribute__warn_unused_result__;
+
+STATIC bool    S_grok_bslash_o(pTHX_ const char* s, UV* uv, STRLEN* len, const char** error_msg, const bool output_warning)
+                       __attribute__warn_unused_result__
+                       __attribute__nonnull__(pTHX_1)
+                       __attribute__nonnull__(pTHX_2)
+                       __attribute__nonnull__(pTHX_3)
+                       __attribute__nonnull__(pTHX_4);
+#define PERL_ARGS_ASSERT_GROK_BSLASH_O \
+       assert(s); assert(uv); assert(len); assert(error_msg)
+
+PERL_STATIC_INLINE bool        S_grok_bslash_x(pTHX_ const char* s, UV* uv, STRLEN* len, const char** error_msg, const bool output_warning)
+                       __attribute__warn_unused_result__
+                       __attribute__nonnull__(pTHX_1)
+                       __attribute__nonnull__(pTHX_2)
+                       __attribute__nonnull__(pTHX_3)
+                       __attribute__nonnull__(pTHX_4);
+#define PERL_ARGS_ASSERT_GROK_BSLASH_X \
+       assert(s); assert(uv); assert(len); assert(error_msg)
+
+PERL_STATIC_INLINE I32 S_regcurly(pTHX_ const char *s)
+                       __attribute__warn_unused_result__
+                       __attribute__pure__
+                       __attribute__nonnull__(pTHX_1);
+#define PERL_ARGS_ASSERT_REGCURLY      \
+       assert(s)
+
+#endif
 #if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_UTF8_C)
 PERL_CALLCONV SV*      Perl__add_range_to_invlist(pTHX_ SV* invlist, const UV start, const UV end)
                        __attribute__warn_unused_result__;