This is an archive of the discontinued LLVM Phabricator instance.

[ms] [llvm-ml] Warn on redefinition of a command-line definition
AbandonedPublic

Authored by epastor on Dec 2 2020, 1:07 PM.

Details

Reviewers
None
Summary

If a macro is defined on the command line and then overridden in the source code, this is likely to be an error in the user's build system. We should warn on this.

Diff Detail

Event Timeline

epastor created this revision.Dec 2 2020, 1:07 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 2 2020, 1:07 PM
epastor requested review of this revision.Dec 2 2020, 1:07 PM

The test here doesn't currently warn - because test5 is already defined, and as such the line under t5: is lexed as:

def textequ <redef>

I need to check how ML.EXE handles this!

epastor updated this revision to Diff 330809.Mar 15 2021, 2:15 PM

Rebase on parent

epastor updated this revision to Diff 331329.Mar 17 2021, 11:21 AM

Rebase on parent

thakis added a subscriber: thakis.Apr 16 2021, 7:24 AM

(this didn't have me as a reviewer, so I only saw it by coincidence)

We should also add the /WX switch :)

If I read it right, this isn't ready to go yet, right?

(this didn't have me as a reviewer, so I only saw it by coincidence)

We should also add the /WX switch :)

That was added in https://reviews.llvm.org/D92504.

If I read it right, this isn't ready to go yet, right?

Correct; I need to investigate more corner cases in ML.EXE. It's unclear how ML.EXE handles redefinitions... when I read the spec as suggesting that (e.g.) test5 should be replaced by def before the line is even parsed!

epastor abandoned this revision.Jun 9 2021, 9:33 PM

This required a few too many changes; I'll re-upload a working variant on top of a prerequisite (D103993).