From c0e087a65a2f1ab354d3016bc29262eeec722d6f Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Tue, 6 Oct 2020 11:56:59 -0500 Subject: Fix VFD h5repacktest (#20) * 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 --- bin/genparser | 22 ++-- config/cmake/HDF5_Process_Flex_Files.cmake | 24 +++- hl/src/H5LTanalyze.c | 176 ++++++++++++++--------------- hl/src/H5LTanalyze.l | 32 ++---- hl/src/H5LTparse.c | 10 +- src/H5Fquery.c | 12 +- tools/test/h5repack/h5repacktst.c | 2 - 7 files changed, 141 insertions(+), 137 deletions(-) diff --git a/bin/genparser b/bin/genparser index e6aee5b..8728dea 100755 --- a/bin/genparser +++ b/bin/genparser @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/config/cmake/HDF5_Process_Flex_Files.cmake b/config/cmake/HDF5_Process_Flex_Files.cmake index 2595c39..9445545 100644 --- a/config/cmake/HDF5_Process_Flex_Files.cmake +++ b/config/cmake/HDF5_Process_Flex_Files.cmake @@ -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 @@ -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 diff --git a/hl/src/H5LTanalyze.c b/hl/src/H5LTanalyze.c index 41e77b0..2f9ba7b 100644 --- a/hl/src/H5LTanalyze.c +++ b/hl/src/H5LTanalyze.c @@ -1,4 +1,5 @@ -#if defined __GNUC__ && 402 <= __GNUC__ * 100 + __GNUC_MINOR__ +#if defined(__GNUC__) +#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402 #pragma GCC diagnostic ignored "-Wconversion" #pragma GCC diagnostic ignored "-Wimplicit-function-declaration" #pragma GCC diagnostic ignored "-Wlarger-than=" @@ -10,19 +11,24 @@ #pragma GCC diagnostic ignored "-Wsign-conversion" #pragma GCC diagnostic ignored "-Wstrict-overflow" #pragma GCC diagnostic ignored "-Wstrict-prototypes" +#pragma GCC diagnostic ignored "-Wsuggest-attribute=const" #pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" #pragma GCC diagnostic ignored "-Wswitch-default" #pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-macros" #pragma GCC diagnostic ignored "-Wunused-parameter" -#elif defined __SUNPRO_CC +#endif +#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 600 +#pragma GCC diagnostic ignored "-Wnull-dereference" +#endif +#elif defined __SUNPRO_CC #pragma disable_warn #elif defined _MSC_VER #pragma warning(push, 1) #endif -#line 2 "hl/src/H5LTanalyze.c" +#line 1 "hl/src/H5LTanalyze.c" -#line 4 "hl/src/H5LTanalyze.c" +#line 3 "hl/src/H5LTanalyze.c" #define YY_INT_ALIGNED short int @@ -903,18 +909,6 @@ char *yytext; #include #include "H5LTparse.h" -/* Turn off suggest const & malloc attribute warnings in gcc */ -#if defined __GNUC__ && 402 <= __GNUC__ * 100 + __GNUC_MINOR__ -#pragma GCC diagnostic ignored "-Wsuggest-attribute=const" -#endif - -/* Turn off null dereference warnings in gcc. - * We have no control over this generated code. - */ -#if defined __GNUC__ && 600 <= __GNUC__ * 100 -#pragma GCC diagnostic ignored "-Wnull-dereference" -#endif - int my_yyinput(char *, int); #undef YY_INPUT #define YY_INPUT(b, r, ms) (r = my_yyinput(b, ms)) @@ -962,9 +956,9 @@ extern hbool_t is_opq_tag; hbool_t first_quote = 1; -#line 1162 "hl/src/H5LTanalyze.c" +#line 1149 "hl/src/H5LTanalyze.c" -#line 1164 "hl/src/H5LTanalyze.c" +#line 1151 "hl/src/H5LTanalyze.c" #define INITIAL 0 #define TAG_STRING 1 @@ -1175,9 +1169,9 @@ YY_DECL } { -#line 89 "hl/src/H5LTanalyze.l" +#line 77 "hl/src/H5LTanalyze.l" -#line 1383 "hl/src/H5LTanalyze.c" +#line 1370 "hl/src/H5LTanalyze.c" while (/*CONSTCOND*/ 1) /* loops until end-of-file is reached */ { @@ -1236,385 +1230,385 @@ do_action: /* This label is used only to access EOF actions. */ switch (yy_act) { /* beginning of action switch */ case 1: YY_RULE_SETUP -#line 91 "hl/src/H5LTanalyze.l" +#line 79 "hl/src/H5LTanalyze.l" { return hid(H5T_STD_I8BE_TOKEN); } YY_BREAK case 2: YY_RULE_SETUP -#line 92 "hl/src/H5LTanalyze.l" +#line 80 "hl/src/H5LTanalyze.l" { return hid(H5T_STD_I8LE_TOKEN); } YY_BREAK case 3: YY_RULE_SETUP -#line 93 "hl/src/H5LTanalyze.l" +#line 81 "hl/src/H5LTanalyze.l" { return hid(H5T_STD_I16BE_TOKEN); } YY_BREAK case 4: YY_RULE_SETUP -#line 94 "hl/src/H5LTanalyze.l" +#line 82 "hl/src/H5LTanalyze.l" { return hid(H5T_STD_I16LE_TOKEN); } YY_BREAK case 5: YY_RULE_SETUP -#line 95 "hl/src/H5LTanalyze.l" +#line 83 "hl/src/H5LTanalyze.l" { return hid(H5T_STD_I32BE_TOKEN); } YY_BREAK case 6: YY_RULE_SETUP -#line 96 "hl/src/H5LTanalyze.l" +#line 84 "hl/src/H5LTanalyze.l" { return hid(H5T_STD_I32LE_TOKEN); } YY_BREAK case 7: YY_RULE_SETUP -#line 97 "hl/src/H5LTanalyze.l" +#line 85 "hl/src/H5LTanalyze.l" { return hid(H5T_STD_I64BE_TOKEN); } YY_BREAK case 8: YY_RULE_SETUP -#line 98 "hl/src/H5LTanalyze.l" +#line 86 "hl/src/H5LTanalyze.l" { return hid(H5T_STD_I64LE_TOKEN); } YY_BREAK case 9: YY_RULE_SETUP -#line 100 "hl/src/H5LTanalyze.l" +#line 88 "hl/src/H5LTanalyze.l" { return hid(H5T_STD_U8BE_TOKEN); } YY_BREAK case 10: YY_RULE_SETUP -#line 101 "hl/src/H5LTanalyze.l" +#line 89 "hl/src/H5LTanalyze.l" { return hid(H5T_STD_U8LE_TOKEN); } YY_BREAK case 11: YY_RULE_SETUP -#line 102 "hl/src/H5LTanalyze.l" +#line 90 "hl/src/H5LTanalyze.l" { return hid(H5T_STD_U16BE_TOKEN); } YY_BREAK case 12: YY_RULE_SETUP -#line 103 "hl/src/H5LTanalyze.l" +#line 91 "hl/src/H5LTanalyze.l" { return hid(H5T_STD_U16LE_TOKEN); } YY_BREAK case 13: YY_RULE_SETUP -#line 104 "hl/src/H5LTanalyze.l" +#line 92 "hl/src/H5LTanalyze.l" { return hid(H5T_STD_U32BE_TOKEN); } YY_BREAK case 14: YY_RULE_SETUP -#line 105 "hl/src/H5LTanalyze.l" +#line 93 "hl/src/H5LTanalyze.l" { return hid(H5T_STD_U32LE_TOKEN); } YY_BREAK case 15: YY_RULE_SETUP -#line 106 "hl/src/H5LTanalyze.l" +#line 94 "hl/src/H5LTanalyze.l" { return hid(H5T_STD_U64BE_TOKEN); } YY_BREAK case 16: YY_RULE_SETUP -#line 107 "hl/src/H5LTanalyze.l" +#line 95 "hl/src/H5LTanalyze.l" { return hid(H5T_STD_U64LE_TOKEN); } YY_BREAK case 17: YY_RULE_SETUP -#line 109 "hl/src/H5LTanalyze.l" +#line 97 "hl/src/H5LTanalyze.l" { return hid(H5T_NATIVE_CHAR_TOKEN); } YY_BREAK case 18: YY_RULE_SETUP -#line 110 "hl/src/H5LTanalyze.l" +#line 98 "hl/src/H5LTanalyze.l" { return hid(H5T_NATIVE_SCHAR_TOKEN); } YY_BREAK case 19: YY_RULE_SETUP -#line 111 "hl/src/H5LTanalyze.l" +#line 99 "hl/src/H5LTanalyze.l" { return hid(H5T_NATIVE_UCHAR_TOKEN); } YY_BREAK case 20: YY_RULE_SETUP -#line 112 "hl/src/H5LTanalyze.l" +#line 100 "hl/src/H5LTanalyze.l" { return hid(H5T_NATIVE_SHORT_TOKEN); } YY_BREAK case 21: YY_RULE_SETUP -#line 113 "hl/src/H5LTanalyze.l" +#line 101 "hl/src/H5LTanalyze.l" { return hid(H5T_NATIVE_USHORT_TOKEN); } YY_BREAK case 22: YY_RULE_SETUP -#line 114 "hl/src/H5LTanalyze.l" +#line 102 "hl/src/H5LTanalyze.l" { return hid(H5T_NATIVE_INT_TOKEN); } YY_BREAK case 23: YY_RULE_SETUP -#line 115 "hl/src/H5LTanalyze.l" +#line 103 "hl/src/H5LTanalyze.l" { return hid(H5T_NATIVE_UINT_TOKEN); } YY_BREAK case 24: YY_RULE_SETUP -#line 116 "hl/src/H5LTanalyze.l" +#line 104 "hl/src/H5LTanalyze.l" { return hid(H5T_NATIVE_LONG_TOKEN); } YY_BREAK case 25: YY_RULE_SETUP -#line 117 "hl/src/H5LTanalyze.l" +#line 105 "hl/src/H5LTanalyze.l" { return hid(H5T_NATIVE_ULONG_TOKEN); } YY_BREAK case 26: YY_RULE_SETUP -#line 118 "hl/src/H5LTanalyze.l" +#line 106 "hl/src/H5LTanalyze.l" { return hid(H5T_NATIVE_LLONG_TOKEN); } YY_BREAK case 27: YY_RULE_SETUP -#line 119 "hl/src/H5LTanalyze.l" +#line 107 "hl/src/H5LTanalyze.l" { return hid(H5T_NATIVE_ULLONG_TOKEN); } YY_BREAK case 28: YY_RULE_SETUP -#line 121 "hl/src/H5LTanalyze.l" +#line 109 "hl/src/H5LTanalyze.l" { return hid(H5T_IEEE_F32BE_TOKEN); } YY_BREAK case 29: YY_RULE_SETUP -#line 122 "hl/src/H5LTanalyze.l" +#line 110 "hl/src/H5LTanalyze.l" { return hid(H5T_IEEE_F32LE_TOKEN); } YY_BREAK case 30: YY_RULE_SETUP -#line 123 "hl/src/H5LTanalyze.l" +#line 111 "hl/src/H5LTanalyze.l" { return hid(H5T_IEEE_F64BE_TOKEN); } YY_BREAK case 31: YY_RULE_SETUP -#line 124 "hl/src/H5LTanalyze.l" +#line 112 "hl/src/H5LTanalyze.l" { return hid(H5T_IEEE_F64LE_TOKEN); } YY_BREAK case 32: YY_RULE_SETUP -#line 125 "hl/src/H5LTanalyze.l" +#line 113 "hl/src/H5LTanalyze.l" { return hid(H5T_NATIVE_FLOAT_TOKEN); } YY_BREAK case 33: YY_RULE_SETUP -#line 126 "hl/src/H5LTanalyze.l" +#line 114 "hl/src/H5LTanalyze.l" { return hid(H5T_NATIVE_DOUBLE_TOKEN); } YY_BREAK case 34: YY_RULE_SETUP -#line 127 "hl/src/H5LTanalyze.l" +#line 115 "hl/src/H5LTanalyze.l" { return hid(H5T_NATIVE_LDOUBLE_TOKEN); } YY_BREAK case 35: YY_RULE_SETUP -#line 129 "hl/src/H5LTanalyze.l" +#line 117 "hl/src/H5LTanalyze.l" { return token(H5T_STRING_TOKEN); } YY_BREAK case 36: YY_RULE_SETUP -#line 130 "hl/src/H5LTanalyze.l" +#line 118 "hl/src/H5LTanalyze.l" { return token(STRSIZE_TOKEN); } YY_BREAK case 37: YY_RULE_SETUP -#line 131 "hl/src/H5LTanalyze.l" +#line 119 "hl/src/H5LTanalyze.l" { return token(STRPAD_TOKEN); } YY_BREAK case 38: YY_RULE_SETUP -#line 132 "hl/src/H5LTanalyze.l" +#line 120 "hl/src/H5LTanalyze.l" { return token(CSET_TOKEN); } YY_BREAK case 39: YY_RULE_SETUP -#line 133 "hl/src/H5LTanalyze.l" +#line 121 "hl/src/H5LTanalyze.l" { return token(CTYPE_TOKEN); } YY_BREAK case 40: YY_RULE_SETUP -#line 134 "hl/src/H5LTanalyze.l" +#line 122 "hl/src/H5LTanalyze.l" { return token(H5T_STR_NULLTERM_TOKEN); } YY_BREAK case 41: YY_RULE_SETUP -#line 135 "hl/src/H5LTanalyze.l" +#line 123 "hl/src/H5LTanalyze.l" { return token(H5T_STR_NULLPAD_TOKEN); } YY_BREAK case 42: YY_RULE_SETUP -#line 136 "hl/src/H5LTanalyze.l" +#line 124 "hl/src/H5LTanalyze.l" { return token(H5T_STR_SPACEPAD_TOKEN); } YY_BREAK case 43: YY_RULE_SETUP -#line 137 "hl/src/H5LTanalyze.l" +#line 125 "hl/src/H5LTanalyze.l" { return token(H5T_CSET_ASCII_TOKEN); } YY_BREAK case 44: YY_RULE_SETUP -#line 138 "hl/src/H5LTanalyze.l" +#line 126 "hl/src/H5LTanalyze.l" { return token(H5T_CSET_UTF8_TOKEN); } YY_BREAK case 45: YY_RULE_SETUP -#line 139 "hl/src/H5LTanalyze.l" +#line 127 "hl/src/H5LTanalyze.l" { return token(H5T_C_S1_TOKEN); } YY_BREAK case 46: YY_RULE_SETUP -#line 140 "hl/src/H5LTanalyze.l" +#line 128 "hl/src/H5LTanalyze.l" { return token(H5T_FORTRAN_S1_TOKEN); } YY_BREAK case 47: YY_RULE_SETUP -#line 141 "hl/src/H5LTanalyze.l" +#line 129 "hl/src/H5LTanalyze.l" { return token(H5T_VARIABLE_TOKEN); } YY_BREAK case 48: YY_RULE_SETUP -#line 143 "hl/src/H5LTanalyze.l" +#line 131 "hl/src/H5LTanalyze.l" { return token(H5T_COMPOUND_TOKEN); } YY_BREAK case 49: YY_RULE_SETUP -#line 144 "hl/src/H5LTanalyze.l" +#line 132 "hl/src/H5LTanalyze.l" { return token(H5T_ENUM_TOKEN); } YY_BREAK case 50: YY_RULE_SETUP -#line 145 "hl/src/H5LTanalyze.l" +#line 133 "hl/src/H5LTanalyze.l" { return token(H5T_ARRAY_TOKEN); } YY_BREAK case 51: YY_RULE_SETUP -#line 146 "hl/src/H5LTanalyze.l" +#line 134 "hl/src/H5LTanalyze.l" { return token(H5T_VLEN_TOKEN); } YY_BREAK case 52: YY_RULE_SETUP -#line 148 "hl/src/H5LTanalyze.l" +#line 136 "hl/src/H5LTanalyze.l" { return token(H5T_OPAQUE_TOKEN); } YY_BREAK case 53: YY_RULE_SETUP -#line 149 "hl/src/H5LTanalyze.l" +#line 137 "hl/src/H5LTanalyze.l" { return token(OPQ_SIZE_TOKEN); } YY_BREAK case 54: YY_RULE_SETUP -#line 150 "hl/src/H5LTanalyze.l" +#line 138 "hl/src/H5LTanalyze.l" { return token(OPQ_TAG_TOKEN); } YY_BREAK case 55: YY_RULE_SETUP -#line 152 "hl/src/H5LTanalyze.l" +#line 140 "hl/src/H5LTanalyze.l" { if (is_str_size || (is_enum && is_enum_memb) || is_opq_size || (asindex > -1 && arr_stack[asindex].is_dim) || @@ -1628,7 +1622,7 @@ do_action: /* This label is used only to access EOF actions. */ YY_BREAK case 56: YY_RULE_SETUP -#line 162 "hl/src/H5LTanalyze.l" +#line 150 "hl/src/H5LTanalyze.l" { /*if it's first quote, and is a compound field name or an enum symbol*/ if ((is_opq_tag || is_enum || (csindex > -1 && cmpd_stack[csindex].is_field)) && @@ -1644,7 +1638,7 @@ do_action: /* This label is used only to access EOF actions. */ case 57: /* rule 57 can match eol */ YY_RULE_SETUP -#line 172 "hl/src/H5LTanalyze.l" +#line 160 "hl/src/H5LTanalyze.l" { #ifdef H5_HAVE_WIN32_API H5LTyylval.sval = _strdup(yytext); @@ -1657,42 +1651,42 @@ do_action: /* This label is used only to access EOF actions. */ YY_BREAK case 58: YY_RULE_SETUP -#line 182 "hl/src/H5LTanalyze.l" +#line 170 "hl/src/H5LTanalyze.l" { return token('{'); } YY_BREAK case 59: YY_RULE_SETUP -#line 183 "hl/src/H5LTanalyze.l" +#line 171 "hl/src/H5LTanalyze.l" { return token('}'); } YY_BREAK case 60: YY_RULE_SETUP -#line 184 "hl/src/H5LTanalyze.l" +#line 172 "hl/src/H5LTanalyze.l" { return token('['); } YY_BREAK case 61: YY_RULE_SETUP -#line 185 "hl/src/H5LTanalyze.l" +#line 173 "hl/src/H5LTanalyze.l" { return token(']'); } YY_BREAK case 62: YY_RULE_SETUP -#line 186 "hl/src/H5LTanalyze.l" +#line 174 "hl/src/H5LTanalyze.l" { return token(':'); } YY_BREAK case 63: YY_RULE_SETUP -#line 187 "hl/src/H5LTanalyze.l" +#line 175 "hl/src/H5LTanalyze.l" { return token(';'); } @@ -1700,23 +1694,23 @@ do_action: /* This label is used only to access EOF actions. */ case 64: /* rule 64 can match eol */ YY_RULE_SETUP -#line 188 "hl/src/H5LTanalyze.l" +#line 176 "hl/src/H5LTanalyze.l" ; YY_BREAK case 65: /* rule 65 can match eol */ YY_RULE_SETUP -#line 189 "hl/src/H5LTanalyze.l" +#line 177 "hl/src/H5LTanalyze.l" { return 0; } YY_BREAK case 66: YY_RULE_SETUP -#line 191 "hl/src/H5LTanalyze.l" +#line 179 "hl/src/H5LTanalyze.l" ECHO; YY_BREAK -#line 1803 "hl/src/H5LTanalyze.c" +#line 1790 "hl/src/H5LTanalyze.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(TAG_STRING): yyterminate(); @@ -2413,11 +2407,7 @@ yy_scan_buffer(char *base, yy_size_t size) * yy_scan_bytes() instead. */ YY_BUFFER_STATE -yy_scan_string(const char *yystr) -{ - - return yy_scan_bytes(yystr, (int)strlen(yystr)); -} +yy_scan_string(const char *yystr) { return yy_scan_bytes(yystr, (int)strlen(yystr)); } /** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. @@ -2688,7 +2678,7 @@ yyfree(void *ptr) #define YYTABLES_NAME "yytables" -#line 191 "hl/src/H5LTanalyze.l" +#line 179 "hl/src/H5LTanalyze.l" int my_yyinput(char *buf, int max_size) diff --git a/hl/src/H5LTanalyze.l b/hl/src/H5LTanalyze.l index cdd5b0d..04d3321 100644 --- a/hl/src/H5LTanalyze.l +++ b/hl/src/H5LTanalyze.l @@ -23,18 +23,6 @@ #include #include "H5LTparse.h" -/* Turn off suggest const & malloc attribute warnings in gcc */ -#if defined __GNUC__ && 402 <= __GNUC__ * 100 + __GNUC_MINOR__ -#pragma GCC diagnostic ignored "-Wsuggest-attribute=const" -#endif - -/* Turn off null dereference warnings in gcc. - * We have no control over this generated code. - */ -#if defined __GNUC__ && 600 <= __GNUC__ * 100 -#pragma GCC diagnostic ignored "-Wnull-dereference" -#endif - int my_yyinput(char *, int); #undef YY_INPUT #define YY_INPUT(b, r, ms) (r=my_yyinput(b, ms)) @@ -131,9 +119,9 @@ STRSIZE {return token(STRSIZE_TOKEN);} STRPAD {return token(STRPAD_TOKEN);} CSET {return token(CSET_TOKEN);} CTYPE {return token(CTYPE_TOKEN);} -H5T_STR_NULLTERM {return token(H5T_STR_NULLTERM_TOKEN);} -H5T_STR_NULLPAD {return token(H5T_STR_NULLPAD_TOKEN);} -H5T_STR_SPACEPAD {return token(H5T_STR_SPACEPAD_TOKEN);} +H5T_STR_NULLTERM {return token(H5T_STR_NULLTERM_TOKEN);} +H5T_STR_NULLPAD {return token(H5T_STR_NULLPAD_TOKEN);} +H5T_STR_SPACEPAD {return token(H5T_STR_SPACEPAD_TOKEN);} H5T_CSET_ASCII {return token(H5T_CSET_ASCII_TOKEN);} H5T_CSET_UTF8 {return token(H5T_CSET_UTF8_TOKEN);} H5T_C_S1 {return token(H5T_C_S1_TOKEN);} @@ -149,19 +137,19 @@ H5T_OPAQUE {return token(H5T_OPAQUE_TOKEN);} OPQ_SIZE {return token(OPQ_SIZE_TOKEN);} OPQ_TAG {return token(OPQ_TAG_TOKEN);} -[0-9]+ { - if( is_str_size || (is_enum && is_enum_memb) || +[0-9]+ { + if( is_str_size || (is_enum && is_enum_memb) || is_opq_size || (asindex>-1 && arr_stack[asindex].is_dim) || (csindex>-1 && cmpd_stack[csindex].is_field) ) { H5LTyylval.ival = atoi(yytext); - return NUMBER; + return NUMBER; } else REJECT; } "\"" { /*if it's first quote, and is a compound field name or an enum symbol*/ - if((is_opq_tag || is_enum || (csindex>-1 && cmpd_stack[csindex].is_field)) + if((is_opq_tag || is_enum || (csindex>-1 && cmpd_stack[csindex].is_field)) && first_quote) { first_quote = 0; BEGIN TAG_STRING; @@ -178,7 +166,7 @@ OPQ_TAG {return token(OPQ_TAG_TOKEN);} BEGIN INITIAL; return STRING; } - + "{" {return token('{');} "}" {return token('}');} "[" {return token('[');} @@ -192,8 +180,8 @@ OPQ_TAG {return token(OPQ_TAG_TOKEN);} int my_yyinput(char *buf, int max_size) { int ret; - - memcpy(buf, myinput, input_len); + + memcpy(buf, myinput, input_len); ret = (int)input_len; return ret; } diff --git a/hl/src/H5LTparse.c b/hl/src/H5LTparse.c index 291c89d..15be8a4 100644 --- a/hl/src/H5LTparse.c +++ b/hl/src/H5LTparse.c @@ -1,4 +1,5 @@ -#if defined __GNUC__ && 402 <= __GNUC__ * 100 + __GNUC_MINOR__ +#if defined(__GNUC__) +#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402 #pragma GCC diagnostic ignored "-Wconversion" #pragma GCC diagnostic ignored "-Wimplicit-function-declaration" #pragma GCC diagnostic ignored "-Wlarger-than=" @@ -10,12 +11,17 @@ #pragma GCC diagnostic ignored "-Wsign-conversion" #pragma GCC diagnostic ignored "-Wstrict-overflow" #pragma GCC diagnostic ignored "-Wstrict-prototypes" +#pragma GCC diagnostic ignored "-Wsuggest-attribute=const" #pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" #pragma GCC diagnostic ignored "-Wswitch-default" #pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-macros" #pragma GCC diagnostic ignored "-Wunused-parameter" -#elif defined __SUNPRO_CC +#endif +#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 600 +#pragma GCC diagnostic ignored "-Wnull-dereference" +#endif +#elif defined __SUNPRO_CC #pragma disable_warn #elif defined _MSC_VER #pragma warning(push, 1) diff --git a/src/H5Fquery.c b/src/H5Fquery.c index 17072ff..dac6e66 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -200,8 +200,8 @@ H5F_get_actual_name(const H5F_t *f) * Function: H5F_get_extpath * * Purpose: Retrieve the file's 'extpath' flags - * This is used by H5L_extern_traverse() and H5D_build_file_prefix() to retrieve the main file's - *location when searching the target file. + * This is used by H5L_extern_traverse() and H5D_build_file_prefix() + * to retrieve the main file's location when searching the target file. * * Return: 'extpath' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- @@ -1228,8 +1228,8 @@ H5F_get_null_fsm_addr(const H5F_t *f) * * Return: VOL class pointer for file, can't fail * - * Programmer: Quincey Koziol - * Saturday, August 17, 2019 + * Programmer: Quincey Koziol + * Saturday, August 17, 2019 * *------------------------------------------------------------------------- */ @@ -1271,8 +1271,8 @@ H5F_get_vol_obj(const H5F_t *f) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Saturday, August 17, 2019 + * Programmer: Quincey Koziol + * Saturday, August 17, 2019 * *------------------------------------------------------------------------- */ diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c index ea9ded1..85af344 100644 --- a/tools/test/h5repack/h5repacktst.c +++ b/tools/test/h5repack/h5repacktst.c @@ -3292,8 +3292,6 @@ make_layout2(hid_t loc_id) if (make_dset(loc_id, CHUNKED_S_FIX, s_sid, chunked_dcpl, s_buf[0]) < 0) goto error; - HDfree(s_buf); - ret_value = 0; error: -- cgit v0.12