[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

__attribute__ ((__unused__)) vs. g++ 3.2.1

From: Robert P. Goddard
Subject: __attribute__ ((__unused__)) vs. g++ 3.2.1
Date: Mon, 27 Jan 2003 11:40:34 -0800
User-agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.1) Gecko/20020827

Bison maintainer:

I just updated both bison and gcc to the latest versions (1.875 and 3.2.1 respectively). That broke my parser.

Bison 1.875 emits the following:


  /* Suppress GCC warning that yyerrlab1 is unused when no action
     invokes YYERROR.  */
#if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 + __GNUC_MINOR__)
  __attribute__ ((__unused__))

  goto yyerrlab2;

This is rejected by g++ 3.2.1 with the following message:

ClassDef_parse.cc: In function `int yyparse()':
src/tools/ClassDef_parse.cc:1261: parse error before `goto'

where the line number is that of "goto yyerrlab2;". I was able to work around this by inserting the following in the declarations section of my .yy file to disable the __attribute__ mechanism entirely:

    // Work around a bug in the relation between bison and GCC 3.x:
#if defined (__GNUC__) && 3 <= __GNUC__
#define __attribute__(arglist)

I don't know whether the problem is specific to g++ (GNU C++), or whether it would arise with recent gcc (GNU C) too. I also don't know precisely how new g++ has to be for the error to arise; I jumped directly from 2.9.5 to 3.2.1.

Robert P. Goddard, Senior Physicist
Applied Physics Laboratory, University of Washington
1013 NE 40th St., Seattle, WA 98105-6698
206-543-1267; FAX 206-543-6785; address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]