[ expat-Bugs-419585 ] Compiling with gcc for C++ exceptions.

noreply@sourceforge.net noreply@sourceforge.net
Thu Nov 8 20:23:01 2001


Bugs item #419585, was opened at 2001-04-27 11:49
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=110127&aid=419585&group_id=10127

Category: Build control
Group: Feature Request
Status: Closed
Resolution: Fixed
Priority: 5
Submitted By: David Crowley (dcrowley)
Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: Compiling with gcc for C++ exceptions.

Initial Comment:

It would be nice if when compiling with gcc, the 
flag "-fexceptions" was added so it can deal with C++ 
handlers that throw exceptions.  As it's now built by 
default, C++ programs will crash if they throw in the 
handler. Perhaps make "-fexceptions" the default so as 
to be most robust, and allow people to turn off the 
flag as a parameter to configure ("configure --no-
exceptions" or whatever).

----------------------------------------------------------------------

>Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2001-11-08 20:22

Message:
Logged In: YES 
user_id=3066

Historical note:  The addition of -fexceptions caused
problems for some versions of GCC, where it was not
supported.  configure.in revision 1.25 is more careful to
only add the option when the available GCC actually supports it.

----------------------------------------------------------------------

Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2001-07-26 13:50

Message:
Logged In: YES 
user_id=3066

OK, that's fine then.  I've added the -fexceptions flag when we can determine that the compiler is GCC.  This is in configure.in revision 1.18.

----------------------------------------------------------------------

Comment By: David Crowley (dcrowley)
Date: 2001-07-25 15:53

Message:
Logged In: YES 
user_id=27458

Here are the results of my bench mark.  Running on Linux 
2.2.16 (SGI, dual processors, 800MHz), and parsing a 123MB 
xml file.
Each run was initiated like this:

% time cat bigdog.xml | ./xbench

xbench is dynamically linked against expat.  I copied 
libexpat.so.0.0.1 compiled with -fexceptions 
to /usr/local/lib, ran, and then copied one compiled w/o -
fexceptions, ran.

With -fexceptions: 9.82s, 9.80s, 9.79s.
W/o -fexceptions: 9.78s, 9.77s, 9.78s.

So the difference is pretty negligible.  Around <.5% if any.

xbench.c is attached.  Make your own 123MB file :)



----------------------------------------------------------------------

Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2001-07-25 14:33

Message:
Logged In: YES 
user_id=3066

This sounds like a reasonable plan -- I look forward to your measurement results.  I really don't know what the C++ penetration is on Unix platforms, and may be exhibiting an unfortunate C bias.

I've marked the feature request as "pending"; when you add to it it will be automatically re-opened and assigned back to me, so it won't get lost.

----------------------------------------------------------------------

Comment By: David Crowley (dcrowley)
Date: 2001-07-25 14:20

Message:
Logged In: YES 
user_id=27458

While I agree that yes, it IS a C implementation, I would 
think that it would still be nice to for the library to be 
more easily useable by C++ coders out of the box.  I will 
do a benchmark in C and see if I can figure out how much of 
an impact the -fexceptions flag really makes.  If it's less 
than 2-3% impact in performance, I see no reason not to 
make it a default.  If a C coder REALLY needs that extra 
speed and knows they will never install any C++ apps which 
link against it, then by all means they can remove the flag.

----------------------------------------------------------------------

Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2001-07-24 20:19

Message:
Logged In: YES 
user_id=3066

Added a note about this in README revision 1.7.

This is not being added as a default option -- Expat is fundamentally a C implementation, not C++.  Avoiding this option for normal C allows the optimizer to perform more effective optimizations and generally improve performance.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=110127&aid=419585&group_id=10127