From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18923 invoked by alias); 28 Jul 2009 21:48:46 -0000 Received: (qmail 18869 invoked by uid 22791); 28 Jul 2009 21:48:43 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_64,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 28 Jul 2009 21:48:33 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n6SLmVwf024729 for ; Tue, 28 Jul 2009 17:48:31 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n6SLmUKg015887 for ; Tue, 28 Jul 2009 17:48:31 -0400 Received: from host0.dyn.jankratochvil.net (sebastian-int.corp.redhat.com [172.16.52.221]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n6SLmTEI004080 for ; Tue, 28 Jul 2009 17:48:30 -0400 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.14.3/8.14.3) with ESMTP id n6SLmTNI018532 for ; Tue, 28 Jul 2009 23:48:29 +0200 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.3/8.14.3/Submit) id n6SLmSO4018531 for gdb-patches@sourceware.org; Tue, 28 Jul 2009 23:48:28 +0200 Date: Wed, 29 Jul 2009 00:57:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patch] Fix cp-name-parser.y warnings using gcc-4.5 HEAD Message-ID: <20090728214828.GA9784@host0.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) X-IsSubscribed: yes 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: 2009-07/txt/msg00702.txt.bz2 Hi, here is the cp-name-parser.y part of the gcc-4.5 compatibility patch. No regressions on {x86_64,x86_64-m32,i686}-fedora11-linux-gnu. (The yylex() part could probably use HANDLE_SPECIAL which is regression-less; but did not check it more.) Thanks, Jan gdb/ 2009-07-28 Jan Kratochvil Fix gcc-4.5 HEAD warnings. * cp-name-parser.y (%union , %token GLOBAL) (GLOBAL_CONSTRUCTORS, GLOBAL_DESTRUCTORS, demangler_special ): Remove. (yylex <"global constructors keyed to ">) (yylex <"global destructors keyed to ">): Base it on DEMANGLER_SPECIAL. (cp_comp_to_string): Remove variables str, prefix and buf. Remove the GLOBAL_DESTRUCTORS and GLOBAL_CONSTRUCTORS handling. (cp_print): Remove the GLOBAL_DESTRUCTORS and GLOBAL_CONSTRUCTORS handling. --- a/gdb/cp-name-parser.y +++ b/gdb/cp-name-parser.y @@ -255,10 +255,6 @@ make_name (const char *name, int len) int fold_flag; } abstract; int lval; - struct { - int val; - struct demangle_component *type; - } typed_val_int; const char *opname; } @@ -313,14 +309,6 @@ make_name (const char *name, int len) /* Non-C++ things we get from the demangler. */ %token DEMANGLER_SPECIAL %token CONSTRUCTION_VTABLE CONSTRUCTION_IN -%token GLOBAL - -%{ -enum { - GLOBAL_CONSTRUCTORS = DEMANGLE_COMPONENT_LITERAL + 20, - GLOBAL_DESTRUCTORS = DEMANGLE_COMPONENT_LITERAL + 21 -}; -%} /* Precedence declarations. */ @@ -430,10 +418,6 @@ demangler_special d_right ($$) = NULL; } | CONSTRUCTION_VTABLE start CONSTRUCTION_IN start { $$ = fill_comp (DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE, $2, $4); } - | GLOBAL - { $$ = make_empty ($1.val); - d_left ($$) = $1.type; - d_right ($$) = NULL; } ; operator : OPERATOR NEW @@ -1861,23 +1845,23 @@ yylex (void) { const char *p; lexptr = tokstart + 29; - yylval.typed_val_int.val = GLOBAL_CONSTRUCTORS; + yylval.lval = DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS; /* Find the end of the symbol. */ p = symbol_end (lexptr); - yylval.typed_val_int.type = make_name (lexptr, p - lexptr); + yylval.comp = make_name (lexptr, p - lexptr); lexptr = p; - return GLOBAL; + return DEMANGLER_SPECIAL; } if (strncmp (tokstart, "global destructors keyed to ", 28) == 0) { const char *p; lexptr = tokstart + 28; - yylval.typed_val_int.val = GLOBAL_DESTRUCTORS; + yylval.lval = DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS; /* Find the end of the symbol. */ p = symbol_end (lexptr); - yylval.typed_val_int.type = make_name (lexptr, p - lexptr); + yylval.comp = make_name (lexptr, p - lexptr); lexptr = p; - return GLOBAL; + return DEMANGLER_SPECIAL; } HANDLE_SPECIAL ("vtable for ", DEMANGLE_COMPONENT_VTABLE); @@ -1976,32 +1960,10 @@ allocate_info (void) char * cp_comp_to_string (struct demangle_component *result, int estimated_len) { - char *str, *prefix = NULL, *buf; - size_t err = 0; + size_t err; - if (result->type == GLOBAL_DESTRUCTORS) - { - result = d_left (result); - prefix = "global destructors keyed to "; - } - else if (result->type == GLOBAL_CONSTRUCTORS) - { - result = d_left (result); - prefix = "global constructors keyed to "; - } - - str = cplus_demangle_print (DMGL_PARAMS | DMGL_ANSI, result, estimated_len, &err); - if (str == NULL) - return NULL; - - if (prefix == NULL) - return str; - - buf = malloc (strlen (str) + strlen (prefix) + 1); - strcpy (buf, prefix); - strcat (buf, str); - free (str); - return (buf); + return cplus_demangle_print (DMGL_PARAMS | DMGL_ANSI, result, estimated_len, + &err); } /* Convert a demangled name to a demangle_component tree. On success, @@ -2048,17 +2010,6 @@ cp_print (struct demangle_component *result) char *str; size_t err = 0; - if (result->type == GLOBAL_DESTRUCTORS) - { - result = d_left (result); - fputs ("global destructors keyed to ", stdout); - } - else if (result->type == GLOBAL_CONSTRUCTORS) - { - result = d_left (result); - fputs ("global constructors keyed to ", stdout); - } - str = cplus_demangle_print (DMGL_PARAMS | DMGL_ANSI, result, 64, &err); if (str == NULL) return;