This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Declaring a function from gcc internals
- From: "Vincent R." <forumer at smartmobili dot com>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Tue, 31 Mar 2009 13:35:43 +0200
- Subject: Declaring a function from gcc internals
Hi,
We are always working on implementing SEH exceptions on a arm
cross-compiler so we have started to add parser recognition for __try
,__except __finally keyword (resp. RID_SEH_TRY, RID_SEH_EXCEPT,
RID_SEH_FINALLY)
We have also declared the following new functions :
extern void c_begin_seh_try_stmt (location_t, tree);
extern tree c_finish_seh_try_stmt (void);
extern void c_begin_except_clause (tree);
extern void c_finish_except_clause (void);
Now let's consider the following sample code :
int _tmain(int argc, _TCHAR* argv[])
{
DWORD* ptr = NULL; // NULL pointer
__try
{
puts("in try");
*ptr = 0x4242; // causes an access violation exception;
}
__except(puts("in filter"), EXCEPTION_EXECUTE_HANDLER)
{
puts("in except");
}
return 0;
}
What we need now is to parse the __except (easy)