Squashed 'third_party/gflags/' changes from f0523f1..7e70988

7e70988 fix: PVS Studio warnings
754d332 fix: No extern template declaration for MSVC <12.0
82456f2 fix: Declare FlagRegisterer c’tor explicit template instanations as extern in header
3e2e349 fix: Declare FALGS_no##name variables as static
c0b1add fix: Import with GFLAGS_USE_TARGET_NAMESPACE=ON
f1ea012 fix: Import with or without gflags:: namespace
b0c4cd2 fix: Define both 'gflags' and 'gflags::gflags' alias targets
04c8ce7 fix: Indentation, use spaces instead of real tabs
d4a050d Merge pull request #247 from Mizux/master
48677f9 fix missing-field-initializers warnings on gcc
6e53655 Fix V728 excessive check
cad38c9 Set postfixes for generated libraries based on buildtype
2c49763 Fix build on some clang variants
660603a doc: Update documentation on how to use Bazel
518267d Remove installation guide's recommendation to use Bazel's bind().
f7228d7 Use CMake namespace gflags:: for export and alias target
8b39845 Remove uneeded enable_test()
9ab4d11 Add VERSION to project
e292e04 Use += for appends
6d1c363 Add Bazel-on-Windows support
7759264 repair wrong namespace problem
2334846 Removed unused functions.
60784b5 Remove using ::fLS::clstring;
57ceb0e enh: Move CMake defines to separate header, unused by Bazel
7d36353 Fix typo in BUILD
aa2d0f7 fix: Remove obsolete and unused CleanFileName code
4663c80 cmake: Add convenience uninstall target (#221)
46f73f8 Release v2.2.1
66d4386 enh: AppVeyor builds with different toolchains (copied from gtest project)
6348ea9 fix: Check HAVE_STDINT_H or HAVE_INTTYPES_H for older MSVC versions
3d5bc48 git: Ignore symbolic links created by Bazel build tool
74603f5 fix: Static code analyzer error regarding strncmp with empty kRootDir string
4a694e8 Use inttypes.h on VC++ 2013 and up
21c7bcd Fix CMake macro special variable usage (#216)
95ffb27 Fix static initialization order fiasco caused by global registry lock (#215)
80ebb42 Install dll's to correct path (#213)
652651b Fix statically linked gflags library with MSVC
9314597 Mark single argument constructors in mutex.h as explicit.
30dbc81 Changed include directory in bazel build
8935ef4 enh: Link to online documentation in README
20858a4 fix: Enable language C for older CMake versions when needed (#196)
ac6834e fix: Remove unused program_name variable
22ed2ce fix: Include utils by file instead of CMAKE_MODULE_PATH search
f8a0efe Release v2.2.0
2f336a2 doc: //external:gflags_nothreads Bazel target
c6b9377 git: Ignore builds/ subdirectory
84ab952 doc: Update use of gflags with Bazel documentation
b872d6b enh: Bazel BUILD, add WORKSPACE file (#192)
37c4c58 add: Bazel WORKSPACE file
37e2867 enh: Refactored Bazel BUILD rules
8f2c22a Revert "enh: Rename private sources, include public headers with rel path"
ea6144e enh: Rename private sources, include public headers with rel path
86d67a3 fix: Add -lpthread to link Bazel BUILD options (#189)
c94a60e enh: Configure and install pkg-config .pc file
3e7ef74 enh: Set GFLAGS_IS_A_DLL in INTERFACE_COMPILE_DEFINITIONS
1846983 fix: Ensure installation path uses forward slashes
3886da5 enh: Add option to add installation to CMake’s package registry
6c0ee00 fix: Copy missing IMPORTED_IMPLIB_<CONFIG> gflags target property
3064f63 enh: Avoid use of install(EXPORTS) FILE option
14c0e93 Convert dashes to underscores for unknown flags (#177)
cce68f0 Fix error messages to not truncate to 255 characters (#175)
f4eace1 fix: Validate modified flags only once (#173)
408061b fix make error for lacking namespace (#170)
7d31c02 Fix unsigned comparison error in gflags_reporting.cc (#168)
a69b254 Fix Windows linker errors and warnings. (#166)
15394d3 Add shared library build to the AppVeyor CI config. (#167)
e58e530 Remove filter for excluded tests from AppVeyor config. (#165)
435f949 test: Travis CI build static+shared in Release+Debug (#164)
22e4a53 fix: Run strip_flags_binary test only for release configurations (#163)
c713d2e test: Run AppVeyor build via cmake --build and run tests. (#162)
b16653e fix: Typo in gflags_strip_flags_test.cmake script
ec4b5da doc: Add AppVeyor status badge to README
f0be9c8 Add initial AppVeyor config. (#161)
78cab6c doc: Add Travis CI status badge to README
4667f41 Enable Travis CI for Linux and OSX builds (#160)
a5a1b28 Merge pull request #158 from dreamer-dead/use-type-name-enum
7ba9921 Fix wrong type comparison and outdated OfType() usage.
3051942 Fix indentation and remove outdated assert.
3c0ad4f Extract common code from FlagRegisterer to reduce size.
a1e461d Change template FlagValue::OfType() to Type() getter.
46ea10f Do not pass flag type as a char literal when registering a new flag.
fe57e5a Merge pull request #156 from dreamer-dead/fix-flag-value-typename
fa26638 Fix unittests expectations related to uint32.
5ef4c3c Fix uint32 type name.
2e4159f Merge pull request #155 from dreamer-dead/add-missing-reference
3e946c9 Add missing reference symbol to a function parameter.
546819b Merge pull request #152 from Liuchang0812/master
0c17f1e fix bug about LRLF
ac1a925 fix #151: Ubuntu package name in INSTALL instructions
d701cea Merge pull request #150 from LuminateWireless/fix-bazel-build
7ae23fd Add gendir to the include path so that building with bazel doesn't complain config.h can't be found.
8de80b9 Merge pull request #149 from hevy-CC4477/master
eff38cb fix test compilation
9353bca Merge pull request #147 from bazineta/master
81d8a92 Correct FV_MAX_INDEX
eaf0534 Support uint32 as flag type
74bcd20 Merge PR #137 with change of SOVERSION to <major>.<minor>
4534195 fix: Change SOVERSION to <major>.<minor> for 2.x release versions
5e30706 Merge pull request #143 from schuhschuh/fix-bazel-bulid-osx
687b2c5 fix #133: Use awk instead of sed which would require different options on OS X
5844199 Merge pull request #142 from schuhschuh/master
1c8285f mod: Update doc with new find_package COMPONENTS or subproject use
12d810d Merge pull request #141 from schuhschuh/master
389ef3f Merge branch 'master' of github.com:gflags/gflags
752c632 fix: Include order of config.h and gflags.h in unit test
f9e69b3 Merge pull request #140 from schuhschuh/enh-#117-gflags-subproject-support
7a21c16 cmake: Rename targets to gflags[_nothreads]_(static|shared), support find_package COMPONENTS
a4382e5 cmake: Require CMake 2.8.12 in NC tests
2de6bf3 cmake: Change CMake package configuration variable name prefix to GFLAGS_
91e16ee cmake: Add CMake variable to cache only when gflags is not a subproject
b686469 git: Add CMakeLists.txt.user Qt Creator configuration to ignore list
e50698c Merge pull request #139 from schuhschuh/master
18cb422 fix: Require CMake version 2.8.12 in test project
799e910 fix: Include private config.h in gflags_unittest.cc
abe4b10 fix: Package URLs
221f327 Revert "#136 Move test binaries to Testing/bin"
2a3454c fix: DLL import/export defines for unit tests, remove obsolete config_for_unittests.h
545e9df fix: Add missing include guards to gflags/config.h
6bd636c cmake: Clean up static library filename suffix code from PR #126
dd48d70 Merge pull request #126 from hevy-CC4477/master
9ef0d52 enh: Add usage of DEFINE_validator to test project
02f3189 #136 Move test binaries to Testing/bin
92865ce #51 #138 Use std::string instead const char * for global "constants"
8ac4bc4 fix: Pass std::string directly, no need for c_str() call
b90a325 properly export the .so minor version
3ae911f mod: Update doc
762f9cb #51 Call ShutDownCommandLineFlags for (manual) valgrind test
7a69001 #51 Use static StringFlagDestructor to destruct string objects allocated by placement new
3f968fc Merge pull request #133 from earhart/master
40b85b1 Add bazel support
f9fa305 Merge pull request #131 from sbc100/no_threads
b572a72 Define NO_THREADS in when building without threads
03bebcb Merge pull request #129 from Nazg-Gul/master
366e9d3 Fix some compilation warnings with MSVC 2015
4f100cb Resolve several missing declarations warnings
d78b00d handle generation of dynamic and static library on windows.
9db8289 #125 Fix unused typedef/variable warning for static assertion
4e61c45 #124 Remove using namespace from mutex.h

Change-Id: I61f02738b43ce97c825345375af77a44231165f4
git-subtree-dir: third_party/gflags
git-subtree-split: 7e709881881c2663569cd49a93e5c8d9228d868e
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 77b582f..4cd1e69 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -18,13 +18,16 @@
 
 if (BUILD_SHARED_LIBS)
   set (type shared)
+  if (GFLAGS_IS_A_DLL)
+    add_definitions(-DGFLAGS_IS_A_DLL)
+  endif ()
 else ()
   set (type static)
 endif ()
 if (BUILD_gflags_LIB)
-  link_libraries (gflags-${type})
+  link_libraries (gflags_${type})
 else ()
-  link_libraries (gflags_nothreads-${type})
+  link_libraries (gflags_nothreads_${type})
 endif ()
 
 # ----------------------------------------------------------------------------
@@ -37,6 +40,7 @@
   NAME strip_flags_binary
   COMMAND "${CMAKE_COMMAND}" "-DBINARY=$<TARGET_FILE:gflags_strip_flags_test>"
           -P "${CMAKE_CURRENT_SOURCE_DIR}/gflags_strip_flags_test.cmake"
+  CONFIGURATIONS Release MinSizeRel
 )
 
 # ----------------------------------------------------------------------------
diff --git a/test/config/CMakeLists.txt b/test/config/CMakeLists.txt
index b5bc282..6190b25 100644
--- a/test/config/CMakeLists.txt
+++ b/test/config/CMakeLists.txt
@@ -1,10 +1,10 @@
 ## gflags package configuration tests
 
-cmake_minimum_required (VERSION 2.8)
+cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR)
 
 project (gflags_${TEST_NAME})
 
 find_package (gflags REQUIRED)
 
 add_executable (foo main.cc)
-target_link_libraries (foo gflags)
+target_link_libraries (foo gflags::gflags)
diff --git a/test/config/main.cc b/test/config/main.cc
index 9b2b898..3c033e3 100644
--- a/test/config/main.cc
+++ b/test/config/main.cc
@@ -3,10 +3,18 @@
 
 DEFINE_string(message, "Hello World!", "The message to print");
 
+static bool ValidateMessage(const char* flagname, const std::string &message)
+{
+  return !message.empty();
+}
+DEFINE_validator(message, ValidateMessage);
+
 int main(int argc, char **argv)
 {
   gflags::SetUsageMessage("Test CMake configuration of gflags library (gflags-config.cmake)");
+  gflags::SetVersionString("0.1");
   gflags::ParseCommandLineFlags(&argc, &argv, true);
   std::cout << FLAGS_message << std::endl;
+  gflags::ShutDownCommandLineFlags();
   return 0;
 }
diff --git a/test/config_for_unittests.h b/test/config_for_unittests.h
deleted file mode 100644
index 914571b..0000000
--- a/test/config_for_unittests.h
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright (c) 2007, Google Inc.
-// All rights reserved.
-// 
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-// 
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-// 
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// ---
-// All Rights Reserved.
-//
-//
-// This file is needed for windows -- unittests are not part of the
-// gflags dll, but still want to include config.h just like the
-// dll does, so they can use internal tools and APIs for testing.
-//
-// The problem is that config.h declares GFLAGS_DLL_DECL to be
-// for exporting symbols, but the unittest needs to *import* symbols
-// (since it's not the dll).
-//
-// The solution is to have this file, which is just like config.h but
-// sets GFLAGS_DLL_DECL to do a dllimport instead of a dllexport.
-//
-// The reason we need this extra GFLAGS_DLL_DECL_FOR_UNITTESTS
-// variable is in case people want to set GFLAGS_DLL_DECL explicitly
-// to something other than __declspec(dllexport).  In that case, they
-// may want to use something other than __declspec(dllimport) for the
-// unittest case.  For that, we allow folks to define both
-// GFLAGS_DLL_DECL and GFLAGS_DLL_DECL_FOR_UNITTESTS explicitly.
-//
-// NOTE: This file is equivalent to config.h on non-windows systems,
-// which never defined GFLAGS_DLL_DECL_FOR_UNITTESTS and always
-// define GFLAGS_DLL_DECL to the empty string.
-
-#include "config.h"
-
-#ifdef GFLAGS_DLL_DECL
-#  undef GFLAGS_DLL_DECL
-#endif
-#ifdef GFLAGS_DLL_DEFINE_FLAG
-#  undef GFLAGS_DLL_DEFINE_FLAG
-#endif
-#ifdef GFLAGS_DLL_DECLARE_FLAG
-#  undef GFLAGS_DLL_DECLARE_FLAG
-#endif
-
-#ifdef GFLAGS_DLL_DECL_FOR_UNITTESTS
-#  define GFLAGS_DLL_DECL  GFLAGS_DLL_DECL_FOR_UNITTESTS
-#else
-#  define GFLAGS_DLL_DECL  // if DLL_DECL_FOR_UNITTESTS isn't defined, use ""
-#endif
-
-// Import flags defined by gflags.cc
-#if GFLAGS_IS_A_DLL && defined(_MSC_VER)
-#  define GFLAGS_DLL_DECLARE_FLAG __declspec(dllimport)
-#else
-#  define GFLAGS_DLL_DECLARE_FLAG
-#endif
\ No newline at end of file
diff --git a/test/gflags_declare_flags.cc b/test/gflags_declare_flags.cc
old mode 100644
new mode 100755
index dc53de5..3d952a8
--- a/test/gflags_declare_flags.cc
+++ b/test/gflags_declare_flags.cc
@@ -1,8 +1,11 @@
+#define GFLAGS_DLL_DECLARE_FLAG
+
 #include <iostream>
 #include <gflags/gflags_declare.h>
 
 DECLARE_string(message); // in gflags_delcare_test.cc
 
+void print_message();
 void print_message()
 {
   std::cout << FLAGS_message << std::endl;
diff --git a/test/gflags_declare_test.cc b/test/gflags_declare_test.cc
index 707bcc0..47d11c2 100644
--- a/test/gflags_declare_test.cc
+++ b/test/gflags_declare_test.cc
@@ -5,8 +5,8 @@
 
 int main(int argc, char **argv)
 {
-  gflags::SetUsageMessage("Test compilation and use of gflags_declare.h");
-  gflags::ParseCommandLineFlags(&argc, &argv, true);
+  GFLAGS_NAMESPACE::SetUsageMessage("Test compilation and use of gflags_declare.h");
+  GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true);
   print_message();
   return 0;
 }
diff --git a/test/gflags_strip_flags_test.cc b/test/gflags_strip_flags_test.cc
old mode 100644
new mode 100755
index 25ef53a..143f0c6
--- a/test/gflags_strip_flags_test.cc
+++ b/test/gflags_strip_flags_test.cc
@@ -34,7 +34,6 @@
 // script that runs 'strings' over this program and makes sure
 // that the help string is not in there.
 
-#include "config_for_unittests.h"
 #define STRIP_FLAG_HELP 1
 #include <gflags/gflags.h>
 
diff --git a/test/gflags_strip_flags_test.cmake b/test/gflags_strip_flags_test.cmake
index bd419c4..5bb5cc1 100644
--- a/test/gflags_strip_flags_test.cmake
+++ b/test/gflags_strip_flags_test.cmake
@@ -1,7 +1,7 @@
 if (NOT BINARY)
-  message (FATAl_ERROR "BINARY file to check not specified!")
+  message (FATAL_ERROR "BINARY file to check not specified!")
 endif ()
 file (STRINGS "${BINARY}" strings REGEX "This text should be stripped out")
 if (strings)
   message (FATAL_ERROR "Text not stripped from binary like it should be: ${BINARY}")
-endif ()
\ No newline at end of file
+endif ()
diff --git a/test/gflags_unittest.cc b/test/gflags_unittest.cc
old mode 100644
new mode 100755
index 80f7398..9a922ef
--- a/test/gflags_unittest.cc
+++ b/test/gflags_unittest.cc
@@ -32,9 +32,11 @@
 // For now, this unit test does not cover all features of
 // gflags.cc
 
-#include "config_for_unittests.h"
 #include <gflags/gflags.h>
 
+#include "config.h"
+#include "util.h"
+
 #include <math.h>       // for isinf() and isnan()
 #include <stdio.h>
 #include <stdlib.h>
@@ -44,7 +46,6 @@
 #endif
 #include <vector>
 #include <string>
-#include "util.h"
 TEST_INIT
 EXPECT_DEATH_INIT
 
@@ -74,6 +75,7 @@
 DEFINE_bool(test_bool, false, "tests bool-ness");
 DEFINE_int32(test_int32, -1, "");
 DEFINE_int64(test_int64, -2, "");
+DEFINE_uint32(test_uint32, 1, "");
 DEFINE_uint64(test_uint64, 2, "");
 DEFINE_double(test_double, -1.0, "");
 DEFINE_string(test_string, "initial", "");
@@ -114,6 +116,7 @@
 DEFINE_bool(unused_bool, true, "unused bool-ness");
 DEFINE_int32(unused_int32, -1001, "");
 DEFINE_int64(unused_int64, -2001, "");
+DEFINE_uint32(unused_uint32, 1000, "");
 DEFINE_uint64(unused_uint64, 2000, "");
 DEFINE_double(unused_double, -1000.0, "");
 DEFINE_string(unused_string, "unused", "");
@@ -213,7 +216,7 @@
   int32 FLAGS_tldflag1 = FLAGS_nonotldflag1;
   int32 FLAGS_notldflag1 = FLAGS_nonotldflag1;
   static FlagRegisterer o_tldflag1(
-    "tldflag1", "int32",
+    "tldflag1",
     "should show up in --helpshort", "gflags_unittest.cc",
     &FLAGS_tldflag1, &FLAGS_notldflag1);
 }
@@ -224,7 +227,7 @@
   int32 FLAGS_tldflag2 = FLAGS_nonotldflag2;
   int32 FLAGS_notldflag2 = FLAGS_nonotldflag2;
   static FlagRegisterer o_tldflag2(
-    "tldflag2", "int32",
+    "tldflag2",
     "should show up in --helpshort", "gflags_unittest.",
     &FLAGS_tldflag2, &FLAGS_notldflag2);
 }
@@ -276,6 +279,7 @@
   AssertIsType<bool>(FLAGS_test_bool);
   AssertIsType<int32>(FLAGS_test_int32);
   AssertIsType<int64>(FLAGS_test_int64);
+  AssertIsType<uint32>(FLAGS_test_uint32);
   AssertIsType<uint64>(FLAGS_test_uint64);
   AssertIsType<double>(FLAGS_test_double);
   AssertIsType<string>(FLAGS_test_string);
@@ -353,6 +357,19 @@
       false,
       123,
       123.0);
+
+  // Test that flags can use dashes instead of underscores.
+  TestFlagString(
+      // Flag string
+      "-test-string=initial\n"
+      "--test-bool=false\n"
+      "--test-int32=123\n"
+      "--test-double=123.0\n",
+      // Expected values
+      "initial",
+      false,
+      123,
+      123.0);
 }
 
 // Tests the filename part of the flagfile
@@ -590,12 +607,16 @@
   FLAGS_test_bool = true;
   FLAGS_test_int32 = 119;
   FLAGS_test_int64 = 1191;
-  FLAGS_test_uint64 = 11911;
+  FLAGS_test_uint32 = 11911;
+  FLAGS_test_uint64 = 119111;
 
   EXPECT_EQ("",
             SetCommandLineOption("test_bool", "12"));
 
   EXPECT_EQ("",
+            SetCommandLineOption("test_uint32", "-1970"));
+
+  EXPECT_EQ("",
             SetCommandLineOption("test_int32", "7000000000000"));
 
   EXPECT_EQ("",
@@ -608,6 +629,7 @@
   EXPECT_EQ("", SetCommandLineOption("test_bool", ""));
   EXPECT_EQ("", SetCommandLineOption("test_int32", ""));
   EXPECT_EQ("", SetCommandLineOption("test_int64", ""));
+  EXPECT_EQ("", SetCommandLineOption("test_uint32", ""));
   EXPECT_EQ("", SetCommandLineOption("test_uint64", ""));
   EXPECT_EQ("", SetCommandLineOption("test_double", ""));
   EXPECT_EQ("test_string set to \n", SetCommandLineOption("test_string", ""));
@@ -615,7 +637,8 @@
   EXPECT_TRUE(FLAGS_test_bool);
   EXPECT_EQ(119, FLAGS_test_int32);
   EXPECT_EQ(1191, FLAGS_test_int64);
-  EXPECT_EQ(11911, FLAGS_test_uint64);
+  EXPECT_EQ(11911, FLAGS_test_uint32);
+  EXPECT_EQ(119111, FLAGS_test_uint64);
 }
 
 
@@ -668,14 +691,19 @@
   EXPECT_EQ(-1, Int32FromEnv("INT_VAL2", 10));
   EXPECT_EQ(10, Int32FromEnv("INT_VAL_UNKNOWN", 10));
 
-  setenv("INT_VAL3", "1099511627776", 1);
+  setenv("INT_VAL3", "4294967295", 1);
+  EXPECT_EQ(1, Uint32FromEnv("INT_VAL1", 10));
+  EXPECT_EQ(4294967295L, Uint32FromEnv("INT_VAL3", 30));
+  EXPECT_EQ(10, Uint32FromEnv("INT_VAL_UNKNOWN", 10));
+
+  setenv("INT_VAL4", "1099511627776", 1);
   EXPECT_EQ(1, Int64FromEnv("INT_VAL1", 20));
   EXPECT_EQ(-1, Int64FromEnv("INT_VAL2", 20));
-  EXPECT_EQ(1099511627776LL, Int64FromEnv("INT_VAL3", 20));
+  EXPECT_EQ(1099511627776LL, Int64FromEnv("INT_VAL4", 20));
   EXPECT_EQ(20, Int64FromEnv("INT_VAL_UNKNOWN", 20));
 
   EXPECT_EQ(1, Uint64FromEnv("INT_VAL1", 30));
-  EXPECT_EQ(1099511627776ULL, Uint64FromEnv("INT_VAL3", 30));
+  EXPECT_EQ(1099511627776ULL, Uint64FromEnv("INT_VAL4", 30));
   EXPECT_EQ(30, Uint64FromEnv("INT_VAL_UNKNOWN", 30));
 
   // I pick values here that can be easily represented exactly in floating-point
@@ -711,6 +739,11 @@
   EXPECT_DEATH(Int32FromEnv("INT_BAD3", 10), "error parsing env variable");
   EXPECT_DEATH(Int32FromEnv("INT_BAD4", 10), "error parsing env variable");
 
+  EXPECT_DEATH(Uint32FromEnv("INT_BAD1", 10), "error parsing env variable");
+  EXPECT_DEATH(Uint32FromEnv("INT_BAD2", 10), "error parsing env variable");
+  EXPECT_DEATH(Uint32FromEnv("INT_BAD3", 10), "error parsing env variable");
+  EXPECT_DEATH(Uint32FromEnv("INT_BAD4", 10), "error parsing env variable");
+
   setenv("BIGINT_BAD1", "18446744073709551616000", 1);
   EXPECT_DEATH(Int64FromEnv("INT_BAD1", 20), "error parsing env variable");
   EXPECT_DEATH(Int64FromEnv("INT_BAD3", 20), "error parsing env variable");
@@ -814,9 +847,10 @@
   // Initializes the flags.
   FLAGS_test_bool = false;
   FLAGS_test_int32 = -1;
-  FLAGS_test_int64 = -2;
-  FLAGS_test_uint64 = 3;
-  FLAGS_test_double = 4.0;
+  FLAGS_test_uint32 = 2;
+  FLAGS_test_int64 = -3;
+  FLAGS_test_uint64 = 4;
+  FLAGS_test_double = 5.0;
   FLAGS_test_string = "good";
 
   // Saves the flag states.
@@ -826,8 +860,9 @@
     // Modifies the flags.
     FLAGS_test_bool = true;
     FLAGS_test_int32 = -5;
-    FLAGS_test_int64 = -6;
-    FLAGS_test_uint64 = 7;
+    FLAGS_test_uint32 = 6;
+    FLAGS_test_int64 = -7;
+    FLAGS_test_uint64 = 8;
     FLAGS_test_double = 8.0;
     FLAGS_test_string = "bad";
 
@@ -837,9 +872,10 @@
   // Verifies the flag values were restored.
   EXPECT_FALSE(FLAGS_test_bool);
   EXPECT_EQ(-1, FLAGS_test_int32);
-  EXPECT_EQ(-2, FLAGS_test_int64);
-  EXPECT_EQ(3, FLAGS_test_uint64);
-  EXPECT_DOUBLE_EQ(4.0, FLAGS_test_double);
+  EXPECT_EQ(2, FLAGS_test_uint32);
+  EXPECT_EQ(-3, FLAGS_test_int64);
+  EXPECT_EQ(4, FLAGS_test_uint64);
+  EXPECT_DOUBLE_EQ(5.0, FLAGS_test_double);
   EXPECT_EQ("good", FLAGS_test_string);
 }
 
@@ -1332,7 +1368,7 @@
   // addresses of these variables will be overwritten...  Stack smash!
   static bool current_storage;
   static bool defvalue_storage;
-  FlagRegisterer fr("flag_name", "bool", 0, "filename",
+  FlagRegisterer fr("flag_name", NULL, "filename",
                     &current_storage, &defvalue_storage);
   CommandLineFlagInfo fi;
   EXPECT_TRUE(GetCommandLineFlagInfo("flag_name", &fi));
@@ -1485,7 +1521,7 @@
 
 }  // unnamed namespace
 
-int main(int argc, char **argv) {
+static int main(int argc, char **argv) {
 
   // Run unit tests only if called without arguments, otherwise this program
   // is used by an "external" usage test
@@ -1514,7 +1550,7 @@
   // The non-recommended way:
   FLAGS_changed_bool2 = true;
 
-  SetUsageMessage(usage_message.c_str());
+  SetUsageMessage(usage_message);
   SetVersionString("test_version");
   ParseCommandLineFlags(&argc, &argv, true);
   MakeTmpdir(&FLAGS_test_tmpdir);
diff --git a/test/nc/CMakeLists.txt b/test/nc/CMakeLists.txt
index e425d91..d00b07d 100644
--- a/test/nc/CMakeLists.txt
+++ b/test/nc/CMakeLists.txt
@@ -1,6 +1,6 @@
 ## gflags negative compilation tests
 
-cmake_minimum_required (VERSION 2.8)
+cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR)
 
 if (NOT TEST_NAME)
   message (FATAL_ERROR "Missing TEST_NAME CMake flag")
@@ -13,4 +13,4 @@
 include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/..")
 add_definitions (-DTEST_${TEST_NAME_UPPER})
 add_executable (gflags_${TEST_NAME} gflags_nc.cc)
-target_link_libraries(gflags_${TEST_NAME} ${gflags_LIBRARIES})
+target_link_libraries(gflags_${TEST_NAME} gflags)