Re: Feature request: optionally compile with support for exceptions

Roberto Bagnara bagnara@cs.unipr.it writes:
what I am asking for is a feature and I am willing to do everything it requires to minimize the chance of troubles. That is why I sent a message to this list. The feature is very important for our application (a C++ library for the manipulation of convex polyhedra) and I believe it is important for all those C++ applications where the exhaustion of virtual memory cannot simply be handled by writing a message and aborting. The feature is so important that I have already done the modifications I am proposing to GMP 3.1.1. What I would like to avoid is having to distribute tar archives and RPMs of the modified version to the users of our library.
Thanks for the background. Also please note that I'm not making any decisions, I'm just a member of the gmp mailing list.
I realize that there is a potential for troubles but I also believe that solutions can be found. For the people doing `make install' we could make sure the exceptions-enabled versions of GMP are installed under the basename, say `libgmp_e'.
That would help.
No, CXXFLAGS has nothing to do with what we are talking about. In fact
- GMP is written in C;
- -fexceptions is the GCC default for the compilation of C++ sources, so it will be OK even when GMP will include the new C++ interface.
My intention was to add the -fexceptions flag to the flags used when compiling GMP:s C++ wrapper (which isn't included in the dist yet), but not when compiling the C and assembler files.
Are you saying that one has to use -fexceptions also when compiling the files that are written in C? That's news to me, but I'm mostly ignorant when it comes to C++ exceptions.
CXXFLAGS=-fexceptions && ./configure && make
Perhaps you meant
CFLAGS=-fexceptions && ./configure && make
but this is also a very bad idea in GMP 3.1.1 (the current release), since `-fexceptions' will _replace_ any other compilation option so that a good portion of the nice work done by the configure script is simply lost. In other words, on the machine I am using this very moment, I would compile GMP with `-fexceptions' instead of `-g -O -fomit-frame-pointer -mcpu=pentiumpro', and these
Sorry for the typo. I meant
CXXFLAGS=-fexceptions ./configure && make
I.e. CXXFLAGS should be set in _configure's_ environment, but not in _make's_. If that doesn't work, it could be considered a bug in the configure script.
/Niels

"Niels Möller" wrote:
Are you saying that one has to use -fexceptions also when compiling the files that are written in C? That's news to me, but I'm mostly ignorant when it comes to C++ exceptions.
Yes: for exceptions to be propagated correctly, C files must be compiled with -fexceptions.
Perhaps you meant
CFLAGS=-fexceptions && ./configure && make
but this is also a very bad idea in GMP 3.1.1 (the current release), since `-fexceptions' will _replace_ any other compilation option so that a good portion of the nice work done by the configure script is simply lost. In other words, on the machine I am using this very moment, I would compile GMP with `-fexceptions' instead of `-g -O -fomit-frame-pointer -mcpu=pentiumpro', and these
Sorry for the typo. I meant
CXXFLAGS=-fexceptions ./configure && make
I.e. CXXFLAGS should be set in _configure's_ environment, but not in _make's_. If that doesn't work, it could be considered a bug in the configure script.
Sorry also on my part: I copied and pasted your typo but I did try the right thing. To summarize, if I do (copying and pasting what I have just redone on my machine)
CFLAGS=-fexceptions /usr/local/distrib/gmp-3.1.1/configure
I override all the other compilation flags: I get `-fexceptions' and not `-g -O -fomit-frame-pointer -mcpu=pentiumpro'. If assigning to CFLAGS was meant to _add_ to the compilation flags, then this is a bug in the configure script. In some projects of mine I use configure options like --with-extra-cflags for that purpose. All the best,
Roberto

Roberto Bagnara bagnara@cs.unipr.it writes:
CFLAGS=-fexceptions /usr/local/distrib/gmp-3.1.1/configure
I override all the other compilation flags: I get `-fexceptions' and not `-g -O -fomit-frame-pointer -mcpu=pentiumpro'. If assigning to CFLAGS was meant to _add_ to the compilation flags, then this is a bug in the configure script. In some projects of mine I use configure options like --with-extra-cflags for that purpose. All the best,
I sometimes set CPPFLAGS to do that. Not a kosher use of that variable, but it works because gmp and autoconf don't usually use it for anything else.
I'm not sure what the right way is. The current suggestion is to watch what GMP gives, then re-run with that and any additions or subtractions.
participants (3)
-
Kevin Ryde
-
nisse@lysator.liu.se
-
Roberto Bagnara