From dbc79bd8c8d5b9ef078401064db9bb0554affbcf Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 29 Dec 2010 15:35:15 -0500 Subject: [PATCH] Fix constness in compiler id detection Since commit 70c2dc8a (Make compiler id detection more robust, 2008-03-10) we store compiler identification strings in test binaries using the form char* info = "info"; Use the const-correct char const* info = "info"; form instead. This allows the C++ compiler identification to work with "-Werror -Wall" or equivalent flags if the compiler would warn about const-to-non-const conversion. --- Modules/CMakeCCompilerId.c.in | 2 +- Modules/CMakeCXXCompilerId.cpp.in | 2 +- Modules/CMakePlatformId.h.in | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index accda3257..27fa341fe 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -85,7 +85,7 @@ getting matched. Store it in a pointer rather than an array because some compilers will just produce instructions to fill the array rather than assigning a pointer to a static array. */ -char* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; @CMAKE_C_COMPILER_ID_PLATFORM_CONTENT@ diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index 4a32823f8..af84ae88b 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -76,7 +76,7 @@ getting matched. Store it in a pointer rather than an array because some compilers will just produce instructions to fill the array rather than assigning a pointer to a static array. */ -char* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; @CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT@ diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in index e20348aac..718e28997 100644 --- a/Modules/CMakePlatformId.h.in +++ b/Modules/CMakePlatformId.h.in @@ -109,6 +109,6 @@ getting matched. Store it in a pointer rather than an array because some compilers will just produce instructions to fill the array rather than assigning a pointer to a static array. */ -char* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; -char* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; +char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; +char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]";