Opened 18 years ago

Closed 18 years ago

Last modified 6 years ago

#7525 closed feature request (fixed)

Restore compatibility with gcc 2.95

Reported by: SF/fizzet Owned by: fingolfin
Priority: normal Component: Ports
Version: Keywords:
Cc: Game:

Description

Since 0.9.0, scummvm no longer builds with gcc 2.95. It would be nice if this was restored.

See http://sourceforge.net/tracker/index.php?func=detail&aid=1602835&group_id=37116&atid=418820 for a partial build log that shows the error.

Ticket imported from: #1602879. Ticket imported from: feature-requests/341.

Attachments (2)

br1602879-gcc295.diff (1.9 KB ) - added by cyxx 18 years ago.
Possible workarounds
hashmap.patch (911 bytes ) - added by fingolfin 18 years ago.

Download all attachments as: .zip

Change History (11)

by cyxx, 18 years ago

Attachment: br1602879-gcc295.diff added

Possible workarounds

comment:1 by cyxx, 18 years ago

I have the necessary changes in my local source to be able to compile with GCC 2.95.

I haven't committed it because I am not that happy with the workaround I had to introduce to properly initialize the String::_storage member. Basically, the "_storage()" statement in the String constructor results in the following warning :

warning: common/str.h:99 ANSI C++ forbids assignment of arrays

In that case, GCC won't emit code to initialize the array, hence why I do it explicitly in the patch.

Has anyone here a better workaround/idea ? Max ?

comment:2 by cyxx, 18 years ago

Owner: set to fingolfin

by fingolfin, 18 years ago

Attachment: hashmap.patch added

comment:3 by fingolfin, 18 years ago

That warning regarding ANSI C++ seems bogus to me (and it does not appear with GCC 4.x nor 3.x). Since it is just that (a warning), I'd tend to simply ignore it.

As for the hashmap.h change: Please try the attached alternate patch -- does that resolve the error for you ? It certainly does so for me on a test machine.

Finally, the engines/saga/actor.cpp change could simply be commited right away :-).

comment:4 by cyxx, 18 years ago

I was probably unclear about the String::_storage warning. Let me try to re-phrase it. If we ignore that warning (ie. we don't change the code in the constructor and let the "_storage()" call as it is now), then _storage won't be properly initialized/cleared.

hashmap patch is ok under gcc2.95, and definitly better than the previous #if block :)

comment:5 by fingolfin, 18 years ago

I see your point regarding class String now. Well, I am not too happy with that mod, from a "style" point of view. But from a purely pragmatic point of view, it shouldn't cause any harm, and is small enough. I'd say, add a short comment stating why we init the string like this ("Init _storage member explicitly for GCC 2.95.x compatibility" or so), and then you can commit it.

comment:6 by cyxx, 18 years ago

Resolution: fixed
Status: newclosed

comment:7 by cyxx, 18 years ago

Committed.

ScummVM should now compile and execute successfully with GCC 2.95.x (a lot of warnings subsist during compilation, but it should be safe to ignore them). Closing item.

comment:8 by SF/fizzet, 18 years ago

Thanks guys! Looking forward to the next release...

comment:9 by digitall, 6 years ago

Component: Ports
Note: See TracTickets for help on using tickets.