* jv-exp.y (yylex): Replace DEPRECATED_STREQN with the appropriate
authorMarkus Deuling <deuling@de.ibm.com>
Fri, 18 Jan 2008 09:12:19 +0000 (09:12 +0000)
committerMarkus Deuling <deuling@de.ibm.com>
Fri, 18 Jan 2008 09:12:19 +0000 (09:12 +0000)
function calls.
* m2-exp.y (yylex): Likewise.
* objc-exp.y (yylex): Likewise.

* defs.h (DEPRECATED_STREQN): Remove.

gdb/ChangeLog
gdb/defs.h
gdb/jv-exp.y
gdb/m2-exp.y
gdb/objc-exp.y

index 97e6d375e9799923acfd1da6a888f01915fa585b..ed9f2dc6b1ad164e9c21b89ba5cd29ebaa52e524 100644 (file)
@@ -1,3 +1,12 @@
+2008-01-18  Markus Deuling  <deuling@de.ibm.com>
+
+       * jv-exp.y (yylex): Replace DEPRECATED_STREQN with the appropriate
+       function calls.
+       * m2-exp.y (yylex): Likewise.
+       * objc-exp.y (yylex): Likewise.
+
+       * defs.h (DEPRECATED_STREQN): Remove.
+
 2008-01-17  H.J. Lu  <hjl.tools@gmail.com>
 
        * MAINTAINERS: Update my email address.
index 85778cbf81d01541f80f83d5d66fd77c95fa663e..b0d07e7c2b721a7aafa658b17ddf3df300dc9497 100644 (file)
@@ -124,37 +124,6 @@ typedef bfd_vma CORE_ADDR;
 #define max(a, b) ((a) > (b) ? (a) : (b))
 #endif
 
-/* Macros to do string compares.
-
-   NOTE: cagney/2000-03-14:
-
-   While old code can continue to refer to these macros, new code is
-   probably better off using strcmp() directly vis: ``strcmp() == 0''
-   and ``strcmp() != 0''.
-
-   This is because modern compilers can directly inline strcmp()
-   making the original justification for these macros - avoid function
-   call overhead by pre-testing the first characters
-   (``*X==*Y?...:0'') - redundant.
-
-   ``Even if [...] testing the first character does have a modest
-   performance improvement, I'd rather that whenever a performance
-   issue is found that we spend the effort on algorithmic
-   optimizations than micro-optimizing.'' J.T. */
-
-/* NOTE: cagney/2003-11-23: All instances of STREQ[N] covered by
-   testing GDB on a stabs system have been replaced by equivalent
-   str[n]cmp calls.  To avoid the possability of introducing bugs when
-   making untested changes, the remaining references were deprecated
-   rather than replaced.  */
-
-/* DISCLAIMER: cagney/2003-11-23: Simplified definition of these
-   macros so that they just map directly onto strcmp equivalent.  I'm
-   not responsible for any breakage due to code that relied on the old
-   underlying implementation.  */
-
-#define DEPRECATED_STREQN(a,b,c) (strncmp ((a), (b), (c)) == 0)
-
 /* Check if a character is one of the commonly used C++ marker characters.  */
 extern int is_cplus_marker (int);
 
