diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-03-27 20:01:44 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-03-27 20:01:44 (GMT) |
commit | bf5ef12d50b75a37a368f1b3fa8f1647e3bca36e (patch) | |
tree | 22e77fa685a49bbae0914a1085c64ef518945772 | |
parent | d5bbf3d4086d7fa0300325a08a608f1cc7b4ce33 (diff) | |
parent | 07a66822fb1350955150295fcd6d9f53d3b7ee15 (diff) | |
download | hdf5-bf5ef12d50b75a37a368f1b3fa8f1647e3bca36e.zip hdf5-bf5ef12d50b75a37a368f1b3fa8f1647e3bca36e.tar.gz hdf5-bf5ef12d50b75a37a368f1b3fa8f1647e3bca36e.tar.bz2 |
Merge pull request #2470 in HDFFV/hdf5 from ~BYRN/hdf5_adb:develop to develop
* commit '07a66822fb1350955150295fcd6d9f53d3b7ee15':
TRILAB-24 use CHECK_STRUCT_HAS_MEMBER
-rw-r--r-- | config/cmake_ext_mod/ConfigureChecks.cmake | 22 | ||||
-rw-r--r-- | config/cmake_ext_mod/HDFTests.c | 79 | ||||
-rw-r--r-- | release_docs/RELEASE.txt | 7 |
3 files changed, 20 insertions, 88 deletions
diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 52cb7dd..33d4d6e 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -20,6 +20,7 @@ include (CheckSymbolExists) include (CheckTypeSize) include (CheckVariableExists) include (TestBigEndian) +include (CheckStructHasMember) #----------------------------------------------------------------------------- # APPLE/Darwin setup @@ -328,7 +329,7 @@ if (MINGW OR NOT WINDOWS) CHECK_FUNCTION_EXISTS (fseeko ${HDF_PREFIX}_HAVE_FSEEKO) - HDF_FUNCTION_TEST (HAVE_STAT64_STRUCT) + CHECK_STRUCT_HAS_MEMBER("struct stat64" st_blocks "sys/types.h;sys/stat.h" HAVE_STAT64_STRUCT) if (HAVE_STAT64_STRUCT) CHECK_FUNCTION_EXISTS (stat64 ${HDF_PREFIX}_HAVE_STAT64) endif () @@ -438,14 +439,18 @@ if (MINGW OR NOT WINDOWS) #----------------------------------------------------------------------------- # Check a bunch of time functions #----------------------------------------------------------------------------- + CHECK_STRUCT_HAS_MEMBER("struct tm" tm_gmtoff "time.h" ${HDF_PREFIX}_HAVE_TM_GMTOFF) + CHECK_STRUCT_HAS_MEMBER("struct tm" __tm_gmtoff "time.h" ${HDF_PREFIX}_HAVE___TM_GMTOFF) + CHECK_STRUCT_HAS_MEMBER("struct tm" tm_sec "sys/types.h;sys/time.h;time.h" ${HDF_PREFIX}_TIME_WITH_SYS_TIME) + if (${HDF_PREFIX}_HAVE_SYS_TIME_H) + CHECK_STRUCT_HAS_MEMBER("struct tm" tz_minuteswest "sys/types.h;sys/time.h;time.h" ${HDF_PREFIX}_HAVE_STRUCT_TIMEZONE) + else () + CHECK_STRUCT_HAS_MEMBER("struct tm" tz_minuteswest "sys/types.h;time.h" ${HDF_PREFIX}_HAVE_STRUCT_TIMEZONE) + endif () CHECK_FUNCTION_EXISTS (gettimeofday ${HDF_PREFIX}_HAVE_GETTIMEOFDAY) foreach (time_test - HAVE_TM_GMTOFF - HAVE___TM_GMTOFF # HAVE_TIMEZONE - HAVE_STRUCT_TIMEZONE GETTIMEOFDAY_GIVES_TZ - TIME_WITH_SYS_TIME HAVE_TM_ZONE HAVE_STRUCT_TM_TM_ZONE ) @@ -453,20 +458,19 @@ if (MINGW OR NOT WINDOWS) endforeach () if (NOT CYGWIN AND NOT MINGW) HDF_FUNCTION_TEST (HAVE_TIMEZONE) -# HDF_FUNCTION_TEST (HAVE_STAT_ST_BLOCKS) endif () # ---------------------------------------------------------------------- # Does the struct stat have the st_blocks field? This field is not Posix. # - HDF_FUNCTION_TEST (HAVE_STAT_ST_BLOCKS) + CHECK_STRUCT_HAS_MEMBER("struct stat" st_blocks "sys/types.h;sys/stat.h" ${HDF_PREFIX}_HAVE_STAT_ST_BLOCKS) # ---------------------------------------------------------------------- # How do we figure out the width of a tty in characters? # CHECK_FUNCTION_EXISTS (ioctl ${HDF_PREFIX}_HAVE_IOCTL) - HDF_FUNCTION_TEST (HAVE_STRUCT_VIDEOCONFIG) - HDF_FUNCTION_TEST (HAVE_STRUCT_TEXT_INFO) + CHECK_STRUCT_HAS_MEMBER ("struct videoconfig" numtextcols "" ${HDF_PREFIX}_HAVE_STRUCT_VIDEOCONFIG) + CHECK_STRUCT_HAS_MEMBER ("struct text_info" screenwidth "" ${HDF_PREFIX}_HAVE_STRUCT_TEXT_INFO) CHECK_FUNCTION_EXISTS (_getvideoconfig ${HDF_PREFIX}_HAVE__GETVIDEOCONFIG) CHECK_FUNCTION_EXISTS (gettextinfo ${HDF_PREFIX}_HAVE_GETTEXTINFO) CHECK_FUNCTION_EXISTS (_scrsize ${HDF_PREFIX}_HAVE__SCRSIZE) diff --git a/config/cmake_ext_mod/HDFTests.c b/config/cmake_ext_mod/HDFTests.c index 0b9b530..31a568a 100644 --- a/config/cmake_ext_mod/HDFTests.c +++ b/config/cmake_ext_mod/HDFTests.c @@ -88,25 +88,6 @@ int main(void) } #endif - -#ifdef TIME_WITH_SYS_TIME -/* Time with sys/time test */ - -#include <sys/types.h> -#include <sys/time.h> -#include <time.h> - -int -main () -{ -if ((struct tm *) 0) -return 0; - ; - return 0; -} - -#endif - #ifdef STDC_HEADERS #include <stdlib.h> #include <stdarg.h> @@ -162,26 +143,6 @@ main () #endif /* HAVE_FUNCTION */ -#ifdef HAVE_TM_GMTOFF - -#ifdef HAVE_SYS_TIME_H -#include <sys/time.h> -#endif -#include <time.h> -SIMPLE_TEST(struct tm tm; tm.tm_gmtoff=0); - -#endif /* HAVE_TM_GMTOFF */ - -#ifdef HAVE___TM_GMTOFF - -#ifdef HAVE_SYS_TIME_H -#include <sys/time.h> -#endif -#include <time.h> -SIMPLE_TEST(struct tm tm; tm.__tm_gmtoff=0); - -#endif /* HAVE_TM___GMTOFF */ - #ifdef HAVE_TIMEZONE #ifdef HAVE_SYS_TIME_H @@ -192,24 +153,6 @@ SIMPLE_TEST(timezone=0); #endif /* HAVE_TIMEZONE */ -#ifdef HAVE_STRUCT_TIMEZONE - -#include <sys/types.h> -#ifdef HAVE_SYS_TIME_H -#include <sys/time.h> -#endif -#include <time.h> -SIMPLE_TEST(struct timezone tz; tz.tz_minuteswest=0); - -#endif /* HAVE_STRUCT_TIMEZONE */ - -#ifdef HAVE_STAT_ST_BLOCKS - -#include <sys/stat.h> -SIMPLE_TEST(struct stat sb; sb.st_blocks=0); - -#endif /* HAVE_STAT_ST_BLOCKS */ - #ifdef PRINTF_LL_WIDTH #ifdef HAVE_LONG_LONG @@ -319,16 +262,6 @@ int main() } #endif -#ifdef HAVE_STAT64_STRUCT -#include <sys/types.h> -#include <sys/stat.h>], -struct stat64 sb; -int main() -{ - return 0; -} -#endif - #ifdef TEST_DIRECT_VFD_WORKS #include <sys/types.h> #include <sys/stat.h> @@ -432,18 +365,6 @@ int main () #endif /* HAVE_IOEO */ -#ifdef HAVE_STRUCT_VIDEOCONFIG - -SIMPLE_TEST(struct videoconfig w; w.numtextcols=0); - -#endif /* HAVE_STRUCT_VIDEOCONFIG */ - -#ifdef HAVE_STRUCT_TEXT_INFO - -SIMPLE_TEST(struct text_info w; w.screenwidth=0); - -#endif /* HAVE_STRUCT_TEXT_INFO */ - #if defined( HAVE_INLINE ) || defined( HAVE___INLINE__ ) || defined( HAVE___INLINE ) #ifndef __cplusplus #if defined( HAVE_INLINE ) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 17987f6..5451e85 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -48,6 +48,13 @@ New Features Configuration: ------------- + - CMake ConfigureChecks.cmake file now uses CHECK_STRUCT_HAS_MEMBER + + Some handcrafted tests in HDFTests.c has been removed and the CMake + CHECK_STRUCT_HAS_MEMBER module has been used. + + (ADB - 2020/03/24, TRILAB-24) + - Both build systems use same set of warnings flags GNU C warnings flags were moved to files in a config sub-folder |