This is an archive of the discontinued LLVM Phabricator instance.

Don't redefine a bunch of defines from llvm-config.h in config.h.
ClosedPublic

Authored by thakis on Apr 30 2018, 1:57 PM.

Details

Reviewers
rnk
bogner
chapuni
Summary

r210144 made config.h include llvm-config.h and deduplicated defines. Then rL239987 later added back some of the duplication. http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20150914/300329.html suggests this was done for the configure/make build, which no longer exists.

A prior attempt at this was apparently at https://reviews.llvm.org/D41371

Diff Detail

Event Timeline

thakis created this revision.Apr 30 2018, 1:57 PM
thakis updated this revision to Diff 144632.Apr 30 2018, 1:58 PM

missed one

bogner added inline comments.Apr 30 2018, 5:18 PM
include/llvm/Config/config.h.cmake
296–297

The one in llvm-config.h doesn't have this comment and does use cmakedefine. Please make sure we're still doing the right thing when this is empty (that is, build with -DLLVM_DEFAULT_TARGET_TRIPLE="")

thakis added inline comments.May 1 2018, 6:12 AM
include/llvm/Config/config.h.cmake
296–297

Since config.h includes llvm-config.h, when it's undefined in config.h the one in llvm-config.h won. So this is behavior-preserving, and since this doesn't work it looks like the comment is outdated.

thakis added a comment.May 2 2018, 8:51 AM

bogner, rnk, chapuni: ping

include/llvm/Config/config.h.cmake
296–297

Did this make sense?

bogner added inline comments.May 2 2018, 3:21 PM
include/llvm/Config/config.h.cmake
296–297

No, I think you have this backwards. Today, if LLVM_DEFAULT_TARGET_TRIPLE is blank, llvm-config.h has a comment like so:

/* #undef LLVM_DEFAULT_TARGET_TRIPLE */

Whereas config.h defines the value to an empty string:

#define LLVM_DEFAULT_TARGET_TRIPLE ""

So removing this from config.h will make it so that it's neither #defined nor #undef'd in either file, which is not behaviour preserving. In fact, if you build this way you'll probably get a compile error in lib/Support/Unix/Host.inc when it tries to call updateTripleOSVersion with no parameter. This is what I was asking you to check here.

Moving the explicit define from here to llvm-config.h is also technically not behaviour preserving, since external projects that use these headers will see a #define of "" instead of no symbol at all, but I think that's at least a change that is arguably correct.

thakis updated this revision to Diff 145036.May 3 2018, 10:01 AM
thakis marked 4 inline comments as done.

Address comment.

include/llvm/Config/config.h.cmake
296–297

Got it, thanks! I removed LLVM_DEFAULT_TARGET_TRIPLE from this change.

bogner accepted this revision.May 3 2018, 2:18 PM
This revision is now accepted and ready to land.May 3 2018, 2:18 PM
rnk accepted this revision.May 8 2018, 4:08 PM

+1

thakis closed this revision.May 10 2018, 7:48 AM

r331987, thanks!