index 14a7bf852d529b37441bbad66163ba62ad102512..9387fa79d1d91ea3ef762854db65f108ed908ffc 100644 (file)
@@ -1128,34 +1128,34 @@ yylex ()
   switch (namelen)
     {
     case 7:
-      if (DEPRECATED_STREQN (tokstart, "boolean", 7))
+      if (strncmp (tokstart, "boolean", 7) == 0)
        return BOOLEAN;
       break;
     case 6:
-      if (DEPRECATED_STREQN (tokstart, "double", 6))      
+      if (strncmp (tokstart, "double", 6) == 0)      
        return DOUBLE;
       break;
     case 5:
-      if (DEPRECATED_STREQN (tokstart, "short", 5))
+      if (strncmp (tokstart, "short", 5) == 0)
        return SHORT;
-      if (DEPRECATED_STREQN (tokstart, "false", 5))
+      if (strncmp (tokstart, "false", 5) == 0)
        {
          yylval.lval = 0;
          return BOOLEAN_LITERAL;
        }
-      if (DEPRECATED_STREQN (tokstart, "super", 5))
+      if (strncmp (tokstart, "super", 5) == 0)
        return SUPER;
-      if (DEPRECATED_STREQN (tokstart, "float", 5))
+      if (strncmp (tokstart, "float", 5) == 0)
        return FLOAT;
       break;
     case 4:
-      if (DEPRECATED_STREQN (tokstart, "long", 4))
+      if (strncmp (tokstart, "long", 4) == 0)
        return LONG;
-      if (DEPRECATED_STREQN (tokstart, "byte", 4))
+      if (strncmp (tokstart, "byte", 4) == 0)
        return BYTE;
-      if (DEPRECATED_STREQN (tokstart, "char", 4))
+      if (strncmp (tokstart, "char", 4) == 0)
        return CHAR;
-      if (DEPRECATED_STREQN (tokstart, "true", 4))
+      if (strncmp (tokstart, "true", 4) == 0)
        {
          yylval.lval = 1;
          return BOOLEAN_LITERAL;
index 9fd62cc046465f0dda1f19994f98f7f2e1cae360..143252fd6bd11affdd2bd43f6b97f34b7b30280d 100644 (file)
@@ -845,7 +845,7 @@ yylex ()
 
   /* See if it is a special token of length 2 */
   for( i = 0 ; i < (int) (sizeof tokentab2 / sizeof tokentab2[0]) ; i++)
-     if(DEPRECATED_STREQN(tokentab2[i].name, tokstart, 2))
+     if (strncmp (tokentab2[i].name, tokstart, 2) == 0)
      {
        lexptr += 2;
        return tokentab2[i].token;
@@ -1002,7 +1002,8 @@ yylex ()
 
   /*  Lookup special keywords */
   for(i = 0 ; i < (int) (sizeof(keytab) / sizeof(keytab[0])) ; i++)
-     if(namelen == strlen(keytab[i].keyw) && DEPRECATED_STREQN(tokstart,keytab[i].keyw,namelen))
+     if (namelen == strlen (keytab[i].keyw)
+        && strncmp (tokstart, keytab[i].keyw, namelen) == 0)
           return keytab[i].token;
 
   yylval.sval.ptr = tokstart;
@@ -1076,12 +1077,12 @@ yylex ()
     else
     {
        /* Built-in BOOLEAN type.  This is sort of a hack. */
-       if(DEPRECATED_STREQN(tokstart,"TRUE",4))
+       if (strncmp (tokstart, "TRUE", 4) == 0)
        {
          yylval.ulval = 1;
          return M2_TRUE;
        }
-       else if(DEPRECATED_STREQN(tokstart,"FALSE",5))
+       else if (strncmp (tokstart, "FALSE", 5) == 0)
        {
          yylval.ulval = 0;
          return M2_FALSE;
index e8648795287b71f4568ab6570f6f7d6956a6b401..f44cf6d7ced1a23b983e6cd40fa1f71f1b33fe03 100644 (file)
@@ -1248,7 +1248,7 @@ yylex ()
   tokstart = lexptr;
   /* See if it is a special token of length 3.  */
   for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
-    if (DEPRECATED_STREQN (tokstart, tokentab3[i].operator, 3))
+    if (strncmp (tokstart, tokentab3[i].operator, 3) == 0)
       {
        lexptr += 3;
        yylval.opcode = tokentab3[i].opcode;
@@ -1257,7 +1257,7 @@ yylex ()
 
   /* See if it is a special token of length 2.  */
   for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
-    if (DEPRECATED_STREQN (tokstart, tokentab2[i].operator, 2))
+    if (strncmp (tokstart, tokentab2[i].operator, 2) == 0)
       {
        lexptr += 2;
        yylval.opcode = tokentab2[i].opcode;
@@ -1572,43 +1572,43 @@ yylex ()
   switch (namelen)
     {
     case 8:
-      if (DEPRECATED_STREQN (tokstart, "unsigned", 8))
+      if (strncmp (tokstart, "unsigned", 8) == 0)
        return UNSIGNED;
       if (current_language->la_language == language_cplus
          && strncmp (tokstart, "template", 8) == 0)
        return TEMPLATE;
-      if (DEPRECATED_STREQN (tokstart, "volatile", 8))
+      if (strncmp (tokstart, "volatile", 8) == 0)
        return VOLATILE_KEYWORD;
       break;
     case 6:
-      if (DEPRECATED_STREQN (tokstart, "struct", 6))
+      if (strncmp (tokstart, "struct", 6) == 0)
        return STRUCT;
-      if (DEPRECATED_STREQN (tokstart, "signed", 6))
+      if (strncmp (tokstart, "signed", 6) == 0)
        return SIGNED_KEYWORD;
-      if (DEPRECATED_STREQN (tokstart, "sizeof", 6))      
+      if (strncmp (tokstart, "sizeof", 6) == 0)
        return SIZEOF;
-      if (DEPRECATED_STREQN (tokstart, "double", 6))      
+      if (strncmp (tokstart, "double", 6) == 0) 
        return DOUBLE_KEYWORD;
       break;
     case 5:
       if ((current_language->la_language == language_cplus)
          && strncmp (tokstart, "class", 5) == 0)
        return CLASS;
-      if (DEPRECATED_STREQN (tokstart, "union", 5))
+      if (strncmp (tokstart, "union", 5) == 0)
        return UNION;
-      if (DEPRECATED_STREQN (tokstart, "short", 5))
+      if (strncmp (tokstart, "short", 5) == 0)
        return SHORT;
-      if (DEPRECATED_STREQN (tokstart, "const", 5))
+      if (strncmp (tokstart, "const", 5) == 0)
        return CONST_KEYWORD;
       break;
     case 4:
-      if (DEPRECATED_STREQN (tokstart, "enum", 4))
+      if (strncmp (tokstart, "enum", 4) == 0)
        return ENUM;
-      if (DEPRECATED_STREQN (tokstart, "long", 4))
+      if (strncmp (tokstart, "long", 4) == 0)
        return LONG;
       break;
     case 3:
-      if (DEPRECATED_STREQN (tokstart, "int", 3))
+      if (strncmp (tokstart, "int", 3) == 0)
        return INT_KEYWORD;
       break;
     default: