Re: Forcing register assignments before non-conditional blocks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 19 Apr 2008 15:19:44 +0200
Simon Kagstrom <simon.kagstrom@xxxxxxxxx> wrote:

> For a project of mine [1], I'm using Java exceptions in C code and
> have implemented a construct similar to Java try/catch blocks. I have
> a slight problem with GCC optimization though.

I just wanted to say that I found a solution to this problem (very
simple as well). I defined the try/catch macros as

   #define NOPH_try(callback, arg) do { \
     asm volatile("");                  \
     __NOPH_try(callback, arg);         \
   } while(0); if ( *(int*)0 != 0 ) {

   #define NOPH_catch() } do {          \
     asm volatile("");                  \
     __NOPH_catch();                    \
   } while(0)

instead, i.e., adding an if-statement that I know will always be true
and enclosing everything between try/catch in this block.

// Simon

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux