#154 Fix for GCC-4.4 compile error

closed-accepted
None
5
2010-08-04
2010-08-03
No

When building with GCC-4.4, the UCSim stuff fails to build because sim/ucsim/cmd.src/cmdlex.cc refers to the macro EOF without #including <cstdio> where it's defined (with older GCCs the rules were not strictly enforced and some headers included each other, masking the bug). The attached patch adds the requisite include line and allows SDCC-2.9.0 to build on GCC-4.4.

Discussion

  • Borut Ražem

    Borut Ražem - 2010-08-03

    Hi Christopher,

    if I compile ucsim on my machine with gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3, everything is OK. The same is on sdcc snapshot build machines.

    File cmdlex.cc is generated from cmdlex.l by flex and the EOF is used by the generated code. It is not used in cmdlex.l, so the problem should be fixed in flex. cmdlex.l was generated by flex 2.5.35, which is the same version I have on my Ubuntu 10.04 machine.

    If this is really a bug, you should report it to flex developers.

    Borut

     
  • Borut Ražem

    Borut Ražem - 2010-08-03
    • assigned_to: nobody --> borutr
    • status: open --> pending-works-for-me
     
  • Christopher Head

    When I run "flex -o cmdlex.cc --c++ cmdlex.l" in the directory (with flex version 2.5.35), the generated cmdlex.cc file already contains the line "#include <cstdio>", as my patch adds (so clearly flex is working fine, at least recent versions such as we're using). The problem is that your sdcc-src-2.9.0.tar.bz2 distribution file doesn't run flex, it ships a pregenerated cmdlex.cc in the tarball which does NOT have that required #include line (and, indeed, SDCC's Subversion repository has cmdlex.cc in it, rather than only cmdlex.l!)

     
  • Christopher Head

    • status: pending-works-for-me --> open-works-for-me
     
  • Borut Ražem

    Borut Ražem - 2010-08-04
    • status: open-works-for-me --> open-accepted
     
  • Borut Ražem

    Borut Ražem - 2010-08-04

    Christopher,

    I didn't try to regenerate cmdlex.cc since the flex version number was the same. Now I did it and the generated file is in deed different from the old one. (Who can we trust anymore?)

    I still don't understand why you are getting the error while I don't. Which OS/distribution are you using?

    Thanks for the clarification,
    Borut

     
  • Borut Ražem

    Borut Ražem - 2010-08-04
    • status: open-accepted --> closed-accepted
     
  • Christopher Head

    Gentoo Linux. Maybe one or other of us has a local patch floating around in our distro's flex somewhere. Anyway, all sorted now I guess, you'll just include the regenerated file in subsequent releases?

     
  • Borut Ražem

    Borut Ražem - 2010-08-10

    The regenerated file is included in sdcc svn source control and it will be included in the next sdcc release.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks