浏览代码

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.
Brad King 15 年之前
父节点
当前提交
dbc79bd8c8
共有 3 个文件被更改,包括 4 次插入4 次删除
  1. 1 1
      Modules/CMakeCCompilerId.c.in
  2. 1 1
      Modules/CMakeCXXCompilerId.cpp.in
  3. 2 2
      Modules/CMakePlatformId.h.in

+ 1 - 1
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@
 

+ 1 - 1
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@
 

+ 2 - 2
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 "]";