Skip to content

Commit

Permalink
Fix VFD h5repacktest (#20)
Browse files Browse the repository at this point in the history
* h5repacktest VFD fix and formatting changes

* Fix memory leak in H5PL__find_plugin_in_path

When encountering a directory, the current loop iteration was skipped
without freeing the memory allocated for the path.

* Refactor parser GCC diagnostic statements

* genparser on jelly with default bison/flex

Co-authored-by: Michael Kuhn <[email protected]>
  • Loading branch information
byrnHDF and michaelkuhn authored Oct 6, 2020
1 parent 2384233 commit c0e087a
Show file tree
Hide file tree
Showing 7 changed files with 141 additions and 137 deletions.
22 changes: 14 additions & 8 deletions bin/genparser
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#! /bin/bash
#
# 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
# 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
Expand Down Expand Up @@ -204,8 +204,8 @@ ${HDF5_FLEX} --nounistd -PH5LTyy -o ${path_to_hl_src}/H5LTanalyze.c ${path_to_hl
# instead of int. Currently the generated function H5LTyyparse is
# generated with a return value of type int, which is a mapping to the
# flex yyparse function. The return value in the HL library should be
# an hid_t.
# I propose to not use flex to generate this function, but for now I am
# an hid_t.
# I propose to not use flex to generate this function, but for now I am
# adding a perl command to find and replace this function declaration in
# H5LTparse.c.
perl -0777 -pi -e 's/int yyparse/hid_t yyparse/igs' ${path_to_hl_src}/H5LTparse.c
Expand All @@ -218,7 +218,8 @@ perl -0777 -pi -e 's/int H5LTyyparse/hid_t H5LTyyparse/igs' ${path_to_hl_src}/H5
# will simply ignore them, but we want to avoid those warnings.
for f in ${path_to_hl_src}/H5LTparse.c ${path_to_hl_src}/H5LTanalyze.c
do
echo '#if defined __GNUC__ && 402 <= __GNUC__ * 100 + __GNUC_MINOR__ ' >> tmp.out
echo '#if defined (__GNUC__) ' >> tmp.out
echo '#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402 ' >> tmp.out
echo '#pragma GCC diagnostic ignored "-Wconversion" ' >> tmp.out
echo '#pragma GCC diagnostic ignored "-Wimplicit-function-declaration" ' >> tmp.out
echo '#pragma GCC diagnostic ignored "-Wlarger-than=" ' >> tmp.out
Expand All @@ -230,11 +231,16 @@ do
echo '#pragma GCC diagnostic ignored "-Wsign-conversion" ' >> tmp.out
echo '#pragma GCC diagnostic ignored "-Wstrict-overflow" ' >> tmp.out
echo '#pragma GCC diagnostic ignored "-Wstrict-prototypes" ' >> tmp.out
echo '#pragma GCC diagnostic ignored "-Wsuggest-attribute=const" ' >> tmp.out
echo '#pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" ' >> tmp.out
echo '#pragma GCC diagnostic ignored "-Wswitch-default" ' >> tmp.out
echo '#pragma GCC diagnostic ignored "-Wunused-function" ' >> tmp.out
echo '#pragma GCC diagnostic ignored "-Wunused-macros" ' >> tmp.out
echo '#pragma GCC diagnostic ignored "-Wunused-parameter" ' >> tmp.out
echo '#endif ' >> tmp.out
echo '#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 600 ' >> tmp.out
echo '#pragma GCC diagnostic ignored "-Wnull-dereference" ' >> tmp.out
echo '#endif ' >> tmp.out
echo '#elif defined __SUNPRO_CC ' >> tmp.out
echo '#pragma disable_warn ' >> tmp.out
echo '#elif defined _MSC_VER ' >> tmp.out
Expand Down
24 changes: 20 additions & 4 deletions config/cmake/HDF5_Process_Flex_Files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,29 @@ if (FILE_PARSE)
# will simply ignore them, but we want to avoid those warnings.
file (READ ${FILE_PARSE}.c TEST_STREAM)
file (WRITE ${FILE_PARSE}.c "
#if __GNUC__ >= 4 && __GNUC_MINOR__ >=2\n
#if defined __GNUC__
#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402\n
#pragma GCC diagnostic ignored \"-Wconversion\"\n
#pragma GCC diagnostic ignored \"-Wimplicit-function-declaration\"\n
#pragma GCC diagnostic ignored \"-Wlarger-than=\"\n
#pragma GCC diagnostic ignored \"-Wmissing-prototypes\"\n
#pragma GCC diagnostic ignored \"-Wnested-externs\"\n
#pragma GCC diagnostic ignored \"-Wold-style-definition\"\n
#pragma GCC diagnostic ignored \"-Wredundant-decls\"\n
#pragma GCC diagnostic ignored \"-Wsign-compare\"\n
#pragma GCC diagnostic ignored \"-Wsign-conversion\"\n
#pragma GCC diagnostic ignored \"-Wstrict-overflow\"\n
#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"\n
#pragma GCC diagnostic ignored \"-Wsuggest-attribute=const\"\n
#pragma GCC diagnostic ignored \"-Wsuggest-attribute=pure\"\n
#pragma GCC diagnostic ignored \"-Wswitch-default\"\n
#pragma GCC diagnostic ignored \"-Wunused-function\"\n
#pragma GCC diagnostic ignored \"-Wunused-macros\"\n
#pragma GCC diagnostic ignored \"-Wunused-parameter\"\n
#pragma GCC diagnostic ignored \"-Wredundant-decls\"\n
#endif\n
#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 600\n
#pragma GCC diagnostic ignored "-Wnull-dereference"\"\n
#endif\n
#elif defined __SUNPRO_CC\n
#pragma disable_warn\n
#elif defined _MSC_VER\n
Expand All @@ -69,21 +77,29 @@ if (FILE_ANALYZE)
# will simply ignore them, but we want to avoid those warnings.
file (READ ${GEN_DIR}/${FILE_ANALYZE} TEST_STREAM)
file (WRITE ${FILE_ANALYZE} "
#if __GNUC__ >= 4 && __GNUC_MINOR__ >=2\n
#if defined __GNUC__
#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402\n
#pragma GCC diagnostic ignored \"-Wconversion\"\n
#pragma GCC diagnostic ignored \"-Wimplicit-function-declaration\"\n
#pragma GCC diagnostic ignored \"-Wlarger-than=\"\n
#pragma GCC diagnostic ignored \"-Wmissing-prototypes\"\n
#pragma GCC diagnostic ignored \"-Wnested-externs\"\n
#pragma GCC diagnostic ignored \"-Wold-style-definition\"\n
#pragma GCC diagnostic ignored \"-Wredundant-decls\"\n
#pragma GCC diagnostic ignored \"-Wsign-compare\"\n
#pragma GCC diagnostic ignored \"-Wsign-conversion\"\n
#pragma GCC diagnostic ignored \"-Wstrict-overflow\"\n
#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"\n
#pragma GCC diagnostic ignored \"-Wsuggest-attribute=const\"\n
#pragma GCC diagnostic ignored \"-Wsuggest-attribute=pure\"\n
#pragma GCC diagnostic ignored \"-Wswitch-default\"\n
#pragma GCC diagnostic ignored \"-Wunused-function\"\n
#pragma GCC diagnostic ignored \"-Wunused-macros\"\n
#pragma GCC diagnostic ignored \"-Wunused-parameter\"\n
#pragma GCC diagnostic ignored \"-Wredundant-decls\"\n
#endif\n
#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 600\n
#pragma GCC diagnostic ignored "-Wnull-dereference"\"\n
#endif\n
#elif defined __SUNPRO_CC\n
#pragma disable_warn\n
#elif defined _MSC_VER\n
Expand Down
Loading

0 comments on commit c0e087a

Please sign in to comment.