From 944cbb940009119de7ccae8a42734b38d03ea2c7 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 30 Mar 2020 13:10:36 -0500 Subject: TRILAB-192 merging warnings changes from develop --- MANIFEST | 43 +- c++/examples/Makefile.am | 4 +- c++/examples/run-c++-ex.sh.in | 4 +- c++/src/CMakeLists.txt | 6 + config/clang-warnings/developer-general | 3 + config/clang-warnings/error-general | 79 +++ config/clang-warnings/general | 26 + config/clang-warnings/no-developer-general | 1 + config/cmake/HDFCompilerFlags.cmake | 197 ++++---- config/cmake/libhdf5.settings.cmake.in | 4 +- config/commence.am | 2 +- config/gnu-flags | 146 +++--- config/gnu-warnings-developer-general | 8 - config/gnu-warnings-general | 32 -- config/gnu-warnings-no-developer-general | 4 - config/gnu-warnings/4.2-4.3 | 3 + config/gnu-warnings/4.2-4.4 | 2 + config/gnu-warnings/4.2-4.6 | 2 + config/gnu-warnings/4.2-4.last | 3 + config/gnu-warnings/4.3 | 2 + config/gnu-warnings/4.4 | 3 + config/gnu-warnings/4.5 | 1 + config/gnu-warnings/4.5-4.6 | 3 + config/gnu-warnings/4.6 | 2 + config/gnu-warnings/4.7 | 5 + config/gnu-warnings/4.8 | 1 + config/gnu-warnings/4.9 | 1 + config/gnu-warnings/5 | 2 + config/gnu-warnings/6 | 9 + config/gnu-warnings/7 | 7 + config/gnu-warnings/8 | 3 + config/gnu-warnings/9 | 2 + config/gnu-warnings/developer-4.5 | 7 + config/gnu-warnings/developer-4.6 | 1 + config/gnu-warnings/developer-4.7 | 7 + config/gnu-warnings/developer-4.8 | 1 + config/gnu-warnings/developer-7 | 1 + config/gnu-warnings/developer-8 | 3 + config/gnu-warnings/developer-general | 13 + config/gnu-warnings/error-5 | 12 + config/gnu-warnings/error-8 | 9 + config/gnu-warnings/error-general | 91 ++++ config/gnu-warnings/general | 32 ++ config/gnu-warnings/no-developer-4.5 | 1 + config/gnu-warnings/no-developer-4.6 | 1 + config/gnu-warnings/no-developer-4.7 | 2 + config/gnu-warnings/no-developer-4.8 | 1 + config/gnu-warnings/no-developer-8 | 2 + config/gnu-warnings/no-developer-general | 4 + config/linux-gnueabihf | 16 + config/netbsd | 56 +++ config/sanitizer/sanitizers.cmake | 109 ++--- config/toolchain/intel.cmake | 13 +- configure.ac | 31 +- examples/Makefile.am | 4 +- examples/run-c-ex.sh.in | 29 +- fortran/examples/Makefile.am | 4 +- fortran/examples/run-fortran-ex.sh.in | 27 +- hl/c++/examples/Makefile.am | 4 +- hl/c++/examples/run-hlc++-ex.sh.in | 28 +- hl/c++/src/CMakeLists.txt | 6 + hl/examples/Makefile.am | 4 +- hl/examples/run-hlc-ex.sh.in | 27 +- hl/fortran/examples/Makefile.am | 4 +- hl/fortran/examples/run-hlfortran-ex.sh.in | 4 +- hl/src/CMakeLists.txt | 6 + java/src/jni/CMakeLists.txt | 3 + java/src/jni/h5aImp.c | 6 +- java/src/jni/h5eImp.c | 6 +- java/src/jni/h5lImp.c | 6 +- java/src/jni/h5oImp.c | 41 +- release_docs/RELEASE.txt | 17 + src/CMakeLists.txt | 6 + src/H5Fsuper.c | 213 ++++---- src/H5Odeprec.c | 1 + src/H5Oint.c | 757 +++++++++++++++-------------- src/H5Rint.c | 37 +- tools/lib/CMakeLists.txt | 6 + tools/src/h5copy/CMakeLists.txt | 2 + tools/src/h5diff/CMakeLists.txt | 2 + tools/src/h5dump/CMakeLists.txt | 2 + tools/src/h5format_convert/CMakeLists.txt | 2 + tools/src/h5ls/CMakeLists.txt | 2 + tools/src/h5repack/CMakeLists.txt | 2 + tools/src/h5stat/CMakeLists.txt | 2 + tools/src/misc/CMakeLists.txt | 8 + 86 files changed, 1456 insertions(+), 835 deletions(-) create mode 100644 config/clang-warnings/developer-general create mode 100644 config/clang-warnings/error-general create mode 100644 config/clang-warnings/general create mode 100644 config/clang-warnings/no-developer-general delete mode 100644 config/gnu-warnings-developer-general delete mode 100644 config/gnu-warnings-general delete mode 100644 config/gnu-warnings-no-developer-general create mode 100644 config/gnu-warnings/4.2-4.3 create mode 100644 config/gnu-warnings/4.2-4.4 create mode 100644 config/gnu-warnings/4.2-4.6 create mode 100644 config/gnu-warnings/4.2-4.last create mode 100644 config/gnu-warnings/4.3 create mode 100644 config/gnu-warnings/4.4 create mode 100644 config/gnu-warnings/4.5 create mode 100644 config/gnu-warnings/4.5-4.6 create mode 100644 config/gnu-warnings/4.6 create mode 100644 config/gnu-warnings/4.7 create mode 100644 config/gnu-warnings/4.8 create mode 100644 config/gnu-warnings/4.9 create mode 100644 config/gnu-warnings/5 create mode 100644 config/gnu-warnings/6 create mode 100644 config/gnu-warnings/7 create mode 100644 config/gnu-warnings/8 create mode 100644 config/gnu-warnings/9 create mode 100644 config/gnu-warnings/developer-4.5 create mode 100644 config/gnu-warnings/developer-4.6 create mode 100644 config/gnu-warnings/developer-4.7 create mode 100644 config/gnu-warnings/developer-4.8 create mode 100644 config/gnu-warnings/developer-7 create mode 100644 config/gnu-warnings/developer-8 create mode 100644 config/gnu-warnings/developer-general create mode 100644 config/gnu-warnings/error-5 create mode 100644 config/gnu-warnings/error-8 create mode 100644 config/gnu-warnings/error-general create mode 100644 config/gnu-warnings/general create mode 100644 config/gnu-warnings/no-developer-4.5 create mode 100644 config/gnu-warnings/no-developer-4.6 create mode 100644 config/gnu-warnings/no-developer-4.7 create mode 100644 config/gnu-warnings/no-developer-4.8 create mode 100644 config/gnu-warnings/no-developer-8 create mode 100644 config/gnu-warnings/no-developer-general create mode 100644 config/linux-gnueabihf create mode 100644 config/netbsd diff --git a/MANIFEST b/MANIFEST index 4266c39..dc9552b 100644 --- a/MANIFEST +++ b/MANIFEST @@ -131,18 +131,55 @@ ./config/intel-flags ./config/linux-gnu ./config/linux-gnuaout +./config/linux-gnueabihf ./config/linux-gnulibc1 ./config/linux-gnulibc2 ./config/lt_vers.am ./config/Makefile.am.blank +./config/netbsd ./config/pgi-fflags ./config/pgi-flags ./config/solaris #warnings files for both autotools and CMake -./config/gnu-warnings-general -./config/gnu-warnings-developer-general -./config/gnu-warnings-no-developer-general +./config/clang-warnings/developer-general +./config/clang-warnings/error-general +./config/clang-warnings/general +./config/clang-warnings/no-developer-general +./config/gnu-warnings/4.2-4.3 +./config/gnu-warnings/4.2-4.4 +./config/gnu-warnings/4.2-4.6 +./config/gnu-warnings/4.2-4.last +./config/gnu-warnings/4.3 +./config/gnu-warnings/4.4 +./config/gnu-warnings/4.5 +./config/gnu-warnings/4.5-4.6 +./config/gnu-warnings/4.6 +./config/gnu-warnings/4.7 +./config/gnu-warnings/4.8 +./config/gnu-warnings/4.9 +./config/gnu-warnings/5 +./config/gnu-warnings/6 +./config/gnu-warnings/7 +./config/gnu-warnings/8 +./config/gnu-warnings/9 +./config/gnu-warnings/developer-4.5 +./config/gnu-warnings/developer-4.6 +./config/gnu-warnings/developer-4.7 +./config/gnu-warnings/developer-4.8 +./config/gnu-warnings/developer-7 +./config/gnu-warnings/developer-8 +./config/gnu-warnings/developer-general +./config/gnu-warnings/error-5 +./config/gnu-warnings/error-8 +./config/gnu-warnings/error-general +./config/gnu-warnings/general +./config/gnu-warnings/no-developer-4.5 +./config/gnu-warnings/no-developer-4.6 +./config/gnu-warnings/no-developer-4.7 +./config/gnu-warnings/no-developer-4.8 +./config/gnu-warnings/no-developer-8 +./config/gnu-warnings/no-developer-general ./config/intel-warnings-general ./config/site-specific/BlankForm diff --git a/c++/examples/Makefile.am b/c++/examples/Makefile.am index 51ab8e3..0648504 100644 --- a/c++/examples/Makefile.am +++ b/c++/examples/Makefile.am @@ -49,8 +49,8 @@ CXX_API=yes # Where to install examples # Note: no '/' after DESTDIR. Explanation in commence.am -EXAMPLEDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/c++ -EXAMPLETOPDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples +EXAMPLEDIR=$(examplesdir)/c++ +EXAMPLETOPDIR=$(examplesdir) # How to build programs using h5c++ $(EXTRA_PROG): $(H5CPP) diff --git a/c++/examples/run-c++-ex.sh.in b/c++/examples/run-c++-ex.sh.in index d975924..4667878 100644 --- a/c++/examples/run-c++-ex.sh.in +++ b/c++/examples/run-c++-ex.sh.in @@ -18,7 +18,7 @@ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # This script will compile and run the c++ examples from source files # -# installed in .../share/hdf5_examples/c++ using h5c++. The # +# installed in @examplesdir@/c++ using h5c++. The # # order for running programs with RunTest in the MAIN section below is taken # # from the Makefile. The order is important since some of the test programs # # use data files created by earlier test programs. Any future additions should # @@ -32,7 +32,7 @@ EXIT_FAILURE=1 # Where the tool is installed. # default is relative path to installed location of the tools -prefix="${prefix:-../../..}" +prefix="${prefix:-../${prefix_relto_examplesdir}}" AR="@AR@" RANLIB="@RANLIB@" H5TOOL="h5c++" # The tool name diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index 39f0f3a..fa15c9e 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -90,6 +90,9 @@ if (NOT ONLY_SHARED_LIBS) PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) + target_compile_options(${HDF5_CPP_LIB_TARGET} + PRIVATE "${HDF5_CMAKE_CXX_FLAGS}" + ) target_compile_definitions(${HDF5_CPP_LIB_TARGET} PRIVATE $<$:MPICH_SKIP_MPICXX;MPICH_IGNORE_CXX_SEEK># Parallel/MPI, prevent spurious cpp/cxx warnings ) @@ -107,6 +110,9 @@ if (BUILD_SHARED_LIBS) PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) + target_compile_options(${HDF5_CPP_LIBSH_TARGET} + PRIVATE "${HDF5_CMAKE_CXX_FLAGS}" + ) target_compile_definitions(${HDF5_CPP_LIBSH_TARGET} PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" PRIVATE $<$:MPICH_SKIP_MPICXX;MPICH_IGNORE_CXX_SEEK># Parallel/MPI, prevent spurious cpp/cxx warnings diff --git a/config/clang-warnings/developer-general b/config/clang-warnings/developer-general new file mode 100644 index 0000000..aa8c32e --- /dev/null +++ b/config/clang-warnings/developer-general @@ -0,0 +1,3 @@ +-Wformat-nonliteral +-Wmissing-noreturn +-Wswitch-enum diff --git a/config/clang-warnings/error-general b/config/clang-warnings/error-general new file mode 100644 index 0000000..a9aa516 --- /dev/null +++ b/config/clang-warnings/error-general @@ -0,0 +1,79 @@ +# +# HDF5 code should not trigger the following warnings under any +# circumstances, so ask the compiler to treat them as errors: +# +-Werror=bad-function-cast +-Werror=implicit-function-declaration +-Werror=incompatible-pointer-types +-Werror=missing-declarations +-Werror=packed +-Werror=shadow +-Werror=sometimes-uninitialized +-Werror=switch +# +#-Werror=discarded-qualifiers +# +# +# NOTE: File Driver files are not compatible with these warnings as errors +# H5FDdirect.c,H5FDmpio.c,H5FDros3.c, +# -Werror=unused-function +# +-Wunused-function +# +# H5FDdrvr_module.h +# -Werror=unused-variable +# +-Wunused-variable +# +# H5VLpassthru.c +# -Werror=unused-parameter +# +-Wunused-parameter +# +# +# +# NOTE: Tools files are not compatible with these warnings as errors +# lib/h5tools.c +# -Werror=cast-align +# +-Wcast-align +# +# lib/h5tools_utils.c +# -Werror=unused-parameter +# +# +# NOTE: JNI files are not compatible with these warnings as errors +# jni/h5pDCPLImp.c,jni/nativeData.c,jni/h5util.c,jni/h5rImp.c +# jni/h5sImp.c,jni/h5tImp.c +# -Werror=cast-align +# jni/h5util.c +# -Werror=format(-overflow) +# +-Wformat +# +# +#Examples and tests do not use the same set of extensive warning flags as libraries +# Here is a list of tests and examples that have issues with the stricter warnings as error +# +# NOTE: Test files are not compatible with these warnings as errors +# thread_id.c, +# -Werror=unused-function +# dsets.c +# -Werror=unused-parameter +# +# +# NOTE: Examples files are not compatible with these warnings as errors +# h5_vds-eiger.c,h5_vds-exclim.c,h5_vds.c,h5_vds-exc.c,h5_vds-percival-unlim-maxmin.c +# h5_vds-percival.c,h5_read.c,h5_rdwt.c,h5_mount.c,h5_extend.c,h5_extend_write.c +# h5_write.c,h5_vds-simpleIO.c,h5_ref2reg_deprec.c,h5_crtgrp.c,h5_select.c +# h5_vds-percival-unlim.c,h5_crtatt.c,h5_group.c,h5_attribute.c,h5_crtdat.c +# h5_reference_deprec.c +# h5_rdwt.c,h5_crtgrp.c,h5_crtatt.c,h5_crtdat.c +# -Werror=strict-prototypes +# h5_rdwt.c,h5_crtgrp.c,h5_crtatt.c,h5_crtdat.c +# -Werror=old-style-definition +# h5_vds-exclim.c,h5_vds.c,h5_vds-exc.c, +# -Werror=unused-variable +# h5_elink_unix2win.c,h5_extlink.c,h5_attribute.c +# -Werror=unused-parameter + diff --git a/config/clang-warnings/general b/config/clang-warnings/general new file mode 100644 index 0000000..f0c9b93 --- /dev/null +++ b/config/clang-warnings/general @@ -0,0 +1,26 @@ +# general clang warnings flags +-Wall +-Warray-bounds +-Wcast-qual +-Wconversion +-Wdouble-promotion +-Wextra +-Wformat=2 +-Wframe-larger-than=16384 +-Wimplicit-fallthrough +# +# NOTE: Due to the divergence in the C and C++, we're dropping support for +# compiling the C library with a C++ compiler and dropping the -Wc++-compat +# warning. +# +-Wno-c++-compat +# +# NOTE: Disable the -Wformat-nonliteral from -Wformat=2 here and re-add +# it to the developer flags. +# +-Wno-format-nonliteral +-Wnull-dereference +-Wunused-const-variable +-Wwrite-strings +-Wpedantic +-Wvolatile-register-var diff --git a/config/clang-warnings/no-developer-general b/config/clang-warnings/no-developer-general new file mode 100644 index 0000000..2f4e0c5 --- /dev/null +++ b/config/clang-warnings/no-developer-general @@ -0,0 +1 @@ +-Wmissing-noreturn diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index 17b0854..03c6936 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -23,7 +23,7 @@ macro (ADD_H5_FLAGS h5_flag_var infile) string (REGEX REPLACE "^#.*" "" str_flag "${str_flag}") #message (STATUS "str_flag=${str_flag}") if (str_flag) - set (${h5_flag_var} "${${h5_flag_var}} ${str_flag}") + list (APPEND ${h5_flag_var} "${str_flag}") endif () endforeach () endif () @@ -98,12 +98,16 @@ if (HDF5_DISABLE_COMPILER_WARNINGS) endif () #----------------------------------------------------------------------------- +# HDF5 library compile options +#----------------------------------------------------------------------------- + +#----------------------------------------------------------------------------- # CDash is configured to only allow 3000 warnings, so # break into groups (from the config/gnu-flags file) #----------------------------------------------------------------------------- -if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) +if (NOT MSVC) if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -erroff=%none -DBSD_COMP") + list (APPEND HDF5_CMAKE_C_FLAGS "-erroff=%none -DBSD_COMP") else () # General flags # @@ -115,32 +119,30 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) # NOTE: Don't add -Wpadded here since we can't/won't fix the (many) # warnings that are emitted. If you need it, add it at configure time. if (CMAKE_C_COMPILER_ID STREQUAL "Intel") - ADD_H5_FLAGS (CMAKE_C_FLAGS_GENERAL "${HDF5_SOURCE_DIR}/config/intel-warnings-general") - message (STATUS "CMAKE_C_FLAGS_GENERAL=${CMAKE_C_FLAGS_GENERAL}") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_GENERAL}") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wcomment -Wdeprecated -Wmain -Wmissing-declarations -Wmissing-prototypes -Wp64 -Wpointer-arith") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wreturn-type -Wstrict-prototypes -Wuninitialized") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wunknown-pragmas -Wunused-function -Wunused-variable") + ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/intel-warnings-general") + message (STATUS "CMAKE_C_FLAGS_GENERAL=${HDF5_CMAKE_C_FLAGS}") + list (APPEND H5_CFLAGS0 "-Wcomment -Wdeprecated -Wmain -Wmissing-declarations -Wmissing-prototypes -Wp64 -Wpointer-arith") + list (APPEND H5_CFLAGS0 "-Wreturn-type -Wstrict-prototypes -Wuninitialized") + list (APPEND H5_CFLAGS0 "-Wunknown-pragmas -Wunused-function -Wunused-variable") # this is just a failsafe - set (H5_CFLAGS0 "${H5_CFLAGS0} -finline-functions") + list (APPEND H5_CFLAGS0 "-finline-functions") if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 18.0) - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wextra-tokens -Wformat -Wformat-security -Wic-pointer -Wshadow") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wsign-compare -Wtrigraphs -Wwrite-strings") + list (APPEND H5_CFLAGS0 "-Wextra-tokens -Wformat -Wformat-security -Wic-pointer -Wshadow") + list (APPEND H5_CFLAGS0 "-Wsign-compare -Wtrigraphs -Wwrite-strings") endif() elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") - ADD_H5_FLAGS (CMAKE_C_FLAGS_GENERAL "${HDF5_SOURCE_DIR}/config/gnu-warnings-general") - message (STATUS "CMAKE_C_FLAGS_GENERAL=${CMAKE_C_FLAGS_GENERAL}") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_GENERAL}") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wbad-function-cast -Wcast-align") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wdeclaration-after-statement -Wdisabled-optimization") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wmissing-declarations") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wredundant-decls -Wstrict-prototypes -Wswitch-enum -Wswitch-default") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wunused-macros -Wunsafe-loop-optimizations") + ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/general") + message (STATUS "CMAKE_C_FLAGS_GENERAL=${HDF5_CMAKE_C_FLAGS}") + ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-general") # gcc automatically inlines based on the optimization level # this is just a failsafe - set (H5_CFLAGS0 "${H5_CFLAGS0} -finline-functions") - message (STATUS "H5_CFLAGS0=${H5_CFLAGS0}") + list (APPEND H5_CFLAGS0 "-finline-functions") + elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang") + ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/general") + message (STATUS "CMAKE_C_FLAGS_GENERAL=${HDF5_CMAKE_C_FLAGS}") + ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/clang-warnings/error-general") + elseif (CMAKE_C_COMPILER_ID STREQUAL "PGI") + list (APPEND HDF5_CMAKE_C_FLAGS "-Minform=inform") endif () endif () @@ -152,100 +154,127 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) if (HDF5_ENABLE_DEV_WARNINGS) message (STATUS "....HDF5 developer group warnings are enabled") if (CMAKE_C_COMPILER_ID STREQUAL "Intel") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Winline -Wreorder -Wport -Wstrict-aliasing") + list (APPEND H5_CFLAGS0 "-Winline -Wreorder -Wport -Wstrict-aliasing") elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") - ADD_H5_FLAGS (CMAKE_C_FLAGS_DEV_GENERAL "${HDF5_SOURCE_DIR}/config/gnu-warnings-developer-general") - set (H5_CFLAGS0 "${H5_CFLAGS0} ${CMAKE_C_FLAGS_DEV_GENERAL}") + ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-general") + elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang") + ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/clang-warnings/developer-general") endif () else () if (CMAKE_C_COMPILER_ID STREQUAL "GNU") - ADD_H5_FLAGS (CMAKE_C_FLAGS_NO_DEV_GENERAL "${HDF5_SOURCE_DIR}/config/gnu-warnings-no-developer-general") - set (H5_CFLAGS0 "${H5_CFLAGS0} ${CMAKE_C_FLAGS_NO_DEV_GENERAL}") + ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-general") + elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang") + ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/clang-warnings/no-developer-general") endif () endif () if (CMAKE_C_COMPILER_ID STREQUAL "GNU") # Append warning flags that only gcc 4.3+ knows about + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.3") # # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wlogical-op -Wlarger-than=2560 -Wvla") + # we should approach them a bit cautiously... Only needed for gcc 4.X + if (CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.2-4.last") + endif () # Append more extra warning flags that only gcc 4.4+ know about - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat") + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.4") + endif () endif () # Append more extra warning flags that only gcc 4.5+ know about if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5) - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wstrict-overflow=5 -Wjump-misses-init") - if (HDF5_ENABLE_DEV_WARNINGS) - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wunsuffixed-float-constants") - else () - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wno-unsuffixed-float-constants") - endif () + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.5") + if (HDF5_ENABLE_DEV_WARNINGS) + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.5") + else () + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.5") + endif () + endif () + + # Append more extra warning flags that only gcc 4.6 and less know about + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.2-4.6") + endif () + + # Append more extra warning flags that only gcc 4.5-4.6 know about + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5 AND CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.5-4.6") endif () # Append more extra warning flags that only gcc 4.6+ know about if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6) - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wdouble-promotion -Wtrampolines") + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.6") if (HDF5_ENABLE_DEV_WARNINGS) - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wsuggest-attribute=const") + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.6") else () - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wno-suggest-attribute=const") + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.6") endif () endif () # Append more extra warning flags that only gcc 4.7+ know about if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wstack-usage=8192 -Wvector-operation-performance") + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.7") if (HDF5_ENABLE_DEV_WARNINGS) - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn") + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.7") else () - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wno-suggest-attribute=pure -Wno-suggest-attribute=noreturn") + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.7") endif () endif () # Append more extra warning flags that only gcc 4.8+ know about if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.8) + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8") if (HDF5_ENABLE_DEV_WARNINGS) - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wsuggest-attribute=format") + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.8") else () - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wno-suggest-attribute=format") + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.8") endif () endif () # Append more extra warning flags that only gcc 4.9+ know about if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9) - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wdate-time") + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.9") endif () # Append more extra warning flags that only gcc 5.1+ know about - if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.1) - set (H5_CFLAGS3 "${H5_CFLAGS3} -Warray-bounds=2 -Wc99-c11-compat") + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/5") + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-5") endif () # Append more extra warning flags that only gcc 6.x+ know about if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0) - set (H5_CFLAGS4 "${H5_CFLAGS4} -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa -Wnormalized") + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/6") endif () # Append more extra warning flags that only gcc 7.x+ know about if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 7.0) - set (H5_CFLAGS4 "${H5_CFLAGS4} -Walloc-zero -Walloca -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=1 -Wimplicit-fallthrough=5 -Wrestrict") + ADD_H5_FLAGS (H5_CFLAGS2 "${HDF5_SOURCE_DIR}/config/gnu-warnings/7") + if (HDF5_ENABLE_DEV_WARNINGS) + ADD_H5_FLAGS (H5_CFLAGS2 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-7") + #else () + # ADD_H5_FLAGS (H5_CFLAGS2 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-7") + endif () endif () # Append more extra warning flags that only gcc 8.x+ know about if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 8.0) - set (H5_CFLAGS4 "${H5_CFLAGS4} -Wattribute-alias -Wcast-align=strict -Wshift-overflow=2 -Wno-suggest-attribute=cold -Wno-suggest-attribute=malloc") + ADD_H5_FLAGS (H5_CFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/8") + if (HDF5_ENABLE_DEV_WARNINGS) + ADD_H5_FLAGS (H5_CFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-8") + else () + ADD_H5_FLAGS (H5_CFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-8") + endif () endif () # Append more extra warning flags that only gcc 9.x+ know about if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.0) - set (H5_CFLAGS4 "${H5_CFLAGS4} -Wattribute-alias=2 -Wmissing-profile") + ADD_H5_FLAGS (H5_CFLAGS4 "${HDF5_SOURCE_DIR}/config/gnu-warnings/9") endif () -elseif (CMAKE_C_COMPILER_ID STREQUAL "PGI") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Minform=inform") endif () #----------------------------------------------------------------------------- @@ -257,22 +286,22 @@ if (HDF5_ENABLE_ALL_WARNINGS) if (MSVC) if (HDF5_ENABLE_DEV_WARNINGS) string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Wall /wd4668") + list (APPEND HDF5_CMAKE_C_FLAGS "/Wall /wd4668") if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Wall /wd4668") + list (APPEND HDF5_CMAKE_CXX_FLAGS "/Wall /wd4668") endif () else () string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3") + list (APPEND HDF5_CMAKE_C_FLAGS "/W3") if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3") + list (APPEND HDF5_CMAKE_CXX_FLAGS "/W3") endif () endif () else () if (CMAKE_COMPILER_IS_GNUCC) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS0} ${H5_CFLAGS1} ${H5_CFLAGS2}") + list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS0} ${H5_CFLAGS1} ${H5_CFLAGS2} ${H5_CFLAGS3} ${H5_CFLAGS4}) endif () endif () endif () @@ -284,15 +313,15 @@ option (HDF5_ENABLE_GROUPZERO_WARNINGS "Enable group zero warnings" OFF) if (HDF5_ENABLE_GROUPZERO_WARNINGS) message (STATUS "....Group Zero warnings are enabled") if (MSVC) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W1") + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_C_FLAGS "${HDF5_CMAKE_C_FLAGS}") + list (APPEND HDF5_CMAKE_C_FLAGS "/W1") if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W1") + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}") + list (APPEND HDF5_CMAKE_CXX_FLAGS "/W1") endif () else () if (CMAKE_COMPILER_IS_GNUCC) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS0}") + list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS0}) endif () endif () endif () @@ -304,14 +333,14 @@ option (HDF5_ENABLE_GROUPONE_WARNINGS "Enable group one warnings" OFF) if (HDF5_ENABLE_GROUPONE_WARNINGS) message (STATUS "....Group One warnings are enabled") if (MSVC) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W2") + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_C_FLAGS "${HDF5_CMAKE_C_FLAGS}") + list (APPEND HDF5_CMAKE_C_FLAGS "/W2") if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W2") + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}") + list (APPEND HDF5_CMAKE_CXX_FLAGS "/W2") endif () else () - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS1}") + list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS1}) endif () endif () @@ -322,14 +351,14 @@ option (HDF5_ENABLE_GROUPTWO_WARNINGS "Enable group two warnings" OFF) if (HDF5_ENABLE_GROUPTWO_WARNINGS) message (STATUS "....Group Two warnings are enabled") if (MSVC) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3") + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_C_FLAGS "${HDF5_CMAKE_C_FLAGS}") + list (APPEND HDF5_CMAKE_C_FLAGS "/W3") if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3") + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}") + list (APPEND HDF5_CMAKE_CXX_FLAGS "/W3") endif () else () - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS2}") + list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS2}) endif () endif () @@ -340,14 +369,14 @@ option (HDF5_ENABLE_GROUPTHREE_WARNINGS "Enable group three warnings" OFF) if (HDF5_ENABLE_GROUPTHREE_WARNINGS) message (STATUS "....Group Three warnings are enabled") if (MSVC) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4") + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_C_FLAGS "${HDF5_CMAKE_C_FLAGS}") + list (APPEND HDF5_CMAKE_C_FLAGS "/W4") if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) - string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") + string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}") + list (APPEND HDF5_CMAKE_CXX_FLAGS "/W4") endif () else () - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS3}") + list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS3}) endif () endif () @@ -358,7 +387,7 @@ option (HDF5_ENABLE_GROUPFOUR_WARNINGS "Enable group four warnings" OFF) if (HDF5_ENABLE_GROUPFOUR_WARNINGS) message (STATUS "....Group Four warnings are enabled") if (NOT MSVC) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS4}") + list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS4}) endif () endif () @@ -430,9 +459,9 @@ MARK_AS_ADVANCED (HDF5_ENABLE_SYMBOLS) #----------------------------------------------------------------------------- option (HDF5_ENABLE_PROFILING "Enable profiling flags independently from the build mode." OFF) if (HDF5_ENABLE_PROFILING) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PROFILE_CFLAGS}") + list (APPEND HDF5_CMAKE_C_FLAGS "${PROFILE_CFLAGS}") if(CMAKE_CXX_COMPILER_LOADED) - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PROFILE_CXXFLAGS}") + list (APPEND HDF5_CMAKE_CXX_FLAGS "${PROFILE_CXXFLAGS}") endif () endif () MARK_AS_ADVANCED (HDF5_ENABLE_PROFILING) @@ -443,9 +472,9 @@ MARK_AS_ADVANCED (HDF5_ENABLE_PROFILING) #----------------------------------------------------------------------------- option (HDF5_ENABLE_OPTIMIZATION "Enable optimization flags/settings independently from the build mode" OFF) if (HDF5_ENABLE_OPTIMIZATION) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OPTIMIZE_CFLAGS}") + list (APPEND HDF5_CMAKE_C_FLAGS "${OPTIMIZE_CFLAGS}") if(CMAKE_CXX_COMPILER_LOADED) - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OPTIMIZE_CXXFLAGS}") + list (APPEND HDF5_CMAKE_CXX_FLAGS "${OPTIMIZE_CXXFLAGS}") endif () endif () MARK_AS_ADVANCED (HDF5_ENABLE_OPTIMIZATION) diff --git a/config/cmake/libhdf5.settings.cmake.in b/config/cmake/libhdf5.settings.cmake.in index 8397d68..292eaca 100644 --- a/config/cmake/libhdf5.settings.cmake.in +++ b/config/cmake/libhdf5.settings.cmake.in @@ -38,7 +38,7 @@ Languages: H5_CPPFLAGS: @H5_CPPFLAGS@ AM_CPPFLAGS: @AM_CPPFLAGS@ CFLAGS: @CMAKE_C_FLAGS@ - H5_CFLAGS: @H5_CFLAGS@ + H5_CFLAGS: @HDF5_CMAKE_C_FLAGS@ AM_CFLAGS: @AM_CFLAGS@ Shared C Library: @H5_ENABLE_SHARED_LIB@ Static C Library: @H5_ENABLE_STATIC_LIB@ @@ -54,7 +54,7 @@ Languages: C++: @HDF5_BUILD_CPP_LIB@ @BUILD_CXX_CONDITIONAL_TRUE@ C++ Compiler: @CMAKE_CXX_COMPILER@ @CMAKE_CXX_COMPILER_VERSION@ @BUILD_CXX_CONDITIONAL_TRUE@ C++ Flags: @CMAKE_CXX_FLAGS@ -@BUILD_CXX_CONDITIONAL_TRUE@ H5 C++ Flags: @H5_CXXFLAGS@ +@BUILD_CXX_CONDITIONAL_TRUE@ H5 C++ Flags: @HDF5_CMAKE_CXX_FLAGS@ @BUILD_CXX_CONDITIONAL_TRUE@ AM C++ Flags: @AM_CXXFLAGS@ @BUILD_CXX_CONDITIONAL_TRUE@ Shared C++ Library: @H5_ENABLE_SHARED_LIB@ @BUILD_CXX_CONDITIONAL_TRUE@ Static C++ Library: @H5_ENABLE_STATIC_LIB@ diff --git a/config/commence.am b/config/commence.am index 5fe21a6..cdfbfa0 100644 --- a/config/commence.am +++ b/config/commence.am @@ -70,7 +70,7 @@ H5CPP=${DESTDIR}$(bindir)/h5c++ # instead of CFLAGS, as CFLAGS is reserved solely for the user to define. # This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well. -AM_CFLAGS=@AM_CFLAGS@ @H5_CFLAGS@ +AM_CFLAGS=@AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@ AM_FCFLAGS=@AM_FCFLAGS@ @H5_FCFLAGS@ AM_CXXFLAGS=@AM_CXXFLAGS@ @H5_CXXFLAGS@ AM_CPPFLAGS=@AM_CPPFLAGS@ @H5_CPPFLAGS@ diff --git a/config/gnu-flags b/config/gnu-flags index 3ca74c1..ca0e1b4 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -18,6 +18,24 @@ # # +# For now, do not promote any warnings to errors. +# +PROMOTE_ERRORS_DFLT=no + +# +# This filter rewrites -Werror= as -W, in that way demoting warnings +# promoted to errors back to warnings, if PROMOTE_ERRORS is no. +# +demote_errors() +{ + if [ ${PROMOTE_ERRORS:-${PROMOTE_ERRORS_DFLT}} = no ]; then + sed 's,-Werror=,-W,g' + else + cat + fi +} + +# # Prepend `$srcdir/config/gnu-` to the filename suffix(es) given as # subroutine argument(s), remove comments starting with # and ending # at EOL, replace spans of whitespace (including newlines) with spaces, @@ -26,7 +44,7 @@ load_gcc_arguments() { set -- $(for arg; do - sed 's,#.*$,,' $srcdir/config/gnu-${arg} + sed 's,#.*$,,' $srcdir/config/gnu-warnings/${arg} | demote_errors done) IFS=' ' echo "$*" } @@ -47,7 +65,7 @@ if test "X-" = "X-$cc_flags_set"; then # containing 'icc version'. The cc_version for icc is correctly determined # and flags added in the intel-flags script. cc_version="`$CC $CFLAGS $H5_CFLAGS -v 2>&1 | grep -v 'PathScale' |\ - grep -v 'icc version' |\ + grep -v '^icc.*version' |\ grep 'gcc version' | sed 's/.*gcc version \([-a-z0-9\.]*\).*/\1/'`" cc_vendor=`echo $cc_version |sed 's/\([a-z]*\).*/\1/'` cc_version=`echo $cc_version |sed 's/[-a-z]//g'` @@ -171,142 +189,120 @@ if test "X-gcc" = "X-$cc_vendor"; then # General # ########### - # Note that some of the flags listed here really should be developer - # flags (listed in a separate variable, below) but we put them here - # because they are not raised by the current code and we'd like to - # know if they do start showing up. - # - # NOTE: Don't add -Wpadded here since we can't/won't fix the (many) - # warnings that are emitted. If you need it, add it from the - # environment variable at configure time. - # - # NOTE: Disable the -Wformat-nonliteral from -Wformat=2 here and re-add - # it to the developer flags. - # - # NOTE: Due to the divergence in the C and C++, we're dropping support for - # compiling the C library with a C++ compiler and dropping the -Wc++-compat - # warning. - H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments warnings-general)" - H5_CFLAGS="$H5_CFLAGS -Wbad-function-cast -Wcast-align" - H5_CFLAGS="$H5_CFLAGS -Wdeclaration-after-statement -Wdisabled-optimization" - H5_CFLAGS="$H5_CFLAGS -Wmissing-declarations" - H5_CFLAGS="$H5_CFLAGS -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked" - H5_CFLAGS="$H5_CFLAGS -Wredundant-decls -Wstrict-prototypes -Wswitch-enum -Wswitch-default" - H5_CFLAGS="$H5_CFLAGS -Wunused-macros -Wunsafe-loop-optimizations" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments general)" + H5_ECFLAGS="$H5_ECFLAGS $(load_gcc_arguments error-general)" ###################### # Developer warnings # ###################### - # (suggestions from gcc, not code problems) - # NOTE: -Wformat-nonliteral added back in here (from being disabled in H5_CFLAGS) - NO_DEVELOPER_WARNING_CFLAGS=$(load_gcc_arguments warnings-no-developer-general) - DEVELOPER_WARNING_CFLAGS=$(load_gcc_arguments warnings-developer-general) + NO_DEVELOPER_WARNING_CFLAGS=$(load_gcc_arguments no-developer-general) + DEVELOPER_WARNING_CFLAGS=$(load_gcc_arguments developer-general) ####################### # gcc 4 special cases # ####################### - # Disable warnings about using the 'long long' type w/ gcc 4.6 and earlier + # GCC 4.2 through 4.6 if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -o $cc_vers_major -eq 4 -a $cc_vers_minor -le 6; then - H5_CFLAGS="$H5_CFLAGS -Wno-long-long" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.2-4.6)" fi - # -Wvolatile-register-var was later incorporated into -Wall and - # only needs to be specified explicitly for gcc 4.2-4.3 + # GCC 4.2 through 4.3 if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -o $cc_vers_major -eq 4 -a $cc_vers_minor -le 3; then - H5_CFLAGS="$H5_CFLAGS -Wvolatile-register-var" - fi + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.2-4.3)" + fi - # -Wstrict-aliasing was later incorporated into -Wall and - # only needs to be specified explicitly for gcc 4.5-4.6 + # GCC 4.5 through 4.6 if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -le 6; then - H5_CFLAGS="$H5_CFLAGS -Wstrict-aliasing" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.5-4.6)" fi - # The non-valued form of -Wstrict-overflow is used in gcc 4.2-4.4 + # GCC 4.2 through 4.4 if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -a $cc_vers_major -eq 4 -a $cc_vers_minor -le 4; then - H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.2-4.4)" fi - # -Wvla was later incorporated into -Wpedantic and - # only needs to be specified explicitly for gcc 4 + # GCC 4.2 through the end of GCC 4 series if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2; then - H5_CFLAGS="$H5_CFLAGS -Wvla" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.2-4.last)" fi ############################# # Version-specific warnings # ############################# - # gcc 4.3 + # gcc >= 4.3 if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 3; then - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560" - fi + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.3)" + fi - # gcc 4.4 + # gcc >= 4.4 if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 4; then - H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.4)" fi - # gcc 4.5 + # gcc >= 4.5 if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 5; then - H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wunsuffixed-float-constants" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-unsuffixed-float-constants" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.5)" + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments developer-4.5)" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments no-developer-4.5)" fi - # gcc 4.6 + # gcc >= 4.6 if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 6; then - H5_CFLAGS="$H5_CFLAGS -Wdouble-promotion -Wtrampolines" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=const" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=const" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.6)" + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments developer-4.6)" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments no-developer-4.6)" fi - # gcc 4.7 + # gcc >= 4.7 if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 7; then - H5_CFLAGS="$H5_CFLAGS -Wstack-usage=8192 -Wvector-operation-performance" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=pure -Wno-suggest-attribute=noreturn" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.7)" + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments developer-4.7)" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments no-developer-4.7)" fi - # gcc 4.8 + # gcc >= 4.8 if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 8; then - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=format" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=format" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.8)" + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments developer-4.8)" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments no-developer-4.8)" fi - # gcc 4.9 + # gcc >= 4.9 if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 9; then - H5_CFLAGS="$H5_CFLAGS -Wdate-time" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.9)" fi - # gcc 5 + # gcc >= 5 if test $cc_vers_major -ge 5; then - H5_CFLAGS="$H5_CFLAGS -Warray-bounds=2 -Wc99-c11-compat" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 5)" + H5_ECFLAGS="$H5_ECFLAGS $(load_gcc_arguments error-5)" fi - # gcc 6 + # gcc >= 6 if test $cc_vers_major -ge 6; then - H5_CFLAGS="$H5_CFLAGS -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa -Wnormalized" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 6)" fi - # gcc 7 + # gcc >= 7 if test $cc_vers_major -ge 7; then - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstringop-overflow=2" - H5_CFLAGS="$H5_CFLAGS -Walloc-zero -Walloca -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=1 -Wimplicit-fallthrough=5 -Wrestrict" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 7)" + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments developer-7)" fi # gcc 8 if test $cc_vers_major -ge 8; then - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstringop-overflow=4 -Wsuggest-attribute=cold -Wsuggest-attribute=malloc" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=cold -Wno-suggest-attribute=malloc" - H5_CFLAGS="$H5_CFLAGS -Wattribute-alias -Wcast-align=strict -Wshift-overflow=2" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 8)" + H5_ECFLAGS="$H5_ECFLAGS $(load_gcc_arguments error-8)" + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments developer-8)" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments no-developer-8)" fi # gcc 9 if test $cc_vers_major -ge 9; then - H5_CFLAGS="$H5_CFLAGS -Wattribute-alias=2 -Wmissing-profile" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 9)" fi ################# diff --git a/config/gnu-warnings-developer-general b/config/gnu-warnings-developer-general deleted file mode 100644 index 698f0e0..0000000 --- a/config/gnu-warnings-developer-general +++ /dev/null @@ -1,8 +0,0 @@ -# (suggestions from gcc, not code problems) -# NOTE: -Wformat-nonliteral added back in here (from being disabled in -# H5_CFLAGS) --Waggregate-return --Wformat-nonliteral --Winline --Wmissing-format-attribute --Wmissing-noreturn diff --git a/config/gnu-warnings-general b/config/gnu-warnings-general deleted file mode 100644 index 9e67b71..0000000 --- a/config/gnu-warnings-general +++ /dev/null @@ -1,32 +0,0 @@ -# Note that some of the flags listed here really should be developer -# flags (listed in separate files, gnu-warnings-developer*) but we put -# them here because they are not raised by the current code and we'd like to -# know if they do start showing up. -# -# NOTE: Don't add -Wpadded here since we can't/won't fix the (many) -# warnings that are emitted. If you need it, add it from the -# environment variable at configure time. --Wall --Wcast-qual --Wconversion --Wextra --Wfloat-equal --Wformat=2 --Winit-self --Winvalid-pch --Wmissing-include-dirs -# -# NOTE: Due to the divergence in the C and C++, we're dropping support for -# compiling the C library with a C++ compiler and dropping the -Wc++-compat -# warning. -# --Wno-c++-compat -# -# NOTE: Disable the -Wformat-nonliteral from -Wformat=2 here and re-add -# it to the developer flags. -# --Wno-format-nonliteral --Wshadow --Wundef --Wwrite-strings --pedantic \ No newline at end of file diff --git a/config/gnu-warnings-no-developer-general b/config/gnu-warnings-no-developer-general deleted file mode 100644 index 85dc0a3..0000000 --- a/config/gnu-warnings-no-developer-general +++ /dev/null @@ -1,4 +0,0 @@ --Wno-aggregate-return --Wno-inline --Wno-missing-format-attribute --Wno-missing-noreturn diff --git a/config/gnu-warnings/4.2-4.3 b/config/gnu-warnings/4.2-4.3 new file mode 100644 index 0000000..1881797 --- /dev/null +++ b/config/gnu-warnings/4.2-4.3 @@ -0,0 +1,3 @@ +# -Wvolatile-register-var was later incorporated into -Wall and +# only needs to be specified explicitly for gcc 4.2-4.3 +-Wvolatile-register-var diff --git a/config/gnu-warnings/4.2-4.4 b/config/gnu-warnings/4.2-4.4 new file mode 100644 index 0000000..ec4876f --- /dev/null +++ b/config/gnu-warnings/4.2-4.4 @@ -0,0 +1,2 @@ +# The non-valued form of -Wstrict-overflow is used in gcc 4.2-4.4 +-Wstrict-overflow diff --git a/config/gnu-warnings/4.2-4.6 b/config/gnu-warnings/4.2-4.6 new file mode 100644 index 0000000..37df4ab --- /dev/null +++ b/config/gnu-warnings/4.2-4.6 @@ -0,0 +1,2 @@ +# Disable warnings about using the 'long long' type w/ gcc 4.6 and earlier +-Wno-long-long diff --git a/config/gnu-warnings/4.2-4.last b/config/gnu-warnings/4.2-4.last new file mode 100644 index 0000000..2db90fb --- /dev/null +++ b/config/gnu-warnings/4.2-4.last @@ -0,0 +1,3 @@ +# -Wvla was later incorporated into -Wpedantic and +# only needs to be specified explicitly for gcc 4 +-Wvla diff --git a/config/gnu-warnings/4.3 b/config/gnu-warnings/4.3 new file mode 100644 index 0000000..13d8558 --- /dev/null +++ b/config/gnu-warnings/4.3 @@ -0,0 +1,2 @@ +-Wlarger-than=2560 +-Wlogical-op diff --git a/config/gnu-warnings/4.4 b/config/gnu-warnings/4.4 new file mode 100644 index 0000000..42929b5 --- /dev/null +++ b/config/gnu-warnings/4.4 @@ -0,0 +1,3 @@ +-Wframe-larger-than=16384 +-Wpacked-bitfield-compat +-Wsync-nand diff --git a/config/gnu-warnings/4.5 b/config/gnu-warnings/4.5 new file mode 100644 index 0000000..ddb96df --- /dev/null +++ b/config/gnu-warnings/4.5 @@ -0,0 +1 @@ +-Wstrict-overflow=5 diff --git a/config/gnu-warnings/4.5-4.6 b/config/gnu-warnings/4.5-4.6 new file mode 100644 index 0000000..d3035fe --- /dev/null +++ b/config/gnu-warnings/4.5-4.6 @@ -0,0 +1,3 @@ +# -Wstrict-aliasing was later incorporated into -Wall and +# only needs to be specified explicitly for gcc 4.5-4.6 +-Wstrict-aliasing diff --git a/config/gnu-warnings/4.6 b/config/gnu-warnings/4.6 new file mode 100644 index 0000000..140a20c --- /dev/null +++ b/config/gnu-warnings/4.6 @@ -0,0 +1,2 @@ +-Wdouble-promotion +-Wtrampolines diff --git a/config/gnu-warnings/4.7 b/config/gnu-warnings/4.7 new file mode 100644 index 0000000..c47fe4b --- /dev/null +++ b/config/gnu-warnings/4.7 @@ -0,0 +1,5 @@ +# +# -Wstack-usage=8192 warnings need to be swept up on a branch so +# that we can stop burdening the whole development team. +# +-Wstack-usage=8192 diff --git a/config/gnu-warnings/4.8 b/config/gnu-warnings/4.8 new file mode 100644 index 0000000..5dc577f --- /dev/null +++ b/config/gnu-warnings/4.8 @@ -0,0 +1 @@ +-Wmaybe-uninitialized diff --git a/config/gnu-warnings/4.9 b/config/gnu-warnings/4.9 new file mode 100644 index 0000000..78aa929 --- /dev/null +++ b/config/gnu-warnings/4.9 @@ -0,0 +1 @@ +-Wdate-time diff --git a/config/gnu-warnings/5 b/config/gnu-warnings/5 new file mode 100644 index 0000000..32cb196 --- /dev/null +++ b/config/gnu-warnings/5 @@ -0,0 +1,2 @@ +-Warray-bounds=2 +-Wc99-c11-compat diff --git a/config/gnu-warnings/6 b/config/gnu-warnings/6 new file mode 100644 index 0000000..736a446 --- /dev/null +++ b/config/gnu-warnings/6 @@ -0,0 +1,9 @@ +# +# Careful! -Wduplicated-cond, combined with HDF5's heavy use of +# macros, can make a lot of noise. +# +-Wduplicated-cond +-Whsa +-Wnormalized +-Wnull-dereference +-Wunused-const-variable diff --git a/config/gnu-warnings/7 b/config/gnu-warnings/7 new file mode 100644 index 0000000..266f5c1 --- /dev/null +++ b/config/gnu-warnings/7 @@ -0,0 +1,7 @@ +-Walloca +-Walloc-zero +-Wduplicated-branches +-Wformat-overflow=2 +-Wformat-truncation=1 +-Wimplicit-fallthrough=5 +-Wrestrict diff --git a/config/gnu-warnings/8 b/config/gnu-warnings/8 new file mode 100644 index 0000000..5e7519d --- /dev/null +++ b/config/gnu-warnings/8 @@ -0,0 +1,3 @@ +-Wattribute-alias +-Wcast-align=strict +-Wshift-overflow=2 diff --git a/config/gnu-warnings/9 b/config/gnu-warnings/9 new file mode 100644 index 0000000..c084350 --- /dev/null +++ b/config/gnu-warnings/9 @@ -0,0 +1,2 @@ +-Wattribute-alias=2 +-Wmissing-profile diff --git a/config/gnu-warnings/developer-4.5 b/config/gnu-warnings/developer-4.5 new file mode 100644 index 0000000..48df846 --- /dev/null +++ b/config/gnu-warnings/developer-4.5 @@ -0,0 +1,7 @@ +# +# -Wjump-misses-init makes lots of noise for a questionable benefit. +# Can jumping over an initialization in C cause any harm, if +# the variable is never *used* before it has been initialized? +# +-Wjump-misses-init +-Wunsuffixed-float-constants diff --git a/config/gnu-warnings/developer-4.6 b/config/gnu-warnings/developer-4.6 new file mode 100644 index 0000000..2372fbf --- /dev/null +++ b/config/gnu-warnings/developer-4.6 @@ -0,0 +1 @@ +-Wsuggest-attribute=const diff --git a/config/gnu-warnings/developer-4.7 b/config/gnu-warnings/developer-4.7 new file mode 100644 index 0000000..a3b0781 --- /dev/null +++ b/config/gnu-warnings/developer-4.7 @@ -0,0 +1,7 @@ +-Wsuggest-attribute=noreturn +-Wsuggest-attribute=pure +# +# It's not clear that -Wvector-operation-performance warnings are +# actionable, so they are demoted to "developer" warnings. +# +-Wvector-operation-performance diff --git a/config/gnu-warnings/developer-4.8 b/config/gnu-warnings/developer-4.8 new file mode 100644 index 0000000..b0109e2 --- /dev/null +++ b/config/gnu-warnings/developer-4.8 @@ -0,0 +1 @@ +-Wsuggest-attribute=format diff --git a/config/gnu-warnings/developer-7 b/config/gnu-warnings/developer-7 new file mode 100644 index 0000000..2a3ce7e --- /dev/null +++ b/config/gnu-warnings/developer-7 @@ -0,0 +1 @@ +-Wstringop-overflow=2 diff --git a/config/gnu-warnings/developer-8 b/config/gnu-warnings/developer-8 new file mode 100644 index 0000000..a2ba7ca --- /dev/null +++ b/config/gnu-warnings/developer-8 @@ -0,0 +1,3 @@ +-Wstringop-overflow=4 +-Wsuggest-attribute=cold +-Wsuggest-attribute=malloc diff --git a/config/gnu-warnings/developer-general b/config/gnu-warnings/developer-general new file mode 100644 index 0000000..b34c4b7 --- /dev/null +++ b/config/gnu-warnings/developer-general @@ -0,0 +1,13 @@ +# (suggestions from gcc, not code problems) +# NOTE: -Wformat-nonliteral added back in here (from being disabled in +# H5_CFLAGS) +-Waggregate-return +-Wdisabled-optimization +-Wformat-nonliteral +-Winline +-Wmissing-format-attribute +-Wmissing-noreturn +-Wswitch-default +-Wswitch-enum +-Wunsafe-loop-optimizations +-Wunused-macros diff --git a/config/gnu-warnings/error-5 b/config/gnu-warnings/error-5 new file mode 100644 index 0000000..f7e1138 --- /dev/null +++ b/config/gnu-warnings/error-5 @@ -0,0 +1,12 @@ +-Werror=incompatible-pointer-types +# +# In GCC 4.4.7, the compiler gripes about shadowed global +# declarations when a local variable uses the name of a +# function that's in a system header file. For some reason, +# later versions of GCC (e.g., 5.2.0) don't complain about +# the shadowed globals. Maybe later versions are less fussy? +# Anyway, the shadowing seems to be harmless, and GCC 4.4.7 +# is not a supported compiler, so let us promote shadowed globals +# warnings to errors only for GCC 5 and later. +# +-Werror=shadow diff --git a/config/gnu-warnings/error-8 b/config/gnu-warnings/error-8 new file mode 100644 index 0000000..36c1414 --- /dev/null +++ b/config/gnu-warnings/error-8 @@ -0,0 +1,9 @@ +-Werror=cast-function-type +# +# For GCC 8, promote maybe-initialized warnings to an error. GCC 8 +# reports 0 maybe-uninitialized warnings where earlier versions +# make many false reports. GCC 8 seems to analyze calls to static +# in order to detect initializations that occur there. It's possible +# that GCC 8 only performs that analysis at -O3, though. +# +-Werror=maybe-uninitialized diff --git a/config/gnu-warnings/error-general b/config/gnu-warnings/error-general new file mode 100644 index 0000000..f0e61f8 --- /dev/null +++ b/config/gnu-warnings/error-general @@ -0,0 +1,91 @@ +# +# HDF5 code should not trigger the following warnings under any +# circumstances, so ask the compiler to treat them as errors: +# +-Werror=bad-function-cast +-Werror=declaration-after-statement +-Werror=implicit-function-declaration +-Werror=missing-declarations +-Werror=missing-prototypes +-Werror=nested-externs +-Werror=old-style-definition +-Werror=packed +-Werror=pointer-sign +-Werror=pointer-to-int-cast +-Werror=redundant-decls +-Werror=strict-prototypes +-Werror=switch +# +#-Werror=discarded-qualifiers +# +# +# NOTE: File Driver files are not compatible with these warnings as errors +# H5FDdirect.c,H5FDmpio.c,H5FDros3.c, +# -Werror=unused-function +# +-Wunused-function +# +# H5FDdrvr_module.h +# -Werror=unused-variable +# +-Wunused-variable +# +# H5VLpassthru.c +# -Werror=unused-parameter +# +-Wunused-parameter +# +# +# +# NOTE: Tools files are not compatible with these warnings as errors +# lib/h5tools.c +# -Werror=cast-align +# +-Wcast-align +# +# lib/h5diff_array.c +# -Werror=unused-but-set-variable +# +-Wunused-but-set-variable +# +# lib/h5tools_utils.c +# -Werror=unused-parameter +# +# +# NOTE: JNI files are not compatible with these warnings as errors +# jni/h5pDCPLImp.c,jni/nativeData.c,jni/h5util.c,jni/h5rImp.c +# jni/h5sImp.c,jni/h5tImp.c +# -Werror=cast-align +# jni/h5util.c +# -Werror=format(-overflow) +# +-Wformat +# +# +#Examples and tests do not use the same set of extensive warning flags as libraries +# Here is a list of tests and examples that have issues with the stricter warnings as error +# +# NOTE: Test files are not compatible with these warnings as errors +# thread_id.c, +# -Werror=unused-function +# dsets.c +# -Werror=unused-parameter +# external.c,perform/sio_engine.c +# -Werror=format(-truncation) +# +# +# NOTE: Examples files are not compatible with these warnings as errors +# h5_vds-eiger.c,h5_vds-exclim.c,h5_vds.c,h5_vds-exc.c,h5_vds-percival-unlim-maxmin.c +# h5_vds-percival.c,h5_read.c,h5_rdwt.c,h5_mount.c,h5_extend.c,h5_extend_write.c +# h5_write.c,h5_vds-simpleIO.c,h5_ref2reg_deprec.c,h5_crtgrp.c,h5_select.c +# h5_vds-percival-unlim.c,h5_crtatt.c,h5_group.c,h5_attribute.c,h5_crtdat.c +# h5_reference_deprec.c +# h5_rdwt.c,h5_crtgrp.c,h5_crtatt.c,h5_crtdat.c +# -Werror=strict-prototypes +# h5_rdwt.c,h5_crtgrp.c,h5_crtatt.c,h5_crtdat.c +# -Werror=old-style-definition +# h5_vds-exclim.c,h5_vds.c,h5_vds-exc.c, +# -Werror=unused-variable +# h5_elink_unix2win.c,h5_extlink.c,h5_attribute.c +# -Werror=unused-parameter + diff --git a/config/gnu-warnings/general b/config/gnu-warnings/general new file mode 100644 index 0000000..a7a20b7 --- /dev/null +++ b/config/gnu-warnings/general @@ -0,0 +1,32 @@ +# Note that some of the flags listed here really should be developer +# flags (listed in separate files, gnu-warnings-developer*) but we put +# them here because they are not raised by the current code and we'd like to +# know if they do start showing up. +# +# NOTE: Don't add -Wpadded here since we can't/won't fix the (many) +# warnings that are emitted. If you need it, add it from the +# environment variable at configure time. +-Wall +-Wcast-qual +-Wconversion +-Wextra +-Wfloat-equal +-Wformat=2 +-Winit-self +-Winvalid-pch +-Wmissing-include-dirs +# +# NOTE: Due to the divergence in the C and C++, we're dropping support for +# compiling the C library with a C++ compiler and dropping the -Wc++-compat +# warning. +# +-Wno-c++-compat +# +# NOTE: Disable the -Wformat-nonliteral from -Wformat=2 here and re-add +# it to the developer flags. +# +-Wno-format-nonliteral +-Wshadow +-Wundef +-Wwrite-strings +-pedantic diff --git a/config/gnu-warnings/no-developer-4.5 b/config/gnu-warnings/no-developer-4.5 new file mode 100644 index 0000000..ef7d38f --- /dev/null +++ b/config/gnu-warnings/no-developer-4.5 @@ -0,0 +1 @@ +-Wno-unsuffixed-float-constants diff --git a/config/gnu-warnings/no-developer-4.6 b/config/gnu-warnings/no-developer-4.6 new file mode 100644 index 0000000..ea9cc66 --- /dev/null +++ b/config/gnu-warnings/no-developer-4.6 @@ -0,0 +1 @@ +-Wno-suggest-attribute=const diff --git a/config/gnu-warnings/no-developer-4.7 b/config/gnu-warnings/no-developer-4.7 new file mode 100644 index 0000000..5b85e1f --- /dev/null +++ b/config/gnu-warnings/no-developer-4.7 @@ -0,0 +1,2 @@ +-Wno-suggest-attribute=noreturn +-Wno-suggest-attribute=pure diff --git a/config/gnu-warnings/no-developer-4.8 b/config/gnu-warnings/no-developer-4.8 new file mode 100644 index 0000000..e42e09f --- /dev/null +++ b/config/gnu-warnings/no-developer-4.8 @@ -0,0 +1 @@ +-Wno-suggest-attribute=format diff --git a/config/gnu-warnings/no-developer-8 b/config/gnu-warnings/no-developer-8 new file mode 100644 index 0000000..2134bad --- /dev/null +++ b/config/gnu-warnings/no-developer-8 @@ -0,0 +1,2 @@ +-Wno-suggest-attribute=cold +-Wno-suggest-attribute=malloc diff --git a/config/gnu-warnings/no-developer-general b/config/gnu-warnings/no-developer-general new file mode 100644 index 0000000..85dc0a3 --- /dev/null +++ b/config/gnu-warnings/no-developer-general @@ -0,0 +1,4 @@ +-Wno-aggregate-return +-Wno-inline +-Wno-missing-format-attribute +-Wno-missing-noreturn diff --git a/config/linux-gnueabihf b/config/linux-gnueabihf new file mode 100644 index 0000000..326edeb --- /dev/null +++ b/config/linux-gnueabihf @@ -0,0 +1,16 @@ +# -*- shell-script -*- +# +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. + +# ARM for Raspberry Pi, etc. +# This is the same as linux-gnulibc1 + +. $srcdir/config/linux-gnulibc1 diff --git a/config/netbsd b/config/netbsd new file mode 100644 index 0000000..9a9348b --- /dev/null +++ b/config/netbsd @@ -0,0 +1,56 @@ +# -*- shell-script -*- +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. + + +# This file is part of the HDF5 build script. It is processed shortly +# after configure starts and defines, among other things, flags for +# the various compile modes. +# +# See BlankForm in this directory for details. + +# The default compiler is `gcc' +if test "X-" = "X-$CC"; then + CC=gcc + CC_BASENAME=gcc +fi + +# Figure out C compiler flags +. $srcdir/config/gnu-flags + +# Figure out Intel C compiler flags +. $srcdir/config/intel-flags + +# The default Fortran 90 compiler +if test "X-" = "X-$FC"; then + case $CC_BASENAME in + gcc*|pgcc*) + FC=gfortran + FC_BASENAME=gfortran + ;; + icc*) + FC=ifort + FC_BASENAME=ifort + ;; + mpicc*) + FC=mpif90 + FC_BASENAME=mpif90 + ;; + esac +fi + +# Figure out FORTRAN compiler flags +. $srcdir/config/gnu-fflags + +# Figure out Intel F90 compiler flags +. $srcdir/config/intel-fflags + diff --git a/config/sanitizer/sanitizers.cmake b/config/sanitizer/sanitizers.cmake index ecee2de..0803279 100644 --- a/config/sanitizer/sanitizers.cmake +++ b/config/sanitizer/sanitizers.cmake @@ -29,69 +29,66 @@ function(append value) endfunction() message(STATUS "USE_SANITIZER=${USE_SANITIZER}, CMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}") -if(USE_SANITIZER AND "${CMAKE_C_COMPILER_ID}" MATCHES "Clang") - set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +if(USE_SANITIZER) + if(INTEL_CLANG OR "${CMAKE_C_COMPILER_ID}" MATCHES "Clang") + set(CMAKE_EXPORT_COMPILE_COMMANDS ON) - append("-fno-omit-frame-pointer" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) - message(STATUS "Building with sanitize, base flags=${CMAKE_C_SANITIZER_FLAGS}") + append("-fno-omit-frame-pointer" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + message(STATUS "Building with sanitize, base flags=${CMAKE_C_SANITIZER_FLAGS}") - if(UNIX) - - if(uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG") - append("-O1" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) - endif() + if(UNIX) + if(uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG") + append("-O1" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + endif() - if(USE_SANITIZER MATCHES "([Aa]ddress);([Uu]ndefined)" - OR USE_SANITIZER MATCHES "([Uu]ndefined);([Aa]ddress)") - message(STATUS "Building with Address, Undefined sanitizers") - append("-fsanitize=address,undefined" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) - set(MEMCHECK_TYPE AddressSanitizer) - elseif(USE_SANITIZER MATCHES "([Aa]ddress)") - # Optional: -fno-optimize-sibling-calls -fsanitize-address-use-after-scope - message(STATUS "Building with Address sanitizer") - append("-fsanitize=address" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) - set(MEMCHECK_TYPE AddressSanitizer) - elseif(USE_SANITIZER MATCHES "([Mm]emory([Ww]ith[Oo]rigins)?)") - # Optional: -fno-optimize-sibling-calls -fsanitize-memory-track-origins=2 - append("-fsanitize=memory" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) - if(USE_SANITIZER MATCHES "([Mm]emory[Ww]ith[Oo]rigins)") - message(STATUS "Building with MemoryWithOrigins sanitizer") - append("-fsanitize-memory-track-origins" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + if(USE_SANITIZER MATCHES "([Aa]ddress);([Uu]ndefined)" + OR USE_SANITIZER MATCHES "([Uu]ndefined);([Aa]ddress)") + message(STATUS "Building with Address, Undefined sanitizers") + append("-fsanitize=address,undefined" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + set(MEMCHECK_TYPE AddressSanitizer) + elseif(USE_SANITIZER MATCHES "([Aa]ddress)") + # Optional: -fno-optimize-sibling-calls -fsanitize-address-use-after-scope + message(STATUS "Building with Address sanitizer") + append("-fsanitize=address" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + set(MEMCHECK_TYPE AddressSanitizer) + elseif(USE_SANITIZER MATCHES "([Mm]emory([Ww]ith[Oo]rigins)?)") + # Optional: -fno-optimize-sibling-calls -fsanitize-memory-track-origins=2 + append("-fsanitize=memory" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + if(USE_SANITIZER MATCHES "([Mm]emory[Ww]ith[Oo]rigins)") + message(STATUS "Building with MemoryWithOrigins sanitizer") + append("-fsanitize-memory-track-origins" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + else() + message(STATUS "Building with Memory sanitizer") + endif() + set(MEMCHECK_TYPE MemorySanitizer) + elseif(USE_SANITIZER MATCHES "([Uu]ndefined)") + message(STATUS "Building with Undefined sanitizer") + append("-fsanitize=undefined" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + if(EXISTS "${BLACKLIST_FILE}") + append("-fsanitize-blacklist=${BLACKLIST_FILE}" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + endif() + set(MEMCHECK_TYPE UndefinedBehaviorSanitizer) + elseif(USE_SANITIZER MATCHES "([Tt]hread)") + message(STATUS "Building with Thread sanitizer") + append("-fsanitize=thread" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + set(MEMCHECK_TYPE ThreadSanitizer) + elseif(USE_SANITIZER MATCHES "([Ll]eak)") + message(STATUS "Building with Leak sanitizer") + append("-fsanitize=leak" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + set(MEMCHECK_TYPE LeakSanitizer) else() - message(STATUS "Building with Memory sanitizer") + message( + FATAL_ERROR "Unsupported value of USE_SANITIZER: ${USE_SANITIZER}") endif() - set(MEMCHECK_TYPE MemorySanitizer) - elseif(USE_SANITIZER MATCHES "([Uu]ndefined)") - message(STATUS "Building with Undefined sanitizer") - append("-fsanitize=undefined" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) - if(EXISTS "${BLACKLIST_FILE}") - append("-fsanitize-blacklist=${BLACKLIST_FILE}" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + elseif(MSVC) + if(USE_SANITIZER MATCHES "([Aa]ddress)") + message(STATUS "Building with Address sanitizer") + append("-fsanitize=address" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + else() + message(FATAL_ERROR "This sanitizer not yet supported in the MSVC environment: ${USE_SANITIZER}") endif() - set(MEMCHECK_TYPE UndefinedBehaviorSanitizer) - elseif(USE_SANITIZER MATCHES "([Tt]hread)") - message(STATUS "Building with Thread sanitizer") - append("-fsanitize=thread" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) - set(MEMCHECK_TYPE ThreadSanitizer) - elseif(USE_SANITIZER MATCHES "([Ll]eak)") - message(STATUS "Building with Leak sanitizer") - append("-fsanitize=leak" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) - set(MEMCHECK_TYPE LeakSanitizer) else() - message( - FATAL_ERROR "Unsupported value of USE_SANITIZER: ${USE_SANITIZER}") + message(FATAL_ERROR "USE_SANITIZER is not supported on this platform.") endif() - elseif(MSVC) - if(USE_SANITIZER MATCHES "([Aa]ddress)") - message(STATUS "Building with Address sanitizer") - append("-fsanitize=address" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) - else() - message( - FATAL_ERROR - "This sanitizer not yet supported in the MSVC environment: ${USE_SANITIZER}" - ) - endif() - else() - message(FATAL_ERROR "USE_SANITIZER is not supported on this platform.") endif() - endif() diff --git a/config/toolchain/intel.cmake b/config/toolchain/intel.cmake index 97f6a64..ae1d2f8 100644 --- a/config/toolchain/intel.cmake +++ b/config/toolchain/intel.cmake @@ -3,9 +3,16 @@ set(CMAKE_COMPILER_VENDOR "intel") -set(CMAKE_C_COMPILER icc) -set(CMAKE_CXX_COMPILER icpc) -set(CMAKE_Fortran_COMPILER ifort) +if(USE_SANITIZER) + set(CMAKE_C_COMPILER icl) + set(CMAKE_CXX_COMPILER icl++) + set(CMAKE_Fortran_COMPILER ifort) + set(INTEL_CLANG ON) +else () + set(CMAKE_C_COMPILER icc) + set(CMAKE_CXX_COMPILER icpc) + set(CMAKE_Fortran_COMPILER ifort) +endif () # the following is used if cross-compiling set(CMAKE_CROSSCOMPILING_EMULATOR "") diff --git a/configure.ac b/configure.ac index 54e8caf..ec65386 100644 --- a/configure.ac +++ b/configure.ac @@ -103,7 +103,11 @@ AC_SUBST([AR_FLAGS]) ## H5_CFLAGS (and company) are for CFLAGS that should be used on HDF5, but ## not exported to h5cc (or h5fc, etc.) +## +## H5_ECFLAGS is for warnings that should be treated as errors. +## AC_SUBST([H5_CFLAGS]) +AC_SUBST([H5_ECFLAGS]) AC_SUBST([H5_CPPFLAGS]) AC_SUBST([H5_FCFLAGS]) AC_SUBST([H5_CXXFLAGS]) @@ -232,6 +236,9 @@ case $host_os in freebsd*) host_os_novers=freebsd ;; + netbsd*) + host_os_novers=netbsd + ;; solaris*) host_os_novers=solaris ;; @@ -943,7 +950,7 @@ fi AM_CONDITIONAL([FORTRAN_SHARED_CONDITIONAL], [test "X$H5_FORTRAN_SHARED" = "Xyes"]) ## ---------------------------------------------------------------------- -## Check if they would like to disable building tests +## Check if they would like to disable building tests ## ## This needs to be exposed for the library info file. @@ -2938,6 +2945,28 @@ fi AC_CACHE_SAVE ## ---------------------------------------------------------------------- +## Use custom examples path. +## +AC_MSG_CHECKING([for custom examples path definition]) +AC_ARG_WITH([examplesdir], + [AS_HELP_STRING([--with-examplesdir=location], + [Specify path for examples + [default="DATAROOTDIR/hdf5_examples"]])],, + withval="${datarootdir}/hdf5_examples") + +if test "X$withval" = "X"; then + AC_MSG_RESULT([default]) + examplesdir="${datarootdir}/hdf5_examples" +else + AC_MSG_RESULT([$withval]) + examplesdir=$withval +fi + +AC_SUBST([examplesdir]) +AC_DEFINE_UNQUOTED([EXAMPLESDIR], ["$examplesdir"], + [Define the examples directory]) + +## ---------------------------------------------------------------------- ## Enable custom plugin default path for library. It requires SHARED support. ## AC_MSG_CHECKING([for custom plugin default path definition]) diff --git a/examples/Makefile.am b/examples/Makefile.am index 554ee44..a0d2b00 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -84,8 +84,8 @@ CHECK_CLEANFILES+=$(EXTLINK_DIRS) # Example directory # Note: no '/' after DESTDIR. Explanation in commence.am -EXAMPLEDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/c -EXAMPLETOPDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples +EXAMPLEDIR=$(examplesdir)/c +EXAMPLETOPDIR=$(examplesdir) # List dependencies for each program. Normally, automake would take # care of this for us, but if we tell automake about the programs it diff --git a/examples/run-c-ex.sh.in b/examples/run-c-ex.sh.in index 209cdd7..c6a6bb7 100644 --- a/examples/run-c-ex.sh.in +++ b/examples/run-c-ex.sh.in @@ -18,7 +18,7 @@ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # This script will compile and run the c examples from source files installed # -# in .../share/hdf5_examples/c using h5cc or h5pc. The order for running # +# in @examplesdir@/c using h5cc or h5pc. The order for running # # programs with RunTest in the MAIN section below is taken from the Makefile. # # The order is important since some of the test programs use data files created # # by earlier test programs. Any future additions should be placed accordingly. # @@ -28,10 +28,33 @@ # Initializations EXIT_SUCCESS=0 EXIT_FAILURE=1 - + +# +# Try to derive the path to the installation $prefix established +# by ./configure relative to the examples directory established by +# ./configure. If successful, set `prefix_relto_examplesdir` to the +# relative path. Otherwise, set `prefix_relto_examplesdir` to the +# absolute installation $prefix. +# +# This script uses the value of `prefix` in the user's environment, if +# it is set, below. The content of $() is evaluated in a sub-shell, so +# if `prefix` is set in the user's environment, the shell statements in +# $() won't clobbered it. +# +prefix_relto_examplesdir=$( +prefix=@prefix@ +examplesdir=@examplesdir@ +if [ ${examplesdir##${prefix}/} != ${examplesdir} ]; then + echo $(echo ${examplesdir##${prefix}/} | \ + sed 's,[^/][^/]*,..,g') +else + echo $prefix +fi +) + # Where the tool is installed. # default is relative path to installed location of the tools -prefix="${prefix:-../../..}" +prefix="${prefix:-../${prefix_relto_examplesdir}}" PARALLEL=@PARALLEL@ # Am I in parallel mode? AR="@AR@" RANLIB="@RANLIB@" diff --git a/fortran/examples/Makefile.am b/fortran/examples/Makefile.am index 6bf2edb..fb510bc 100644 --- a/fortran/examples/Makefile.am +++ b/fortran/examples/Makefile.am @@ -74,8 +74,8 @@ endif # Tell automake how to install examples # Note: no '/' after DESTDIR. Explanation in commence.am -EXAMPLEDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/fortran -EXAMPLETOPDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples +EXAMPLEDIR=$(examplesdir)/fortran +EXAMPLETOPDIR=$(examplesdir) # List dependencies for each example. Normally, automake would take # care of this for us, but if we tell automake about the programs it diff --git a/fortran/examples/run-fortran-ex.sh.in b/fortran/examples/run-fortran-ex.sh.in index aa17f89..81e54ea 100644 --- a/fortran/examples/run-fortran-ex.sh.in +++ b/fortran/examples/run-fortran-ex.sh.in @@ -18,7 +18,7 @@ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # This script will compile and run the fortran examples from source files # -# installed in .../share/hdf5_examples/fortran using h5fc or h5pfc. The # +# installed in @examplesdir@/fortran using h5fc or h5pfc. The # # order for running programs with RunTest in the MAIN section below is taken # # from the Makefile. The order is important since some of the test programs # # use data files created by earlier test programs. Any future additions should # @@ -30,9 +30,32 @@ EXIT_SUCCESS=0 EXIT_FAILURE=1 +# +# Try to derive the path to the installation $prefix established +# by ./configure relative to the examples directory established by +# ./configure. If successful, set `prefix_relto_examplesdir` to the +# relative path. Otherwise, set `prefix_relto_examplesdir` to the +# absolute installation $prefix. +# +# This script uses the value of `prefix` in the user's environment, if +# it is set, below. The content of $() is evaluated in a sub-shell, so +# if `prefix` is set in the user's environment, the shell statements in +# $() won't clobbered it. +# +prefix_relto_examplesdir=$( +prefix=@prefix@ +examplesdir=@examplesdir@ +if [ ${examplesdir##${prefix}/} != ${examplesdir} ]; then + echo $(echo ${examplesdir##${prefix}/} | \ + sed 's,[^/][^/]*,..,g') +else + echo $prefix +fi +) + # Where the tool is installed. # default is relative path to installed location of the tools -prefix="${prefix:-../../..}" +prefix="${prefix:-../${prefix_relto_examplesdir}}" PARALLEL=@PARALLEL@ # Am I in parallel mode? AR="@AR@" RANLIB="@RANLIB@" diff --git a/hl/c++/examples/Makefile.am b/hl/c++/examples/Makefile.am index ce719f5..592e8da 100644 --- a/hl/c++/examples/Makefile.am +++ b/hl/c++/examples/Makefile.am @@ -33,8 +33,8 @@ CXX_API=yes # Where to install examples # Note: no '/' after DESTDIR. Explanation in commence.am -EXAMPLEDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/hl/c++ -EXAMPLETOPDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/hl +EXAMPLEDIR=$(examplesdir)/hl/c++ +EXAMPLETOPDIR=$(examplesdir)/hl # How to build programs using h5c++ $(EXTRA_PROG): $(H5CPP) diff --git a/hl/c++/examples/run-hlc++-ex.sh.in b/hl/c++/examples/run-hlc++-ex.sh.in index eb688a1..43831f5 100644 --- a/hl/c++/examples/run-hlc++-ex.sh.in +++ b/hl/c++/examples/run-hlc++-ex.sh.in @@ -18,7 +18,7 @@ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # This script will compile and run the c++ examples from source files # -# installed in .../share/hdf5_examples/hl/c++ using h5c++. The # +# installed in @examplesdir@/hl/c++ using h5c++. The # # order for running programs with RunTest in the MAIN section below is taken # # from the Makefile. The order is important since some of the test programs # # use data files created by earlier test programs. Any future additions should # @@ -29,9 +29,33 @@ # Initializations EXIT_SUCCESS=0 EXIT_FAILURE=1 + +# +# Try to derive the path to the installation $prefix established +# by ./configure relative to the examples directory established by +# ./configure. If successful, set `prefix_relto_examplesdir` to the +# relative path. Otherwise, set `prefix_relto_examplesdir` to the +# absolute installation $prefix. +# +# This script uses the value of `prefix` in the user's environment, if +# it is set, below. The content of $() is evaluated in a sub-shell, so +# if `prefix` is set in the user's environment, the shell statements in +# $() won't clobbered it. +# +prefix_relto_examplesdir=$( +prefix=@prefix@ +examplesdir=@examplesdir@ +if [ ${examplesdir##${prefix}/} != ${examplesdir} ]; then + echo $(echo ${examplesdir##${prefix}/} | \ + sed 's,[^/][^/]*,..,g') +else + echo $prefix +fi +) + # Where the tool is installed. # default is relative path to installed location of the tools -prefix="${prefix:-../../../..}" +prefix="${prefix:-../../${prefix_relto_examplesdir}}" AR="@AR@" RANLIB="@RANLIB@" H5TOOL="h5c++" # The tool name diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt index 866f372..01c8126 100644 --- a/hl/c++/src/CMakeLists.txt +++ b/hl/c++/src/CMakeLists.txt @@ -14,6 +14,9 @@ if (NOT ONLY_SHARED_LIBS) PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) + target_compile_options(${HDF5_HL_CPP_LIB_TARGET} + PRIVATE "${HDF5_CMAKE_CXX_FLAGS}" + ) TARGET_C_PROPERTIES (${HDF5_HL_CPP_LIB_TARGET} STATIC) target_link_libraries (${HDF5_HL_CPP_LIB_TARGET} PUBLIC ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_CPP_LIB_TARGET}") @@ -28,6 +31,9 @@ if (BUILD_SHARED_LIBS) PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) + target_compile_options(${HDF5_HL_CPP_LIBSH_TARGET} + PRIVATE "${HDF5_CMAKE_CXX_FLAGS}" + ) target_compile_definitions(${HDF5_HL_CPP_LIBSH_TARGET} PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" ) diff --git a/hl/examples/Makefile.am b/hl/examples/Makefile.am index 29e1a48..cc2d671 100644 --- a/hl/examples/Makefile.am +++ b/hl/examples/Makefile.am @@ -25,8 +25,8 @@ endif # Example directory # Note: no '/' after DESTDIR. Explanation in commence.am -EXAMPLEDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/hl/c -EXAMPLETOPDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/hl +EXAMPLEDIR=$(examplesdir)/hl/c +EXAMPLETOPDIR=$(examplesdir)/hl INSTALL_SCRIPT_FILES = run-hlc-ex.sh INSTALL_TOP_SCRIPT_FILES = run-hl-ex.sh diff --git a/hl/examples/run-hlc-ex.sh.in b/hl/examples/run-hlc-ex.sh.in index f51b165..e6d0cc9 100644 --- a/hl/examples/run-hlc-ex.sh.in +++ b/hl/examples/run-hlc-ex.sh.in @@ -18,7 +18,7 @@ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # This script will compile and run the c examples from source files installed # -# in .../share/hdf5_examples/hl/c using h5cc or h5pc. The order for running # +# in @examplesdir@/hl/c using h5cc or h5pc. The order for running # # programs with RunTest in the MAIN section below is taken from the Makefile. # # The order is important since some of the test programs use data files created # # by earlier test programs. Any future additions should be placed accordingly. # @@ -29,9 +29,32 @@ EXIT_SUCCESS=0 EXIT_FAILURE=1 +# +# Try to derive the path to the installation $prefix established +# by ./configure relative to the examples directory established by +# ./configure. If successful, set `prefix_relto_examplesdir` to the +# relative path. Otherwise, set `prefix_relto_examplesdir` to the +# absolute installation $prefix. +# +# This script uses the value of `prefix` in the user's environment, if +# it is set, below. The content of $() is evaluated in a sub-shell, so +# if `prefix` is set in the user's environment, the shell statements in +# $() won't clobbered it. +# +prefix_relto_examplesdir=$( +prefix=@prefix@ +examplesdir=@examplesdir@ +if [ ${examplesdir##${prefix}/} != ${examplesdir} ]; then + echo $(echo ${examplesdir##${prefix}/} | \ + sed 's,[^/][^/]*,..,g') +else + echo $prefix +fi +) + # Where the tool is installed. # default is relative path to installed location of the tools -prefix="${prefix:-../../../..}" +prefix="${prefix:-../../${prefix_relto_examplesdir}}" PARALLEL=@PARALLEL@ # Am I in parallel mode? AR="@AR@" RANLIB="@RANLIB@" diff --git a/hl/fortran/examples/Makefile.am b/hl/fortran/examples/Makefile.am index d383f9a..b81cc6f 100644 --- a/hl/fortran/examples/Makefile.am +++ b/hl/fortran/examples/Makefile.am @@ -51,8 +51,8 @@ endif # Tell automake how to install examples # Note: no '/' after DESTDIR. Explanation in commence.am -EXAMPLEDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/hl/fortran -EXAMPLETOPDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/hl +EXAMPLEDIR=$(examplesdir)/hl/fortran +EXAMPLETOPDIR=$(examplesdir)/hl # List dependencies for each example. Normally, automake would take # care of this for us, but if we tell automake about the programs it diff --git a/hl/fortran/examples/run-hlfortran-ex.sh.in b/hl/fortran/examples/run-hlfortran-ex.sh.in index 5f12ef0..d7de8e3 100644 --- a/hl/fortran/examples/run-hlfortran-ex.sh.in +++ b/hl/fortran/examples/run-hlfortran-ex.sh.in @@ -18,7 +18,7 @@ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # This script will compile and run the fortran examples from source files # -# installed in .../share/hdf5_examples/hl/fortran using h5fc or h5pfc. The # +# installed in @examplesdir@/hl/fortran using h5fc or h5pfc. The # # order for running programs with RunTest in the MAIN section below is taken # # from the Makefile. The order is important since some of the test programs # # use data files created by earlier test programs. Any future additions should # @@ -32,7 +32,7 @@ EXIT_FAILURE=1 # Where the tool is installed. # default is relative path to installed location of the tools -prefix="${prefix:-../../../..}" +prefix="${prefix:-@prefix@}" PARALLEL=@PARALLEL@ # Am I in parallel mode? AR="@AR@" RANLIB="@RANLIB@" diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt index 55d84c7..7975a1a 100644 --- a/hl/src/CMakeLists.txt +++ b/hl/src/CMakeLists.txt @@ -38,6 +38,9 @@ if (NOT ONLY_SHARED_LIBS) PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) + target_compile_options(${HDF5_HL_LIB_TARGET} + PRIVATE "${HDF5_CMAKE_C_FLAGS}" + ) TARGET_C_PROPERTIES (${HDF5_HL_LIB_TARGET} STATIC) target_link_libraries (${HDF5_HL_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_HL_LIB_TARGET} ${HDF5_HL_LIB_NAME} STATIC 0) @@ -52,6 +55,9 @@ if (BUILD_SHARED_LIBS) PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) + target_compile_options(${HDF5_HL_LIBSH_TARGET} + PRIVATE "${HDF5_CMAKE_C_FLAGS}" + ) target_compile_definitions(${HDF5_HL_LIBSH_TARGET} PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" ) diff --git a/java/src/jni/CMakeLists.txt b/java/src/jni/CMakeLists.txt index 386a908..9440eef 100644 --- a/java/src/jni/CMakeLists.txt +++ b/java/src/jni/CMakeLists.txt @@ -77,6 +77,9 @@ add_library (${HDF5_JAVA_JNI_LIB_TARGET} SHARED ${HDF5_JAVA_JNI_CSRCS} ${HDF5_JA target_include_directories (${HDF5_JAVA_JNI_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_JAVA_JNI_SOURCE_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" ) +target_compile_options(${HDF5_JAVA_JNI_LIB_TARGET} + PRIVATE "${HDF5_CMAKE_C_FLAGS}" +) TARGET_C_PROPERTIES (${HDF5_JAVA_JNI_LIB_TARGET} SHARED) target_link_libraries (${HDF5_JAVA_JNI_LIB_TARGET} PUBLIC ${HDF5_LIBSH_TARGET}) set_target_properties (${HDF5_JAVA_JNI_LIB_TARGET} PROPERTIES FOLDER libraries/jni) diff --git a/java/src/jni/h5aImp.c b/java/src/jni/h5aImp.c index 4dfbe39..b59aeb6 100644 --- a/java/src/jni/h5aImp.c +++ b/java/src/jni/h5aImp.c @@ -2146,7 +2146,7 @@ H5A_iterate_cb jobject visit_callback = wrapper->visit_callback; jstring str; JNIEnv *cbenv = NULL; - jclass cls; + jclass cbcls; jvalue args[4]; void *op_data = (void *)wrapper->op_data; jint status = -1; @@ -2156,10 +2156,10 @@ H5A_iterate_cb H5_JNI_FATAL_ERROR(CBENVONLY, "H5A_iterate_cb: failed to attach current thread to JVM"); } - if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback))) + if (NULL == (cbcls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback))) CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5A_info_t;Lhdf/hdf5lib/callbacks/H5A_iterate_t;)I"))) + if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cbcls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5A_info_t;Lhdf/hdf5lib/callbacks/H5A_iterate_t;)I"))) CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name))) diff --git a/java/src/jni/h5eImp.c b/java/src/jni/h5eImp.c index 7ea4223..80e23a1 100644 --- a/java/src/jni/h5eImp.c +++ b/java/src/jni/h5eImp.c @@ -523,7 +523,7 @@ H5E_walk_cb jobject cb_info_t = NULL; jvalue args[7]; JNIEnv *cbenv = NULL; - jclass cls; + jclass cbcls; void *op_data = (void *)wrapper->op_data; jint status = FAIL; @@ -532,10 +532,10 @@ H5E_walk_cb H5_JNI_FATAL_ERROR(CBENVONLY, "H5E_walk_cb: failed to attach current thread to JVM"); } - if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback))) + if (NULL == (cbcls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback))) CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(ILhdf/hdf5lib/structs/H5E_error2_t;Lhdf/hdf5lib/callbacks/H5E_walk_t;)I"))) + if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cbcls, "callback", "(ILhdf/hdf5lib/structs/H5E_error2_t;Lhdf/hdf5lib/callbacks/H5E_walk_t;)I"))) CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); args[0].j = info->cls_id; diff --git a/java/src/jni/h5lImp.c b/java/src/jni/h5lImp.c index 6b55b46..984fd90 100644 --- a/java/src/jni/h5lImp.c +++ b/java/src/jni/h5lImp.c @@ -625,7 +625,7 @@ H5L_iterate_cb jobject visit_callback = wrapper->visit_callback; jstring str; JNIEnv *cbenv = NULL; - jclass cls; + jclass cbcls; jvalue args[5]; void *op_data = (void *)wrapper->op_data; jint status = -1; @@ -636,10 +636,10 @@ H5L_iterate_cb } /* Get the Method ID for the "callback" function of the H5L_iterate_t class */ - if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback))) + if (NULL == (cbcls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback))) CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5L_info_t;Lhdf/hdf5lib/callbacks/H5L_iterate_t;)I"))) + if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cbcls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5L_info_t;Lhdf/hdf5lib/callbacks/H5L_iterate_opdata_t;)I"))) CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name))) diff --git a/java/src/jni/h5oImp.c b/java/src/jni/h5oImp.c index e332615..a52a905 100644 --- a/java/src/jni/h5oImp.c +++ b/java/src/jni/h5oImp.c @@ -378,15 +378,16 @@ H5O_iterate_cb (hid_t g_id, const char *name, const H5O_info_t *info, void *cb_data) { cb_wrapper *wrapper = (cb_wrapper *)cb_data; - jmethodID constructor, mid; + jmethodID mid; jobject cb_info_t = NULL; jobject visit_callback = wrapper->visit_callback; + jobject ret_obj = NULL; jobject hdrinfobuf; jobject ihinfobuf1; jobject ihinfobuf2; jstring str; JNIEnv *cbenv = NULL; - jclass cls; + jclass cbcls; jvalue args[12]; void *op_data = (void *)wrapper->op_data; jint status = FAIL; @@ -396,10 +397,10 @@ H5O_iterate_cb H5_JNI_FATAL_ERROR(CBENVONLY, "H5O_iterate_cb: failed to attach current thread to JVM"); } - if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback))) + if (NULL == (cbcls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback))) CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5O_info_t;Lhdf/hdf5lib/callbacks/H5O_iterate_t;)I"))) + if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cbcls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5O_info_t;Lhdf/hdf5lib/callbacks/H5O_iterate_t;)I"))) CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name))) @@ -417,41 +418,21 @@ H5O_iterate_cb args[9].j = (jlong)info->hdr.mesg.shared; /* Get a reference to the H5_hdr_info_t class */ - if (NULL == (cls = CBENVPTR->FindClass(CBENVONLY, "hdf/hdf5lib/structs/H5O_hdr_info_t"))) - CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - - /* Get a reference to the constructor; the name is */ - if (NULL == (constructor = CBENVPTR->GetMethodID(CBENVONLY, cls, "", "(IIIIJJJJJJ)V"))) - CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - - if (NULL == (hdrinfobuf = CBENVPTR->NewObjectA(CBENVONLY, cls, constructor, args))) { - HDprintf("H5O_iterate_cb ERROR: hdf/hdf5lib/structs/H5O_hdr_info_t: Creation failed\n"); - CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - } + CALL_CONSTRUCTOR(CBENVONLY, "hdf/hdf5lib/structs/H5O_hdr_info_t", "(IIIIJJJJJJ)V", args, ret_obj); + hdrinfobuf = ret_obj; args[0].j = (jlong)info->meta_size.obj.index_size; args[1].j = (jlong)info->meta_size.obj.heap_size; /* Get a reference to the H5_ih_info_t class */ - if (NULL == (cls = CBENVPTR->FindClass(CBENVONLY, "hdf/hdf5lib/structs/H5_ih_info_t"))) - CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - - /* Get a reference to the constructor; the name is */ - if (NULL == (constructor = CBENVPTR->GetMethodID(CBENVONLY, cls, "", "(JJ)V"))) - CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - - if (NULL == (ihinfobuf1 = CBENVPTR->NewObjectA(CBENVONLY, cls, constructor, args))) { - HDprintf("H5O_iterate_cb ERROR: hdf/hdf5lib/structs/H5_ih_info_t: Creation failed\n"); - CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - } + CALL_CONSTRUCTOR(CBENVONLY, "hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args, ret_obj); + ihinfobuf1 = ret_obj; args[0].j = (jlong)info->meta_size.attr.index_size; args[1].j = (jlong)info->meta_size.attr.heap_size; - if (NULL == (ihinfobuf2 = CBENVPTR->NewObjectA(CBENVONLY, cls, constructor, args))) { - HDprintf("H5O_iterate_cb ERROR: hdf/hdf5lib/structs/H5_ih_info_t: Creation failed\n"); - CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - } + CALL_CONSTRUCTOR(CBENVONLY, "hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args, ret_obj); + ihinfobuf2 = ret_obj; args[0].j = (jlong)info->fileno; args[1].j = (jlong)info->addr; diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 9d6a2b9..64dd12a 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -47,6 +47,23 @@ New Features Configuration: ------------- + - Both build systems use same set of warnings flags + + GNU C warnings flags were moved to files in a config sub-folder + named gnu-warnings. Flags that only are available for a specific + version of the compiler are in files named with that version. + Clang C warnings flags were moved to files in a config sub-folder + named clang-warnings. + + There are flags in named "error-xxx" files with warnings that may + be promoted to errors. Some source files may still need fixes. + + There are also pairs of files named "developer-xxx" and "no-developer-xxx" + that are chosen by the CMake option:HDF5_ENABLE_DEV_WARNINGS or the + configure option:--enable-developer-warnings. + + (ADB - 2020/03/24, TRILAB-192) + - Update CMake minimum version to 3.12 Updated CMake minimum version to 3.12 and added version checks diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 09a18c3..664eb2d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1075,6 +1075,9 @@ if (NOT ONLY_SHARED_LIBS) PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) + target_compile_options(${HDF5_LIB_TARGET} + PRIVATE "${HDF5_CMAKE_C_FLAGS}" + ) target_compile_definitions(${HDF5_LIB_TARGET} PUBLIC ${HDF_EXTRA_C_FLAGS} @@ -1111,6 +1114,9 @@ if (BUILD_SHARED_LIBS) PUBLIC "$<$:${HDFS_INCLUDE_DIR}>" INTERFACE "$/include>" ) + target_compile_options(${HDF5_LIBSH_TARGET} + PRIVATE "${HDF5_CMAKE_C_FLAGS}" + ) target_compile_definitions(${HDF5_LIBSH_TARGET} PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index a1b29d5..bc7391c 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -54,6 +54,7 @@ /********************/ static herr_t H5F__super_ext_create(H5F_t *f, H5O_loc_t *ext_ptr); static herr_t H5F__update_super_ext_driver_msg(H5F_t *f); +herr_t H5O__fsinfo_set_version(H5F_t *f, H5O_fsinfo_t *fsinfo); /*********************/ @@ -88,7 +89,7 @@ static const unsigned H5O_fsinfo_ver_bounds[] = { H5O_FSINFO_VERSION_LATEST /* H5F_LIBVER_LATEST */ }; - + /*------------------------------------------------------------------------- * Function: H5F__super_ext_create * @@ -141,7 +142,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5F__super_ext_create() */ - + /*------------------------------------------------------------------------- * Function: H5F_super_ext_open * @@ -179,7 +180,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5F_super_ext_open() */ - + /*------------------------------------------------------------------------- * Function: H5F__super_ext_close * @@ -232,14 +233,14 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5F__super_ext_close() */ - + /*------------------------------------------------------------------------- * Function: H5F__update_super_ext_driver_msg * - * Purpose: Update the superblock extension file driver info message if + * Purpose: Update the superblock extension file driver info message if * we are using a V 2 superblock. Observe that the function * is a NO-OP if the file driver info message does not exist. - * This is necessary, as the function is called whenever the + * This is necessary, as the function is called whenever the * EOA is updated, and were it to create the file driver info * message, it would find itself in an infinite recursion. * @@ -279,8 +280,8 @@ H5F__update_super_ext_driver_msg(H5F_t *f) /* Check for driver info */ H5_CHECKED_ASSIGN(driver_size, size_t, H5FD_sb_size(f->shared->lf), hsize_t); - /* Nothing to do unless there is both driver info and - * the driver info superblock extension message has + /* Nothing to do unless there is both driver info and + * the driver info superblock extension message has * already been created. */ if(driver_size > 0) { @@ -296,7 +297,7 @@ H5F__update_super_ext_driver_msg(H5F_t *f) /* Write the message to the superblock extension. * - * Note that the superblock extension and the + * Note that the superblock extension and the * file driver info message must already exist. */ drvinfo.len = driver_size; @@ -312,7 +313,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__update_super_ext_driver_msg() */ - + /*------------------------------------------------------------------------- * Function: H5F__super_read * @@ -351,7 +352,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) FUNC_ENTER_PACKAGE_TAG(H5AC__SUPERBLOCK_TAG) /* initialize the drvinfo to NULL -- we will overwrite this if there - * is a driver information block + * is a driver information block */ f->shared->drvinfo = NULL; @@ -443,7 +444,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "can't get property list") /* Make certain we can read the fixed-size portion of the superblock */ - if(H5F__set_eoa(f, H5FD_MEM_SUPER, + if(H5F__set_eoa(f, H5FD_MEM_SUPER, (haddr_t)(H5F_SUPERBLOCK_FIXED_SIZE + H5F_SUPERBLOCK_MINIMAL_VARLEN_SIZE)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "set end of space allocation request failed") @@ -463,12 +464,12 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) if(NULL == (sblock = (H5F_super_t *)H5AC_protect(f, H5AC_SUPERBLOCK, (haddr_t)0, &udata, rw_flags))) HGOTO_ERROR(H5E_FILE, H5E_CANTPROTECT, FAIL, "unable to load superblock") - /* + /* * When opening a file with SWMR-write access, the library will first - * check to ensure that superblock version 3 is used. Otherwise fail + * check to ensure that superblock version 3 is used. Otherwise fail * file open. * - * Then the library will upgrade the file's low_bound depending on + * Then the library will upgrade the file's low_bound depending on * superblock version as follows: * --version 0 or 1: no change to low_bound * --version 2: upgrade low_bound to at least V18 @@ -601,8 +602,8 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) * as the file can appear truncated if only part of it has been * been flushed to disk by the SWMR writer process. */ - /* The EOF check is also skipped when the private property - * H5F_ACS_SKIP_EOF_CHECK_NAME exists in the fapl. + /* The EOF check is also skipped when the private property + * H5F_ACS_SKIP_EOF_CHECK_NAME exists in the fapl. * This property is enabled by the tool h5clear with these * two options: (1) --filesize (2) --increment */ @@ -613,7 +614,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get skip EOF check value") if(H5F_INTENT(f) & H5F_ACC_SWMR_READ) { - /* + /* * When the file is opened for SWMR read access, skip the check if: * --the file is already marked for SWMR writing and * --the file has version 3 superblock for SWMR support @@ -655,10 +656,10 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) drvrinfo_udata.f = f; drvrinfo_udata.driver_addr = sblock->driver_addr; - /* extend EOA so we can read at least the fixed sized - * portion of the driver info block + /* extend EOA so we can read at least the fixed sized + * portion of the driver info block */ - if(H5FD_set_eoa(f->shared->lf, H5FD_MEM_SUPER, sblock->driver_addr + H5F_DRVINFOBLOCK_HDR_SIZE) < 0) /* will extend eoa later if required */ + if(H5FD_set_eoa(f->shared->lf, H5FD_MEM_SUPER, sblock->driver_addr + H5F_DRVINFOBLOCK_HDR_SIZE) < 0) /* will extend eoa later if required */ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "set end of space allocation request failed") /* Look up the driver info block */ @@ -671,7 +672,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) if(((rw_flags & H5AC__READ_ONLY_FLAG) == 0) && H5F_HAS_FEATURE(f, H5FD_FEAT_DIRTY_DRVRINFO_LOAD)) drvinfo_flags |= H5AC__DIRTIED_FLAG; - /* set the pin entry flag so that the driver information block + /* set the pin entry flag so that the driver information block * cache entry will be pinned in the cache. */ drvinfo_flags |= H5AC__PIN_ENTRY_FLAG; @@ -857,7 +858,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) /* As "eoa_pre_fsm_fsalloc" may be undefined for a crashed file * with persistent free space managers, therefore, set - * "first_alloc_dealloc" when the condition + * "first_alloc_dealloc" when the condition * "dropping free-space to the floor is true. * This will ensure that no action is done to settle things on file * close via H5MF_settle_meta_data_fsm() and H5MF_settle_raw_data_fsm(). @@ -871,9 +872,9 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) f->shared->fs_addr[u] = fsinfo.fs_addr[u - 1]; /* If the following two conditions are true: - * (1) file is persisting free-space + * (1) file is persisting free-space * (2) dropping free-space to the floor (null_fsm_addr) - * nullify the addresses of the FSMs + * nullify the addresses of the FSMs */ if(f->shared->fs_persist && null_fsm_addr) for(u = 0; u < NELMTS(fsinfo.fs_addr); u++) @@ -888,7 +889,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) #if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */ /* KLUGE ALERT!! * - * H5F__super_ext_write_msg() expects f->shared->sblock to + * H5F__super_ext_write_msg() expects f->shared->sblock to * be set -- verify that it is NULL, and then set it. * Set it back to NULL when we are done. */ @@ -925,12 +926,12 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) /* if the metadata cache image superblock extension message exists, * read its contents and pass the data on to the metadata cache. * Given this data, the cache will load and decode the metadata - * cache image block, decoded it and load its contents into the - * the cache on the test protect call. + * cache image block, decoded it and load its contents into the + * the cache on the test protect call. * - * Further, if the file is opened R/W, the metadata cache will + * Further, if the file is opened R/W, the metadata cache will * delete the metadata cache image superblock extension and free - * the cache image block. Don't do this now as f->shared + * the cache image block. Don't do this now as f->shared * is not fully setup, which complicates matters. */ @@ -979,20 +980,20 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) /* Write driver info information to the superblock extension */ #if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */ - /* KLUGE ALERT!! - * - * H5F__super_ext_write_msg() expects f->shared->sblock to - * be set -- verify that it is NULL, and then set it. - * Set it back to NULL when we are done. - */ - HDassert(f->shared->sblock == NULL); - f->shared->sblock = sblock; + /* KLUGE ALERT!! + * + * H5F__super_ext_write_msg() expects f->shared->sblock to + * be set -- verify that it is NULL, and then set it. + * Set it back to NULL when we are done. + */ + HDassert(f->shared->sblock == NULL); + f->shared->sblock = sblock; #endif /* JRM */ - if(H5F__super_ext_write_msg(f, H5O_DRVINFO_ID, &drvinfo, FALSE, H5O_MSG_NO_FLAGS_SET) < 0) + if(H5F__super_ext_write_msg(f, H5O_DRVINFO_ID, &drvinfo, FALSE, H5O_MSG_NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error in writing message to superblock extension") #if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */ - f->shared->sblock = NULL; + f->shared->sblock = NULL; #endif /* JRM */ } /* end if */ @@ -1025,10 +1026,10 @@ done: if(sblock && H5AC_unprotect(f, H5AC_SUPERBLOCK, (haddr_t)0, sblock, sblock_flags) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTUNPROTECT, FAIL, "unable to close superblock") - /* If we have failed, make sure no entries are left in the + /* If we have failed, make sure no entries are left in the * metadata cache, so that it can be shut down and discarded. */ - if(ret_value < 0) { + if(ret_value < 0) { /* Unpin and discard drvinfo cache entry */ if(f->shared->drvinfo) { if(H5AC_unpin_entry(f->shared->drvinfo) < 0) @@ -1054,7 +1055,7 @@ done: FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5F__super_read() */ - + /*------------------------------------------------------------------------- * Function: H5F__super_init * @@ -1118,10 +1119,10 @@ H5F__super_init(H5F_t *f) if(!(f->shared->fs_strategy == H5F_FILE_SPACE_STRATEGY_DEF && f->shared->fs_persist == H5F_FREE_SPACE_PERSIST_DEF && f->shared->fs_threshold == H5F_FREE_SPACE_THRESHOLD_DEF && - f->shared->fs_page_size == H5F_FILE_SPACE_PAGE_SIZE_DEF)) + f->shared->fs_page_size == H5F_FILE_SPACE_PAGE_SIZE_DEF)) non_default_fs_settings = TRUE; - /* + /* * When creating a file with write access, the library will: * -- set superblock version to 0, 1 or 2 based on feature enabled * -- no change to low_bound @@ -1130,9 +1131,9 @@ H5F__super_init(H5F_t *f) * -- set superblock version to 3 * -- upgrade low_bound to at least V110 * - * Then the library will finalize superblock version to that allowed by + * Then the library will finalize superblock version to that allowed by * low_bound if that is higher. - * Lastly, the library will check to ensure the superblock version does not + * Lastly, the library will check to ensure the superblock version does not * exceed the version allowed by high_bound. Otherwise fail file open. * * For details, please see RFC:Setting Bounds for Object Creation in HDF5 1.10.0. @@ -1142,12 +1143,12 @@ H5F__super_init(H5F_t *f) * the status_flags field in the superblock. The problem is discussed in * jira issue SWMR-79 and also in the RFC: File Format Changes in HDF5 1.10.0. * The file's low_bound is upgraded for SWMR so that the library will - * use the best format versions available in 1.10. - * Due to the possible upgrade, the fapl returned from H5Fget_access_plist() + * use the best format versions available in 1.10. + * Due to the possible upgrade, the fapl returned from H5Fget_access_plist() * might indicate a low_bound higher than what the user originally set. */ - /* + /* * Creating a file with SWMR-write access will * upgrade superblock version and low_bound */ @@ -1158,10 +1159,10 @@ H5F__super_init(H5F_t *f) /* Bump superblock version to create superblock extension for SOHM info */ } else if(f->shared->sohm_nindexes > 0) super_vers = HDF5_SUPERBLOCK_VERSION_2; - /* - * Bump superblock version to create superblock extension for: - * -- non-default file space strategy or - * -- non-default persisting free-space or + /* + * Bump superblock version to create superblock extension for: + * -- non-default file space strategy or + * -- non-default persisting free-space or * -- non-default free-space threshold or * -- non-default page_size */ @@ -1238,7 +1239,7 @@ H5F__super_init(H5F_t *f) /* Compute the size of the driver information block */ H5_CHECKED_ASSIGN(driver_size, size_t, H5FD_sb_size(f->shared->lf), hsize_t); - /* The following code sets driver_size to the valued needed + /* The following code sets driver_size to the valued needed * for the driver info block, and sets the driver info block * address regardless of the version of the superblock. */ @@ -1279,7 +1280,7 @@ H5F__super_init(H5F_t *f) /* Allocate space for the superblock */ if(HADDR_UNDEF == H5MF_alloc(f, H5FD_MEM_SUPER, superblock_size)) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for superblock") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for superblock") /* set the drvinfo filed to NULL -- will overwrite this later if needed */ f->shared->drvinfo = NULL; @@ -1330,7 +1331,7 @@ H5F__super_init(H5F_t *f) * be tuned if more information is added to the superblock * extension. */ - if(H5F__super_ext_create(f, &ext_loc) < 0) + if(H5F__super_ext_create(f, &ext_loc) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "unable to create superblock extension") ext_created = TRUE; @@ -1403,7 +1404,7 @@ H5F__super_init(H5F_t *f) if(H5O_msg_create(&ext_loc, H5O_FSINFO_ID, H5O_MSG_FLAG_DONTSHARE | H5O_MSG_FLAG_MARK_IF_UNKNOWN, H5O_UPDATE_TIME, &fsinfo) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update free-space info header message") - } /* end if */ + } /* end if */ } /* end if */ else { /* Check for creating an "old-style" driver info block */ @@ -1486,7 +1487,7 @@ done: FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5F__super_init() */ - + /*------------------------------------------------------------------------- * Function: H5F_eoa_dirty * @@ -1516,8 +1517,8 @@ H5F_eoa_dirty(H5F_t *f) if(H5F_super_dirty(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty") - /* If the driver information block exists, mark it dirty as well - * so that the change in eoa will be reflected there as well if + /* If the driver information block exists, mark it dirty as well + * so that the change in eoa will be reflected there as well if * appropriate. */ if(f->shared->drvinfo) { @@ -1533,7 +1534,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5F_eoa_dirty() */ - + /*------------------------------------------------------------------------- * Function: H5F_super_dirty * @@ -1567,7 +1568,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5F_super_dirty() */ - + /*------------------------------------------------------------------------- * Function: H5F__super_free * @@ -1598,7 +1599,7 @@ H5F__super_free(H5F_super_t *sblock) FUNC_LEAVE_NOAPI(SUCCEED) } /* H5F__super_free() */ - + /*------------------------------------------------------------------------- * Function: H5F__super_size * @@ -1627,7 +1628,7 @@ H5F__super_size(H5F_t *f, hsize_t *super_size, hsize_t *super_ext_size) /* Set the superblock size */ if(super_size) - *super_size = (hsize_t)H5F_SUPERBLOCK_SIZE(f->shared->sblock); + *super_size = (hsize_t)H5F_SUPERBLOCK_SIZE(f->shared->sblock); /* Set the superblock extension size */ if(super_ext_size) { @@ -1663,7 +1664,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5F__super_size() */ - + /*------------------------------------------------------------------------- * Function: H5F__super_ext_write_msg() * @@ -1682,9 +1683,9 @@ H5F__super_ext_write_msg(H5F_t *f, unsigned id, void *mesg, H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ hbool_t ext_created = FALSE; /* Whether superblock extension was created */ hbool_t ext_opened = FALSE; /* Whether superblock extension was opened */ - H5O_loc_t ext_loc; /* "Object location" for superblock extension */ - htri_t status; /* Indicate whether the message exists or not */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_loc_t ext_loc; /* "Object location" for superblock extension */ + htri_t status; /* Indicate whether the message exists or not */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -1703,8 +1704,8 @@ H5F__super_ext_write_msg(H5F_t *f, unsigned id, void *mesg, } /* end if */ else { HDassert(may_create); - if(H5F__super_ext_create(f, &ext_loc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "unable to create file's superblock extension") + if(H5F__super_ext_create(f, &ext_loc) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "unable to create file's superblock extension") ext_created = TRUE; } /* end else */ HDassert(H5F_addr_defined(ext_loc.addr)); @@ -1712,24 +1713,24 @@ H5F__super_ext_write_msg(H5F_t *f, unsigned id, void *mesg, /* Check if message with ID does not exist in the object header */ if((status = H5O_msg_exists(&ext_loc, id)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check object header for message or message exists") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check object header for message or message exists") /* Check for creating vs. writing */ if(may_create) { if(status) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "Message should not exist") - /* Create the message with ID in the superblock extension */ - if(H5O_msg_create(&ext_loc, id, (mesg_flags | H5O_MSG_FLAG_DONTSHARE), H5O_UPDATE_TIME, mesg) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to create the message in object header") + /* Create the message with ID in the superblock extension */ + if(H5O_msg_create(&ext_loc, id, (mesg_flags | H5O_MSG_FLAG_DONTSHARE), H5O_UPDATE_TIME, mesg) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to create the message in object header") } /* end if */ else { if(!status) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "Message should exist") - /* Update the message with ID in the superblock extension */ - if(H5O_msg_write(&ext_loc, id, (mesg_flags | H5O_MSG_FLAG_DONTSHARE), H5O_UPDATE_TIME, mesg) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to write the message in object header") + /* Update the message with ID in the superblock extension */ + if(H5O_msg_write(&ext_loc, id, (mesg_flags | H5O_MSG_FLAG_DONTSHARE), H5O_UPDATE_TIME, mesg) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to write the message in object header") } /* end else */ done: @@ -1748,7 +1749,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5F__super_ext_write_msg() */ - + /*------------------------------------------------------------------------- * Function: H5F__super_ext_remove_msg * @@ -1764,11 +1765,11 @@ herr_t H5F__super_ext_remove_msg(H5F_t *f, unsigned id) { H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ - H5O_loc_t ext_loc; /* "Object location" for superblock extension */ + H5O_loc_t ext_loc; /* "Object location" for superblock extension */ hbool_t ext_opened = FALSE; /* Whether the superblock extension was opened */ - int null_count = 0; /* # of null messages */ + int null_count = 0; /* # of null messages */ htri_t status; /* Indicate whether the message exists or not */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -1780,34 +1781,34 @@ H5F__super_ext_remove_msg(H5F_t *f, unsigned id) /* Open superblock extension object header */ if(H5F_super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "error in starting file's superblock extension") + HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "error in starting file's superblock extension") ext_opened = TRUE; /* Check if message with ID exists in the object header */ if((status = H5O_msg_exists(&ext_loc, id)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check object header for message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check object header for message") else if(status) { /* message exists */ - H5O_hdr_info_t hdr_info; /* Object header info for superblock extension */ - - /* Remove the message */ - if(H5O_msg_remove(&ext_loc, id, H5O_ALL, TRUE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete free-space manager info message") - - /* Get info for the superblock extension's object header */ - if(H5O_get_hdr_info(&ext_loc, &hdr_info) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve superblock extension info") - - /* If the object header is an empty base chunk, remove superblock extension */ - if(hdr_info.nchunks == 1) { - if((null_count = H5O_msg_count(&ext_loc, H5O_NULL_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages") - else if((unsigned)null_count == hdr_info.nmesgs) { - HDassert(H5F_addr_defined(ext_loc.addr)); - if(H5O_delete(f, ext_loc.addr) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages") - f->shared->sblock->ext_addr = HADDR_UNDEF; - } /* end if */ - } /* end if */ + H5O_hdr_info_t hdr_info; /* Object header info for superblock extension */ + + /* Remove the message */ + if(H5O_msg_remove(&ext_loc, id, H5O_ALL, TRUE) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete free-space manager info message") + + /* Get info for the superblock extension's object header */ + if(H5O_get_hdr_info(&ext_loc, &hdr_info) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve superblock extension info") + + /* If the object header is an empty base chunk, remove superblock extension */ + if(hdr_info.nchunks == 1) { + if((null_count = H5O_msg_count(&ext_loc, H5O_NULL_ID)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages") + else if((unsigned)null_count == hdr_info.nmesgs) { + HDassert(H5F_addr_defined(ext_loc.addr)); + if(H5O_delete(f, ext_loc.addr) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages") + f->shared->sblock->ext_addr = HADDR_UNDEF; + } /* end if */ + } /* end if */ } /* end if */ done: @@ -1822,7 +1823,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5F__super_ext_remove_msg() */ - + /*------------------------------------------------------------------------- * Function: H5O__fsinfo_set_version * diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c index 33ed787..0e12904 100644 --- a/src/H5Odeprec.c +++ b/src/H5Odeprec.c @@ -32,6 +32,7 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ #include "H5Eprivate.h" /* Error handling */ #include "H5Opkg.h" /* Object headers */ diff --git a/src/H5Oint.c b/src/H5Oint.c index 39ebfd8..ee266b9 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -31,6 +31,7 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* File access */ #include "H5FLprivate.h" /* Free lists */ @@ -57,7 +58,7 @@ /* User data for recursive traversal over objects from a group */ typedef struct { hid_t obj_id; /* The ID for the starting group */ - H5G_loc_t *start_loc; /* Location of starting group */ + H5G_loc_t *start_loc; /* Location of starting group */ H5SL_t *visited; /* Skip list for tracking visited nodes */ H5O_iterate_t op; /* Application callback */ void *op_data; /* Application's op data */ @@ -97,36 +98,36 @@ hbool_t H5_PKG_INIT_VAR = FALSE; * message. */ const H5O_msg_class_t *const H5O_msg_class_g[] = { - H5O_MSG_NULL, /*0x0000 Null */ - H5O_MSG_SDSPACE, /*0x0001 Dataspace */ - H5O_MSG_LINFO, /*0x0002 Link information */ - H5O_MSG_DTYPE, /*0x0003 Datatype */ - H5O_MSG_FILL, /*0x0004 Old data storage -- fill value */ - H5O_MSG_FILL_NEW, /*0x0005 New data storage -- fill value */ - H5O_MSG_LINK, /*0x0006 Link */ - H5O_MSG_EFL, /*0x0007 Data storage -- external data files */ - H5O_MSG_LAYOUT, /*0x0008 Data Layout */ + H5O_MSG_NULL, /*0x0000 Null */ + H5O_MSG_SDSPACE, /*0x0001 Dataspace */ + H5O_MSG_LINFO, /*0x0002 Link information */ + H5O_MSG_DTYPE, /*0x0003 Datatype */ + H5O_MSG_FILL, /*0x0004 Old data storage -- fill value */ + H5O_MSG_FILL_NEW, /*0x0005 New data storage -- fill value */ + H5O_MSG_LINK, /*0x0006 Link */ + H5O_MSG_EFL, /*0x0007 Data storage -- external data files */ + H5O_MSG_LAYOUT, /*0x0008 Data Layout */ #ifdef H5O_ENABLE_BOGUS - H5O_MSG_BOGUS_VALID, /*0x0009 "Bogus valid" (for testing) */ + H5O_MSG_BOGUS_VALID, /*0x0009 "Bogus valid" (for testing) */ #else /* H5O_ENABLE_BOGUS */ - NULL, /*0x0009 "Bogus valid" (for testing) */ + NULL, /*0x0009 "Bogus valid" (for testing) */ #endif /* H5O_ENABLE_BOGUS */ - H5O_MSG_GINFO, /*0x000A Group information */ - H5O_MSG_PLINE, /*0x000B Data storage -- filter pipeline */ - H5O_MSG_ATTR, /*0x000C Attribute */ - H5O_MSG_NAME, /*0x000D Object name */ - H5O_MSG_MTIME, /*0x000E Object modification date and time */ - H5O_MSG_SHMESG, /*0x000F File-wide shared message table */ - H5O_MSG_CONT, /*0x0010 Object header continuation */ - H5O_MSG_STAB, /*0x0011 Symbol table */ - H5O_MSG_MTIME_NEW, /*0x0012 New Object modification date and time */ - H5O_MSG_BTREEK, /*0x0013 Non-default v1 B-tree 'K' values */ - H5O_MSG_DRVINFO, /*0x0014 Driver info settings */ - H5O_MSG_AINFO, /*0x0015 Attribute information */ - H5O_MSG_REFCOUNT, /*0x0016 Object's ref. count */ - H5O_MSG_FSINFO, /*0x0017 Free-space manager info */ + H5O_MSG_GINFO, /*0x000A Group information */ + H5O_MSG_PLINE, /*0x000B Data storage -- filter pipeline */ + H5O_MSG_ATTR, /*0x000C Attribute */ + H5O_MSG_NAME, /*0x000D Object name */ + H5O_MSG_MTIME, /*0x000E Object modification date and time */ + H5O_MSG_SHMESG, /*0x000F File-wide shared message table */ + H5O_MSG_CONT, /*0x0010 Object header continuation */ + H5O_MSG_STAB, /*0x0011 Symbol table */ + H5O_MSG_MTIME_NEW, /*0x0012 New Object modification date and time */ + H5O_MSG_BTREEK, /*0x0013 Non-default v1 B-tree 'K' values */ + H5O_MSG_DRVINFO, /*0x0014 Driver info settings */ + H5O_MSG_AINFO, /*0x0015 Attribute information */ + H5O_MSG_REFCOUNT, /*0x0016 Object's ref. count */ + H5O_MSG_FSINFO, /*0x0017 Free-space manager info */ H5O_MSG_MDCI, /*0x0018 Metadata cache image */ - H5O_MSG_UNKNOWN /*0x0019 Placeholder for unknown message */ + H5O_MSG_UNKNOWN /*0x0019 Placeholder for unknown message */ }; /* Format version bounds for object header */ @@ -174,20 +175,20 @@ H5FL_EXTERN(H5_obj_t); * datatype message is a datatype but only some of them are datasets. */ static const H5O_obj_class_t *const H5O_obj_class_g[] = { - H5O_OBJ_DATATYPE, /* Datatype object (H5O_TYPE_NAMED_DATATYPE - 2) */ - H5O_OBJ_DATASET, /* Dataset object (H5O_TYPE_DATASET - 1) */ - H5O_OBJ_GROUP, /* Group object (H5O_TYPE_GROUP - 0) */ + H5O_OBJ_DATATYPE, /* Datatype object (H5O_TYPE_NAMED_DATATYPE - 2) */ + H5O_OBJ_DATASET, /* Dataset object (H5O_TYPE_DATASET - 1) */ + H5O_OBJ_GROUP, /* Group object (H5O_TYPE_GROUP - 0) */ }; - + /*------------------------------------------------------------------------- - * Function: H5O__init_package + * Function: H5O__init_package * - * Purpose: Initialize information specific to H5O interface. + * Purpose: Initialize information specific to H5O interface. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, January 18, 2007 * *------------------------------------------------------------------------- @@ -206,7 +207,7 @@ H5O__init_package(void) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__init_package() */ - + /*------------------------------------------------------------------------- * Function: H5O_set_version * @@ -253,24 +254,24 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_set_version() */ - + /*------------------------------------------------------------------------- - * Function: H5O_create + * Function: H5O_create * - * Purpose: Creates a new object header. Allocates space for it and + * Purpose: Creates a new object header. Allocates space for it and * then calls an initialization function. The object header * is opened for write access and should eventually be * closed by calling H5O_close(). * - * Return: Success: Non-negative, the ENT argument contains - * information about the object header, - * including its address. + * Return: Success: Non-negative, the ENT argument contains + * information about the object header, + * including its address. * - * Failure: Negative + * Failure: Negative * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Aug 5 1997 + * Programmer: Robb Matzke + * matzke@llnl.gov + * Aug 5 1997 * *------------------------------------------------------------------------- */ @@ -312,7 +313,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_create() */ - + /*----------------------------------------------------------------------------- * Function: H5O__create_ohdr * @@ -377,7 +378,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5O__create_ohdr() */ - + /*----------------------------------------------------------------------------- * Function: H5O__apply_ohdr * @@ -548,17 +549,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__apply_ohdr() */ - + /*------------------------------------------------------------------------- - * Function: H5O_open + * Function: H5O_open * - * Purpose: Opens an object header which is described by the symbol table - * entry OBJ_ENT. + * Purpose: Opens an object header which is described by the symbol table + * entry OBJ_ENT. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Monday, January 5, 1998 + * Programmer: Robb Matzke + * Monday, January 5, 1998 * * Modification: * Raymond Lu @@ -585,7 +586,7 @@ H5O_open(H5O_loc_t *loc) /* Turn off the variable for holding file or increment open-lock counters */ if(loc->holding_file) - loc->holding_file = FALSE; + loc->holding_file = FALSE; else H5F_INCR_NOPEN_OBJS(loc->file); @@ -593,17 +594,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_open() */ - + /*------------------------------------------------------------------------- - * Function: H5O_open_name + * Function: H5O_open_name * - * Purpose: Opens an object within an HDF5 file. + * Purpose: Opens an object within an HDF5 file. * - * Return: Success: An open object identifier - * Failure: Negative + * Return: Success: An open object identifier + * Failure: Negative * - * Programmer: Quincey Koziol - * March 5 2007 + * Programmer: Quincey Koziol + * March 5 2007 * *------------------------------------------------------------------------- */ @@ -611,8 +612,8 @@ hid_t H5O_open_name(const H5G_loc_t *loc, const char *name, hbool_t app_ref) { H5G_loc_t obj_loc; /* Location used to open group */ - H5G_name_t obj_path; /* Opened object group hier. path */ - H5O_loc_t obj_oloc; /* Opened object object location */ + H5G_name_t obj_path; /* Opened object group hier. path */ + H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ hid_t ret_value = H5I_INVALID_HID; @@ -644,17 +645,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_open_name() */ - + /*------------------------------------------------------------------------- * Function: H5O__open_by_idx * * Purpose: Internal routine to open an object by index within group * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol - * December 28, 2017 + * Programmer: Quincey Koziol + * December 28, 2017 * *------------------------------------------------------------------------- */ @@ -663,10 +664,10 @@ H5O__open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n) { H5G_loc_t obj_loc; /* Location used to open group */ - H5G_name_t obj_path; /* Opened object group hier. path */ - H5O_loc_t obj_oloc; /* Opened object object location */ + H5G_name_t obj_path; /* Opened object group hier. path */ + H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_PACKAGE @@ -696,17 +697,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__open_by_idx() */ - + /*------------------------------------------------------------------------- * Function: H5O__open_by_addr * * Purpose: Internal routine to open an object by its address * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol - * December 28, 2017 + * Programmer: Quincey Koziol + * December 28, 2017 * *------------------------------------------------------------------------- */ @@ -714,9 +715,9 @@ hid_t H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr) { H5G_loc_t obj_loc; /* Location used to open group */ - H5G_name_t obj_path; /* Opened object group hier. path */ - H5O_loc_t obj_oloc; /* Opened object object location */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + H5G_name_t obj_path; /* Opened object group hier. path */ + H5O_loc_t obj_oloc; /* Opened object object location */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_PACKAGE @@ -739,17 +740,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__open_by_addr() */ - + /*------------------------------------------------------------------------- - * Function: H5O__open_by_loc + * Function: H5O__open_by_loc * - * Purpose: Opens an object and returns an ID given its group loction. + * Purpose: Opens an object and returns an ID given its group loction. * - * Return: Success: Open object identifier - * Failure: Negative + * Return: Success: Open object identifier + * Failure: Negative * - * Programmer: James Laird - * July 25 2006 + * Programmer: James Laird + * July 25 2006 * *------------------------------------------------------------------------- */ @@ -757,7 +758,7 @@ hid_t H5O__open_by_loc(const H5G_loc_t *obj_loc, hbool_t app_ref) { const H5O_obj_class_t *obj_class; /* Class of object for location */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_PACKAGE @@ -776,16 +777,16 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__open_by_loc() */ - + /*------------------------------------------------------------------------- - * Function: H5O_close + * Function: H5O_close * - * Purpose: Closes an object header that was previously open. + * Purpose: Closes an object header that was previously open. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Monday, January 5, 1998 + * Programmer: Robb Matzke + * Monday, January 5, 1998 * *------------------------------------------------------------------------- */ @@ -818,8 +819,8 @@ H5O_close(H5O_loc_t *loc, hbool_t *file_closed /*out*/) if(H5F_FILE_ID(loc->file)< 0 && 1 == H5F_NREFS(loc->file)) HDfprintf(H5DEBUG(O), "< %a auto %lu remaining\n", loc->addr, (unsigned long)H5F_NOPEN_OBJS(loc->file)); - else - HDfprintf(H5DEBUG(O), "< %a\n", loc->addr); + else + HDfprintf(H5DEBUG(O), "< %a\n", loc->addr); } #endif @@ -840,20 +841,20 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_close() */ - + /*------------------------------------------------------------------------- - * Function: H5O__link_oh + * Function: H5O__link_oh * - * Purpose: Adjust the link count for an open object header by adding - * ADJUST to the link count. + * Purpose: Adjust the link count for an open object header by adding + * ADJUST to the link count. * - * Return: Success: New link count + * Return: Success: New link count * - * Failure: Negative + * Failure: Negative * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Aug 5 1997 + * Programmer: Robb Matzke + * matzke@llnl.gov + * Aug 5 1997 * *------------------------------------------------------------------------- */ @@ -861,7 +862,7 @@ int H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted) { haddr_t addr = H5O_OH_GET_ADDR(oh); /* Object header address */ - int ret_value = -1; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_PACKAGE @@ -955,29 +956,29 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__link_oh() */ - + /*------------------------------------------------------------------------- - * Function: H5O_link + * Function: H5O_link * - * Purpose: Adjust the link count for an object header by adding - * ADJUST to the link count. + * Purpose: Adjust the link count for an object header by adding + * ADJUST to the link count. * - * Return: Success: New link count + * Return: Success: New link count * - * Failure: Negative + * Failure: Negative * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Aug 5 1997 + * Programmer: Robb Matzke + * matzke@llnl.gov + * Aug 5 1997 * *------------------------------------------------------------------------- */ int H5O_link(const H5O_loc_t *loc, int adjust) { - H5O_t *oh = NULL; + H5O_t *oh = NULL; hbool_t deleted = FALSE; /* Whether the object was deleted */ - int ret_value = -1; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI_TAG(loc->addr, FAIL) @@ -1003,21 +1004,21 @@ done: FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O_link() */ - + /*------------------------------------------------------------------------- - * Function: H5O_protect + * Function: H5O_protect * - * Purpose: Wrapper around H5AC_protect for use during a H5O_protect-> + * Purpose: Wrapper around H5AC_protect for use during a H5O_protect-> * H5O_msg_append->...->H5O_msg_append->H5O_unprotect sequence of calls * during an object's creation. * - * Return: Success: Pointer to the object header structure for the + * Return: Success: Pointer to the object header structure for the * object. - * Failure: NULL + * Failure: NULL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Dec 31 2002 + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Dec 31 2002 * *------------------------------------------------------------------------- */ @@ -1189,21 +1190,21 @@ done: FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O_protect() */ - + /*------------------------------------------------------------------------- - * Function: H5O_pin + * Function: H5O_pin * - * Purpose: Pin an object header down for use during a sequence of message + * Purpose: Pin an object header down for use during a sequence of message * operations, which prevents the object header from being * evicted from the cache. * - * Return: Success: Pointer to the object header structure for the + * Return: Success: Pointer to the object header structure for the * object. - * Failure: NULL + * Failure: NULL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Jul 13 2008 + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Jul 13 2008 * *------------------------------------------------------------------------- */ @@ -1238,19 +1239,19 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_pin() */ - + /*------------------------------------------------------------------------- - * Function: H5O_unpin + * Function: H5O_unpin * - * Purpose: Unpin an object header, allowing it to be evicted from the + * Purpose: Unpin an object header, allowing it to be evicted from the * metadata cache. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Jul 13 2008 + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Jul 13 2008 * *------------------------------------------------------------------------- */ @@ -1273,20 +1274,20 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_unpin() */ - + /*------------------------------------------------------------------------- - * Function: H5O_unprotect + * Function: H5O_unprotect * - * Purpose: Wrapper around H5AC_unprotect for use during a H5O_protect-> + * Purpose: Wrapper around H5AC_unprotect for use during a H5O_protect-> * H5O_msg_append->...->H5O_msg_append->H5O_unprotect sequence of calls * during an object's creation. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Dec 31 2002 + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Dec 31 2002 * *------------------------------------------------------------------------- */ @@ -1330,17 +1331,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_unprotect() */ - + /*------------------------------------------------------------------------- - * Function: H5O_touch_oh + * Function: H5O_touch_oh * - * Purpose: If FORCE is non-zero then create a modification time message - * unless one already exists. Then update any existing - * modification time message with the current time. + * Purpose: If FORCE is non-zero then create a modification time message + * unless one already exists. Then update any existing + * modification time message with the current time. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, July 27, 1998 * *------------------------------------------------------------------------- @@ -1350,7 +1351,7 @@ H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force) { H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */ hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */ - time_t now; /* Current time */ + time_t now; /* Current time */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1365,7 +1366,7 @@ H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force) /* Check version, to determine how to store time information */ if(oh->version == H5O_VERSION_1) { - size_t idx; /* Index of modification time message to update */ + size_t idx; /* Index of modification time message to update */ /* Look for existing message */ for(idx = 0; idx < oh->nmesgs; idx++) @@ -1424,18 +1425,18 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_touch_oh() */ - + /*------------------------------------------------------------------------- - * Function: H5O_touch + * Function: H5O_touch * - * Purpose: Touch an object by setting the modification time to the - * current time and marking the object as dirty. Unless FORCE - * is non-zero, nothing happens if there is no MTIME message in - * the object header. + * Purpose: Touch an object by setting the modification time to the + * current time and marking the object as dirty. Unless FORCE + * is non-zero, nothing happens if there is no MTIME message in + * the object header. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, July 27, 1998 * *------------------------------------------------------------------------- @@ -1443,8 +1444,8 @@ done: herr_t H5O_touch(const H5O_loc_t *loc, hbool_t force) { - H5O_t *oh = NULL; /* Object header to modify */ - unsigned oh_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting object header */ + H5O_t *oh = NULL; /* Object header to modify */ + unsigned oh_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting object header */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1471,15 +1472,15 @@ done: } /* end H5O_touch() */ #ifdef H5O_ENABLE_BOGUS - + /*------------------------------------------------------------------------- - * Function: H5O_bogus_oh + * Function: H5O_bogus_oh * - * Purpose: Create a "bogus" message unless one already exists. + * Purpose: Create a "bogus" message unless one already exists. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * * Tuesday, January 21, 2003 * @@ -1488,8 +1489,8 @@ done: herr_t H5O_bogus_oh(H5F_t *f, H5O_t *oh, unsigned bogus_id, unsigned mesg_flags) { - size_t idx; /* Local index variable */ - H5O_msg_class_t *type; /* Message class type */ + size_t idx; /* Local index variable */ + H5O_msg_class_t *type; /* Message class type */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1507,25 +1508,25 @@ H5O_bogus_oh(H5F_t *f, H5O_t *oh, unsigned bogus_id, unsigned mesg_flags) H5O_bogus_t *bogus; /* Pointer to the bogus information */ /* Allocate the native message in memory */ - if(NULL == (bogus = H5MM_malloc(sizeof(H5O_bogus_t)))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "memory allocation failed for 'bogus' message") + if(NULL == (bogus = H5MM_malloc(sizeof(H5O_bogus_t)))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "memory allocation failed for 'bogus' message") /* Update the native value */ bogus->u = H5O_BOGUS_VALUE; - if(bogus_id == H5O_BOGUS_VALID_ID) - type = H5O_MSG_BOGUS_VALID; - else if(bogus_id == H5O_BOGUS_INVALID_ID) - type = H5O_MSG_BOGUS_INVALID; - else - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID for 'bogus' message") + if(bogus_id == H5O_BOGUS_VALID_ID) + type = H5O_MSG_BOGUS_VALID; + else if(bogus_id == H5O_BOGUS_INVALID_ID) + type = H5O_MSG_BOGUS_INVALID; + else + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID for 'bogus' message") /* Allocate space in the object header for bogus message */ - if(H5O__msg_alloc(f, oh, type, &mesg_flags, bogus, &idx) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for 'bogus' message") + if(H5O__msg_alloc(f, oh, type, &mesg_flags, bogus, &idx) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for 'bogus' message") /* Point to "bogus" information (take it over) */ - oh->mesg[idx].native = bogus; + oh->mesg[idx].native = bogus; /* Set the appropriate flags for the message */ oh->mesg[idx].flags = mesg_flags; @@ -1540,20 +1541,20 @@ done: } /* end H5O_bogus_oh() */ #endif /* H5O_ENABLE_BOGUS */ - + /*------------------------------------------------------------------------- - * Function: H5O_delete + * Function: H5O_delete * - * Purpose: Delete an object header from a file. This frees the file + * Purpose: Delete an object header from a file. This frees the file * space used for the object header (and it's continuation blocks) * and also walks through each header message and asks it to * remove all the pieces of the file referenced by the header. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Mar 19 2003 + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Mar 19 2003 * *------------------------------------------------------------------------- */ @@ -1602,21 +1603,21 @@ done: FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O_delete() */ - + /*------------------------------------------------------------------------- - * Function: H5O__delete_oh + * Function: H5O__delete_oh * - * Purpose: Internal function to: + * Purpose: Internal function to: * Delete an object header from a file. This frees the file * space used for the object header (and it's continuation blocks) * and also walks through each header message and asks it to * remove all the pieces of the file referenced by the header. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Mar 19 2003 + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Mar 19 2003 * *------------------------------------------------------------------------- */ @@ -1624,7 +1625,7 @@ static herr_t H5O__delete_oh(H5F_t *f, H5O_t *oh) { H5O_mesg_t *curr_msg; /* Pointer to current message being operated on */ - unsigned u; + unsigned u; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1646,16 +1647,16 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__delete_oh() */ - + /*------------------------------------------------------------------------- - * Function: H5O_obj_type + * Function: H5O_obj_type * - * Purpose: Retrieves the type of object pointed to by `loc'. + * Purpose: Retrieves the type of object pointed to by `loc'. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, November 4, 1998 * *------------------------------------------------------------------------- @@ -1663,7 +1664,7 @@ done: herr_t H5O_obj_type(const H5O_loc_t *loc, H5O_type_t *obj_type) { - H5O_t *oh = NULL; /* Object header for location */ + H5O_t *oh = NULL; /* Object header for location */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_TAG(loc->addr, FAIL) @@ -1678,21 +1679,21 @@ H5O_obj_type(const H5O_loc_t *loc, H5O_type_t *obj_type) done: if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O_obj_type() */ - + /*------------------------------------------------------------------------- - * Function: H5O__obj_type_real + * Function: H5O__obj_type_real * - * Purpose: Returns the type of object pointed to by `oh'. + * Purpose: Returns the type of object pointed to by `oh'. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, November 21, 2005 * *------------------------------------------------------------------------- @@ -1724,16 +1725,16 @@ H5O__obj_type_real(const H5O_t *oh, H5O_type_t *obj_type) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__obj_type_real() */ - + /*------------------------------------------------------------------------- - * Function: H5O__obj_class + * Function: H5O__obj_class * - * Purpose: Returns the class of object pointed to by `loc'. + * Purpose: Returns the class of object pointed to by `loc'. * - * Return: Success: An object class - * Failure: NULL + * Return: Success: An object class + * Failure: NULL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, November 6, 2006 * *------------------------------------------------------------------------- @@ -1741,7 +1742,7 @@ H5O__obj_type_real(const H5O_t *oh, H5O_type_t *obj_type) const H5O_obj_class_t * H5O__obj_class(const H5O_loc_t *loc) { - H5O_t *oh = NULL; /* Object header for location */ + H5O_t *oh = NULL; /* Object header for location */ const H5O_obj_class_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC_TAG(loc->addr) @@ -1756,21 +1757,21 @@ H5O__obj_class(const H5O_loc_t *loc) done: if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header") FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O__obj_class() */ - + /*------------------------------------------------------------------------- - * Function: H5O__obj_class_real + * Function: H5O__obj_class_real * - * Purpose: Returns the class of object pointed to by `oh'. + * Purpose: Returns the class of object pointed to by `oh'. * - * Return: Success: An object class - * Failure: NULL + * Return: Success: An object class + * Failure: NULL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, November 21, 2005 * *------------------------------------------------------------------------- @@ -1778,7 +1779,7 @@ done: static const H5O_obj_class_t * H5O__obj_class_real(const H5O_t *oh) { - size_t i; /* Local index variable */ + size_t i; /* Local index variable */ const H5O_obj_class_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -1789,7 +1790,7 @@ H5O__obj_class_real(const H5O_t *oh) /* Test whether entry qualifies as a particular type of object */ /* (Note: loop is in reverse order, to test specific objects first) */ for(i = NELMTS(H5O_obj_class_g); i > 0; --i) { - htri_t isa; /* Is entry a particular type? */ + htri_t isa; /* Is entry a particular type? */ if((isa = (H5O_obj_class_g[i - 1]->isa)(oh)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to determine object type") @@ -1804,17 +1805,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__obj_class_real() */ - + /*------------------------------------------------------------------------- - * Function: H5O_get_loc + * Function: H5O_get_loc * - * Purpose: Gets the object location for an object given its ID. + * Purpose: Gets the object location for an object given its ID. * - * Return: Success: Pointer to H5O_loc_t - * Failure: NULL + * Return: Success: Pointer to H5O_loc_t + * Failure: NULL * - * Programmer: James Laird - * July 25 2006 + * Programmer: James Laird + * July 25 2006 * *------------------------------------------------------------------------- */ @@ -1862,16 +1863,16 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_get_loc() */ - + /*------------------------------------------------------------------------- - * Function: H5O_loc_reset + * Function: H5O_loc_reset * - * Purpose: Reset a object location to an empty state + * Purpose: Reset a object location to an empty state * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, September 19, 2005 * *------------------------------------------------------------------------- @@ -1891,16 +1892,16 @@ H5O_loc_reset(H5O_loc_t *loc) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_loc_reset() */ - + /*------------------------------------------------------------------------- * Function: H5O_loc_copy * * Purpose: Copy object location information * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * koziol@ncsa.uiuc.edu * Monday, September 19, 2005 * @@ -1942,17 +1943,17 @@ H5O_loc_copy(H5O_loc_t *dst, H5O_loc_t *src, H5_copy_depth_t depth) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_loc_copy() */ - + /*------------------------------------------------------------------------- - * Function: H5O_loc_hold_file + * Function: H5O_loc_hold_file * - * Purpose: Have this object header hold a file open until it is + * Purpose: Have this object header hold a file open until it is * released. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: James Laird + * Programmer: James Laird * Wednesday, August 16, 2006 * *------------------------------------------------------------------------- @@ -1975,18 +1976,18 @@ H5O_loc_hold_file(H5O_loc_t *loc) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_loc_hold_file() */ - + /*------------------------------------------------------------------------- - * Function: H5O_loc_free + * Function: H5O_loc_free * - * Purpose: Release resources used by this object header location. + * Purpose: Release resources used by this object header location. * Not to be confused with H5O_close; this is used on * locations that don't correspond to open objects. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: James Laird + * Programmer: James Laird * Wednesday, August 16, 2006 * *------------------------------------------------------------------------- @@ -2015,17 +2016,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_loc_free() */ - + /*------------------------------------------------------------------------- - * Function: H5O_get_hdr_info + * Function: H5O_get_hdr_info * - * Purpose: Retrieve the object header information for an object + * Purpose: Retrieve the object header information for an object * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol - * September 22 2009 + * Programmer: Quincey Koziol + * September 22 2009 * *------------------------------------------------------------------------- */ @@ -2054,22 +2055,22 @@ H5O_get_hdr_info(const H5O_loc_t *loc, H5O_hdr_info_t *hdr) done: if(oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_get_hdr_info() */ - + /*------------------------------------------------------------------------- - * Function: H5O__get_hdr_info_real + * Function: H5O__get_hdr_info_real * - * Purpose: Internal routine to retrieve the object header information for an object + * Purpose: Internal routine to retrieve the object header information for an object * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol - * September 22 2009 + * Programmer: Quincey Koziol + * September 22 2009 * *------------------------------------------------------------------------- */ @@ -2077,7 +2078,7 @@ static herr_t H5O__get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr) { const H5O_mesg_t *curr_msg; /* Pointer to current message being operated on */ - const H5O_chunk_t *curr_chunk; /* Pointer to current message being operated on */ + const H5O_chunk_t *curr_chunk; /* Pointer to current message being operated on */ unsigned u; /* Local index variable */ FUNC_ENTER_STATIC_NOERR @@ -2140,16 +2141,16 @@ H5O__get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__get_hdr_info_real() */ - + /*------------------------------------------------------------------------- * Function: H5O_get_info * * Purpose: Retrieve the information for an object * * Note: Add a parameter "fields" to indicate selection of object info. - * - * Return: Success: Non-negative - * Failure: Negative + * + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol * November 21 2006 @@ -2193,7 +2194,7 @@ H5O_get_info(const H5O_loc_t *loc, H5O_info_t *oinfo, unsigned fields) /* Set the object's reference count */ oinfo->rc = oh->nlink; - } + } /* Get time information, if requested */ if(fields & H5O_INFO_TIME) { @@ -2270,7 +2271,7 @@ done: FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O_get_info() */ - + /*------------------------------------------------------------------------- * Function: H5O__get_info_by_idx * @@ -2280,8 +2281,8 @@ done: * * Note: Add a parameter "fields" to indicate selection of object info. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol * December 28, 2017 @@ -2293,10 +2294,10 @@ H5O__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t id H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, unsigned fields) { H5G_loc_t obj_loc; /* Location used to open group */ - H5G_name_t obj_path; /* Opened object group hier. path */ - H5O_loc_t obj_oloc; /* Opened object object location */ + H5G_name_t obj_path; /* Opened object group hier. path */ + H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -2327,17 +2328,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__get_info_by_idx() */ - + /*------------------------------------------------------------------------- - * Function: H5O_get_create_plist + * Function: H5O_get_create_plist * - * Purpose: Retrieve the object creation properties for an object + * Purpose: Retrieve the object creation properties for an object * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol - * November 28 2006 + * Programmer: Quincey Koziol + * November 28 2006 * *------------------------------------------------------------------------- */ @@ -2382,17 +2383,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_get_create_plist() */ - + /*------------------------------------------------------------------------- - * Function: H5O_get_nlinks + * Function: H5O_get_nlinks * - * Purpose: Retrieve the number of link messages read in from the file + * Purpose: Retrieve the number of link messages read in from the file * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol - * March 11 2007 + * Programmer: Quincey Koziol + * March 11 2007 * *------------------------------------------------------------------------- */ @@ -2422,17 +2423,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_get_nlinks() */ - + /*------------------------------------------------------------------------- - * Function: H5O_obj_create + * Function: H5O_obj_create * - * Purpose: Creates an object, in an abstract manner. + * Purpose: Creates an object, in an abstract manner. * - * Return: Success: Pointer to object opened - * Failure: NULL + * Return: Success: Pointer to object opened + * Failure: NULL * - * Programmer: Quincey Koziol - * April 9 2007 + * Programmer: Quincey Koziol + * April 9 2007 * *------------------------------------------------------------------------- */ @@ -2453,7 +2454,7 @@ H5O_obj_create(H5F_t *f, H5O_type_t obj_type, void *crt_info, H5G_loc_t *obj_loc /* Iterate through the object classes */ for(u = 0; u < NELMTS(H5O_obj_class_g); u++) { /* Check for correct type of object to create */ - if(H5O_obj_class_g[u]->type == obj_type) { + if(H5O_obj_class_g[u]->type == obj_type) { /* Call the object class's 'create' routine */ HDassert(H5O_obj_class_g[u]->create); if(NULL == (ret_value = H5O_obj_class_g[u]->create(f, crt_info, obj_loc))) @@ -2469,21 +2470,21 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_obj_create() */ - + /*------------------------------------------------------------------------- - * Function: H5O_get_oh_addr + * Function: H5O_get_oh_addr * - * Purpose: Retrieve the address of the object header + * Purpose: Retrieve the address of the object header * - * Note: This routine participates in the "Inlining C struct access" - * pattern, don't call it directly, use the appropriate macro - * defined in H5Oprivate.h. + * Note: This routine participates in the "Inlining C struct access" + * pattern, don't call it directly, use the appropriate macro + * defined in H5Oprivate.h. * - * Return: Success: Valid haddr_t - * Failure: HADDR_UNDEF + * Return: Success: Valid haddr_t + * Failure: HADDR_UNDEF * - * Programmer: Quincey Koziol - * March 15 2007 + * Programmer: Quincey Koziol + * March 15 2007 * *------------------------------------------------------------------------- */ @@ -2499,7 +2500,7 @@ H5O_get_oh_addr(const H5O_t *oh) FUNC_LEAVE_NOAPI(oh->chunk[0].addr) } /* end H5O_get_oh_addr() */ - + /*------------------------------------------------------------------------- * Function: H5O_get_oh_flags * @@ -2516,7 +2517,7 @@ H5O_get_oh_flags(const H5O_t *oh) FUNC_LEAVE_NOAPI(oh->flags); /* flags can be 0 */ } /* H5O_get_oh_flags() */ - + /*------------------------------------------------------------------------- * Function: H5O_get_oh_mtime * @@ -2538,7 +2539,7 @@ H5O_get_oh_mtime(const H5O_t *oh) FUNC_LEAVE_NOAPI(oh->mtime); } /* H5O_get_oh_mtime() */ - + /*------------------------------------------------------------------------- * Function: H5O_get_oh_version * @@ -2556,17 +2557,17 @@ H5O_get_oh_version(const H5O_t *oh) FUNC_LEAVE_NOAPI(oh->version); } /* H5O_get_oh_version() */ - + /*------------------------------------------------------------------------- - * Function: H5O_get_rc_and_type + * Function: H5O_get_rc_and_type * - * Purpose: Retrieve an object's reference count and type + * Purpose: Retrieve an object's reference count and type * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol - * November 4 2007 + * Programmer: Quincey Koziol + * November 4 2007 * *------------------------------------------------------------------------- */ @@ -2601,7 +2602,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_get_rc_and_type() */ - + /*------------------------------------------------------------------------- * Function: H5O__free_visit_visited * @@ -2610,7 +2611,7 @@ done: * Return: Non-negative on success, negative on failure * * Programmer: Quincey Koziol - * Nov 25, 2007 + * Nov 25, 2007 * *------------------------------------------------------------------------- */ @@ -2624,17 +2625,17 @@ H5O__free_visit_visited(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSE FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__free_visit_visited() */ - + /*------------------------------------------------------------------------- - * Function: H5O__visit_cb + * Function: H5O__visit_cb * * Purpose: Callback function for recursively visiting objects from a group * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol - * Nov 25, 2007 + * Programmer: Quincey Koziol + * Nov 25, 2007 * *------------------------------------------------------------------------- */ @@ -2644,8 +2645,8 @@ H5O__visit_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t *li { H5O_iter_visit_ud_t *udata = (H5O_iter_visit_ud_t *)_udata; /* User data for callback */ H5G_loc_t obj_loc; /* Location of object */ - H5G_name_t obj_path; /* Object's group hier. path */ - H5O_loc_t obj_oloc; /* Object's object location */ + H5G_name_t obj_path; /* Object's group hier. path */ + H5O_loc_t obj_oloc; /* Object's object location */ hbool_t obj_found = FALSE; /* Object at 'name' found */ herr_t ret_value = H5_ITER_CONT; /* Return value */ @@ -2716,9 +2717,9 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__visit_cb() */ - + /*------------------------------------------------------------------------- - * Function: H5O__visit + * Function: H5O__visit * * Purpose: Recursively visit an object and all the objects reachable * from it. If the starting object is a group, all the objects @@ -2739,14 +2740,14 @@ done: * Note: Add a parameter "fields" to indicate selection of object info. * * Return: Success: The return value of the first operator that - * returns non-zero, or zero if all members were - * processed with no operator returning non-zero. + * returns non-zero, or zero if all members were + * processed with no operator returning non-zero. * * Failure: Negative if something goes wrong within the - * library, or the negative value returned by one - * of the operators. + * library, or the negative value returned by one + * of the operators. * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * November 24 2007 * *------------------------------------------------------------------------- @@ -2756,7 +2757,7 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields) { H5O_iter_visit_ud_t udata; /* User data for callback */ - H5G_loc_t loc; /* Location of reference object */ + H5G_loc_t loc; /* Location of reference object */ H5G_loc_t obj_loc; /* Location used to open object */ H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ @@ -2803,7 +2804,7 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* Check for object being a group */ if(oinfo.type == H5O_TYPE_GROUP) { - H5G_loc_t start_loc; /* Location of starting group */ + H5G_loc_t start_loc; /* Location of starting group */ /* Get the location of the starting group */ if(H5G_loc(obj_id, &start_loc) < 0) @@ -2856,17 +2857,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__visit() */ - + /*------------------------------------------------------------------------- - * Function: H5O__inc_rc + * Function: H5O__inc_rc * - * Purpose: Increments the reference count on an object header + * Purpose: Increments the reference count on an object header * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Jul 13 2008 + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Jul 13 2008 * *------------------------------------------------------------------------- */ @@ -2892,17 +2893,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__inc_rc() */ - + /*------------------------------------------------------------------------- - * Function: H5O__dec_rc + * Function: H5O__dec_rc * - * Purpose: Decrements the reference count on an object header + * Purpose: Decrements the reference count on an object header * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Jul 13 2008 + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Jul 13 2008 * *------------------------------------------------------------------------- */ @@ -2928,7 +2929,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__dec_rc() */ - + /*------------------------------------------------------------------------- * Function: H5O_dec_rc_by_loc * @@ -2971,16 +2972,16 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_dec_rc_by_loc() */ - + /*------------------------------------------------------------------------- - * Function: H5O_get_proxy + * Function: H5O_get_proxy * - * Purpose: Retrieve the proxy for the object header. + * Purpose: Retrieve the proxy for the object header. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 24 2016 + * Programmer: Quincey Koziol + * July 24 2016 * *------------------------------------------------------------------------- */ @@ -2995,24 +2996,24 @@ H5O_get_proxy(const H5O_t *oh) FUNC_LEAVE_NOAPI(oh->proxy) } /* end H5O_get_proxy() */ - + /*------------------------------------------------------------------------- - * Function: H5O__free + * Function: H5O__free * - * Purpose: Destroys an object header. + * Purpose: Destroys an object header. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Jan 15 2003 + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Jan 15 2003 * *------------------------------------------------------------------------- */ herr_t H5O__free(H5O_t *oh) { - unsigned u; /* Local index variable */ + unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE diff --git a/src/H5Rint.c b/src/H5Rint.c index 4334faa..4056716 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -23,6 +23,7 @@ /***********/ #include "H5private.h" /* Generic Functions */ #include "H5ACprivate.h" /* Metadata cache */ +#include "H5CXprivate.h" /* API Contexts */ #include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5Gprivate.h" /* Groups */ @@ -77,7 +78,7 @@ static const H5I_class_t H5I_REFERENCE_CLS[1] = {{ /* Flag indicating "top" of interface has been initialized */ static hbool_t H5R_top_package_initialize_s = FALSE; - + /*-------------------------------------------------------------------------- NAME H5R__init_package -- Initialize interface-specific information @@ -108,7 +109,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__init_package() */ - + /*-------------------------------------------------------------------------- NAME H5R_top_term_package @@ -130,7 +131,7 @@ done: int H5R_top_term_package(void) { - int n = 0; + int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -138,7 +139,7 @@ H5R_top_term_package(void) if (H5I_nmembers(H5I_REFERENCE) > 0) { (void)H5I_clear_type(H5I_REFERENCE, FALSE, FALSE); n++; - } + } /* Mark closed */ if (0 == n) @@ -148,7 +149,7 @@ H5R_top_term_package(void) FUNC_LEAVE_NOAPI(n) } /* end H5R_top_term_package() */ - + /*-------------------------------------------------------------------------- NAME H5R_term_package @@ -172,7 +173,7 @@ H5R_top_term_package(void) int H5R_term_package(void) { - int n = 0; + int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -192,7 +193,7 @@ H5R_term_package(void) FUNC_LEAVE_NOAPI(n) } /* end H5R_term_package() */ - + /*-------------------------------------------------------------------------- NAME H5R__create @@ -224,9 +225,9 @@ herr_t H5R__create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5S_t *space) { - H5G_loc_t obj_loc; /* Group hier. location of object */ - H5G_name_t path; /* Object group hier. path */ - H5O_loc_t oloc; /* Object object location */ + H5G_loc_t obj_loc; /* Group hier. location of object */ + H5G_name_t path; /* Object group hier. path */ + H5O_loc_t oloc; /* Object object location */ hbool_t obj_found = FALSE; /* Object location found */ herr_t ret_value = SUCCEED; /* Return value */ @@ -341,7 +342,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__create() */ - + /*-------------------------------------------------------------------------- NAME H5R__dereference @@ -380,7 +381,7 @@ H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, H5O_loc_t oloc; /* Object location */ H5G_name_t path; /* Path of object */ H5G_loc_t loc; /* Group location */ - unsigned rc; /* Reference count of object */ + unsigned rc; /* Reference count of object */ H5O_type_t obj_type; /* Type of object */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -510,7 +511,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__dereference() */ - + /*-------------------------------------------------------------------------- NAME H5R__get_region @@ -540,7 +541,7 @@ H5R__get_region(H5F_t *file, const void *_ref) H5HG_t hobjid; /* Heap object ID */ uint8_t *buf = NULL; /* Buffer to store serialized selection in */ H5S_t *ds = NULL; /* Temporary pointer to dataspace */ - H5S_t *ret_value = NULL; /* Return value */ + H5S_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -587,7 +588,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__get_region() */ - + /*-------------------------------------------------------------------------- NAME H5R__get_obj_type @@ -598,7 +599,7 @@ done: H5F_t *file; IN: File the object being dereferenced is within H5R_type_t ref_type; IN: Type of reference to query void *ref; IN: Reference to query. - H5O_type_t *obj_type; OUT: The type of the object, set on success + H5O_type_t *obj_type; OUT: The type of the object, set on success RETURNS Non-negative on success/Negative on failure @@ -615,7 +616,7 @@ H5R__get_obj_type(H5F_t *file, H5R_type_t ref_type, const void *_ref, H5O_type_t *obj_type) { H5O_loc_t oloc; /* Object location */ - unsigned rc; /* Reference count of object */ + unsigned rc; /* Reference count of object */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -676,7 +677,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__get_obj_type() */ - + /*-------------------------------------------------------------------------- NAME H5R__get_name diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt index 9ce7538..306c033 100644 --- a/tools/lib/CMakeLists.txt +++ b/tools/lib/CMakeLists.txt @@ -38,6 +38,9 @@ if (NOT ONLY_SHARED_LIBS) PRIVATE "${HDF5_TOOLS_LIB_SOURCE_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) + target_compile_options(${HDF5_TOOLS_LIB_TARGET} + PRIVATE "${HDF5_CMAKE_C_FLAGS}" + ) #target_compile_definitions(${HDF5_TOOLS_LIB_TARGET} PRIVATE H5_TOOLS_DEBUG) #target_compile_definitions(${HDF5_TOOLS_LIB_TARGET} PRIVATE H5DIFF_DEBUG) TARGET_C_PROPERTIES (${HDF5_TOOLS_LIB_TARGET} STATIC) @@ -57,6 +60,9 @@ if (BUILD_SHARED_LIBS) PRIVATE "${HDF5_TOOLS_LIB_SOURCE_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) + target_compile_options(${HDF5_TOOLS_LIBSH_TARGET} + PRIVATE "${HDF5_CMAKE_C_FLAGS}" + ) target_compile_definitions(${HDF5_TOOLS_LIBSH_TARGET} PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" #PRIVATE H5_TOOLS_DEBUG diff --git a/tools/src/h5copy/CMakeLists.txt b/tools/src/h5copy/CMakeLists.txt index 29888f2..8f230a0 100644 --- a/tools/src/h5copy/CMakeLists.txt +++ b/tools/src/h5copy/CMakeLists.txt @@ -7,6 +7,7 @@ project (HDF5_TOOLS_SRC_H5COPY C) if (NOT ONLY_SHARED_LIBS) add_executable (h5copy ${HDF5_TOOLS_SRC_H5COPY_SOURCE_DIR}/h5copy.c) target_include_directories (h5copy PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(h5copy PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5copy STATIC) target_link_libraries (h5copy PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5copy PROPERTIES FOLDER tools) @@ -18,6 +19,7 @@ endif () if (BUILD_SHARED_LIBS) add_executable (h5copy-shared ${HDF5_TOOLS_SRC_H5COPY_SOURCE_DIR}/h5copy.c) target_include_directories (h5copy-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(h5copy-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5copy-shared SHARED) target_link_libraries (h5copy-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5copy-shared PROPERTIES FOLDER tools) diff --git a/tools/src/h5diff/CMakeLists.txt b/tools/src/h5diff/CMakeLists.txt index 93e99cf..eec7246 100644 --- a/tools/src/h5diff/CMakeLists.txt +++ b/tools/src/h5diff/CMakeLists.txt @@ -10,6 +10,7 @@ if (NOT ONLY_SHARED_LIBS) ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c ) target_include_directories (h5diff PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(h5diff PRIVATE "${HDF5_CMAKE_C_FLAGS}") #target_compile_definitions (h5diff PRIVATE H5_TOOLS_DEBUG) TARGET_C_PROPERTIES (h5diff STATIC) target_link_libraries (h5diff PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) @@ -24,6 +25,7 @@ if (BUILD_SHARED_LIBS) ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c ) target_include_directories (h5diff-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(h5diff-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") #target_compile_definitions (h5diff-shared PRIVATE H5_TOOLS_DEBUG) TARGET_C_PROPERTIES (h5diff-shared SHARED) target_link_libraries (h5diff-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) diff --git a/tools/src/h5dump/CMakeLists.txt b/tools/src/h5dump/CMakeLists.txt index 104d9b0..e02fe68 100644 --- a/tools/src/h5dump/CMakeLists.txt +++ b/tools/src/h5dump/CMakeLists.txt @@ -11,6 +11,7 @@ if (NOT ONLY_SHARED_LIBS) ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.c ) target_include_directories (h5dump PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(h5dump PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5dump STATIC) target_link_libraries (h5dump PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) #target_compile_definitions(h5dump PRIVATE H5_TOOLS_DEBUG) @@ -27,6 +28,7 @@ if (BUILD_SHARED_LIBS) ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.c ) target_include_directories (h5dump-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(h5dump-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5dump-shared SHARED) target_link_libraries (h5dump-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) #target_compile_definitions(h5dump-shared PRIVATE H5_TOOLS_DEBUG) diff --git a/tools/src/h5format_convert/CMakeLists.txt b/tools/src/h5format_convert/CMakeLists.txt index 70c07ee..863ecbe 100644 --- a/tools/src/h5format_convert/CMakeLists.txt +++ b/tools/src/h5format_convert/CMakeLists.txt @@ -7,6 +7,7 @@ project (HDF5_TOOLS_SRC_H5FC C) if (NOT ONLY_SHARED_LIBS) add_executable (h5format_convert ${HDF5_TOOLS_SRC_H5FC_SOURCE_DIR}/h5format_convert.c) target_include_directories (h5format_convert PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(h5format_convert PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5format_convert STATIC) target_link_libraries (h5format_convert PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5format_convert PROPERTIES FOLDER tools) @@ -17,6 +18,7 @@ endif () if (BUILD_SHARED_LIBS) add_executable (h5format_convert-shared ${HDF5_TOOLS_SRC_H5FC_SOURCE_DIR}/h5format_convert.c) target_include_directories (h5format_convert-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(h5format_convert-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5format_convert-shared SHARED) target_link_libraries (h5format_convert-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5format_convert-shared PROPERTIES FOLDER tools) diff --git a/tools/src/h5ls/CMakeLists.txt b/tools/src/h5ls/CMakeLists.txt index 7be33b5..c1ce006 100644 --- a/tools/src/h5ls/CMakeLists.txt +++ b/tools/src/h5ls/CMakeLists.txt @@ -7,6 +7,7 @@ project (HDF5_TOOLS_SRC_H5LS C) if (NOT ONLY_SHARED_LIBS) add_executable (h5ls ${HDF5_TOOLS_SRC_H5LS_SOURCE_DIR}/h5ls.c) target_include_directories (h5ls PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(h5ls PRIVATE "${HDF5_CMAKE_C_FLAGS}") #target_compile_definitions(h5ls PRIVATE H5_TOOLS_DEBUG) TARGET_C_PROPERTIES (h5ls STATIC) target_link_libraries (h5ls PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) @@ -19,6 +20,7 @@ endif () if (BUILD_SHARED_LIBS) add_executable (h5ls-shared ${HDF5_TOOLS_SRC_H5LS_SOURCE_DIR}/h5ls.c) target_include_directories (h5ls-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(h5ls-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") #target_compile_definitions(h5ls-shared PRIVATE H5_TOOLS_DEBUG) TARGET_C_PROPERTIES (h5ls-shared SHARED) target_link_libraries (h5ls-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) diff --git a/tools/src/h5repack/CMakeLists.txt b/tools/src/h5repack/CMakeLists.txt index 967e8d7..a4aa1ef 100644 --- a/tools/src/h5repack/CMakeLists.txt +++ b/tools/src/h5repack/CMakeLists.txt @@ -17,6 +17,7 @@ set (REPACK_COMMON_SOURCES if (NOT ONLY_SHARED_LIBS) add_executable (h5repack ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_main.c) target_include_directories (h5repack PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(h5repack PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5repack STATIC) target_link_libraries (h5repack PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5repack PROPERTIES FOLDER tools) @@ -28,6 +29,7 @@ endif () if (BUILD_SHARED_LIBS) add_executable (h5repack-shared ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_main.c) target_include_directories (h5repack-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(h5repack-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5repack-shared SHARED) target_link_libraries (h5repack-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5repack-shared PROPERTIES FOLDER tools) diff --git a/tools/src/h5stat/CMakeLists.txt b/tools/src/h5stat/CMakeLists.txt index f6cc542..f0722fd 100644 --- a/tools/src/h5stat/CMakeLists.txt +++ b/tools/src/h5stat/CMakeLists.txt @@ -7,6 +7,7 @@ project (HDF5_TOOLS_SRC_H5STAT C) if (NOT ONLY_SHARED_LIBS) add_executable (h5stat ${HDF5_TOOLS_SRC_H5STAT_SOURCE_DIR}/h5stat.c) target_include_directories (h5stat PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(h5stat PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5stat STATIC) target_link_libraries (h5stat PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5stat PROPERTIES FOLDER tools) @@ -18,6 +19,7 @@ endif () if (BUILD_SHARED_LIBS) add_executable (h5stat-shared ${HDF5_TOOLS_SRC_H5STAT_SOURCE_DIR}/h5stat.c) target_include_directories (h5stat-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(h5stat-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5stat-shared SHARED) target_link_libraries (h5stat-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5stat-shared PROPERTIES FOLDER tools) diff --git a/tools/src/misc/CMakeLists.txt b/tools/src/misc/CMakeLists.txt index 16e4555..1e9cacc 100644 --- a/tools/src/misc/CMakeLists.txt +++ b/tools/src/misc/CMakeLists.txt @@ -8,6 +8,7 @@ project (HDF5_TOOLS_SRC_MISC C) if (NOT ONLY_SHARED_LIBS) add_executable (h5debug ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5debug.c) target_include_directories (h5debug PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(h5debug PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5debug STATIC) target_link_libraries (h5debug PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5debug PROPERTIES FOLDER tools) @@ -15,6 +16,7 @@ if (NOT ONLY_SHARED_LIBS) add_executable (h5repart ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5repart.c) target_include_directories (h5repart PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(h5repart PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5repart STATIC) target_link_libraries (h5repart PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5repart PROPERTIES FOLDER tools) @@ -22,6 +24,7 @@ if (NOT ONLY_SHARED_LIBS) add_executable (h5mkgrp ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5mkgrp.c) target_include_directories (h5mkgrp PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(h5mkgrp PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5mkgrp STATIC) target_link_libraries (h5mkgrp PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5mkgrp PROPERTIES FOLDER tools) @@ -29,6 +32,7 @@ if (NOT ONLY_SHARED_LIBS) add_executable (h5clear ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5clear.c) target_include_directories (h5clear PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(h5clear PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5clear STATIC) target_link_libraries (h5clear PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5clear PROPERTIES FOLDER tools) @@ -45,12 +49,14 @@ if (BUILD_SHARED_LIBS) add_executable (h5debug-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5debug.c) target_include_directories (h5debug-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5debug-shared SHARED) + target_compile_options(h5debug-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") target_link_libraries (h5debug-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5debug-shared PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5debug-shared") add_executable (h5repart-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5repart.c) target_include_directories (h5repart-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(h5repart-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5repart-shared SHARED) target_link_libraries (h5repart-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5repart-shared PROPERTIES FOLDER tools) @@ -58,6 +64,7 @@ if (BUILD_SHARED_LIBS) add_executable (h5mkgrp-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5mkgrp.c) target_include_directories (h5mkgrp-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(h5mkgrp-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5mkgrp-shared SHARED) target_link_libraries (h5mkgrp-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5mkgrp-shared PROPERTIES FOLDER tools) @@ -65,6 +72,7 @@ if (BUILD_SHARED_LIBS) add_executable (h5clear-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5clear.c) target_include_directories (h5clear-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(h5clear-shared PRIVATE "${HDF5_CMAKE_C_FLAGS}") TARGET_C_PROPERTIES (h5clear-shared SHARED) target_link_libraries (h5clear-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5clear-shared PROPERTIES FOLDER tools) -- cgit v0.12