<div dir="ltr">Filip, <div> ping. <br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Oct 21, 2013 at 1:03 PM, Kostya Serebryany <span dir="ltr"><<a href="mailto:kcc@google.com" target="_blank">kcc@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">This seems to be still unfixed. <div><br></div><div>--kcc </div></div><div class="HOEnZb"><div class="h5">
<div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Oct 17, 2013 at 11:50 AM, Kai Nacke <span dir="ltr"><<a href="mailto:kai.nacke@redstar.de" target="_blank">kai.nacke@redstar.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Yes - I see it with clang 3.4 on Linux.<br>
<br>
Regards<br>
Kai<div><br>
<br>
On 17.10.2013 09:41, Kostya Serebryany wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>
This is causing build errors for me:<br>
<br>
/home/kcc/llvm/lib/Support/<u></u>ErrorHandling.cpp:110:5: error: cast between<br>
pointer-to-function and pointer-to-object is an extension<br>
[-Werror,-Wpedantic]<br>
reinterpret_cast<<u></u>LLVMFatalErrorHandler>(user_<u></u>data);<br>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<u></u>~~~~~~~~~~~~~~~~~~~~<br>
/home/kcc/llvm/lib/Support/<u></u>ErrorHandling.cpp:116:27: error: cast between<br>
pointer-to-function and pointer-to-object is an extension<br>
[-Werror,-Wpedantic]<br>
bindingsErrorHandler, reinterpret_cast<void*>(<u></u>Handler));<br>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<u></u>~~<br>
<br>
Does anyone else see these?<br>
<br>
My build config is:<br>
cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON \<br>
-DCMAKE_C_COMPILER=/home/kcc/<u></u>host_clang/bin/clang \<br>
-DCMAKE_CXX_COMPILER=/home/<u></u>kcc/host_clang/bin/clang++ \<br>
-DCMAKE_EXPORT_COMPILE_<u></u>COMMANDS=ON \<br>
-DLLVM_ENABLE_WERROR=ON<br>
<br>
<br>
<br>
<br>
<br>
On Thu, Oct 17, 2013 at 5:38 AM, Filip Pizlo <<a href="mailto:fpizlo@apple.com" target="_blank">fpizlo@apple.com</a><br></div><div><div>
<mailto:<a href="mailto:fpizlo@apple.com" target="_blank">fpizlo@apple.com</a>>> wrote:<br>
<br>
Author: fpizlo<br>
Date: Wed Oct 16 20:38:28 2013<br>
New Revision: 192864<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=192864&view=rev" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project?rev=192864&view=rev</a><br>
Log:<br>
Expose install_fatal_error_handler() through the C API.<br>
<br>
I expose the API with some caveats:<br>
<br>
- The C++ API involves a traditional void* opaque pointer for the fatal<br>
error callback. The C API doesn’t do this. I don’t think that the<br>
void*<br>
opaque pointer makes any sense since this is a global callback -<br>
there will<br>
only be one of them. So if you need to pass some data to your callback,<br>
just put it in a global variable.<br>
<br>
- The bindings will ignore the gen_crash_diag boolean. I ignore it<br>
because<br>
(1) I don’t know what it does, (2) it’s not documented AFAIK, and (3) I<br>
couldn’t imagine any use for it. I made the gut call that it probably<br>
wasn’t important enough to expose through the C API.<br>
<br>
<br>
Modified:<br>
llvm/trunk/include/llvm-c/<u></u>Core.h<br>
llvm/trunk/lib/Support/<u></u>ErrorHandling.cpp<br>
<br>
Modified: llvm/trunk/include/llvm-c/<u></u>Core.h<br>
URL:<br>
<a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=192864&r1=192863&r2=192864&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/include/<u></u>llvm-c/Core.h?rev=192864&r1=<u></u>192863&r2=192864&view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/include/llvm-c/<u></u>Core.h (original)<br>
+++ llvm/trunk/include/llvm-c/<u></u>Core.h Wed Oct 16 20:38:28 2013<br>
@@ -416,6 +416,22 @@ void LLVMShutdown();<br>
char *LLVMCreateMessage(const char *Message);<br>
void LLVMDisposeMessage(char *Message);<br>
<br>
+typedef void (*LLVMFatalErrorHandler)(const char *Reason);<br>
+<br>
+/**<br>
+ * Install a fatal error handler. By default, if LLVM detects a<br>
fatal error, it<br>
+ * will call exit(1). This may not be appropriate in many contexts.<br>
For example,<br>
+ * doing exit(1) will bypass many crash reporting/tracing system<br>
tools. This<br>
+ * function allows you to install a callback that will be invoked<br>
prior to the<br>
+ * call to exit(1).<br>
+ */<br>
+void LLVMInstallFatalErrorHandler(<u></u>LLVMFatalErrorHandler Handler);<br>
+<br>
+/**<br>
+ * Reset the fatal error handler. This resets LLVM's fatal error<br>
handling<br>
+ * behavior to the default.<br>
+ */<br>
+void LLVMResetFatalErrorHandler(<u></u>void);<br>
<br>
/**<br>
* @defgroup LLVMCCoreContext Contexts<br>
<br>
Modified: llvm/trunk/lib/Support/<u></u>ErrorHandling.cpp<br>
URL:<br>
<a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/ErrorHandling.cpp?rev=192864&r1=192863&r2=192864&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/llvm/trunk/lib/<u></u>Support/ErrorHandling.cpp?rev=<u></u>192864&r1=192863&r2=192864&<u></u>view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- llvm/trunk/lib/Support/<u></u>ErrorHandling.cpp (original)<br>
+++ llvm/trunk/lib/Support/<u></u>ErrorHandling.cpp Wed Oct 16 20:38:28 2013<br>
@@ -20,6 +20,7 @@<br>
#include "llvm/Support/Signals.h"<br>
#include "llvm/Support/Threading.h"<br>
#include "llvm/Support/raw_ostream.h"<br>
+#include "llvm-c/Core.h"<br>
#include <cassert><br>
#include <cstdlib><br>
<br>
@@ -102,3 +103,19 @@ void llvm::llvm_unreachable_<u></u>internal(con<br>
LLVM_BUILTIN_UNREACHABLE;<br>
#endif<br>
}<br>
+<br>
+static void bindingsErrorHandler(void *user_data, const<br>
std::string& reason,<br>
+ bool gen_crash_diag) {<br>
+ LLVMFatalErrorHandler handler =<br>
+ reinterpret_cast<<u></u>LLVMFatalErrorHandler>(user_<u></u>data);<br>
+ handler(reason.c_str());<br>
+}<br>
+<br>
+void LLVMInstallFatalErrorHandler(<u></u>LLVMFatalErrorHandler Handler) {<br>
+ install_fatal_error_handler(<br>
+ bindingsErrorHandler, reinterpret_cast<void*>(<u></u>Handler));<br>
+}<br>
+<br>
+void LLVMResetFatalErrorHandler() {<br>
+ remove_fatal_error_handler();<br>
+}<br>
<br>
<br>
______________________________<u></u>_________________<br>
llvm-commits mailing list<br></div></div>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a> <mailto:<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.<u></u>edu</a>><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/llvm-commits</a><div><br>
<br>
<br>
<br>
<br>
______________________________<u></u>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/llvm-commits</a><br>
<br>
</div></blockquote><div><div>
<br>
______________________________<u></u>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>