mirror of https://github.com/Kitware/CMake.git
Browse Source
cmake: Remove broken '--warn-unused-vars' option
cmake: Remove broken '--warn-unused-vars' option
This option has been broken since commit b9f9915516
(cmMakefile: Remove
VarUsageStack., 2015-05-17, v3.3.0-rc1~52^2). That commit removed the
check that an initialized variable has actually been used and caused the
option to warn on every variable ever set. This was not caught by the
test suite because the test for the feature only checked that warnings
appear when needed and not that they do not appear when not needed.
The option was never very practical to use. Remove it to avoid the
runtime cost of usage tracking and checks for every variable (which we
were doing even when the option was not used).
pull/334/head

20 changed files with 16 additions and 144 deletions
-
6Help/manual/cmake.1.rst
-
6Help/release/dev/remove-warn-unused-vars.rst
-
6Source/QtDialog/CMakeSetupDialog.cxx
-
1Source/QtDialog/CMakeSetupDialog.h
-
7Source/QtDialog/QCMake.cxx
-
4Source/QtDialog/QCMake.h
-
14Source/cmDefinitions.cxx
-
4Source/cmDefinitions.h
-
44Source/cmMakefile.cxx
-
7Source/cmMakefile.h
-
5Source/cmServerProtocol.cxx
-
1Source/cmServerProtocol.h
-
5Source/cmStateSnapshot.cxx
-
1Source/cmStateSnapshot.h
-
3Source/cmake.cxx
-
3Source/cmake.h
-
1Source/cmakemain.cxx
-
30Tests/CMakeLists.txt
-
4Tests/VariableUnusedViaSet/CMakeLists.txt
-
8Tests/VariableUnusedViaUnset/CMakeLists.txt
@ -0,0 +1,6 @@ |
|||
remove-warn-unused-vars |
|||
----------------------- |
|||
|
|||
* The :manual:`cmake(1)` command-line option ``--warn-unused-vars`` has |
|||
been removed and is now silently ignored. The option has not worked |
|||
correctly since CMake 3.3. |
@ -1,4 +0,0 @@ |
|||
set(UNUSED_VARIABLE) |
|||
# Warning should occur here |
|||
set(UNUSED_VARIABLE "Usage") |
|||
message(STATUS "${UNUSED_VARIABLE}") |
@ -1,8 +0,0 @@ |
|||
# NOTE: Changing lines in here changes the test results since the first |
|||
# instance shouldn't warn, but the second should and they have the same message |
|||
|
|||
# A warning should NOT be issued for this line: |
|||
set(UNUSED_VARIABLE) |
|||
# Warning should occur here: |
|||
set(UNUSED_VARIABLE) |
|||
message(STATUS "${UNUSED_VARIABLE}") |
Write
Preview
Loading…
Cancel
Save
Reference in new issue