From 515f9af0d48be569adb51dfb43ff483cfc0d5156 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 3 Jun 2013 13:04:56 -0400 Subject: [PATCH] variable_watch: Remove leftover debugging code (#14187) When a watch does not specify a command to call then variable_watch prints out a message to stderr. Remove code after that which collects all variable values to construct a message that is never printed. Otherwise such code causes a READ_ACCESS watch to trigger on all variables in the currents scope. Reported-by: Yichao Yu --- Source/cmVariableWatchCommand.cxx | 13 ------------- Tests/RunCMake/variable_watch/NoWatcher-stderr.txt | 4 ++++ Tests/RunCMake/variable_watch/NoWatcher.cmake | 8 ++++++++ Tests/RunCMake/variable_watch/RunCMakeTest.cmake | 1 + 4 files changed, 13 insertions(+), 13 deletions(-) create mode 100644 Tests/RunCMake/variable_watch/NoWatcher-stderr.txt create mode 100644 Tests/RunCMake/variable_watch/NoWatcher.cmake diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx index a432943ae1..85329308cb 100644 --- a/Source/cmVariableWatchCommand.cxx +++ b/Source/cmVariableWatchCommand.cxx @@ -122,19 +122,6 @@ void cmVariableWatchCommand::VariableAccessed(const std::string& variable, msg << " The value of the variable: \"" << newValue << "\"" << std::endl; msg << " The list file stack: " << stack.c_str(); cmSystemTools::Message(msg.str().c_str()); - std::vector vars = makefile->GetDefinitions(); - cmOStringStream msg2; - size_t cc; - for ( cc = 0; cc < vars.size(); cc ++ ) - { - if ( vars[cc] == variable ) - { - continue; - } - msg2 << vars[cc] << " = \"" - << makefile->GetDefinition(vars[cc].c_str()) << "\"" << std::endl; - } - //cmSystemTools::Message(msg2.str().c_str()); } this->InCallback = false; } diff --git a/Tests/RunCMake/variable_watch/NoWatcher-stderr.txt b/Tests/RunCMake/variable_watch/NoWatcher-stderr.txt new file mode 100644 index 0000000000..95ff73b48e --- /dev/null +++ b/Tests/RunCMake/variable_watch/NoWatcher-stderr.txt @@ -0,0 +1,4 @@ +my_func +\* Variable "b" was accessed using MODIFIED_ACCESS in: .*/Tests/RunCMake/variable_watch/NoWatcher.cmake + The value of the variable: "" + The list file stack: .*/Tests/RunCMake/variable_watch/CMakeLists.txt;.*/Tests/RunCMake/variable_watch/NoWatcher.cmake$ diff --git a/Tests/RunCMake/variable_watch/NoWatcher.cmake b/Tests/RunCMake/variable_watch/NoWatcher.cmake new file mode 100644 index 0000000000..8a68efbe42 --- /dev/null +++ b/Tests/RunCMake/variable_watch/NoWatcher.cmake @@ -0,0 +1,8 @@ +function(my_func) + message("my_func") +endfunction() +variable_watch(a my_func) +set(a "") + +variable_watch(b) +set(b "") diff --git a/Tests/RunCMake/variable_watch/RunCMakeTest.cmake b/Tests/RunCMake/variable_watch/RunCMakeTest.cmake index 1dd7688f7a..8d20476735 100644 --- a/Tests/RunCMake/variable_watch/RunCMakeTest.cmake +++ b/Tests/RunCMake/variable_watch/RunCMakeTest.cmake @@ -1,3 +1,4 @@ include(RunCMake) run_cmake(ModifiedAccess) +run_cmake(NoWatcher)