[Cmake-commits] CMake branch, next, updated. v3.0.0-rc5-3267-g2bcdb80

Ben Boeckel ben.boeckel at kitware.com
Tue May 20 13:36:10 EDT 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  2bcdb80ed7e68afc491dd752b4847818dafdba46 (commit)
       via  6a6f2b63a23914ed6d41324f4b536eb82d02dd55 (commit)
       via  c0e4340a2c2043af76efbadf5f655907720d13fe (commit)
      from  a0c533f27dd8bcb7fbfc9521de5b25ac7f12a738 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2bcdb80ed7e68afc491dd752b4847818dafdba46
commit 2bcdb80ed7e68afc491dd752b4847818dafdba46
Merge: a0c533f 6a6f2b6
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Tue May 20 13:36:09 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue May 20 13:36:09 2014 -0400

    Merge topic 'dev/watch-variable-policy' into next
    
    6a6f2b63 tests: test CMP0054
    c0e4340a CMP0054: Remove ALLOWED_UNKNOWN_VARIABLE_READ_ACCESS


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6a6f2b63a23914ed6d41324f4b536eb82d02dd55
commit 6a6f2b63a23914ed6d41324f4b536eb82d02dd55
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Mon May 5 17:46:48 2014 -0400
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Tue May 13 16:18:19 2014 -0400

    tests: test CMP0054

diff --git a/Tests/RunCMake/CMP0054/CMP0054-NEW-result.txt b/Tests/RunCMake/CMP0054/CMP0054-NEW-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMP0054-NEW-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CMP0054/CMP0054-NEW-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-NEW-stderr.txt
new file mode 100644
index 0000000..ea1cc74
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMP0054-NEW-stderr.txt
@@ -0,0 +1,4 @@
+^UNKNOWN_READ_ACCESS
+--><--
+UNKNOWN_READ_ACCESS
+--><--$
diff --git a/Tests/RunCMake/CMP0054/CMP0054-NEW.cmake b/Tests/RunCMake/CMP0054/CMP0054-NEW.cmake
new file mode 100644
index 0000000..259e598
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMP0054-NEW.cmake
@@ -0,0 +1,12 @@
+cmake_policy(SET CMP0054 NEW)
+
+function (watch_callback var access value file stack)
+  message(${access})
+endfunction ()
+
+variable_watch(uninit watch_callback)
+message("-->${uninit}<--")
+set(CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS ON)
+message("-->${uninit}<--")
+# Don't warn during generate
+set(CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS OFF)
diff --git a/Tests/RunCMake/CMP0054/CMP0054-OLD-result.txt b/Tests/RunCMake/CMP0054/CMP0054-OLD-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMP0054-OLD-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CMP0054/CMP0054-OLD-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-OLD-stderr.txt
new file mode 100644
index 0000000..50d6c11
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMP0054-OLD-stderr.txt
@@ -0,0 +1,4 @@
+^UNKNOWN_READ_ACCESS
+--><--
+ALLOWED_UNKNOWN_READ_ACCESS
+--><--$
diff --git a/Tests/RunCMake/CMP0054/CMP0054-OLD.cmake b/Tests/RunCMake/CMP0054/CMP0054-OLD.cmake
new file mode 100644
index 0000000..893dc7b
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMP0054-OLD.cmake
@@ -0,0 +1,12 @@
+cmake_policy(SET CMP0054 OLD)
+
+function (watch_callback var access value file stack)
+  message(${access})
+endfunction ()
+
+variable_watch(uninit watch_callback)
+message("-->${uninit}<--")
+set(CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS ON)
+message("-->${uninit}<--")
+# Don't warn during generate
+set(CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS OFF)
diff --git a/Tests/RunCMake/CMP0054/CMP0054-WARN-result.txt b/Tests/RunCMake/CMP0054/CMP0054-WARN-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMP0054-WARN-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CMP0054/CMP0054-WARN-stderr.txt b/Tests/RunCMake/CMP0054/CMP0054-WARN-stderr.txt
new file mode 100644
index 0000000..db5f8d0
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMP0054-WARN-stderr.txt
@@ -0,0 +1,13 @@
+^UNKNOWN_READ_ACCESS
+--><--
+CMake Warning \(dev\) at CMP0054-WARN.cmake:8 \(message\):
+  Policy CMP0054 is not set: Remove ALLOWED_UNKNOWN_VARIABLE_READ_ACCESS
+  variable_watch access type.  Run "cmake --help-policy CMP0054" for policy
+  details.  Use the cmake_policy command to set the policy and suppress this
+  warning.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
+This warning is for project developers.  Use -Wno-dev to suppress it.
+
+ALLOWED_UNKNOWN_READ_ACCESS
+--><--$
diff --git a/Tests/RunCMake/CMP0054/CMP0054-WARN.cmake b/Tests/RunCMake/CMP0054/CMP0054-WARN.cmake
new file mode 100644
index 0000000..fde0538
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMP0054-WARN.cmake
@@ -0,0 +1,10 @@
+function (watch_callback var access value file stack)
+  message(${access})
+endfunction ()
+
+variable_watch(uninit watch_callback)
+message("-->${uninit}<--")
+set(CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS ON)
+message("-->${uninit}<--")
+# Don't warn during generate
+set(CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS OFF)
diff --git a/Tests/RunCMake/CMP0054/CMakeLists.txt b/Tests/RunCMake/CMP0054/CMakeLists.txt
new file mode 100644
index 0000000..3482e6b
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.0)
+project(${RunCMake_TEST} CXX)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0054/RunCMakeTest.cmake b/Tests/RunCMake/CMP0054/RunCMakeTest.cmake
new file mode 100644
index 0000000..4cc7649
--- /dev/null
+++ b/Tests/RunCMake/CMP0054/RunCMakeTest.cmake
@@ -0,0 +1,5 @@
+include(RunCMake)
+
+run_cmake(CMP0054-OLD)
+run_cmake(CMP0054-NEW)
+run_cmake(CMP0054-WARN)
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index e797a73..16170a2 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -35,6 +35,7 @@ add_RunCMake_test(CMP0046)
 add_RunCMake_test(CMP0049)
 add_RunCMake_test(CMP0050)
 add_RunCMake_test(CMP0051)
