This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++ PATCH: PR 10180


Op di 29-04-2003, om 18:12 schreef Mark Mitchell:
> On Tue, 2003-04-29 at 00:59, Steven Bosscher wrote:
> > Whoops, 
> > 
> > > 1 #include <setjmp.h>
> > > 2
> > > 3 inline void foo();
> > 
> > should be "inline void foo() {setjmp(0);};"
> 
> Oh, with that change I just get a warning about "foo".

I get that with cc1, but only after a few changes.

$ nl t.c
     1 #include <setjmp.h>
     2 inline void foo(void) { setjmp (0); }
     3 int main(int argc, char** argv)
     4 {
     5   foo();
     6   return 0;
     7 };
$ ./cc1 t.c -O -finline-functions -Winline -quiet
t.c: In function `main':
t.c:3: warning: inlining failed in call to `foo'
t.c:6: warning: called from here
$ ./cc1plus t.c -O -finline-functions -Winline -quiet
t.c: In function `int main(int, char**)':
t.c:3: warning: inlining failed in call to `void foo()'
t.c:6: warning: called from here
t.c: In function `void foo()':
/usr/include/setjmp.h:52: warning: inlining failed in call to `int 
   _setjmp(__jmp_buf_tag*)'
t.c:3: warning: called from here

> And the compiler is telling you something valuable -- it cannot inline
> functions which contain calls to setjmp.

As far as I can tell, that is only true for the C++ front end, which
makes explicit checks for setjmp calls in optimize.c.

Note that this snippet came from a PR I could close this morning thanks
to your patch.

Greetz
Steven



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]