<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Apr 3, 2013, at 7:03 PM, Eric Christopher <<a href="mailto:echristo@gmail.com">echristo@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">This seems like a pretty horrific hack. </div></blockquote><div><br></div><div>I'm not sure I share your subjective assessment of this fix.</div><div><br></div><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">I don't think we want to rely<br>on the preprocessor to do this sort of thing.</div></blockquote><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><br>I've got no objections to not naming unused parameters in headers, in<br>fact, when I did this same sort of thing a while back I cleaned that<br>up and it seems like a much better way to go.<br></div></blockquote><div><br></div><div>Unused parameters wasn't the only warning that came up.  -Wmissing-noreturn is another, and that one is trickier to fix.</div><div><br></div><div>My intuition is that it's unwise to expect WebKit's use of -Wmissing-noreturn and -Wunused-param to be the last case of build failures in LLVM clients due to unexpected uses of warning C++ flags.  This change ensures that downstream clients can benefit from LLVM's C API even if they use these, and other, flags - since the C API headers themselves follow really good hygiene (mostly by virtue of not having any function bodies, and sticking to simple pure C declarations).  This change also preserves existing behavior for clients who use the C++ API instead of the C one, or who have already side-stepped the build warnings/errors by other means.</div><div><br></div><div>Do you disagree with this intuition, or do you believe that there exists a better long-term solution?</div><div><br></div><div>-Filip</div><div><br></div><div><br></div><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><br>-eric<br><br>On Wed, Apr 3, 2013 at 4:12 PM, Evan Cheng <<a href="mailto:evan.cheng@apple.com">evan.cheng@apple.com</a>> wrote:<br><blockquote type="cite">Author: evancheng<br>Date: Wed Apr  3 18:12:39 2013<br>New Revision: 178713<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=178713&view=rev">http://llvm.org/viewvc/llvm-project?rev=178713&view=rev</a><br>Log:<br>Make it possible to include llvm-c without including C++ headers. Patch by Filip Pizlo.<br><br>Modified:<br>   llvm/trunk/include/llvm-c/Core.h<br>   llvm/trunk/include/llvm-c/ExecutionEngine.h<br>   llvm/trunk/include/llvm-c/Object.h<br>   llvm/trunk/include/llvm-c/Target.h<br>   llvm/trunk/include/llvm-c/TargetMachine.h<br>   llvm/trunk/include/llvm-c/Transforms/PassManagerBuilder.h<br><br>Modified: llvm/trunk/include/llvm-c/Core.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=178713&r1=178712&r2=178713&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=178713&r1=178712&r2=178713&view=diff</a><br>==============================================================================<br>--- llvm/trunk/include/llvm-c/Core.h (original)<br>+++ llvm/trunk/include/llvm-c/Core.h Wed Apr  3 18:12:39 2013<br>@@ -17,14 +17,15 @@<br><br>#include "llvm/Support/DataTypes.h"<br><br>-#ifdef __cplusplus<br>-<br>+#if defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS)<br>/* Need these includes to support the LLVM 'cast' template for the C++ 'wrap'<br>   and 'unwrap' conversion functions. */<br>#include "llvm/IR/IRBuilder.h"<br>#include "llvm/IR/Module.h"<br>#include "llvm/PassRegistry.h"<br>+#endif /* defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS) */<br><br>+#ifdef __cplusplus<br>extern "C" {<br>#endif<br><br>@@ -2669,7 +2670,9 @@ LLVMBool LLVMIsMultithreaded();<br><br>#ifdef __cplusplus<br>}<br>+#endif<br><br>+#if defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS)<br>namespace llvm {<br>  class MemoryBuffer;<br>  class PassManagerBase;<br>@@ -2763,6 +2766,6 @@ namespace llvm {<br>  }<br>}<br><br>-#endif /* !defined(__cplusplus) */<br>+#endif /* defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS) */<br><br>-#endif /* !defined(LLVM_C_CORE_H) */<br>+#endif /* defined(LLVM_C_CORE_H) */<br><br>Modified: llvm/trunk/include/llvm-c/ExecutionEngine.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/ExecutionEngine.h?rev=178713&r1=178712&r2=178713&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/ExecutionEngine.h?rev=178713&r1=178712&r2=178713&view=diff</a><br>==============================================================================<br>--- llvm/trunk/include/llvm-c/ExecutionEngine.h (original)<br>+++ llvm/trunk/include/llvm-c/ExecutionEngine.h Wed Apr  3 18:12:39 2013<br>@@ -138,7 +138,9 @@ void *LLVMGetPointerToGlobal(LLVMExecuti<br><br>#ifdef __cplusplus<br>}<br>+#endif<br><br>+#if defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS)<br>namespace llvm {<br>  struct GenericValue;<br>  class ExecutionEngine;<br>@@ -157,7 +159,6 @@ namespace llvm {<br><br>  #undef DEFINE_SIMPLE_CONVERSION_FUNCTIONS<br>}<br>-<br>-#endif /* defined(__cplusplus) */<br>+#endif /* defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS) */<br><br>#endif<br><br>Modified: llvm/trunk/include/llvm-c/Object.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Object.h?rev=178713&r1=178712&r2=178713&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Object.h?rev=178713&r1=178712&r2=178713&view=diff</a><br>==============================================================================<br>--- llvm/trunk/include/llvm-c/Object.h (original)<br>+++ llvm/trunk/include/llvm-c/Object.h Wed Apr  3 18:12:39 2013<br>@@ -22,9 +22,11 @@<br>#include "llvm-c/Core.h"<br>#include "llvm/Config/llvm-config.h"<br><br>-#ifdef __cplusplus<br>+#if defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS)<br>#include "llvm/Object/ObjectFile.h"<br>+#endif /* defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS) */<br><br>+#ifdef __cplusplus<br>extern "C" {<br>#endif<br><br>@@ -99,7 +101,9 @@ const char *LLVMGetRelocationValueString<br><br>#ifdef __cplusplus<br>}<br>+#endif<br><br>+#if defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS)<br>namespace llvm {<br>  namespace object {<br>    inline ObjectFile *unwrap(LLVMObjectFileRef OF) {<br>@@ -142,8 +146,8 @@ namespace llvm {<br><br>  }<br>}<br>+#endif /* defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS) */<br><br>-#endif /* defined(__cplusplus) */<br><br>#endif<br><br><br>Modified: llvm/trunk/include/llvm-c/Target.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Target.h?rev=178713&r1=178712&r2=178713&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Target.h?rev=178713&r1=178712&r2=178713&view=diff</a><br>==============================================================================<br>--- llvm/trunk/include/llvm-c/Target.h (original)<br>+++ llvm/trunk/include/llvm-c/Target.h Wed Apr  3 18:12:39 2013<br>@@ -235,7 +235,9 @@ void LLVMDisposeTargetData(LLVMTargetDat<br><br>#ifdef __cplusplus<br>}<br>+#endif<br><br>+#if defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS)<br>namespace llvm {<br>  class DataLayout;<br>  class TargetLibraryInfo;<br>@@ -257,7 +259,6 @@ namespace llvm {<br>    return reinterpret_cast<LLVMTargetLibraryInfoRef>(X);<br>  }<br>}<br>-<br>-#endif /* defined(__cplusplus) */<br>+#endif /* defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS) */<br><br>#endif<br><br>Modified: llvm/trunk/include/llvm-c/TargetMachine.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/TargetMachine.h?rev=178713&r1=178712&r2=178713&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/TargetMachine.h?rev=178713&r1=178712&r2=178713&view=diff</a><br>==============================================================================<br>--- llvm/trunk/include/llvm-c/TargetMachine.h (original)<br>+++ llvm/trunk/include/llvm-c/TargetMachine.h Wed Apr  3 18:12:39 2013<br>@@ -119,7 +119,9 @@ LLVMBool LLVMTargetMachineEmitToFile(LLV<br><br>#ifdef __cplusplus<br>}<br>+#endif<br><br>+#if defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS)<br>namespace llvm {<br>  class TargetMachine;<br>  class Target;<br>@@ -138,6 +140,6 @@ namespace llvm {<br>    return reinterpret_cast<LLVMTargetRef>(const_cast<Target*>(P));<br>  }<br>}<br>-#endif<br>+#endif /* defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS) */<br><br>#endif<br><br>Modified: llvm/trunk/include/llvm-c/Transforms/PassManagerBuilder.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Transforms/PassManagerBuilder.h?rev=178713&r1=178712&r2=178713&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Transforms/PassManagerBuilder.h?rev=178713&r1=178712&r2=178713&view=diff</a><br>==============================================================================<br>--- llvm/trunk/include/llvm-c/Transforms/PassManagerBuilder.h (original)<br>+++ llvm/trunk/include/llvm-c/Transforms/PassManagerBuilder.h Wed Apr  3 18:12:39 2013<br>@@ -18,8 +18,11 @@<br><br>typedef struct LLVMOpaquePassManagerBuilder *LLVMPassManagerBuilderRef;<br><br>-#ifdef __cplusplus<br>+#if defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS)<br>#include "llvm/Transforms/IPO/PassManagerBuilder.h"<br>+#endif<br>+<br>+#ifdef __cplusplus<br>extern "C" {<br>#endif<br><br>@@ -86,7 +89,9 @@ void LLVMPassManagerBuilderPopulateLTOPa<br><br>#ifdef __cplusplus<br>}<br>+#endif<br><br>+#if defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS)<br>namespace llvm {<br>  inline PassManagerBuilder *unwrap(LLVMPassManagerBuilderRef P) {<br>    return reinterpret_cast<PassManagerBuilder*>(P);<br>@@ -96,6 +101,6 @@ namespace llvm {<br>    return reinterpret_cast<LLVMPassManagerBuilderRef>(P);<br>  }<br>}<br>-#endif<br>+#endif /* defined(__cplusplus) && !defined(LLVM_DO_NOT_INCLUDE_CPP_HEADERS) */<br><br>#endif<br><br><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits<br></blockquote>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a></div></blockquote></div><br></body></html>