C++ PATCH: Improve exceptions/inlining compile-time performance

Jason Merrill jason@redhat.com
Tue Apr 22 15:36:00 GMT 2003


On Tue, 22 Apr 2003 10:53:59 +0200 (CEST), Richard Guenther <rguenth@tat.physik.uni-tuebingen.de> wrote:

> What I'd like to know is wether the compiler can detect that in
>
> struct foo {
>   int get() const { return i; }
>   int i;
> };
>
> get() is actually throw(), or if we really need to start putting throw()
> after every trivial method declaration... I.e. in what cases do we really
> help the compiler here?

The compiler currently detects that a function cannot throw when it
generates RTL for that function.  Unfortunately, many inline functions
never need RTL.  Also, this only works for calling functions defined before
the caller in the same translation unit; doing better would require
inter-procedural optimizations which we still don't have.

We should be able to do a conservative approximation at the tree level, by
simply remembering whether or not build_call has seen a call to a function
that can throw.

Jason



More information about the Gcc-patches mailing list