From: Martin Quinson Date: Fri, 12 Feb 2016 22:07:32 +0000 (+0100) Subject: [cmake] kill unused cruft aiming at surviving pre-c++11 or pre-c99 compilers X-Git-Tag: v3_13~846 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/06cc5b34eccf67f299861b27a1a367b079fc8d3d?hp=2e7f7d3ea30119fa42a31428a632abb76a68f4c6 [cmake] kill unused cruft aiming at surviving pre-c++11 or pre-c99 compilers --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 34badcaaeb..6225d9aae8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -763,123 +763,8 @@ endif() ## System checks ## -#SG_CONFIGURE_PART([System checks...]) -#AC_PROG_CC(xlC gcc cc) -auto -#AM_SANITY_CHECK -auto - -#AC_PROG_MAKE_SET - -#AC_CHECK_VA_COPY - -set(diff_va "va_copy((d),(s))" - "VA_COPY((d),(s))" - "__va_copy((d),(s))" - "__builtin_va_copy((d),(s))" - "do { (d) = (s)\; } while (0)" - "do { *(d) = *(s)\; } while (0)" - "memcpy((void *)&(d), (void *)&(s), sizeof(s))" - "memcpy((void *)(d), (void *)(s), sizeof(*(s)))" - ) - -foreach(fct ${diff_va}) - write_file("${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_va_copy.c" "#include -#include -#include -#define DO_VA_COPY(d,s) ${fct} -void test(char *str, ...) -{ - va_list ap, ap2; - int i; - va_start(ap, str); - DO_VA_COPY(ap2, ap); - for (i = 1; i <= 9; i++) { - int k = (int)va_arg(ap, int); - if (k != i) - abort(); - } - DO_VA_COPY(ap, ap2); - for (i = 1; i <= 9; i++) { - int k = (int)va_arg(ap, int); - if (k != i) - abort(); - } - va_end(ap); -} -int main(void) -{ - test(\"test\", 1, 2, 3, 4, 5, 6, 7, 8, 9); - exit(0); -}" - ) - - execute_process( - COMMAND ${CMAKE_C_COMPILER} "${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_va_copy.c" - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - RESULT_VARIABLE COMPILE_VA_NULL_VAR - OUTPUT_QUIET - ERROR_QUIET - ) - - if(NOT COMPILE_VA_NULL_VAR) - string(REGEX REPLACE "\;" "" fctbis ${fct}) - if(${fctbis} STREQUAL "va_copy((d),(s))") - set(HAVE_VA_COPY 1) - set(ac_cv_va_copy "C99") - set(__VA_COPY_USE_C99 "va_copy((d),(s))") - endif() - - if(${fctbis} STREQUAL "VA_COPY((d),(s))") - set(ac_cv_va_copy "GCM") - set(__VA_COPY_USE_GCM "VA_COPY((d),(s))") - endif() - - if(${fctbis} STREQUAL "__va_copy((d),(s))") - set(ac_cv_va_copy "GCH") - set(__VA_COPY_USE_GCH "__va_copy((d),(s))") - endif() - - if(${fctbis} STREQUAL "__builtin_va_copy((d),(s))") - set(ac_cv_va_copy "GCB") - set(__VA_COPY_USE_GCB "__builtin_va_copy((d),(s))") - endif() - - if(${fctbis} STREQUAL "do { (d) = (s) } while (0)") - set(ac_cv_va_copy "ASS") - set(__VA_COPY_USE_ASS "do { (d) = (s); } while (0)") - endif() - - if(${fctbis} STREQUAL "do { *(d) = *(s) } while (0)") - set(ac_cv_va_copy "ASP") - set(__VA_COPY_USE_ASP "do { *(d) = *(s); } while (0)") - endif() - - if(${fctbis} STREQUAL "memcpy((void *)&(d), (void *)&(s), sizeof(s))") - set(ac_cv_va_copy "CPS") - set(__VA_COPY_USE_CPS "memcpy((void *)&(d), (void *)&(s), sizeof(s))") - endif() - - if(${fctbis} STREQUAL "memcpy((void *)(d), (void *)(s), sizeof(*(s)))") - set(ac_cv_va_copy "CPP") - set(__VA_COPY_USE_CPP "memcpy((void *)(d), (void *)(s), sizeof(*(s)))") - endif() - - if(NOT STATUS_OK) - set(__VA_COPY_USE "__VA_COPY_USE_${ac_cv_va_copy}(d, s)") - endif() - set(STATUS_OK "1") - - endif() - -endforeach(fct ${diff_va}) - -#-------------------------------------------------------------------------------------------------- ### check for a working snprintf if(HAVE_SNPRINTF AND HAVE_VSNPRINTF OR WIN32) - if(WIN32) - #set(HAVE_SNPRINTF 1) - #set(HAVE_VSNPRINTF 1) - endif() - if(CMAKE_CROSSCOMPILING) set(RUN_SNPRINTF_FUNC "cross") #set(PREFER_PORTABLE_SNPRINTF 1) diff --git a/tools/cmake/src/internal_config.h.in b/tools/cmake/src/internal_config.h.in index 3b0b8229af..c6c0e59010 100644 --- a/tools/cmake/src/internal_config.h.in +++ b/tools/cmake/src/internal_config.h.in @@ -45,9 +45,6 @@ #cmakedefine __VISUALC__ @__VISUALC__@ #cmakedefine __BORLANDC__ @__BORLANDC__@ #cmakedefine APPLE @APPLE@ -#ifdef _MSC_VER - #define HAVE_VA_COPY -#endif /* Set to true if enable_model-checking is true */ #cmakedefine MMALLOC_WANT_OVERRIDE_LEGACY @MMALLOC_WANT_OVERRIDE_LEGACY@ #cmakedefine HAVE_MC @HAVE_MC@ @@ -70,15 +67,6 @@ /* Path to the addr2line tool */ #cmakedefine ADDR2LINE "@ADDR2LINE@" -/* Predefined possible va_copy() implementation (id: ASP) */ -#cmakedefine __VA_COPY_USE_ASP(d, s) @__VA_COPY_USE_ASP@ - -/* Predefined possible va_copy() implementation (id: ASS) */ -#cmakedefine __VA_COPY_USE_ASS(d, s) @__VA_COPY_USE_ASS@ - -/* Predefined possible va_copy() implementation (id: C99) */ -#cmakedefine __VA_COPY_USE_C99(d, s) @__VA_COPY_USE_C99@ - /* Define if xbt contexts are based on our threads implementation or not */ #cmakedefine HAVE_THREAD_CONTEXTS @HAVE_THREAD_CONTEXTS@ @@ -88,21 +76,6 @@ /* Define if xbt contexts are based on ucontext or not */ #cmakedefine HAVE_UCONTEXT_CONTEXTS @HAVE_UCONTEXT_CONTEXTS@ -/* Predefined possible va_copy() implementation (id: CPP) */ -#cmakedefine __VA_COPY_USE_CPP(d, s) @__VA_COPY_USE_CPP@ - -/* Predefined possible va_copy() implementation (id: CPS) */ -#cmakedefine __VA_COPY_USE_CPS(d, s) @__VA_COPY_USE_CPS@ - -/* Predefined possible va_copy() implementation (id: GCB) */ -#cmakedefine __VA_COPY_USE_GCB(d, s) @__VA_COPY_USE_GCB@ - -/* Predefined possible va_copy() implementation (id: GCH) */ -#cmakedefine __VA_COPY_USE_GCH(d, s) @__VA_COPY_USE_GCH@ - -/* Predefined possible va_copy() implementation (id: GCM) */ -#cmakedefine __VA_COPY_USE_GCM(d, s) @__VA_COPY_USE_GCM@ - /* Used to select the flavor of assembly that we need today */ #cmakedefine PROCESSOR_i686 @PROCESSOR_i686@ #cmakedefine PROCESSOR_x86_64 @PROCESSOR_x86_64@ @@ -216,10 +189,6 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_VALGRIND_VALGRIND_H @HAVE_VALGRIND_VALGRIND_H@ -/* Define if va_copy() macro exists (and no fallback implementation is - required) */ -#cmakedefine HAVE_VA_COPY @HAVE_VA_COPY@ - /* Define to 1 if you have the `vsnprintf' function. */ #cmakedefine HAVE_VSNPRINTF @HAVE_VSNPRINTF@ @@ -275,21 +244,5 @@ `char[]'. */ #cmakedefine YYTEXT_POINTER -/* Optional va_copy() implementation activation */ -#ifndef HAVE_VA_COPY -#define va_copy(d, s) __VA_COPY_USE(d, s) -#endif -/* Define to id of used va_copy() implementation */ -#cmakedefine __VA_COPY_USE(d, s) @__VA_COPY_USE@ - -/* Define to empty if `const' does not conform to ANSI C. */ -#cmakedefine const @const@ - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -#cmakedefine inline @inline@ -#endif - /* Define to `unsigned int' if does not define. */ #cmakedefine size_t @size_t@