From 114a878c64ce6f8223cfd22d76a20eb16d177e5e Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- languages/cpp/app_templates/prc-tool/callback.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 languages/cpp/app_templates/prc-tool/callback.h (limited to 'languages/cpp/app_templates/prc-tool/callback.h') diff --git a/languages/cpp/app_templates/prc-tool/callback.h b/languages/cpp/app_templates/prc-tool/callback.h new file mode 100644 index 00000000..bf0ead45 --- /dev/null +++ b/languages/cpp/app_templates/prc-tool/callback.h @@ -0,0 +1,24 @@ +#ifndef __CALLBACK_H__ +#define __CALLBACK_H__ + +/* This is a workaround for a bug in the current version of gcc: + + gcc assumes that no one will touch %a4 after it is set up in crt0.o. + This isn't true if a function is called as a callback by something + that wasn't compiled by gcc (like FrmCloseAllForms()). It may also + not be true if it is used as a callback by something in a different + shared library. + + We really want a function attribute "callback" which will insert this + progloue and epilogoue automatically. + + - Ian */ + +register void *reg_a4 asm("%a4"); + +#define CALLBACK_PROLOGUE \ + void *save_a4 = reg_a4; asm("move.l %%a5,%%a4; sub.l #edata,%%a4" : :); + +#define CALLBACK_EPILOGUE reg_a4 = save_a4; + +#endif -- cgit v1.2.3