I recently (on 18/12/2008) mailed a GCC patch to this mailing list,
but I went on holiday after and have only just arrived back. I
probably should have asked for some feedback then.

The patch is for the C++ component of GCC. It adds some compiler
warning options. The primary usage of these options generates warnings
when compiling code that could terminate due to unhandled exceptions.

Functionally, the code is pretty much alpha, although it is tidy,
commented, tested (by me) and working as expected.

MY REQUESTS:
A) I'm hoping that someone else here may have the time to download and
install it, to tell me at least whether it works for them.
B) If possible it would also be nice if someone were to take a glance
at the code and tell me whether it looks like it would be suitable.
There's documentation describing it's workings and it's not very long
or unusual, only around 1000 lines total.
C) Lastly, it would be nice if someone could indicate whether a
finished and fully functional version of this project would be likely
to make it into the mainline as I have seen requests for its
functionality many times, including on this mailing list, and it has
no downside:
- It does not alter the output in any way.
- It has no impact on compilation and compilation speed when not
explicitly invoked.
- The code is structured to make any future maintenance painless.

I really don't have much of an idea how things work around here, and
as my patch isn't near being complete I'm not after a formal review or
a branch or merge, just a few pointers as to whether I'm headed in the
right direction.

Thanks to anybody that can help out in any way.



FILES INCLUDED:
res.tgz: Contains the following:
- res.txt: Documentation.
- test.tgz: Test files and script. (See tests.txt for info)
- res.diff: Patch file.

I've never made patch files before, but hopefully this one is OK.
I used [diff -Naur original/gcc-3.4.2/gcc res/gcc-3.4.2/gcc > res.diff]
I tested it on a fresh gcc-3.4.2 extract and it worked with [patch -p1
< res.diff]

TESTING:
For a quick test, just call gcc with -Wres (or -Wres -Wres-debug to add the
debug info).
I haven't tested on much real-world code, there's a chance it may
still have bugs and segfault or something, although I have tried to
test for them. It's still alpha though.

Testcases:
Unzip test.tgz and read test/tests.txt for instructions, or call
test/test.sh <gcc path/command>.
All the testcases except the last work as they should.

CODE:
I tried to use GCC coding style but I didn't see an 80 character/line
limit anywhere in the document, so I didn't use any limit. Perhaps
someone will bite me for this or perhaps you'll all celebrate the
beginning of a new era of sensible unlimited lines :) anyway it's
alpha so it hardly matters at present - it's just far easier for me to
read.





MORE INFORMATION IF NOT ALREADY TL/DRd:
The discussion prior to me starting this project were primarily:
1) Whether it was possible to accurately check exception
specifications at compile-time, thus eliminating the issue of
unhandled exceptions.
2) Whether it was possible to require exception specifications to
always be accurate without in any way limiting the full power and
flexibility of C++.
3) Whether using exception specifications could, in some cases, lead
to slower execution when not handling an exception.

I hope that, even at this early stage, this project shows that #1 and
#2 are possible for non-template code.
With a bit of work it should be possible to show that #1 is possible
for template code also, although this will initially be limiting.
I further hope to show (see documentation, the topic about extending
C++) that it would be quite simple and painless to make minor changes
to C++'s exception specification rules so that #2 is also possible for
template code.
If #3 is true it has to be the compilers fault. It should also be very
easy to add a switch to instruct G++ to ignore all exception
specifications when generating code, if necessary.
Once that is done, it would not be very arduous to update (or fork)
all major libraries, STL, Boost etc to make them compliant. In fact it
could almost be automated.
Then accidental unhandled exceptions could be a thing of the past.

Attachment: res.tgz
Description: GNU Zip compressed data

Reply via email to