+add_RunCMake_test(CMP0054)
 add_RunCMake_test(CTest)
 if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles")
   add_RunCMake_test(CompilerChange)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c0e4340a2c2043af76efbadf5f655907720d13fe
commit c0e4340a2c2043af76efbadf5f655907720d13fe
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Mon May 5 17:25:24 2014 -0400
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Tue May 13 16:18:18 2014 -0400

    CMP0054: Remove ALLOWED_UNKNOWN_VARIABLE_READ_ACCESS
    
    The CMake code for it is now redundant and only slows down uninitialized
    variable accesses.

diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst
index 136cf5c..f1717a0 100644
--- a/Help/manual/cmake-policies.7.rst
+++ b/Help/manual/cmake-policies.7.rst
@@ -105,3 +105,4 @@ All Policies
    /policy/CMP0051
    /policy/CMP0052
    /policy/CMP0053
+   /policy/CMP0054
diff --git a/Help/policy/CMP0054.rst b/Help/policy/CMP0054.rst
new file mode 100644
index 0000000..7c2b2c3
--- /dev/null
+++ b/Help/policy/CMP0054.rst
@@ -0,0 +1,21 @@
+CMP0054
+-------
+
+Deprecate `ALLOWED_UNKNOWN_VARIABLE_READ_ACCESS` :command:`variable_watch`
+access type.
+
+CMake 3.0 and lower allowed switching the access type of variable access to
+`ALLOWED_UNKNOWN_VARIABLE_READ_ACCESS` based on the undocumented
+`CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS` variable. Since the callback is
+always called no matter what, just with a different access type based on this
+variable, the access types are now collapsed into one.
+
+The OLD behavior for this policy is to use the
+`ALLOWED_UNKNOWN_VARIABLE_READ_ACCESS` access type based on the
+`CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS` variable. The NEW behavior for this
+policy is to always use `UNKNOWN_VARIABLE_READ_ACCESS` as the access type.
+
+This policy was introduced in CMake version 3.1.
+CMake version |release| warns when the policy is not set and uses
+``OLD`` behavior.  Use the :command:`cmake_policy` command to set it
+to ``OLD`` or ``NEW`` explicitly.
diff --git a/Help/release/dev/watch-variable-policy.rst b/Help/release/dev/watch-variable-policy.rst
new file mode 100644
index 0000000..0d96fb7
--- /dev/null
+++ b/Help/release/dev/watch-variable-policy.rst
@@ -0,0 +1,5 @@
+watch-variable-policy
+---------------------
+
+* Policy :policy:`CMP0054` introduced to improve variable lookup performance
+  for uninitialized variables.
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 90a7b0b..382767d 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2472,19 +2472,46 @@ const char* cmMakefile::GetDefinition(const std::string& name) const
       }
     else
       {
-      // are unknown access allowed
-      const char* allow = this->Internal->VarStack.top()
-        .Get("CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS");
-      if(cmSystemTools::IsOn(allow))
+      int type = cmVariableWatch::UNKNOWN_VARIABLE_READ_ACCESS;
+      switch(this->GetPolicyStatus(cmPolicies::CMP0054))
         {
-        vv->VariableAccessed(name,
-          cmVariableWatch::ALLOWED_UNKNOWN_VARIABLE_READ_ACCESS, def, this);
+        case cmPolicies::WARN:
+        {
+          // Warn if necessary.
+          const char* allow = this->Internal->VarStack.top()
+            .Get("CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS");
+          if(cmSystemTools::IsOn(allow))
+            {
+            this->IssueMessage(cmake::AUTHOR_WARNING,
+              this->GetPolicies()->GetPolicyWarning(cmPolicies::CMP0054));
+            // Checking again is unnecessary and doubly expensive (and the
+            // reason for the policy...); just duplicate the old behavior here.
+            type = cmVariableWatch::ALLOWED_UNKNOWN_VARIABLE_READ_ACCESS;
+            }
+          break;
         }
-      else
+        case cmPolicies::OLD:
         {
-        vv->VariableAccessed(name,
-          cmVariableWatch::UNKNOWN_VARIABLE_READ_ACCESS, def, this);
+          // OLD behavior is to use ALLOWED_UNKNOWN_VARIABLE_READ_ACCESS if
+          // needed.
+          const char* allow = this->Internal->VarStack.top()
+            .Get("CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS");
+          if(cmSystemTools::IsOn(allow))
+            {
+            type = cmVariableWatch::ALLOWED_UNKNOWN_VARIABLE_READ_ACCESS;
+            }
+          break;
+        }
+        case cmPolicies::REQUIRED_IF_USED:
+        case cmPolicies::REQUIRED_ALWAYS:
+          this->IssueMessage(cmake::FATAL_ERROR,
+            this->GetPolicies()->GetRequiredPolicyError(cmPolicies::CMP0054));
+          break;
+        case cmPolicies::NEW:
+          // Do nothing.
+          break;
         }
+      vv->VariableAccessed(name, type, def, this);
       }
     }
 #endif
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 693945d..199497a 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -359,6 +359,12 @@ cmPolicies::cmPolicies()
     CMP0053, "CMP0053",
     "Simplify variable reference and escape sequence evaluation.",
     3,1,0, cmPolicies::WARN);
