[Pcre-svn] [906] code/trunk: opcode lengths must be private …

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [906] code/trunk: opcode lengths must be private for printint and fixed some compiler warnings
Revision: 906
          http://vcs.pcre.org/viewvc?view=rev&revision=906
Author:   zherczeg
Date:     2012-01-24 09:55:16 +0000 (Tue, 24 Jan 2012)


Log Message:
-----------
opcode lengths must be private for printint and fixed some compiler warnings

Modified Paths:
--------------
    code/trunk/pcre_jit_compile.c
    code/trunk/pcre_printint.c
    code/trunk/sljit/sljitNativeX86_common.c


Modified: code/trunk/pcre_jit_compile.c
===================================================================
--- code/trunk/pcre_jit_compile.c    2012-01-23 19:26:03 UTC (rev 905)
+++ code/trunk/pcre_jit_compile.c    2012-01-24 09:55:16 UTC (rev 906)
@@ -796,6 +796,7 @@
 int offset;


/* >= 1 + shortest item size (2) */
+SLJIT_UNUSED_ARG(stacktop);
SLJIT_ASSERT(stackpos >= stacktop + 2);

 stackpos = STACK(stackpos);
@@ -4928,7 +4929,7 @@
   SLJIT_ASSERT(*opcode >= OP_CLASS || *opcode <= OP_XCLASS);
   *type = *opcode;
   cc++;
