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.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/test/tools/llvm-ml/command_line_defines_errors.asm | ||
---|---|---|
1 | I couldn't get lit to just detect the warning, for some reason. I'm open to suggestions! |
I tried patching this in
llvm/test/tools/llvm-ml/command_line_defines_errors.asm | ||
---|---|---|
1 | Hm, works for me: ; RUN: llvm-ml -filetype=s %s /Fo - /Dtest1=def 2>&1 | FileCheck %s --implicit-check-not=warning: .code ; CHECK: :[[# @LINE + 1]]:1: warning: redefining 'test1', already defined on the command line test1 textequ <redef> end % out/gn/bin/llvm-lit -s -vv llvm/test/tools/llvm-ml/command_line_defines_errors.asm Testing Time: 0.13s Passed: 1 |
llvm/test/tools/llvm-ml/command_line_defines_errors.asm | ||
---|---|---|
1 | ... darn, I would've sworn I tried that, but apparently I kept putting it in the other file - forgetting that CHECK always requires lines to occur in order, and that the warning is emitted before any of the output lines I'm checking against. Thanks! |
LG with tweak below
llvm/test/tools/llvm-ml/command_line_defines_errors.asm | ||
---|---|---|
1 | You don't need the implicit check not for error: if there's an error the command will exit non-0 and lit will fail the test |
Maybe you need 2>&1 in front of the | so that lit sees stderr?