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.
This commit is contained in:
Brad King 2015-02-06 13:09:37 -05:00
parent 44100adc6c
commit 87be2e1427
5 changed files with 0 additions and 12 deletions

View File

@ -26,7 +26,6 @@
#include <cmsys/CommandLineArguments.hxx> #include <cmsys/CommandLineArguments.hxx>
#include <cmsys/SystemTools.hxx> #include <cmsys/SystemTools.hxx>
#include <cmsys/Encoding.hxx> #include <cmsys/Encoding.hxx>
#include <locale.h>
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static const char * cmDocumentationName[][2] = static const char * cmDocumentationName[][2] =
@ -101,7 +100,6 @@ int cpackDefinitionArgument(const char* argument, const char* cValue,
// this is CPack. // this is CPack.
int main (int argc, char const* const* argv) int main (int argc, char const* const* argv)
{ {
setlocale(LC_CTYPE, "");
cmsys::Encoding::CommandLineArguments args = cmsys::Encoding::CommandLineArguments args =
cmsys::Encoding::CommandLineArguments::Main(argc, argv); cmsys::Encoding::CommandLineArguments::Main(argc, argv);
argc = args.argc(); argc = args.argc();

View File

@ -16,7 +16,6 @@
#include <signal.h> #include <signal.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <locale.h>
#include "cmCursesMainForm.h" #include "cmCursesMainForm.h"
#include "cmCursesStandardIncludes.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) int main(int argc, char const* const* argv)
{ {
setlocale(LC_CTYPE, "");
cmsys::Encoding::CommandLineArguments encoding_args = cmsys::Encoding::CommandLineArguments encoding_args =
cmsys::Encoding::CommandLineArguments::Main(argc, argv); cmsys::Encoding::CommandLineArguments::Main(argc, argv);
argc = encoding_args.argc(); argc = encoding_args.argc();

View File

@ -25,7 +25,6 @@
#include "cmLocalGenerator.h" #include "cmLocalGenerator.h"
#include "cmMakefile.h" #include "cmMakefile.h"
#include <cmsys/Encoding.hxx> #include <cmsys/Encoding.hxx>
#include <locale.h>
#ifdef CMAKE_BUILD_WITH_CMAKE #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) int main(int ac, char const* const* av)
{ {
setlocale(LC_CTYPE, "");
cmsys::Encoding::CommandLineArguments args = cmsys::Encoding::CommandLineArguments args =
cmsys::Encoding::CommandLineArguments::Main(ac, av); cmsys::Encoding::CommandLineArguments::Main(ac, av);
ac = args.argc(); ac = args.argc();

View File

@ -19,7 +19,6 @@
#include "CTest/cmCTestScriptHandler.h" #include "CTest/cmCTestScriptHandler.h"
#include "CTest/cmCTestLaunch.h" #include "CTest/cmCTestLaunch.h"
#include "cmsys/Encoding.hxx" #include "cmsys/Encoding.hxx"
#include <locale.h>
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static const char * cmDocumentationName[][2] = static const char * cmDocumentationName[][2] =
@ -117,8 +116,6 @@ static const char * cmDocumentationOptions[][2] =
// this is a test driver program for cmCTest. // this is a test driver program for cmCTest.
int main (int argc, char const* const* argv) int main (int argc, char const* const* argv)
{ {
setlocale(LC_CTYPE, "");
cmsys::Encoding::CommandLineArguments encoding_args = cmsys::Encoding::CommandLineArguments encoding_args =
cmsys::Encoding::CommandLineArguments::Main(argc, argv); cmsys::Encoding::CommandLineArguments::Main(argc, argv);
argc = encoding_args.argc(); argc = encoding_args.argc();

View File

@ -1,14 +1,12 @@
#include <cmSystemTools.h> #include <cmSystemTools.h>
#include <cmsys/Encoding.hxx> #include <cmsys/Encoding.hxx>
#include <string> #include <string>
#include <locale.h>
#define RETVAL @_retval@ #define RETVAL @_retval@
int int
main(int ac, char **av) main(int ac, char **av)
{ {
setlocale(LC_CTYPE, "");
cmsys::Encoding::CommandLineArguments args = cmsys::Encoding::CommandLineArguments args =
cmsys::Encoding::CommandLineArguments::Main(ac, av); cmsys::Encoding::CommandLineArguments::Main(ac, av);
int argc = args.argc(); int argc = args.argc();