[Cmake-commits] CMake branch, next, updated. v3.5.0-628-gad7297d

Brad King brad.king at kitware.com
Wed Mar 23 13:58:45 EDT 2016


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  ad7297d39ef8b8ff960611a03e09c521265031fc (commit)
       via  71f8c91d7188f8d02dbbffd7b1812dc3f1b2accd (commit)
      from  57744007d898ae6a2c61902cf31933bf294753a3 (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 -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ad7297d39ef8b8ff960611a03e09c521265031fc
commit ad7297d39ef8b8ff960611a03e09c521265031fc
Merge: 5774400 71f8c91
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Mar 23 13:58:44 2016 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Mar 23 13:58:44 2016 -0400

    Merge topic 'improve-K_R-C-support' into next
    
    71f8c91d Improve detection of K&R C compilers


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=71f8c91d7188f8d02dbbffd7b1812dc3f1b2accd
commit 71f8c91d7188f8d02dbbffd7b1812dc3f1b2accd
Author:     Paweł Stankowski <aambitny at gmail.com>
AuthorDate: Tue Mar 22 21:41:40 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Mar 23 13:56:19 2016 -0400

    Improve detection of K&R C compilers
    
    The `__CLASSIC_C__` definition is specific to HP compilers.  `__STDC__`
    should be more portable.  It should be defined to `1` for compilers
    conforming to ANSI C and newer standards, though some compilers define
    it to `0` to indicate that they do not support function prototypes.

diff --git a/Modules/CMakeCCompilerABI.c b/Modules/CMakeCCompilerABI.c
index e6a07f4..405599e 100644
--- a/Modules/CMakeCCompilerABI.c
+++ b/Modules/CMakeCCompilerABI.c
@@ -2,7 +2,7 @@
 # error "A C++ compiler has been selected for C."
 #endif
 
-#ifdef __CLASSIC_C__
+#if !defined(__STDC__) || __STDC__ == 0
 # define const
 #endif
 
@@ -12,7 +12,7 @@
 
 /*--------------------------------------------------------------------------*/
 
-#ifdef __CLASSIC_C__
+#if !defined(__STDC__) || __STDC__ == 0
 int main(argc, argv) int argc; char *argv[];
 #else
 int main(int argc, char *argv[])
diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
index c107dfd..1ec9939 100644
--- a/Modules/CMakeCCompilerId.c.in
+++ b/Modules/CMakeCCompilerId.c.in
@@ -5,7 +5,7 @@
 #if defined(__18CXX)
 # define ID_VOID_MAIN
 #endif
-#if defined(__CLASSIC_C__)
+#if !defined(__STDC__) || __STDC__ == 0
 /* cv-qualifiers did not exist in K&R C */
 # define const
 # define volatile
@@ -33,7 +33,7 @@ char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
 @CMAKE_C_COMPILER_ID_PLATFORM_CONTENT@
 @CMAKE_C_COMPILER_ID_ERROR_FOR_TEST@
 
-#if !defined(__STDC__)
+#if !defined(__STDC__) || __STDC__ == 0
 # define C_DIALECT
 #elif __STDC_VERSION__ >= 201000L
 # define C_DIALECT "11"
@@ -50,7 +50,7 @@ const char* info_language_dialect_default =
 #ifdef ID_VOID_MAIN
 void main() {}
 #else
-# if defined(__CLASSIC_C__)
+# if !defined(__STDC__) || __STDC__ == 0
 int main(argc, argv) int argc; char *argv[];
 # else
 int main(int argc, char* argv[])
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake
index f8c6303..e0b5468 100644
--- a/Modules/CMakeDetermineCCompiler.cmake
+++ b/Modules/CMakeDetermineCCompiler.cmake
@@ -87,9 +87,6 @@ else()
 
     # Try enabling ANSI mode on HP.
     "-Aa"
-
-    # Try compiling K&R-compatible code (needed by Bruce C Compiler).
-    "-D__CLASSIC_C__"
     )
 endif()
 
diff --git a/Modules/CMakeTestCCompiler.cmake b/Modules/CMakeTestCCompiler.cmake
index 29a58bd..0d1f43e 100644
--- a/Modules/CMakeTestCCompiler.cmake
+++ b/Modules/CMakeTestCCompiler.cmake
@@ -36,7 +36,7 @@ if(NOT CMAKE_C_COMPILER_WORKS)
     "#ifdef __cplusplus\n"
     "# error \"The CMAKE_C_COMPILER is set to a C++ compiler\"\n"
     "#endif\n"
-    "#if defined(__CLASSIC_C__)\n"
+    "#if !defined(__STDC__) || __STDC__ == 0\n"
     "int main(argc, argv)\n"
     "  int argc;\n"
     "  char* argv[];\n"
