
lib.exe by default exits successfully without writing an output file when no inputs are passed. llvm-lib has the same behavior, for compatibility. This behavior interacts poorly with build systems: If a static library target had no inputs, llvm-lib would not produce an output file, causing ninja (or make, or a similar system) to successfully run that step, but then re-run it on the next build. After this patch, llvm-lib emits a warning in this case, that with /WX can be turned into an error. That way, ninja (or make, or...) will mark the initial build as failed. People who don't like the warning can use /ignore:emptyoutput to suppress it. The warning also points out the existing flag /llvmlibempty which forces creation of an empty .lib file (this is an extension to lib.exe). Differential Revision: https://reviews.llvm.org/D123517
23 lines
893 B
Plaintext
23 lines
893 B
Plaintext
RUN: rm -f %t.lib
|
|
RUN: llvm-lib -out:%t.lib 2>&1 | FileCheck --check-prefix=EMPTYWARN %s
|
|
RUN: test ! -e %t.lib
|
|
RUN: not llvm-lib -out:%t.lib /WX 2>&1 | FileCheck --check-prefix=EMPTYWARN %s
|
|
RUN: test ! -e %t.lib
|
|
RUN: llvm-lib -out:%t.lib /WX /WX:no 2>&1 \
|
|
RUN: | FileCheck --check-prefix=EMPTYWARN %s
|
|
RUN: test ! -e %t.lib
|
|
RUN: llvm-lib /ignore:emptyoutput -out:%t.lib 2>&1 \
|
|
RUN: | FileCheck --check-prefix=NOEMPTYWARN --allow-empty %s
|
|
RUN: test ! -e %t.lib
|
|
RUN: llvm-lib /ignore:emptyoutput /WX -out:%t.lib 2>&1 \
|
|
RUN: | FileCheck --check-prefix=NOEMPTYWARN --allow-empty %s
|
|
RUN: test ! -e %t.lib
|
|
|
|
EMPTYWARN: warning: no input files, not writing output file
|
|
NOEMPTYWARN-NOT: warning: no input files, not writing output file
|
|
|
|
RUN: llvm-lib /llvmlibempty -out:%t.lib 2>&1 \
|
|
RUN: | FileCheck --check-prefix=NOEMPTYWARN --allow-empty %s
|
|
RUN: FileCheck %s < %t.lib
|
|
CHECK: !<arch>
|