Commit a3d85c02 authored by Brad King's avatar Brad King

Merge branch 'upstream-KWSys' into update-kwsys

* upstream-KWSys:
  KWSys 2015-12-14 (c1149ef6)
parents 893f3e2d a36bf7c7
Pipeline #2677 passed with stage
......@@ -118,7 +118,6 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
SET(KWSYS_USE_System 1)
SET(KWSYS_USE_SystemTools 1)
SET(KWSYS_USE_CommandLineArguments 1)
SET(KWSYS_USE_FundamentalType 1)
SET(KWSYS_USE_Terminal 1)
SET(KWSYS_USE_IOStream 1)
SET(KWSYS_USE_FStream 1)
......@@ -374,61 +373,6 @@ IF(KWSYS_CXX_HAS___INT64)
ENDIF()
ENDIF()
IF(KWSYS_USE_FundamentalType)
# Look for type size helper macros.
KWSYS_PLATFORM_INFO_TEST(C KWSYS_C_TYPE_MACROS
"Checking for C type size macros")
SET(macro_regex ".*INFO:macro\\[([^]]*)\\].*")
FOREACH(info ${KWSYS_C_TYPE_MACROS})
IF("${info}" MATCHES "${macro_regex}")
STRING(REGEX REPLACE "${macro_regex}" "\\1" macro "${info}")
SET(KWSYS_C_HAS_MACRO_${macro} 1)
ENDIF()
ENDFOREACH()
# Determine type sizes at preprocessing time if possible, and
# otherwise fall back to a try-compile.
SET(KWSYS_C_TYPE_NAME_CHAR "char")
SET(KWSYS_C_TYPE_NAME_SHORT "short")
SET(KWSYS_C_TYPE_NAME_INT "int")
SET(KWSYS_C_TYPE_NAME_LONG "long")
SET(KWSYS_C_TYPE_NAME_LONG_LONG "long long")
SET(KWSYS_C_TYPE_NAME___INT64 "__int64")
FOREACH(type CHAR SHORT INT LONG LONG_LONG __INT64)
IF(KWSYS_C_HAS_MACRO___SIZEOF_${type}__)
# Use __SIZEOF_${type}__ macro.
SET(KWSYS_SIZEOF_${type} TRUE)
SET(KWSYS_C_CODE_SIZEOF_${type} "#define ${KWSYS_NAMESPACE}_SIZEOF_${type} __SIZEOF_${type}__")
ELSEIF(KWSYS_C_HAS_MACRO___${type}_MAX__)
# Use __${type}_MAX__ macro.
SET(KWSYS_SIZEOF_${type} TRUE)
SET(KWSYS_C_CODE_SIZEOF_${type} "#if __${type}_MAX__ == 0x7f
# define ${KWSYS_NAMESPACE}_SIZEOF_${type} 1
#elif __${type}_MAX__ == 0x7fff
# define ${KWSYS_NAMESPACE}_SIZEOF_${type} 2
#elif __${type}_MAX__ == 0x7fffffff
# define ${KWSYS_NAMESPACE}_SIZEOF_${type} 4
#elif __${type}_MAX__>>32 == 0x7fffffff
# define ${KWSYS_NAMESPACE}_SIZEOF_${type} 8
#else
# error \"Cannot determine sizeof(${KWSYS_C_TYPE_NAME_${type}}).\"
#endif")
ELSE()
# Configure a hard-coded type size.
CHECK_TYPE_SIZE("${KWSYS_C_TYPE_NAME_${type}}" KWSYS_SIZEOF_${type})
IF(NOT KWSYS_SIZEOF_${type})
SET(KWSYS_SIZEOF_${type} 0)
ENDIF()
SET(KWSYS_C_CODE_SIZEOF_${type}
"#define ${KWSYS_NAMESPACE}_SIZEOF_${type} ${KWSYS_SIZEOF_${type}}")
ENDIF()
ENDFOREACH()
# Check signedness of "char" type.
KWSYS_PLATFORM_CXX_TEST_RUN(KWSYS_CHAR_IS_SIGNED
"Checking whether char is signed" DIRECT)
ENDIF()
IF(KWSYS_USE_Encoding)
# Look for type size helper macros.
KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_WSTRING
......@@ -741,7 +685,7 @@ ENDFOREACH()
# Add selected C components.
FOREACH(c
Process Base64 Encoding FundamentalType MD5 Terminal System String
Process Base64 Encoding MD5 Terminal System String
)
IF(KWSYS_USE_${c})
# Use the corresponding header file.
......
/*============================================================================
KWSys - Kitware System Library
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#ifndef @KWSYS_NAMESPACE@_FundamentalType_h
#define @KWSYS_NAMESPACE@_FundamentalType_h
#include <@KWSYS_NAMESPACE@/Configure.h>
/* Redefine all public interface symbol names to be in the proper
namespace. These macros are used internally to kwsys only, and are
not visible to user code. Use kwsysHeaderDump.pl to reproduce
these macros after making changes to the interface. */
#if !defined(KWSYS_NAMESPACE)
# define kwsys_ns(x) @KWSYS_NAMESPACE@##x
# define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT
#endif
#if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
# define kwsysFundamentalType kwsys_ns(FundamentalType)
# define kwsysFundamentalType_Int8 kwsys_ns(FundamentalType_Int8)
# define kwsysFundamentalType_UInt8 kwsys_ns(FundamentalType_UInt8)
# define kwsysFundamentalType_Int16 kwsys_ns(FundamentalType_Int16)
# define kwsysFundamentalType_UInt16 kwsys_ns(FundamentalType_UInt16)
# define kwsysFundamentalType_Int32 kwsys_ns(FundamentalType_Int32)
# define kwsysFundamentalType_UInt32 kwsys_ns(FundamentalType_UInt32)
# define kwsysFundamentalType_Int64 kwsys_ns(FundamentalType_Int64)
# define kwsysFundamentalType_UInt64 kwsys_ns(FundamentalType_UInt64)
#endif
/* The size of fundamental types. Types that do not exist have size 0. */
@KWSYS_C_CODE_SIZEOF_CHAR@
@KWSYS_C_CODE_SIZEOF_SHORT@
@KWSYS_C_CODE_SIZEOF_INT@
@KWSYS_C_CODE_SIZEOF_LONG@
@KWSYS_C_CODE_SIZEOF_LONG_LONG@
@KWSYS_C_CODE_SIZEOF___INT64@
/* Whether types "long long" and "__int64" are enabled. If a type is
enabled then it is a unique fundamental type. */
#define @KWSYS_NAMESPACE@_USE_LONG_LONG @KWSYS_USE_LONG_LONG@
#define @KWSYS_NAMESPACE@_USE___INT64 @KWSYS_USE___INT64@
/* Whether type "char" is signed (it may be signed or unsigned). */
#define @KWSYS_NAMESPACE@_CHAR_IS_SIGNED @KWSYS_CHAR_IS_SIGNED@
#if defined(__cplusplus)
extern "C"
{
#endif
/* Select an 8-bit integer type. */
#if @KWSYS_NAMESPACE@_SIZEOF_CHAR == 1
typedef signed char kwsysFundamentalType_Int8;
typedef unsigned char kwsysFundamentalType_UInt8;
#else
# error "No native data type can represent an 8-bit integer."
#endif
/* Select a 16-bit integer type. */
#if @KWSYS_NAMESPACE@_SIZEOF_SHORT == 2
typedef short kwsysFundamentalType_Int16;
typedef unsigned short kwsysFundamentalType_UInt16;
#elif @KWSYS_NAMESPACE@_SIZEOF_INT == 2
typedef int kwsysFundamentalType_Int16;
typedef unsigned int kwsysFundamentalType_UInt16;
#else
# error "No native data type can represent a 16-bit integer."
#endif
/* Select a 32-bit integer type. */
#if @KWSYS_NAMESPACE@_SIZEOF_INT == 4
typedef int kwsysFundamentalType_Int32;
typedef unsigned int kwsysFundamentalType_UInt32;
#elif @KWSYS_NAMESPACE@_SIZEOF_LONG == 4
typedef long kwsysFundamentalType_Int32;
typedef unsigned long kwsysFundamentalType_UInt32;
#else
# error "No native data type can represent a 32-bit integer."
#endif
/* Select a 64-bit integer type. */
#if @KWSYS_NAMESPACE@_SIZEOF_LONG == 8
typedef signed long kwsysFundamentalType_Int64;
typedef unsigned long kwsysFundamentalType_UInt64;
#elif @KWSYS_NAMESPACE@_USE_LONG_LONG && @KWSYS_NAMESPACE@_SIZEOF_LONG_LONG == 8
typedef signed long long kwsysFundamentalType_Int64;
typedef unsigned long long kwsysFundamentalType_UInt64;
#elif @KWSYS_NAMESPACE@_USE___INT64 && @KWSYS_NAMESPACE@_SIZEOF___INT64 == 8
typedef signed __int64 kwsysFundamentalType_Int64;
typedef unsigned __int64 kwsysFundamentalType_UInt64;
#else
# error "No native data type can represent a 64-bit integer."
#endif
#if defined(__cplusplus)
} /* extern "C" */
#endif
/* If we are building a kwsys .c or .cxx file, let it use these macros.
Otherwise, undefine them to keep the namespace clean. */
#if !defined(KWSYS_NAMESPACE)
# undef kwsys_ns
# undef kwsysEXPORT
# if !defined(KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
# undef kwsysFundamentalType
# undef kwsysFundamentalType_Int8
# undef kwsysFundamentalType_UInt8
# undef kwsysFundamentalType_Int16
# undef kwsysFundamentalType_UInt16
# undef kwsysFundamentalType_Int32
# undef kwsysFundamentalType_UInt32
# undef kwsysFundamentalType_Int64
# undef kwsysFundamentalType_UInt64
# endif
#endif
/* If building a C or C++ file in kwsys itself, give the source file
access to the configured macros without a configured namespace. */
#if defined(KWSYS_NAMESPACE)
# define KWSYS_SIZEOF_CHAR @KWSYS_NAMESPACE@_SIZEOF_CHAR
# define KWSYS_SIZEOF_SHORT @KWSYS_NAMESPACE@_SIZEOF_SHORT
# define KWSYS_SIZEOF_INT @KWSYS_NAMESPACE@_SIZEOF_INT
# define KWSYS_SIZEOF_LONG @KWSYS_NAMESPACE@_SIZEOF_LONG
# define KWSYS_SIZEOF_LONG_LONG @KWSYS_NAMESPACE@_SIZEOF_LONG_LONG
# define KWSYS_SIZEOF___INT64 @KWSYS_NAMESPACE@_SIZEOF___INT64
# define KWSYS_USE_LONG_LONG @KWSYS_NAMESPACE@_USE_LONG_LONG
# define KWSYS_USE___INT64 @KWSYS_NAMESPACE@_USE___INT64
# define KWSYS_CHAR_IS_SIGNED @KWSYS_NAMESPACE@_CHAR_IS_SIGNED
#endif
#endif
......@@ -130,15 +130,6 @@ int main()
}
#endif
#ifdef TEST_KWSYS_CHAR_IS_SIGNED
/* Return 0 for char signed and 1 for char unsigned. */
int main()
{
unsigned char uc = 255;
return (*reinterpret_cast<char*>(&uc) < 0)?0:1;
}
#endif
#ifdef TEST_KWSYS_LFS_WORKS
/* Return 0 when LFS is available and 1 otherwise. */
#define _LARGEFILE_SOURCE
......@@ -326,93 +317,6 @@ int main()
}
#endif
#ifdef TEST_KWSYS_CXX_TYPE_INFO
/* Collect fundamental type information and save it to a CMake script. */
/* Include limits.h to get macros indicating long long and __int64.
Note that certain compilers need special macros to define these
macros in limits.h. */
#if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS)
# define _MSC_EXTENSIONS
#endif
#if defined(__GNUC__) && __GNUC__ < 3
# define _GNU_SOURCE
#endif
#include <limits.h>
#include <stdio.h>
#include <string.h>
/* Due to shell differences and limitations of ADD_DEFINITIONS the
KWSYS_CXX_TYPE_INFO_FILE macro will sometimes have double quotes
and sometimes not. This macro will make sure the value is treated
as a double-quoted string. */
#define TO_STRING(x) TO_STRING0(x)
#define TO_STRING0(x) TO_STRING1(x)
#define TO_STRING1(x) #x
void f() {}
int main()
{
/* Construct the output file name. Some preprocessors will add an
extra level of double quotes, so strip them. */
char fbuf[] = TO_STRING(KWSYS_CXX_TYPE_INFO_FILE);
char* fname = fbuf;
if(fname[0] == '"')
{
++fname;
int len = static_cast<int>(strlen(fname));
if(len > 0 && fname[len-1] == '"')
{
fname[len-1] = 0;
}
}
/* Try to open the output file. */
if(FILE* fout = fopen(fname, "w"))
{
/* Set the size of standard types. */
fprintf(fout, "SET(KWSYS_SIZEOF_CHAR %d)\n", static_cast<int>(sizeof(char)));
fprintf(fout, "SET(KWSYS_SIZEOF_SHORT %d)\n", static_cast<int>(sizeof(short)));
fprintf(fout, "SET(KWSYS_SIZEOF_INT %d)\n", static_cast<int>(sizeof(int)));
fprintf(fout, "SET(KWSYS_SIZEOF_LONG %d)\n", static_cast<int>(sizeof(long)));
/* Set the size of some non-standard but common types. */
/* Check for a limits.h macro for long long to see if the type exists. */
#if defined(LLONG_MAX) || defined(LONG_LONG_MAX) || defined(LONGLONG_MAX)
fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG %d)\n", static_cast<int>(sizeof(long long)));
#else
fprintf(fout, "SET(KWSYS_SIZEOF_LONG_LONG 0) # No long long available.\n");
#endif
/* Check for a limits.h macro for __int64 to see if the type exists. */
#if defined(_I64_MIN)
fprintf(fout, "SET(KWSYS_SIZEOF___INT64 %d)\n", static_cast<int>(sizeof(__int64)));
#else
fprintf(fout, "SET(KWSYS_SIZEOF___INT64 0) # No __int64 available.\n");
#endif
/* Set the size of some pointer types. */
fprintf(fout, "SET(KWSYS_SIZEOF_PDATA %d)\n", static_cast<int>(sizeof(void*)));
fprintf(fout, "SET(KWSYS_SIZEOF_PFUNC %d)\n", static_cast<int>(sizeof(&f)));
/* Set whether the native type "char" is signed or unsigned. */
unsigned char uc = 255;
fprintf(fout, "SET(KWSYS_CHAR_IS_SIGNED %d)\n",
(*reinterpret_cast<char*>(&uc) < 0)?1:0);
fclose(fout);
return 0;
}
else
{
fprintf(stderr, "Failed to write fundamental type info to \"%s\".\n",
fname);
return 1;
}
}
#endif
#ifdef TEST_KWSYS_CXX_HAS_BORLAND_ASM
int main()
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment