Of course, here's the "full story":

I tried to compile the cegcc-toolchain on another mac here (also on  
mac osx 10.5.6 ppc) and was surprised
that I did _not_ get the following error I already mentioned:

/bin/sh /Users/cerial/Workspace/cegcc/src/binutils/ld/../ylwrap /Users/ 
cerial/Workspace/cegcc/src/binutils/ld/deffilep.y y.tab.c deffilep.c  
y.tab.h deffilep.h y.output deffilep.output -- bison -y -d
conflicts: 3 shift/reduce
updating deffilep.h
gcc -DHAVE_CONFIG_H -I. -I/Users/cerial/Workspace/cegcc/src/binutils/ 
ld -I. -I. -I/Users/cerial/Workspace/cegcc/src/binutils/ld -I../bfd -I/ 
Users/cerial/Workspace/cegcc/src/binutils/ld/../bfd -I/Users/cerial/ 
Workspace/cegcc/src/binutils/ld/../include  -g -O2 -DLOCALEDIR="\"/opt/ 
cegcc/share/locale\""   -W -Wall -Wstrict-prototypes -Wmissing- 
prototypes -Werror -g -O2 -c deffilep.c -Wno-error
deffilep.c:204: error: syntax error before numeric constant
deffilep.c:233:1: warning: "STACKSIZE" redefined
In file included from /usr/include/machine/param.h:35,
                  from /usr/include/sys/param.h:110,
                  from /Users/cerial/Workspace/cegcc/src/binutils/ld/ 
sysdep.h:56,
                  from deffilep.y:23:
/usr/include/ppc/param.h:61:1: warning: this is the location of the  
previous definition

---

I found out that on the machine where it worked Bison 2.3 was  
installed and Bison 2.4.1 on the machine where it
didn't - it seemed something went wrong somehow generating deffilep.h  
and deffilep.c from deffilep.y

I then compared the generated deffilep.h and deffilep.c files and saw  
that the old version of Bison (2.3) moved the
the part generated from the "%token" block _before_ the line where  
sysdep.h is #included. Bison 2.4.1 instead
left the original order intact (maybe that's the correct way? I really  
don't know..) which resulted in the aforementioned
error on compiling deffilep.c.
It really seems bison's the "bad" one here, because even on the same  
machine where it worked before, when I put
bison 2.4.1 in the PATH, it stops with the error above. When I remove  
it from the PATH again, compiling works
perfectly.

Here are the deffilep.c and deffilep.h pairs generated by both  
versions of bison (If you'd like to look, I
did not attach them here because they are rather big):

Bison 2.4.1:
http://pocketinsanity.org/deffilep.c.broken
http://pocketinsanity.org/deffilep.h.broken

Bison 2.3:
http://pocketinsanity.org/deffilep.c.works
http://pocketinsanity.org/deffilep.h.works

With my patch, the relevant part in deffilep.y is already in  
(correct ? hopefully..) order and both
bison 2.3 and 2.4.1 produce compilable output.

Thank you for looking into it!

Ismail

Am 27.04.2009 um 21:52 schrieb Danny Backx:

> Ismail,
>
> Can you explain this patch ? Why does a different version of bison
> require these lines to be in other places ?
>
> Also I don't see the STACKSIZE change as I expected it. What  
> happened to
> that ?
>
>       Danny
>
> On Fri, 2009-04-24 at 00:13 +0200, Ismail Khatib wrote:
>> Next, a patch for deffilep.y, which seems to be needed with some
>> versions of bison
>> (a usable deffilep.c is generated with bison 2.3, however at least
>> with version 2.4.1 of bison
>> this patch is needed - so it's no mac specific issue as I suspected
>> beforehand):
>>
>>
>> Index: src/binutils/ld/deffilep.y
>> ===================================================================
>> --- src/binutils/ld/deffilep.y       (revision 1245)
>> +++ src/binutils/ld/deffilep.y       (working copy)
>> @@ -20,6 +20,25 @@
>>       Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
>>       MA 02110-1301, USA.  */
>>
>> +%}
>> +
>> +%union {
>> +  char *id;
>> +  int number;
>> +};
>> +
>> +%token NAME LIBRARY DESCRIPTION STACKSIZE HEAPSIZE CODE DATAU DATAL
>> +%token SECTIONS EXPORTS IMPORTS VERSIONK BASE CONSTANTU CONSTANTL
>> +%token PRIVATEU PRIVATEL
>> +%token READ WRITE EXECUTE SHARED NONAMEU NONAMEL DIRECTIVE
>> +%token <id> ID
>> +%token <number> NUMBER
>> +%type  <number> opt_base opt_ordinal
>> +%type  <number> attr attr_list opt_number exp_opt_list exp_opt
>> +%type  <id> opt_name opt_equal_name dot_name
>> +
>> +%{
>> +
>>  #include "sysdep.h"
>>  #include "libiberty.h"
>>  #include "safe-ctype.h"
>> @@ -99,21 +118,6 @@
>>
>>  %}
>>
>> -%union {
>> -  char *id;
>> -  int number;
>> -};
>> -
>> -%token NAME LIBRARY DESCRIPTION STACKSIZE HEAPSIZE CODE DATAU DATAL
>> -%token SECTIONS EXPORTS IMPORTS VERSIONK BASE CONSTANTU CONSTANTL
>> -%token PRIVATEU PRIVATEL
>> -%token READ WRITE EXECUTE SHARED NONAMEU NONAMEL DIRECTIVE
>> -%token <id> ID
>> -%token <number> NUMBER
>> -%type  <number> opt_base opt_ordinal
>> -%type  <number> attr attr_list opt_number exp_opt_list exp_opt
>> -%type  <id> opt_name opt_equal_name dot_name
>> -
>>  %%
>>
>>  start: start command


--
Ismail "Cerial" Khatib, http://pocketinsanity.org

------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel

Reply via email to