From owner-freebsd-ports-bugs@FreeBSD.ORG Fri Nov 26 19:20:20 2004 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0DEB816A4CF for ; Fri, 26 Nov 2004 19:20:20 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id D296E43D64 for ; Fri, 26 Nov 2004 19:20:19 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.1/8.13.1) with ESMTP id iAQJKJar031419 for ; Fri, 26 Nov 2004 19:20:19 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.1/8.13.1/Submit) id iAQJKJSm031418; Fri, 26 Nov 2004 19:20:19 GMT (envelope-from gnats) Resent-Date: Fri, 26 Nov 2004 19:20:19 GMT Resent-Message-Id: <200411261920.iAQJKJSm031418@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Uranus Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CE7D816A4CE for ; Fri, 26 Nov 2004 19:17:14 +0000 (GMT) Received: from it.muds.net (220-134-153-8.HINET-IP.hinet.net [220.134.153.8]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7032043D54 for ; Fri, 26 Nov 2004 19:17:14 +0000 (GMT) (envelope-from uranus@it.muds.net) Received: from it.muds.net (localhost [127.0.0.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by it.muds.net (Postfix) with ESMTP id C42A2C02B for ; Sat, 27 Nov 2004 03:17:09 +0800 (CST) Received: (from uranus@localhost) by it.muds.net (8.13.1/8.13.1/Submit) id iAQJH915032598; Sat, 27 Nov 2004 03:17:09 +0800 (CST) (envelope-from uranus) Message-Id: <200411261917.iAQJH915032598@it.muds.net> Date: Sat, 27 Nov 2004 03:17:09 +0800 (CST) From: Uranus To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: ports/74436: bison 1.875 produced g++ rejected code X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Uranus List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Nov 2004 19:20:20 -0000 >Number: 74436 >Category: ports >Synopsis: bison 1.875 produced g++ rejected code >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Nov 26 19:20:19 GMT 2004 >Closed-Date: >Last-Modified: >Originator: Uranus >Release: FreeBSD 5.3-STABLE i386 >Organization: >Environment: System: FreeBSD it.muds.net 5.3-STABLE FreeBSD 5.3-STABLE #0: Sun Nov 7 13:15:09 CST 2004 root@it.muds.net:/usr/obj/usr/src/sys/ED i386 >Description: The bison 1.875 will produce the following code: #if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 + __GNUC_MINOR__) __attribute__ ((__unused__)) #endif When the `__attribute__ ((__unused__))' be compiled, we'll get the following error msg: parser.tab.cxx: In function `int yyparse()': parser.tab.cxx:2754: error: expected primary-expression My g++ is system builtin version, 3.4.2 [FreeBSD] 20040728. >How-To-Repeat: Any yacc source code which could trigger that conditional compilation. You can search from Google by the keywords `bison', `__attribute__', and `__unused__' for more information. >Fix: The solution refers to http://lists.gnu.org/archive/html/bison-patches/2003-01/msg00047.html and I reproduce a patch file here: --- yacc.c.orig Sat Dec 28 16:36:02 2002 +++ yacc.c Sat Nov 27 03:12:32 2004 @@ -465,7 +465,14 @@ #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab -#define YYERROR goto yyerrlab1 +#define YYERROR goto ]b4_location_if([do \ + { \ + yylerrsp = yylsp; \ + *++yylerrsp = yyloc; \ + goto yyerrlab1; \ + } \ + while (0)], \ + [goto yyerrlab1])[ /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. @@ -1103,7 +1110,7 @@ /* Else will try to reuse lookahead token after shifting the error token. */ - goto yyerrlab2; + goto yyerrlab1; /*----------------------------------------------------. @@ -1111,21 +1118,6 @@ ----------------------------------------------------*/ yyerrlab1: - /* Suppress GCC warning that yyerrlab1 is unused when no action - invokes YYERROR. */ -#if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 + __GNUC_MINOR__) - __attribute__ ((__unused__)) -#endif - -]b4_location_if([ yylerrsp = yylsp; - *++yylerrsp = yyloc;])[ - goto yyerrlab2; - - -/*---------------------------------------------------------------. -| yyerrlab2 -- pop states until the error token can be shifted. | ----------------------------------------------------------------*/ -yyerrlab2: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) >Release-Note: >Audit-Trail: >Unformatted: