From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6031 invoked by alias); 18 Jan 2008 09:15:27 -0000 Received: (qmail 6017 invoked by uid 22791); 18 Jan 2008 09:15:25 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate4.de.ibm.com (HELO mtagate4.de.ibm.com) (195.212.29.153) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 18 Jan 2008 09:14:59 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate4.de.ibm.com (8.13.8/8.13.8) with ESMTP id m0I9EuiZ145452 for ; Fri, 18 Jan 2008 09:14:56 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v8.7) with ESMTP id m0I9EubY991464 for ; Fri, 18 Jan 2008 10:14:56 +0100 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m0I9EtGu010440 for ; Fri, 18 Jan 2008 10:14:56 +0100 Received: from bbkeks.de.ibm.com (dyn-9-152-248-46.boeblingen.de.ibm.com [9.152.248.46]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id m0I9Es17010410 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 18 Jan 2008 10:14:55 +0100 Message-ID: <47906D9F.3080405@de.ibm.com> Date: Fri, 18 Jan 2008 09:15:00 -0000 From: Markus Deuling User-Agent: Thunderbird 2.0.0.9 (X11/20071031) MIME-Version: 1.0 To: Mark Kettenis CC: gdb-patches@sourceware.org, uweigand@de.ibm.com Subject: Re: [patch]: Replace DEPRECATED_STREQN References: <479064C0.9090402@de.ibm.com> <200801180855.m0I8tPSJ000947@brahms.sibelius.xs4all.nl> In-Reply-To: <200801180855.m0I8tPSJ000947@brahms.sibelius.xs4all.nl> Content-Type: multipart/mixed; boundary="------------060904080403090808050604" Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-01/txt/msg00471.txt.bz2 This is a multi-part message in MIME format. --------------060904080403090808050604 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1414 Hi Mark, Mark Kettenis schrieb: >> Date: Fri, 18 Jan 2008 09:35:12 +0100 >> From: Markus Deuling >> >> Hi, >> >> this patch replaces and removes DEPRECATED_STREQN. Testsuite showed >> no regressions. >> >> Is this ok to commit ? > > If you fix the issue below: > >> 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) > > Space before the '(', not after. > >> @@ -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) > > Likewise. > >> { >> yylval.ulval = 1; >> return M2_TRUE; >> } >> - else if(DEPRECATED_STREQN(tokstart,"FALSE",5)) >> + else if( strncmp (tokstart, "FALSE", 5) == 0) > > And here too. > thanks for pointing me to this. I updated the patch and committed it. Regards, Markus -- Markus Deuling GNU Toolchain for Linux on Cell BE deuling@de.ibm.com --------------060904080403090808050604 Content-Type: text/plain; name="diff-STREQN" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diff-STREQN" Content-length: 7378 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: --------------060904080403090808050604--