<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Aug 3, 2015, at 10:51 AM, Chris Bieneman <<a href="mailto:beanz@apple.com" class="">beanz@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Aug 3, 2015, at 10:30 AM, Mehdi Amini <<a href="mailto:mehdi.amini@apple.com" class="">mehdi.amini@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class="Apple-interchange-newline">On Aug 3, 2015, at 10:24 AM, Chris Bieneman <<a href="mailto:beanz@apple.com" class="">beanz@apple.com</a>> wrote:<br class=""><br class="">Hey Tom,<br class=""><br class="">I’m not a regular user of llvm-config, but this sounds completely right to me, and it would be a significant improvement over what we have now.<br class=""><br class="">The only question I want to raise is, what about NDEBUG? There are headers that conditionalize on NDEBUG, which could lead to ABI incompatibility in the C++ API.<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Is it something that can be fixed or would it be too complicated to handle?<span class="Apple-converted-space"> </span></span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div class=""><br class=""></div><div class="">I think this would need a case-by-case determination that I haven’t done. There are quite a few occurrences of NDEBUG in headers:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-family: 'Andale Mono'; color: rgb(56, 193, 255); background-color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #29f914" class="">> </span><span style="font-variant-ligatures: no-common-ligatures; color: #457bf9" class="">grep</span><span style="font-variant-ligatures: no-common-ligatures; color: #29f914" class=""> </span>-r<span style="font-variant-ligatures: no-common-ligatures; color: #29f914" class=""> </span>NDEBUG<span style="font-variant-ligatures: no-common-ligatures; color: #29f914" class=""> </span>./include/<span style="font-variant-ligatures: no-common-ligatures; color: #29f914" class=""> | </span><span style="font-variant-ligatures: no-common-ligatures; color: #457bf9" class="">wc</span><span style="font-variant-ligatures: no-common-ligatures; color: #29f914" class=""> </span>-l</div><div style="margin: 0px; font-family: 'Andale Mono'; color: rgb(41, 249, 20); background-color: rgb(0, 0, 0);" class=""> 77</div><div class=""><br class=""></div></div><div class="">I imagine many of these aren’t actually ABI issues, but I know that ABI issues have existed in the past.</div></div></div></div></blockquote><div><br class=""></div><div>I quickly looked at them and found these that I believe won’t trigger a linked error:</div><div><br class=""></div><div>- class SCEVExpander: has a field dependent on NDEBUG: "const char *DebugType;"</div><div>- class FunctionLoweringInfo: two fields dependent on NDEBUG: SmallPtrSet<const Instruction *, 8> CatchInfoLost and CatchInfoFound</div><div>- class ScheduleDAGMI: has a field dependent on NDEBUG: unsigned NumInstrsScheduled;</div>- class SchedBoundary: has a field dependent on NDEBUG: unsigned MaxObservedStall;</div><div>- class NodeMetadata: has a field dependent on NDEBUG: bool everConservativelyAllocatable;<br class="">- class ScheduleDAG: has a field dependent on NDEBUG: bool StressSched;<br class=""><div>- class SelectionDAG: has a field dependent on NDEBUG: std::map<const SDNode *, std::string> NodeGraphAttrs;</div><div>- class AssertingVH conditionally inherit from ValueHandleBase and has a dependent field: Value *ThePtr;</div>- class MCProcResourceDesc and MCSchedClassDesc have a field dependent on NDEBUG: const char *Name;</div><div><br class=""></div><div><br class=""></div><div>— </div><div>Mehdi</div><div><br class=""><div><br class=""></div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class=""><br class=""></div><div class="">-Chris</div><br class=""><blockquote type="cite" class=""><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">It would be nice in general to be able to link a “Non assert” build of Clang with an “Assert" version of LLVM (and vice-versa).<span class="Apple-converted-space"> </span></span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">And on the original topic: +1 for Tom proposal/goal, it makes sense to me.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">—</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Mehdi</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class="">Thanks for doing this,<br class="">-Chris<br class=""><br class=""><blockquote type="cite" class="">On Jul 30, 2015, at 1:04 PM, <a href="mailto:tom@stellard.net" class="">tom@stellard.net</a> wrote:<br class=""><br class="">Hi,<br class=""><br class="">My understanding of llvm-config --cxxflags is that it is supposed to report<br class="">which flags are necessary to compile a program that will include LLVM's<br class="">headers and link against its libraries. What it currently reports is<br class="">all of the flags which were used to compile LLVM. This is not very useful,<br class="">because users are required in most cases to filter out flags they don't<br class="">want.<br class=""><br class="">I would like to try to fix this so that it reports only the bare minimum<br class="">of required flags. As an example here all the flags that it reports in<br class="">my autoconf build of llvm:<br class=""><br class="">-I/usr/local/llvm/3.8/include<br class="">-D_DEBUG<br class="">-D_GNU_SOURCE<br class="">-D__STDC_CONSTANT_MACROS<br class="">-D__STDC_FORMAT_MACROS<br class="">-D__STDC_LIMIT_MACROS<br class="">-O3<br class="">-fomit-frame-pointer<br class="">-std=c++11<br class="">-fvisibility-inlines-hidden<br class="">-fno-exceptions<br class="">-fno-rtti<br class="">-fPIC<br class="">-ffunction-sections<br class="">-fdata-sections<br class="">-Wcast-qual<br class=""><br class="">Of these flags the only ones that are really required are (c++ experts<br class="">please correct me if I'm wrong here):<br class=""><br class="">-I/usr/local/llvm/3.8/include<br class="">-D__STDC_CONSTANT_MACROS<br class="">-D__STDC_FORMAT_MACROS<br class="">-D__STDC_LIMIT_MACROS<br class="">-std=c++11<br class=""><br class="">Technically the -D__STDC* macros are only required if you include<br class="">Support/DataTypes.h, but I think that is hard to avoid.<br class=""><br class="">As I understand, The rest of the flags are not required in 100% of the<br class="">use cases.<br class=""><br class="">My proposal for fixing this is to remove everything but the 5 options listed<br class="">above.<br class=""><br class="">For flags like -fno-rtti (are there others?) that are required in some cases<br class="">(I think -fno-rtti is required only if you sub-class LLVM objects), I would propose<br class="">adding a separate flag like --uses-rtti. This would give users more fine-grained<br class="">control over which flags they use, and also would let them choose the correct<br class="">flag since, for example, -fno-rtti is not understood by MSVC.<br class=""><br class="">How do people feel about this proposal?<br class=""><br class="">Thanks,<br class="">Tom<br class="">_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:LLVMdev@cs.uiuc.edu" class="">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu/" class="">http://llvm.cs.uiuc.edu</a><br class=""><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" class="">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br class=""></blockquote><br class=""><br class="">_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:LLVMdev@cs.uiuc.edu" class="">LLVMdev@cs.uiuc.edu</a><span class="Apple-converted-space"> </span> <a href="http://llvm.cs.uiuc.edu/" class="">http://llvm.cs.uiuc.edu</a><br class=""><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" class="">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a></blockquote></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></body></html>