Opened 18 years ago

Closed 18 years ago

Last modified 5 years ago

#8548 closed patch (fixed)

Patch for correct optimizations with GCC 2.95.3

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


GCC 2.95.3 will always use the last -O parameter passed. Currently, when one runs configure with --enable-release, -O2 is added to CXXFLAGS, but that CXXFLAGS precedes the one in Makefile that explicitly definies -O, so the -O overides the -O2. Might be a better way to do this. I removed the -O from the makefile, and just incorporated them into configure. -g -O for debug, -O for --disable-debug, and -O2 for --enabele-release (as it should be.

Ticket imported from: #1511980. Ticket imported from: patches/653.

Attachments (1)

configure-optimize.diff (974 bytes ) - added by SF/keithscr 18 years ago.
Diff for configure and Makefile

Download all attachments as: .zip

Change History (6)

by SF/keithscr, 18 years ago

Attachment: configure-optimize.diff added

Diff for configure and Makefile

comment:1 by fingolfin, 18 years ago

This change is not quite correct. In particular, the only reason "-O" is there is to enable "-Wuninitialized". Without it, the latter will cause GCC to warn about the warning not being possible:

cc1plus: warnings being treated as errors cc1plus: warning: -Wuninitialized is not supported without -O

Hence, we must either remove both or keep both. Personally, I found -Wuninitialized to be be very useful in the past to catch certain otherwise possibly hard to catch bugs, so I'd be disappointed to comletly loose it. OTOH, it would actually be desirable to *not* use -O by default in debug builds -- simply because it (a) slows down the compile time, and (b) makes debugging harder.

So mabye we should add a --enable-Wuninitialized which adds both "-O" and "-Wuninitialized".

comment:2 by SF/keithscr, 18 years ago

I really don't think I am qualified to comment on this.....

What should the default compiling behavior be? always build with -g or...? The only reason I brought this issue up was --enable-release is broken because of where -O is defined, at least based on how GCC 2.95.3 reads -O parameters.

So, should there be 3 different options?

-g (--fast-debug) -g -O -Wuninitialized (default behavior, like now) -O2 -Wuninitialized (--enable-release)

Just a suggestion......

comment:3 by fingolfin, 18 years ago

Owner: set to fingolfin
Resolution: fixed
Status: newclosed

comment:4 by fingolfin, 18 years ago

I have opted to simply disable the "-O -Wuninitialized" line in Makefile for the time being. Fact is that I often find myself removing it and then recompiling ScummVM because -O makes debugging very hard in many cases (because so many things get inlined, at least over here).

For now, re-enabling manually it is easy, and I'll do full compiles with it enabled plus -Werror regularly, to catch problems.

I will also add -Wuninitialized to --enable-release.

Hopefully, this resolves the issue for you, if not, please reopen this item.

comment:5 by digitall, 5 years ago

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