-  class_len = (*type < OP_XCLASS) ? (1 + (32 / sizeof(pcre_uchar))) : GET(cc, 0);
+  class_len = (*type < OP_XCLASS) ? (int)(1 + (32 / sizeof(pcre_uchar))) : GET(cc, 0);
   *opcode = cc[class_len - 1];
   if (*opcode >= OP_CRSTAR && *opcode <= OP_CRMINQUERY)
     {


Modified: code/trunk/pcre_printint.c
===================================================================
--- code/trunk/pcre_printint.c    2012-01-23 19:26:03 UTC (rev 905)
+++ code/trunk/pcre_printint.c    2012-01-24 09:55:16 UTC (rev 906)
@@ -97,13 +97,13 @@


/* The table of operator names. */

-static const char *OP_names[] = { OP_NAME_LIST };
+static const char *priv_OP_names[] = { OP_NAME_LIST };

/* This table of operator lengths is not actually used by the working code,
but its size is needed for a check that ensures it is the correct size for the
number of opcodes (thus catching update omissions). */

-static const pcre_uint8 OP_lengths_size[] = { OP_LENGTHS };
+static const pcre_uint8 priv_OP_lengths[] = { OP_LENGTHS };



@@ -300,13 +300,13 @@

       case OP_TABLE_LENGTH:
       case OP_TABLE_LENGTH +
-        ((sizeof(OP_names)/sizeof(const char *) == OP_TABLE_LENGTH) &&
-        (sizeof(OP_lengths_size) == OP_TABLE_LENGTH)):
+        ((sizeof(priv_OP_names)/sizeof(const char *) == OP_TABLE_LENGTH) &&
+        (sizeof(priv_OP_lengths) == OP_TABLE_LENGTH)):
       break;
 /* ========================================================================== */


     case OP_END:
-    fprintf(f, "    %s\n", OP_names[*code]);
+    fprintf(f, "    %s\n", priv_OP_names[*code]);
     fprintf(f, "------------------------------------------------------------------\n");
     return;


@@ -338,7 +338,7 @@
     case OP_SCBRAPOS:
     if (print_lengths) fprintf(f, "%3d ", GET(code, 1));
       else fprintf(f, "    ");
-    fprintf(f, "%s %d", OP_names[*code], GET2(code, 1+LINK_SIZE));
+    fprintf(f, "%s %d", priv_OP_names[*code], GET2(code, 1+LINK_SIZE));
     break;


     case OP_BRA:
@@ -361,16 +361,16 @@
     case OP_REVERSE:
     if (print_lengths) fprintf(f, "%3d ", GET(code, 1));
       else fprintf(f, "    ");
-    fprintf(f, "%s", OP_names[*code]);
+    fprintf(f, "%s", priv_OP_names[*code]);
     break;


     case OP_CLOSE:
-    fprintf(f, "    %s %d", OP_names[*code], GET2(code, 1));
+    fprintf(f, "    %s %d", priv_OP_names[*code], GET2(code, 1));
     break;


     case OP_CREF:
     case OP_NCREF:
-    fprintf(f, "%3d %s", GET2(code,1), OP_names[*code]);
+    fprintf(f, "%3d %s", GET2(code,1), priv_OP_names[*code]);
     break;


     case OP_RREF:
@@ -425,7 +425,7 @@
     fprintf(f, " %s ", flag);
     if (*code >= OP_TYPESTAR)
       {
-      fprintf(f, "%s", OP_names[code[1]]);
+      fprintf(f, "%s", priv_OP_names[code[1]]);
       if (code[1] == OP_PROP || code[1] == OP_NOTPROP)
         {
         fprintf(f, " %s ", get_ucpname(code[2], code[3]));
@@ -433,7 +433,7 @@
         }
       }
     else extra = print_char(f, code+1, utf);
-    fprintf(f, "%s", OP_names[*code]);
+    fprintf(f, "%s", priv_OP_names[*code]);
     break;


     case OP_EXACTI:
@@ -459,7 +459,7 @@
     case OP_TYPEUPTO:
     case OP_TYPEMINUPTO:
     case OP_TYPEPOSUPTO:
-    fprintf(f, "    %s", OP_names[code[1 + IMM2_SIZE]]);
+    fprintf(f, "    %s", priv_OP_names[code[1 + IMM2_SIZE]]);
     if (code[1 + IMM2_SIZE] == OP_PROP || code[1 + IMM2_SIZE] == OP_NOTPROP)
       {
       fprintf(f, " %s ", get_ucpname(code[1 + IMM2_SIZE + 1],
@@ -509,7 +509,7 @@
     c = code[1];
     if (PRINTABLE(c)) fprintf(f, " %s [^%c]", flag, c);
       else fprintf(f, " %s [^\\x%02x]", flag, c);
-    fprintf(f, "%s", OP_names[*code]);
+    fprintf(f, "%s", priv_OP_names[*code]);
     break;


     case OP_NOTEXACTI:
@@ -536,7 +536,7 @@
     case OP_RECURSE:
     if (print_lengths) fprintf(f, "%3d ", GET(code, 1));
       else fprintf(f, "    ");
-    fprintf(f, "%s", OP_names[*code]);
+    fprintf(f, "%s", priv_OP_names[*code]);
     break;


     case OP_REFI:
@@ -544,17 +544,17 @@
     /* Fall through */
     case OP_REF:
     fprintf(f, " %s \\%d", flag, GET2(code,1));
-    ccode = code + PRIV(OP_lengths)[*code];
+    ccode = code + priv_OP_lengths[*code];
     goto CLASS_REF_REPEAT;


     case OP_CALLOUT:
-    fprintf(f, "    %s %d %d %d", OP_names[*code], code[1], GET(code,2),
+    fprintf(f, "    %s %d %d %d", priv_OP_names[*code], code[1], GET(code,2),
       GET(code, 2 + LINK_SIZE));
     break;


     case OP_PROP:
     case OP_NOTPROP:
-    fprintf(f, "    %s %s", OP_names[*code], get_ucpname(code[1], code[2]));
+    fprintf(f, "    %s %s", priv_OP_names[*code], get_ucpname(code[1], code[2]));
     break;


     /* OP_XCLASS can only occur in UTF or PCRE16 modes. However, there's no
@@ -658,8 +658,8 @@
         case OP_CRMINPLUS:
         case OP_CRQUERY:
         case OP_CRMINQUERY:
-        fprintf(f, "%s", OP_names[*ccode]);
-        extra += PRIV(OP_lengths)[*ccode];
+        fprintf(f, "%s", priv_OP_names[*ccode]);
+        extra += priv_OP_lengths[*ccode];
         break;


         case OP_CRRANGE:
@@ -669,7 +669,7 @@
         if (max == 0) fprintf(f, "{%d,}", min);
         else fprintf(f, "{%d,%d}", min, max);
         if (*ccode == OP_CRMINRANGE) fprintf(f, "?");
-        extra += PRIV(OP_lengths)[*ccode];
+        extra += priv_OP_lengths[*ccode];
         break;


         /* Do nothing if it's not a repeat; this code stops picky compilers
@@ -685,13 +685,13 @@
     case OP_PRUNE_ARG:
     case OP_SKIP_ARG:
     case OP_THEN_ARG:
-    fprintf(f, "    %s ", OP_names[*code]);
+    fprintf(f, "    %s ", priv_OP_names[*code]);
     print_puchar(f, code + 2);
     extra += code[1];
     break;


     case OP_THEN:
-    fprintf(f, "    %s", OP_names[*code]);
+    fprintf(f, "    %s", priv_OP_names[*code]);
     break;


     case OP_CIRCM:
@@ -702,11 +702,11 @@
     /* Anything else is just an item with no data, but possibly a flag. */


     default:
-    fprintf(f, " %s %s", flag, OP_names[*code]);
+    fprintf(f, " %s %s", flag, priv_OP_names[*code]);
     break;
     }


- code += PRIV(OP_lengths)[*code] + extra;
+ code += priv_OP_lengths[*code] + extra;
fprintf(f, "\n");
}
}

Modified: code/trunk/sljit/sljitNativeX86_common.c
===================================================================
--- code/trunk/sljit/sljitNativeX86_common.c    2012-01-23 19:26:03 UTC (rev 905)
+++ code/trunk/sljit/sljitNativeX86_common.c    2012-01-24 09:55:16 UTC (rev 906)
@@ -959,6 +959,7 @@
     sljit_ub* code;
     int dst_r;


+    SLJIT_UNUSED_ARG(op);
     if (SLJIT_UNLIKELY(dst == SLJIT_UNUSED)) {
         /* Just set the zero flag. */
         EMIT_MOV(compiler, TMP_REGISTER, 0, src, srcw);