[llvm-commits] setjmp & longjmp patch for review [updated]

Chris Lattner clattner at apple.com
Sun Dec 10 11:50:54 PST 2006


On Dec 9, 2006, at 2:40 PM, Anton Korobeynikov wrote:

> Hello, Everyone.
>
> Prev. patch should be considered as obsolete: MS runtime is weird: it
> uses underscore version of setjump() but non-underscore for
> longjump() :)
>
> Updated patch attached. Please note, that it will update .h file, so,
> it's recommended to rebuild the whole LLVM tree (well, at least  
> Codegen,
> Target & backends).

Looks good, except for the notes below:

diff -r f7b4f57b400c lib/Target/CBackend/Writer.cpp
--- a/lib/Target/CBackend/Writer.cpp	Wed Dec 06 13:35:10 2006 +0000
+++ b/lib/Target/CBackend/Writer.cpp	Sat Dec 09 12:13:58 2006 +0300
@@ -1138,6 +1138,8 @@ static void generateCompilerSpecificCode
        << "#elif defined(__APPLE__)\n"
        << "extern void *__builtin_alloca(unsigned long);\n"
        << "#define alloca(x) __builtin_alloca(x)\n"
+      << "#define longjmp(x) _longjmp(x)\n"
+      << "#define setjmp(x) _setjmp(x)\n"
        << "#elif defined(__sun__)\n"
        << "#if defined(__sparcv9)\n"
        << "extern void *__builtin_alloca(unsigned long);\n"

This won't work, since they take multiple arguments.  Just use:
+      << "#define longjmp _longjmp\n"
+      << "#define setjmp _setjmp\n"


More generally, why are you basing this on __APPLE__ instead of on  
HAVE__SETJMP/HAVE__LONGJMP?  Won't this break on cygwin because it  
will emit setjmp as "setjmp" instead of "_setjmp"?

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20061210/b6c1ce5b/attachment.html>


More information about the llvm-commits mailing list