From: Markus Deuling <deuling@de.ibm.com>
To: GDB Patches <gdb-patches@sourceware.org>
Cc: Ulrich Weigand <uweigand@de.ibm.com>
Subject: [patch]: Replace DEPRECATED_STREQN
Date: Fri, 18 Jan 2008 08:37:00 -0000 [thread overview]
Message-ID: <479064C0.9090402@de.ibm.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 399 bytes --]
Hi,
this patch replaces and removes DEPRECATED_STREQN. Testsuite showed no regressions.
Is this ok to commit ?
ChangeLog:
* 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.
--
Markus Deuling
GNU Toolchain for Linux on Cell BE
deuling@de.ibm.com
[-- Attachment #2: diff-STREQN --]
[-- Type: text/plain, Size: 7378 bytes --]
diff -urpN src/gdb/defs.h dev/gdb/defs.h
--- src/gdb/defs.h 2008-01-16 12:21:15.000000000 +0100
+++ dev/gdb/defs.h 2008-01-18 09:17:36.000000000 +0100
@@ -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 -urpN src/gdb/jv-exp.y dev/gdb/jv-exp.y
--- src/gdb/jv-exp.y 2008-01-10 10:37:22.000000000 +0100
+++ dev/gdb/jv-exp.y 2008-01-18 08:19:18.000000000 +0100
@@ -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 -urpN src/gdb/m2-exp.y dev/gdb/m2-exp.y
--- src/gdb/m2-exp.y 2008-01-01 23:53:11.000000000 +0100
+++ dev/gdb/m2-exp.y 2008-01-18 09:17:20.000000000 +0100
@@ -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 -urpN src/gdb/objc-exp.y dev/gdb/objc-exp.y
--- src/gdb/objc-exp.y 2008-01-16 12:21:15.000000000 +0100
+++ dev/gdb/objc-exp.y 2008-01-18 08:46:36.000000000 +0100
@@ -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:
next reply other threads:[~2008-01-18 8:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-18 8:37 Markus Deuling [this message]
2008-01-18 8:56 ` Mark Kettenis
2008-01-18 9:15 ` Markus Deuling
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=479064C0.9090402@de.ibm.com \
--to=deuling@de.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=uweigand@de.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox