diff options
-rw-r--r-- | gdb/ChangeLog | 9 | ||||
-rw-r--r-- | gdb/defs.h | 31 | ||||
-rw-r--r-- | gdb/jv-exp.y | 20 | ||||
-rw-r--r-- | gdb/m2-exp.y | 9 | ||||
-rw-r--r-- | gdb/objc-exp.y | 28 |
5 files changed, 38 insertions, 59 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 97e6d37..ed9f2dc 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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. @@ -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); diff --git a/gdb/jv-exp.y b/gdb/jv-exp.y index 14a7bf8..9387fa7 100644 --- a/gdb/jv-exp.y +++ b/gdb/jv-exp.y @@ -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; diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y index 9fd62cc..143252f 100644 --- a/gdb/m2-exp.y +++ b/gdb/m2-exp.y @@ -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; diff --git a/gdb/objc-exp.y b/gdb/objc-exp.y index e864879..f44cf6d 100644 --- a/gdb/objc-exp.y +++ b/gdb/objc-exp.y @@ -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: |