Silence some g++ compiler warnings
authorKarl Williamson <public@khwilliamson.com>
Fri, 7 Dec 2012 05:42:18 +0000 (22:42 -0700)
committerKarl Williamson <public@khwilliamson.com>
Sun, 9 Dec 2012 16:47:17 +0000 (09:47 -0700)
Changing these slightly got rid of the warnings like:
toke.c:9168: warning: format not a string literal and no format arguments

doio.c
pp.c
pp_ctl.c
toke.c

diff --git a/doio.c b/doio.c
index e915bd5..08ed433 100644 (file)
--- a/doio.c
+++ b/doio.c
@@ -1333,7 +1333,7 @@ I32
 Perl_my_lstat_flags(pTHX_ const U32 flags)
 {
     dVAR;
-    static const char no_prev_lstat[] = "The stat preceding -l _ wasn't an lstat";
+    static const char* const no_prev_lstat = "The stat preceding -l _ wasn't an lstat";
     dSP;
     const char *file;
     if (PL_op->op_flags & OPf_REF) {
diff --git a/pp.c b/pp.c
index cf59a84..2eb5bc1 100644 (file)
--- a/pp.c
+++ b/pp.c
@@ -1646,7 +1646,7 @@ PP(pp_repeat)
 
     if (GIMME == G_ARRAY && PL_op->op_private & OPpREPEAT_DOLIST) {
        dMARK;
-       static const char oom_list_extend[] = "Out of memory during list extend";
+       static const char* const oom_list_extend = "Out of memory during list extend";
        const I32 items = SP - MARK;
        const I32 max = items * count;
 
@@ -1698,7 +1698,7 @@ PP(pp_repeat)
        SV * const tmpstr = POPs;
        STRLEN len;
        bool isutf;
-       static const char oom_string_extend[] =
+       static const char* const oom_string_extend =
          "Out of memory during string extend";
 
        if (TARG != tmpstr)
index 0256070..cd5033f 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2692,7 +2692,7 @@ S_dofindlabel(pTHX_ OP *o, const char *label, STRLEN len, U32 flags, OP **opstac
 {
     dVAR;
     OP **ops = opstack;
-    static const char too_deep[] = "Target of goto is too deeply nested";
+    static const char* const too_deep = "Target of goto is too deeply nested";
 
     PERL_ARGS_ASSERT_DOFINDLABEL;
 
@@ -2764,7 +2764,7 @@ PP(pp_goto)
     STRLEN label_len = 0;
     U32 label_flags = 0;
     const bool do_dump = (PL_op->op_type == OP_DUMP);
-    static const char must_have_label[] = "goto must have label";
+    static const char* const must_have_label = "goto must have label";
 
     if (PL_op->op_flags & OPf_STACKED) {
        SV * const sv = POPs;
diff --git a/toke.c b/toke.c
index 16f359e..628a5da 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -110,7 +110,7 @@ Individual members of C<PL_parser> have their own documentation.
 #  define PL_nextval           (PL_parser->nextval)
 #endif
 
-static const char ident_too_long[] = "Identifier too long";
+static const char* const ident_too_long = "Identifier too long";
 
 #ifdef PERL_MAD
 #  define CURMAD(slot,sv) if (PL_madskills) { curmad(slot,sv); sv = 0; }
@@ -10646,7 +10646,7 @@ Perl_scan_num(pTHX_ const char *start, YYSTYPE* lvalp)
     SV *sv = NULL;                     /* place to put the converted number */
     bool floatit;                      /* boolean: int or float? */
     const char *lastub = NULL;         /* position of last underbar */
-    static char const number_too_long[] = "Number too long";
+    static const char* const number_too_long = "Number too long";
 
     PERL_ARGS_ASSERT_SCAN_NUM;