diff --git a/Modules/CheckForPthreads.c b/Modules/CheckForPthreads.c
index 344c81b..cddb2b1 100644
--- a/Modules/CheckForPthreads.c
+++ b/Modules/CheckForPthreads.c
@@ -5,13 +5,14 @@
 void* runner(void*);
 
 int res = 0;
-#ifdef __CLASSIC_C__
-int main(){
+#if !defined(__STDC__) || __STDC__ == 0
+int main(ac, av)
   int ac;
   char*av[];
 #else
-int main(int ac, char*av[]){
+int main(int ac, char*av[])
 #endif
+{
   pthread_t tid[2];
   pthread_create(&tid[0], 0, runner, (void*)1);
   pthread_create(&tid[1], 0, runner, (void*)2);
diff --git a/Modules/CheckFunctionExists.c b/Modules/CheckFunctionExists.c
index fd29618..4805c6a 100644
--- a/Modules/CheckFunctionExists.c
+++ b/Modules/CheckFunctionExists.c
@@ -4,13 +4,14 @@
 extern "C"
 #endif
 char CHECK_FUNCTION_EXISTS();
-#ifdef __CLASSIC_C__
-int main(){
+#if !defined(__STDC__) || __STDC__ == 0
+int main(ac, av)
   int ac;
   char*av[];
 #else
-int main(int ac, char*av[]){
+int main(int ac, char*av[])
 #endif
+{
   CHECK_FUNCTION_EXISTS();
   if(ac > 1000)
     {
diff --git a/Modules/CheckIncludeFile.c.in b/Modules/CheckIncludeFile.c.in
index ddfbee8..de20e9a 100644
--- a/Modules/CheckIncludeFile.c.in
+++ b/Modules/CheckIncludeFile.c.in
@@ -1,13 +1,10 @@
 #include <${CHECK_INCLUDE_FILE_VAR}>
 
-#ifdef __CLASSIC_C__
+#if !defined(__STDC__) || __STDC__ == 0
 int main()
-{
-  return 0;
-}
 #else
 int main(void)
+#endif
 {
   return 0;
 }
-#endif
diff --git a/Modules/CheckIncludeFiles.cmake b/Modules/CheckIncludeFiles.cmake
index 843cd35..c0fe01a 100644
--- a/Modules/CheckIncludeFiles.cmake
+++ b/Modules/CheckIncludeFiles.cmake
@@ -59,7 +59,7 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
         "${CMAKE_CONFIGURABLE_FILE_CONTENT}#include <${FILE}>\n")
     endforeach()
     set(CMAKE_CONFIGURABLE_FILE_CONTENT
-      "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n\nint main(void){return 0;}\n")
+      "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n\n#if !defined(__STDC__) || __STDC == 0\nint main()\n#else\n  int main(void)\n#endif\n  {return 0;}\n")
     configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
       "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFiles.c" @ONLY)
 
diff --git a/Modules/CheckPrototypeDefinition.c.in b/Modules/CheckPrototypeDefinition.c.in
index a97344a..6a7f77d 100644
--- a/Modules/CheckPrototypeDefinition.c.in
+++ b/Modules/CheckPrototypeDefinition.c.in
@@ -14,13 +14,14 @@ static void checkSymbol(void) {
   return @CHECK_PROTOTYPE_DEFINITION_RETURN@;
 }
 
-#ifdef __CLASSIC_C__
-int main() {
+#if !defined(__STDC__) || __STDC__ == 0
+int main(ac , av)
   int ac;
   char*av[];
 #else
-int main(int ac, char *av[]) {
+int main(int ac, char *av[])
 #endif
+{
   checkSymbol();
   if (ac > 1000) {
     return *av[0];
diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake
index c4dff3f..cd91fce 100644
--- a/Modules/CheckSymbolExists.cmake
+++ b/Modules/CheckSymbolExists.cmake
@@ -75,7 +75,7 @@ macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE)
         "${CMAKE_CONFIGURABLE_FILE_CONTENT}#include <${FILE}>\n")
     endforeach()
     set(CMAKE_CONFIGURABLE_FILE_CONTENT
-      "${CMAKE_CONFIGURABLE_FILE_CONTENT}\nint main(int argc, char** argv)\n{\n  (void)argv;\n#ifndef ${SYMBOL}\n  return ((int*)(&${SYMBOL}))[argc];\n#else\n  (void)argc;\n  return 0;\n#endif\n}\n")
+      "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n#if !defined(__STDC__) || __STDC__ == 0\n  int main(argc, argv) int argc; char **argv;\n#else\n  int main(int argc, char** argv)\n#endif\n{\n  (void)argv;\n#ifndef ${SYMBOL}\n  return ((int*)(&${SYMBOL}))[argc];\n#else\n  (void)argc;\n  return 0;\n#endif\n}\n")
 
     configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
       "${SOURCEFILE}" @ONLY)
diff --git a/Modules/CheckTypeSize.c.in b/Modules/CheckTypeSize.c.in
index b6c3688..f42efd3 100644
--- a/Modules/CheckTypeSize.c.in
+++ b/Modules/CheckTypeSize.c.in
@@ -24,7 +24,7 @@ char info_size[] =  {'I', 'N', 'F', 'O', ':', 's','i','z','e','[',
 #endif
   '\0'};
 
-#ifdef __CLASSIC_C__
+#if !defined(__STDC__) || __STDC__ == 0
 int main(argc, argv) int argc; char *argv[];
 #else
 int main(int argc, char *argv[])
diff --git a/Modules/CheckVariableExists.c b/Modules/CheckVariableExists.c
index 752f6e4..7c3eb71 100644
--- a/Modules/CheckVariableExists.c
+++ b/Modules/CheckVariableExists.c
@@ -2,13 +2,14 @@
 
 extern int CHECK_VARIABLE_EXISTS;
 
-#ifdef __CLASSIC_C__
-int main(){
+#if !defined(__STDC__) || __STDC__ == 0
+int main(ac, av)
   int ac;
   char*av[];
 #else
-int main(int ac, char*av[]){
+int main(int ac, char*av[])
 #endif
+{
   if(ac > 1000){return *av[0];}
   return CHECK_VARIABLE_EXISTS;
 }
diff --git a/Modules/Compiler/Bruce-C.cmake b/Modules/Compiler/Bruce-C.cmake
index 23676ec..387e27f 100644
--- a/Modules/Compiler/Bruce-C.cmake
+++ b/Modules/Compiler/Bruce-C.cmake
@@ -1,6 +1,6 @@
 # Bruce C Compiler ignores "-g" flag and optimization cannot be
 # enabled here (it is implemented only for 8086 target).
-set (CMAKE_C_FLAGS_INIT "-D__CLASSIC_C__")
+set (CMAKE_C_FLAGS_INIT "")
 set (CMAKE_C_FLAGS_DEBUG_INIT "-g")
 set (CMAKE_C_FLAGS_MINSIZEREL_INIT "-DNDEBUG")
 set (CMAKE_C_FLAGS_RELEASE_INIT "-DNDEBUG")
diff --git a/Modules/TestEndianess.c.in b/Modules/TestEndianess.c.in
index c924f78..b0cbbc6 100644
--- a/Modules/TestEndianess.c.in
+++ b/Modules/TestEndianess.c.in
@@ -1,6 +1,10 @@
 /* A 16 bit integer is required. */
 typedef @CMAKE_16BIT_TYPE@ cmakeint16;
 
+#if !defined(__STDC__) || __STDC__ == 0
+# define const
+#endif
+
 /* On a little endian machine, these 16bit ints will give "THIS IS LITTLE ENDIAN."
    On a big endian machine the characters will be exchanged pairwise. */
 const cmakeint16 info_little[] =  {0x4854, 0x5349, 0x4920, 0x2053, 0x494c, 0x5454, 0x454c, 0x4520, 0x444e, 0x4149, 0x2e4e, 0x0000};
@@ -9,7 +13,7 @@ const cmakeint16 info_little[] =  {0x4854, 0x5349, 0x4920, 0x2053, 0x494c, 0x545
    On a little endian machine the characters will be exchanged pairwise. */
 const cmakeint16 info_big[] =     {0x5448, 0x4953, 0x2049, 0x5320, 0x4249, 0x4720, 0x454e, 0x4449, 0x414e, 0x2e2e, 0x0000};
 
-#ifdef __CLASSIC_C__
+#if !defined(__STDC__) || __STDC__ == 0
 int main(argc, argv) int argc; char *argv[];
 #else
 int main(int argc, char *argv[])
diff --git a/Tests/Assembler/main.c b/Tests/Assembler/main.c
index 95de0b5..e88921e 100644
--- a/Tests/Assembler/main.c
+++ b/Tests/Assembler/main.c
@@ -1,12 +1,13 @@
 #include <stdio.h>
 
-#ifdef __CLASSIC_C__
-int main(){
+#if !defined(__STDC__) || __STDC__ == 0
+int main(argc, argv)
   int argc;
   char*argv[];
 #else
-int main(int argc, char*argv[]){
+int main(int argc, char*argv[])
 #endif
+{
   printf("hello assembler world, %d arguments  given\n", argc);
   return 0;
 }
diff --git a/Tests/MacroTest/CMakeLists.txt b/Tests/MacroTest/CMakeLists.txt
index 6c6dfb6..47ad9c5 100644
--- a/Tests/MacroTest/CMakeLists.txt
+++ b/Tests/MacroTest/CMakeLists.txt
@@ -51,13 +51,14 @@ include(CheckCSourceCompiles)
 Check_C_Source_Compiles(
 "
 #include <stdio.h>
-#ifdef __CLASSIC_C__
-int main(){
+#if !defined(__STDC__) || __STDC__ == 0
+int main(ac, av)
   int ac;
   char*av[];
 #else
-int main(int ac, char*av[]){
+int main(int ac, char*av[])
 #endif
+{
   if(ac > 1000){return *av[0];}
   return 0;
 }"
diff --git a/Tests/SimpleExclude/dirC/dirA/t4.c b/Tests/SimpleExclude/dirC/dirA/t4.c
index 7c36ca9..0c01b8b 100644
--- a/Tests/SimpleExclude/dirC/dirA/t4.c
+++ b/Tests/SimpleExclude/dirC/dirA/t4.c
@@ -1,14 +1,13 @@
 #include <stdio.h>
 
-#ifdef __CLASSIC_C__
-int main()
-{
+#if !defined(__STDC__) || __STDC__ == 0
+int main(ac, av)
   int ac;
   char*av[];
 #else
   int main(int ac, char*av[])
-    {
 #endif
+    {
     if(ac > 1000){return *av[0];}
     printf("This is T4. This one should work.\n");
     return 0;
diff --git a/Tests/SimpleExclude/dirD/t9.c b/Tests/SimpleExclude/dirD/t9.c
index 321014b..5e64ce5 100644
--- a/Tests/SimpleExclude/dirD/t9.c
+++ b/Tests/SimpleExclude/dirD/t9.c
@@ -2,15 +2,14 @@
 
 extern int tlib7func();
 
-#ifdef __CLASSIC_C__
-int main()
-{
+#if !defined(__STDC__) || __STDC__ == 0
+int main(ac, av)
   int ac;
   char*av[];
 #else
   int main(int ac, char*av[])
-    {
 #endif
+    {
     if(ac > 1000){return *av[0];}
     printf("This is T9. This one should work.\n");
 
diff --git a/Tests/Wrapping/Wrap.c b/Tests/Wrapping/Wrap.c
index 0a1ff50..ce07c7e 100644
--- a/Tests/Wrapping/Wrap.c
+++ b/Tests/Wrapping/Wrap.c
@@ -1,6 +1,6 @@
 #include <stdio.h>
 
-#ifdef __CLASSIC_C__
+#if !defined(__STDC__) || __STDC__ == 0
 int main(argc, argv)
   int argc;
   char ** argv;
diff --git a/bootstrap b/bootstrap
index b3f06a1..f6c0c97 100755
--- a/bootstrap
+++ b/bootstrap
@@ -839,7 +839,7 @@ echo '
 
 #include<stdio.h>
 
-#if defined(__CLASSIC_C__)
+#if !defined(__STDC__) || __STDC__ == 0
 int main(argc, argv)
   int argc;
   char* argv[];

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

Summary of changes:
 Modules/CMakeCCompilerABI.c           |    4 ++--
 Modules/CMakeCCompilerId.c.in         |    6 +++---
 Modules/CMakeDetermineCCompiler.cmake |    3 ---
 Modules/CMakeTestCCompiler.cmake      |    2 +-
 Modules/CheckForPthreads.c            |    7 ++++---
 Modules/CheckFunctionExists.c         |    7 ++++---
 Modules/CheckIncludeFile.c.in         |    7 ++-----
 Modules/CheckIncludeFiles.cmake       |    2 +-
 Modules/CheckPrototypeDefinition.c.in |    7 ++++---
 Modules/CheckSymbolExists.cmake       |    2 +-
 Modules/CheckTypeSize.c.in            |    2 +-
 Modules/CheckVariableExists.c         |    7 ++++---
 Modules/Compiler/Bruce-C.cmake        |    2 +-
 Modules/TestEndianess.c.in            |    6 +++++-
 Tests/Assembler/main.c                |    7 ++++---
 Tests/MacroTest/CMakeLists.txt        |    7 ++++---
 Tests/SimpleExclude/dirC/dirA/t4.c    |    7 +++----
 Tests/SimpleExclude/dirD/t9.c         |    7 +++----
 Tests/Wrapping/Wrap.c                 |    2 +-
 bootstrap                             |    2 +-
 20 files changed, 49 insertions(+), 47 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list