+
+  this->DefinePolicy(
+    CMP0054, "CMP0054",
+    "Remove ALLOWED_UNKNOWN_VARIABLE_READ_ACCESS "
+    "variable_watch access type.",
+    3,1,0, cmPolicies::WARN);
 }
 
 cmPolicies::~cmPolicies()
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 5d69d14..99bcac7 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -106,6 +106,7 @@ public:
     CMP0050, ///< Disallow add_custom_command SOURCE signatures
     CMP0051, ///< List TARGET_OBJECTS in SOURCES target property
     CMP0052, ///< Reject source and build dirs in installed
+    CMP0054, ///< Remove ALLOWED_UNKNOWN_VARIABLE_READ_ACCESS access type
     /// INTERFACE_INCLUDE_DIRECTORIES
 
     CMP0053, ///< Simplify variable reference and escape sequence evaluation

-----------------------------------------------------------------------

Summary of changes:
 Help/manual/cmake-policies.7.rst                   |    1 +
 Help/policy/CMP0054.rst                            |   21 +++++++++
 Help/release/dev/watch-variable-policy.rst         |    5 +++
 Source/cmMakefile.cxx                              |   45 ++++++++++++++++----
 Source/cmPolicies.cxx                              |    6 +++
 Source/cmPolicies.h                                |    1 +
 .../CMP0054-NEW-result.txt}                        |    0
 Tests/RunCMake/CMP0054/CMP0054-NEW-stderr.txt      |    4 ++
 Tests/RunCMake/CMP0054/CMP0054-NEW.cmake           |   12 ++++++
 .../CMP0054-OLD-result.txt}                        |    0
 Tests/RunCMake/CMP0054/CMP0054-OLD-stderr.txt      |    4 ++
 Tests/RunCMake/CMP0054/CMP0054-OLD.cmake           |   12 ++++++
 .../CMP0054-WARN-result.txt}                       |    0
 Tests/RunCMake/CMP0054/CMP0054-WARN-stderr.txt     |   13 ++++++
 Tests/RunCMake/CMP0054/CMP0054-WARN.cmake          |   10 +++++
 Tests/RunCMake/{CMP0051 => CMP0054}/CMakeLists.txt |    0
 Tests/RunCMake/CMP0054/RunCMakeTest.cmake          |    5 +++
 Tests/RunCMake/CMakeLists.txt                      |    1 +
 18 files changed, 131 insertions(+), 9 deletions(-)
 create mode 100644 Help/policy/CMP0054.rst
 create mode 100644 Help/release/dev/watch-variable-policy.rst
 copy Tests/RunCMake/{CMP0022/CMP0022-WARN-empty-old-result.txt => CMP0054/CMP0054-NEW-result.txt} (100%)
 create mode 100644 Tests/RunCMake/CMP0054/CMP0054-NEW-stderr.txt
 create mode 100644 Tests/RunCMake/CMP0054/CMP0054-NEW.cmake
 copy Tests/RunCMake/{CMP0022/CMP0022-WARN-empty-old-result.txt => CMP0054/CMP0054-OLD-result.txt} (100%)
 create mode 100644 Tests/RunCMake/CMP0054/CMP0054-OLD-stderr.txt
 create mode 100644 Tests/RunCMake/CMP0054/CMP0054-OLD.cmake
 copy Tests/RunCMake/{CMP0022/CMP0022-WARN-empty-old-result.txt => CMP0054/CMP0054-WARN-result.txt} (100%)
 create mode 100644 Tests/RunCMake/CMP0054/CMP0054-WARN-stderr.txt
 create mode 100644 Tests/RunCMake/CMP0054/CMP0054-WARN.cmake
 copy Tests/RunCMake/{CMP0051 => CMP0054}/CMakeLists.txt (100%)
 create mode 100644 Tests/RunCMake/CMP0054/RunCMakeTest.cmake


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list