[Cmake-commits] CMake branch, next, updated. v3.1.2-1110-gac06e3e

Brad King brad.king at kitware.com
Fri Feb 6 13:39:53 EST 2015


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  ac06e3ebdab8cdec3195464774bf91f9404929a4 (commit)
       via  0f870234febd9dba0df78e903b412ea19d681062 (commit)
       via  cd408d93fdf347ff63a8062f75f1f4ee3e898b17 (commit)
       via  87be2e1427ba2b1b7697c9332487862917897dca (commit)
      from  a56d580574e11b13a9adb8de0632c6c0b4a8a4da (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=ac06e3ebdab8cdec3195464774bf91f9404929a4
commit ac06e3ebdab8cdec3195464774bf91f9404929a4
Merge: a56d580 0f87023
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Feb 6 13:39:52 2015 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Feb 6 13:39:52 2015 -0500

    Merge topic 'no-global-setlocale' into next
    
    0f870234 Merge branch 'backport-no-global-setlocale' into no-global-setlocale
    cd408d93 Add setlocale() calls around use of libarchive APIs (#14934, #15377)
    87be2e14 Do not call setlocale() globally in CMake applications (#15377)

diff --cc Source/cmSystemTools.cxx
index fea3b5f,6a7467f..2d70ab4
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@@ -26,7 -26,9 +26,8 @@@
  #include <cmsys/Encoding.hxx>
  #if defined(CMAKE_BUILD_WITH_CMAKE)
  # include "cmArchiveWrite.h"
+ # include "cmLocale.h"
  # include <cm_libarchive.h>
 -# include <cmsys/Terminal.h>
  #endif
  #include <cmsys/stl/algorithm>
  #include <cmsys/FStream.hxx>

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0f870234febd9dba0df78e903b412ea19d681062
commit 0f870234febd9dba0df78e903b412ea19d681062
Merge: 78c4418 cd408d9
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Feb 6 13:35:21 2015 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Feb 6 13:35:21 2015 -0500

    Merge branch 'backport-no-global-setlocale' into no-global-setlocale
    
    Resolve conflict in Source/CMakeLists.txt by taking both changes.

diff --cc Source/CMakeLists.txt
index 07839f3,1ff1c16..8a83c3e
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@@ -277,7 -261,7 +277,8 @@@ set(SRC
    cmLocalGenerator.cxx
    cmLocalGenerator.h
    cmLocalUnixMakefileGenerator3.cxx
+   cmLocale.h
 +  ${MACH_SRCS}
    cmMakeDepend.cxx
    cmMakeDepend.h
    cmMakefile.cxx

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cd408d93fdf347ff63a8062f75f1f4ee3e898b17
commit cd408d93fdf347ff63a8062f75f1f4ee3e898b17
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Feb 6 13:23:07 2015 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Feb 6 13:32:57 2015 -0500

    Add setlocale() calls around use of libarchive APIs (#14934, #15377)
    
    The libarchive APIs use nl_langinfo(CODESET) for iconv so they need the
    locale to be set for LC_CTYPE.  However, the rest of CMake does not
    define any behavior for non-ASCII character classification/conversion so
    we do not want to setlocale() globally.  Add a RAII class to save, set,
    and restore the locale around calls to libarchive APIs.
    
    Inspired-by: Clinton Stimpson <clinton at elemtech.com>

diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index f9405b3..1ff1c16 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -261,6 +261,7 @@ set(SRCS
   cmLocalGenerator.cxx
   cmLocalGenerator.h
   cmLocalUnixMakefileGenerator3.cxx
+  cmLocale.h
   cmMakeDepend.cxx
   cmMakeDepend.h
   cmMakefile.cxx
diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx
index a2aecac..9f28d42 100644
--- a/Source/cmArchiveWrite.cxx
+++ b/Source/cmArchiveWrite.cxx
@@ -12,6 +12,7 @@
 #include "cmArchiveWrite.h"
 
 #include "cmSystemTools.h"
+#include "cmLocale.h"
 #include <cmsys/ios/iostream>
 #include <cmsys/Directory.hxx>
 #include <cmsys/FStream.hxx>
@@ -259,6 +260,9 @@ bool cmArchiveWrite::AddFile(const char* file,
     }
   const char* out = file + skip;
 
+  cmLocaleRAII localeRAII;
+  static_cast<void>(localeRAII);
+
   // Meta-data.
   std::string dest = prefix? prefix : "";
   dest += out;
diff --git a/Source/cmLocale.h b/Source/cmLocale.h
new file mode 100644
index 0000000..727f0f5
--- /dev/null
+++ b/Source/cmLocale.h
@@ -0,0 +1,31 @@
+/*============================================================================
+  CMake - Cross Platform Makefile Generator
+  Copyright 2000-2015 Kitware, Inc., Insight Software Consortium
+
+  Distributed under the OSI-approved BSD License (the "License");
+  see accompanying file Copyright.txt for details.
+
+  This software is distributed WITHOUT ANY WARRANTY; without even the
+  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  See the License for more information.
+============================================================================*/
+#ifndef cmLocale_h
+#define cmLocale_h
+
+#include <locale.h>
+
+class cmLocaleRAII
+{
+  const char* OldLocale;
+public:
+  cmLocaleRAII(): OldLocale(setlocale(LC_CTYPE, 0))
+    {
+    setlocale(LC_CTYPE, "");
+    }
+  ~cmLocaleRAII()
+    {
+    setlocale(LC_CTYPE, this->OldLocale);
+    }
+};
+
+#endif
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index fbb4416..89efdc7 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -28,6 +28,7 @@
 #include <cmsys/Encoding.hxx>
 #if defined(CMAKE_BUILD_WITH_CMAKE)
 # include "cmArchiveWrite.h"
+# include "cmLocale.h"
 # include <cm_libarchive.h>
 # include <cmsys/Terminal.h>
 #endif
@@ -1691,6 +1692,8 @@ long copy_data(struct archive *ar, struct archive *aw)
 bool extract_tar(const char* outFileName, bool verbose,
                  bool extract)
 {
+  cmLocaleRAII localeRAII;
+  static_cast<void>(localeRAII);
   struct archive* a = archive_read_new();
   struct archive *ext = archive_write_disk_new();
   archive_read_support_compression_all(a);

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=87be2e1427ba2b1b7697c9332487862917897dca
commit 87be2e1427ba2b1b7697c9332487862917897dca
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Feb 6 13:09:37 2015 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Feb 6 13:32:26 2015 -0500

    Do not call setlocale() globally in CMake applications (#15377)
    
    Revert the changes made by commit v3.1.0-rc1~406^2~1 (Encoding: Add
    setlocale() to applications, 2014-05-30) and commit v3.1.0-rc1~406^2
    (Encoding: Change to only set LC_CTYPE, 2014-06-11), and other setlocale
    calls added later in their spirit.  CMake has not been taught how to
    deal with non-C locales everywhere.  We do not define any functionality
    for character conversions for non-ASCII strings.  Another solution will
    be needed to address the original problem motivating addition of
    setlocale() calls.

diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index c57028d..0173361 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -26,7 +26,6 @@
 #include <cmsys/CommandLineArguments.hxx>
 #include <cmsys/SystemTools.hxx>
 #include <cmsys/Encoding.hxx>
-#include <locale.h>
 
 //----------------------------------------------------------------------------
 static const char * cmDocumentationName[][2] =
@@ -101,7 +100,6 @@ int cpackDefinitionArgument(const char* argument, const char* cValue,
 // this is CPack.
 int main (int argc, char const* const* argv)
 {
-  setlocale(LC_CTYPE, "");
   cmsys::Encoding::CommandLineArguments args =
     cmsys::Encoding::CommandLineArguments::Main(argc, argv);
   argc = args.argc();
diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx
index 28f3d9b..3d92a2d 100644
--- a/Source/CursesDialog/ccmake.cxx
+++ b/Source/CursesDialog/ccmake.cxx
@@ -16,7 +16,6 @@
 
 #include <signal.h>
 #include <sys/ioctl.h>
-#include <locale.h>
 
 #include "cmCursesMainForm.h"
 #include "cmCursesStandardIncludes.h"
@@ -95,8 +94,6 @@ void CMakeMessageHandler(const char* message, const char* title, bool&,
 
 int main(int argc, char const* const* argv)
 {
-  setlocale(LC_CTYPE, "");
-
   cmsys::Encoding::CommandLineArguments encoding_args =
     cmsys::Encoding::CommandLineArguments::Main(argc, argv);
   argc = encoding_args.argc();
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 61b175e..e825f1f 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -25,7 +25,6 @@
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
 #include <cmsys/Encoding.hxx>
-#include <locale.h>
 
 #ifdef CMAKE_BUILD_WITH_CMAKE
 //----------------------------------------------------------------------------
@@ -175,7 +174,6 @@ static void cmakemainProgressCallback(const char *m, float prog,
 
 int main(int ac, char const* const* av)
 {
-  setlocale(LC_CTYPE, "");
   cmsys::Encoding::CommandLineArguments args =
     cmsys::Encoding::CommandLineArguments::Main(ac, av);
   ac = args.argc();
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index fb97af6..3fe31ca 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -19,7 +19,6 @@
 #include "CTest/cmCTestScriptHandler.h"
 #include "CTest/cmCTestLaunch.h"
 #include "cmsys/Encoding.hxx"
-#include <locale.h>
 
 //----------------------------------------------------------------------------
 static const char * cmDocumentationName[][2] =
@@ -117,8 +116,6 @@ static const char * cmDocumentationOptions[][2] =
 // this is a test driver program for cmCTest.
 int main (int argc, char const* const* argv)
 {
-  setlocale(LC_CTYPE, "");
-
   cmsys::Encoding::CommandLineArguments encoding_args =
     cmsys::Encoding::CommandLineArguments::Main(argc, argv);
   argc = encoding_args.argc();
diff --git a/Tests/CTestTestMemcheck/memtester.cxx.in b/Tests/CTestTestMemcheck/memtester.cxx.in
index 43c0ba7..c018e08 100644
--- a/Tests/CTestTestMemcheck/memtester.cxx.in
+++ b/Tests/CTestTestMemcheck/memtester.cxx.in
@@ -1,14 +1,12 @@
 #include <cmSystemTools.h>
 #include <cmsys/Encoding.hxx>
 #include <string>
-#include <locale.h>
 
 #define RETVAL @_retval@
 
 int
 main(int ac, char **av)
 {
-  setlocale(LC_CTYPE, "");
   cmsys::Encoding::CommandLineArguments args =
     cmsys::Encoding::CommandLineArguments::Main(ac, av);
   int argc = args.argc();

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

Summary of changes:
 Source/CMakeLists.txt                          |    1 +
 Source/CPack/cpack.cxx                         |    2 --
 Source/CursesDialog/ccmake.cxx                 |    3 ---
 Source/cmArchiveWrite.cxx                      |    4 ++++
 Source/{cmCurl.h => cmLocale.h}                |   22 ++++++++++++++++------
 Source/cmSystemTools.cxx                       |    3 +++
 Source/cmakemain.cxx                           |    2 --
 Source/ctest.cxx                               |    3 ---
 Tests/CMakeLib/PseudoMemcheck/memtester.cxx.in |    2 --
 9 files changed, 24 insertions(+), 18 deletions(-)
 copy Source/{cmCurl.h => cmLocale.h} (67%)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list