diff options
author | Sean McBride <sean@rogue-research.com> | 2022-06-22 16:16:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-22 16:16:30 (GMT) |
commit | 8b2e7b32b5b9987938ebf6936205f324bc5050b8 (patch) | |
tree | 17062db1b0521cbe22e759c5083b216ae6c62437 /config | |
parent | 55f4cc0caa69d65c505e926fb7b2568ab1a76c58 (diff) | |
download | hdf5-8b2e7b32b5b9987938ebf6936205f324bc5050b8.zip hdf5-8b2e7b32b5b9987938ebf6936205f324bc5050b8.tar.gz hdf5-8b2e7b32b5b9987938ebf6936205f324bc5050b8.tar.bz2 |
Various warning fixes (#1812)
* Fixed -Wreserved-id-macro warnings from header include guards
* Removed all __int64 and LL suffix stuff now that C99 is minimum requirement
* Rename `H5FD_CTL__` to `H5FD_CTL_` to fix -Wreserved-id-macro warnings
Double underscore is reserved in C++ and this public header should be C++ compatible.
* Never define __STDC_FORMAT_MACROS anymore
Defining it causes a -Wreserved-id-macro.
Happily, according to the C++11 standard:
"The macros defined by <stdint> are provided unconditionally. In particular, the symbols __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS (mentioned in C99 footnotes 219, 220, and 222) play no role in C++."
https://cplusplus.github.io/LWG/issue984
So looks like it's not necessary to define it with reasonably new toolchains.
* Fixed some -Wunused-macros warnings, removed dead code
* Fixed all -Wdouble-promotion warnings in C++ files
* Fixed remaining -Wsuggest-destructor-override warnings
* Committing clang-format changes
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'config')
-rw-r--r-- | config/cmake/H5pubconf.h.in | 9 | ||||
-rw-r--r-- | config/cmake_ext_mod/ConfigureChecks.cmake | 52 | ||||
-rw-r--r-- | config/cmake_ext_mod/HDFTests.c | 48 | ||||
-rw-r--r-- | config/ibm-aix | 2 |
4 files changed, 1 insertions, 110 deletions
diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 9a581cb..4b2d2ee 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -464,9 +464,6 @@ /* Define Fortran Maximum Real Decimal Precision */ #define H5_PAC_FC_MAX_REAL_PRECISION @H5_PAC_FC_MAX_REAL_PRECISION@ -/* Width for printf() for type `long long' or `__int64', use `ll' */ -#cmakedefine H5_PRINTF_LL_WIDTH @H5_PRINTF_LL_WIDTH@ - /* The size of `bool', as computed by sizeof. */ #cmakedefine H5_SIZEOF_BOOL @H5_SIZEOF_BOOL@ @@ -559,8 +556,7 @@ #endif -/* Define size of long long and/or __int64 bit integer type only if the type - exists. */ +/* The size of `long long', as computed by sizeof. */ #if !defined(__APPLE__) #cmakedefine H5_SIZEOF_LONG_LONG @H5_SIZEOF_LONG_LONG@ #else @@ -627,9 +623,6 @@ /* The size of `__float128', as computed by sizeof. */ #define H5_SIZEOF___FLOAT128 @H5_SIZEOF___FLOAT128@ -/* The size of `__int64', as computed by sizeof. */ -#define H5_SIZEOF___INT64 @H5_SIZEOF___INT64@ - /* Define if strict file format checks are enabled */ #cmakedefine H5_STRICT_FORMAT_CHECKS @H5_STRICT_FORMAT_CHECKS@ diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 6242b12..c4516c7 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -326,10 +326,6 @@ if (NOT APPLE) HDF_CHECK_TYPE_SIZE (long ${HDF_PREFIX}_SIZEOF_LONG) endif () HDF_CHECK_TYPE_SIZE ("long long" ${HDF_PREFIX}_SIZEOF_LONG_LONG) -HDF_CHECK_TYPE_SIZE (__int64 ${HDF_PREFIX}_SIZEOF___INT64) -if (NOT ${HDF_PREFIX}_SIZEOF___INT64) - set (${HDF_PREFIX}_SIZEOF___INT64 0) -endif () HDF_CHECK_TYPE_SIZE (float ${HDF_PREFIX}_SIZEOF_FLOAT) HDF_CHECK_TYPE_SIZE (double ${HDF_PREFIX}_SIZEOF_DOUBLE) @@ -567,54 +563,6 @@ if (WINDOWS) endif () endif () -#----------------------------------------------------------------------------- -# Check how to print a Long Long integer -#----------------------------------------------------------------------------- -if (NOT ${HDF_PREFIX}_PRINTF_LL_WIDTH OR ${HDF_PREFIX}_PRINTF_LL_WIDTH MATCHES "unknown") - set (PRINT_LL_FOUND 0) - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Checking for appropriate format for 64 bit long:") - endif () - set (CURRENT_TEST_DEFINITIONS "-DPRINTF_LL_WIDTH") - if (${HDF_PREFIX}_SIZEOF_LONG_LONG) - set (CURRENT_TEST_DEFINITIONS "${CURRENT_TEST_DEFINITIONS} -DHAVE_LONG_LONG") - endif () - TRY_RUN (${HDF_PREFIX}_PRINTF_LL_TEST_RUN ${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE - ${CMAKE_BINARY_DIR} - ${HDF_RESOURCES_EXT_DIR}/HDFTests.c - COMPILE_DEFINITIONS "${CURRENT_TEST_DEFINITIONS}" - RUN_OUTPUT_VARIABLE OUTPUT - ) - if (${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE) - if (${HDF_PREFIX}_PRINTF_LL_TEST_RUN MATCHES 0) - string(REGEX REPLACE ".*PRINTF_LL_WIDTH=\\[(.*)\\].*" "\\1" ${HDF_PREFIX}_PRINTF_LL "${OUTPUT}") - set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"${${HDF_PREFIX}_PRINTF_LL}\"" CACHE INTERNAL "Width for printf for type `long long' or `__int64', us. `ll") - set (PRINT_LL_FOUND 1) - else () - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Width test failed with result: ${${HDF_PREFIX}_PRINTF_LL_TEST_RUN}") - endif () - endif () - else () - file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log - "Test ${HDF_PREFIX}_PRINTF_LL_WIDTH failed\n" - ) - endif () - - if (PRINT_LL_FOUND) - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Checking for appropriate format for 64 bit long: found ${${HDF_PREFIX}_PRINTF_LL_WIDTH}") - endif () - else () - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Checking for appropriate format for 64 bit long: not found") - endif () - set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"unknown\"" CACHE INTERNAL - "Width for printf for type `long long' or `__int64', us. `ll" - ) - endif () -endif () - # ---------------------------------------------------------------------- # Set the flag to indicate that the machine can handle converting # denormalized floating-point values. diff --git a/config/cmake_ext_mod/HDFTests.c b/config/cmake_ext_mod/HDFTests.c index 2b2a202..16686ba 100644 --- a/config/cmake_ext_mod/HDFTests.c +++ b/config/cmake_ext_mod/HDFTests.c @@ -80,54 +80,6 @@ SIMPLE_TEST(timezone=0); #endif /* HAVE_TIMEZONE */ -#ifdef PRINTF_LL_WIDTH - -#ifdef HAVE_LONG_LONG -# define LL_TYPE long long -#else /* HAVE_LONG_LONG */ -# define LL_TYPE __int64 -#endif /* HAVE_LONG_LONG */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#if defined(_MSC_VER) && defined(_DEBUG) -# include <crtdbg.h> -int DebugReport(int reportType, char* message, int* returnValue) -{ - (void)reportType; - (void)message; - (void)returnValue; - return 1; /* no further handling required */ -} -#endif - -int main(void) -{ - char *llwidthArgs[] = { "I64", "l64", "ll", "l", "L", "q", NULL }; - char *s = malloc(128); - char **currentArg = NULL; - LL_TYPE x = (LL_TYPE)1048576 * (LL_TYPE)1048576; - #if defined(_MSC_VER) && defined(_DEBUG) - _CrtSetReportHook(DebugReport); - #endif - for (currentArg = llwidthArgs; *currentArg != NULL; currentArg++) - { - char formatString[64]; - snprintf(formatString, sizeof(formatString), "%%%sd", *currentArg); - snprintf(s, 128, formatString, x); - if (strcmp(s, "1099511627776") == 0) - { - printf("PRINTF_LL_WIDTH=[%s]\n", *currentArg); - return 0; - } - } - return 1; -} - -#endif /* PRINTF_LL_WIDTH */ - #ifdef SYSTEM_SCOPE_THREADS #include <stdlib.h> #include <pthread.h> diff --git a/config/ibm-aix b/config/ibm-aix index f48f9d8..9f261e3 100644 --- a/config/ibm-aix +++ b/config/ibm-aix @@ -149,8 +149,6 @@ ac_cv_sizeof_char=${ac_cv_sizeof_char=1} ac_cv_sizeof_short=${ac_cv_sizeof_short=2} ac_cv_sizeof_int=${ac_cv_sizeof_int=4} ac_cv_sizeof_long_long=${ac_cv_sizeof_long_long=8} -# Do not cache __int64 since it is not a standard C type and some compilers -# (e.g., gcc) does not support it. ac_cv_sizeof_float=${ac_cv_sizeof_float=4} ac_cv_sizeof_double=${ac_cv_sizeof_double=8} ac_cv_sizeof_long_double=${ac_cv_sizeof_long_double=8} |