[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bison-1.875: g++ and __attribute__ line
From: |
Nelson H. F. Beebe |
Subject: |
Re: bison-1.875: g++ and __attribute__ line |
Date: |
Fri, 3 Jan 2003 18:38:10 -0700 (MST) |
I reported about a problem with bison-1.875-generated code under g++
compilation:
> An additional check in the installed yacc.c file is needed:
>
> #if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 +
> __GNUC_MINOR__) && !define(__GNUG__)
> but perhaps there is a cleaner way.
Paul Eggert responsed:
>> ...
>> Won't it suffice to append a semicolon to the __attribute__ line, as
>> in the patch I sent you earlier today?
>> ...
Not quite: g++ then complains:
y.tab.c:2677:warning: empty declaration
Although it is just a warning, it is an unwanted message, and it could
well become an error with the next gcc release. The gcc manual says:
>> ...
>> The keyword `__attribute__' allows you to specify special attributes
>> when making a declaration. This keyword is followed by an attribute
>> specification inside double parentheses. The following attributes are
>> currently defined for functions on all targets: `noreturn', `noinline',
^^^^^^^^^^^^^-- note
>> `always_inline', `pure', `const', `format', `format_arg',
>> `no_instrument_function', `section', `constructor', `destructor',
>> `used', `unused', `deprecated', `weak', `malloc', and `alias'.
>> ...
The use that bison is making of this is not for functions:
goto yyerrlab2;
yyerrlab1:
__attribute__ ((__unused__))
goto yyerrlab2;
It seems to me that this is in disagreement with the documented
purpose of __attribute__(()), and thus, should be taken out, or
rewritten to be conformant.
-------------------------------------------------------------------------------
- Nelson H. F. Beebe Tel: +1 801 581 5254 -
- Center for Scientific Computing FAX: +1 801 581 4148 -
- University of Utah Internet e-mail: address@hidden -
- Department of Mathematics, 110 LCB address@hidden address@hidden -
- 155 S 1400 E RM 233 address@hidden -
- Salt Lake City, UT 84112-0090, USA URL: http://www.math.utah.edu/~beebe -
-------------------------------------------------------------------------------
- Re: bison-1.875: g++ and __attribute__ line,
Nelson H. F. Beebe <=