<div dir="ltr">Hi,<div><br></div><div>I only checked the dev mailing list for a duplicate, didn't think of looking for it in commits.</div><div><br></div><div>There's some valid criticism in that thread, so I'll think about this some more and if I come up with any more ideas I'll reply on phab.</div><div><br></div><div>Best,</div><div>- Philip</div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-07-01 20:16 GMT+02:00 Matthias Braun <span dir="ltr"><<a href="mailto:mbraun@apple.com" target="_blank">mbraun@apple.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">This has also come up with llvm before: <a href="http://reviews.llvm.org/D11833" target="_blank">http://reviews.llvm.org/D11833</a><span class="HOEnZb"><font color="#888888"><div><br></div><div>- Matthias</div></font></span><div><div class="h5"><div><br><div><blockquote type="cite"><div>On Jul 1, 2016, at 10:11 AM, Reid Kleckner via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:</div><br><div><div dir="ltr">When we added the ABI breaking EpochTracker to DenseMap, we added a macro called LLVM_ENABLE_ABI_BREAKING_CHECKS, which is controlled by the CMake option LLVM_ABI_BREAKING_CHECKS. I think we should make all ABI-impacting uses of NDEBUG in headers use this macro instead.<div><br></div><div>I don't know what the current behavior is, but I would like this macro to correlate with NDEBUG by default. People packaging LLVM as a library for redistribution can turn off the ABI breaking checks manually.</div><div><br></div><div>Also, this has come up before, although Alp was concerned with Clang, not LLVM:</div><div><a href="http://lists.llvm.org/pipermail/llvm-dev/2013-November/067410.html" target="_blank">http://lists.llvm.org/pipermail/llvm-dev/2013-November/067410.html</a></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 1, 2016 at 5:37 AM, Philip Pfaffe via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</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">Hi everyone,<div><br></div><div>we have several header files in which the NDEBUG macro is being used. In some of these, the NDEBUG macro changes the size, the interface, or the layout of a type. One example is AssertingVH, which turns into a flat, transparent Value* wrapper in Release build. Now everywhere you use these headers, the state of the NDEBUG flag must be the same, or else bad things could happen.</div><div><br></div><div>This turns out to be quite problematic for out-of-tree targets and projects, because it effectively forces them to use the same build type with which LLVM was compiled. Thus, a project maintainer needs to keep a Debug and a Release build of LLVM around, and is mostly barred from using binary distributions.</div><div><br></div><div>If the community agrees that this is a problem, I'd like to discuss two possible solutions.</div><div><br></div><div>Solution #1:</div><div>Don't use NDEBUG (or any similar or depending macro) inside public-facing header files. I think this is the cleanest solution, but it requires a great amount of discipline on the side of developers and reviewers to stick with this pattern, and it will probably have a performance impact (e.g., for AssertingVH).</div><div><br></div><div>Solution #2:</div><div>Replace NDEBUG with a custom flag (e.g. LLVM_NDEBUG), and have CMake take care of synchronizing the two. I.e. ensure that LLVM_NDEBUG is set iff NDEBUG is set. Introducing this is probably a lot more work, because it touches all subprojects.</div><div><br></div><div>What do you think?</div><div><br></div><div>Best,</div><div>- Philip</div></div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div>
_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br></div></blockquote></div><br></div></div></div></div></blockquote></div><br></div>