diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-10-07 16:36:19 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-10-07 16:36:19 (GMT) |
commit | 81e70df05c9aac3cf9974890c3773c15d48740a5 (patch) | |
tree | baebee86d0cbfcd58fe049bce40c74857dd43c56 /bin | |
parent | 2eeb6c46fe23379b212ebde1bf062ec726256fb8 (diff) | |
download | hdf5-81e70df05c9aac3cf9974890c3773c15d48740a5.zip hdf5-81e70df05c9aac3cf9974890c3773c15d48740a5.tar.gz hdf5-81e70df05c9aac3cf9974890c3773c15d48740a5.tar.bz2 |
Merge from develop
github updates
bin scripts
parser updates
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/format_source | 24 | ||||
-rwxr-xr-x | bin/format_source_patch | 24 | ||||
-rwxr-xr-x | bin/genparser | 29 | ||||
-rwxr-xr-x | bin/h5vers | 2 | ||||
-rwxr-xr-x | bin/pkgscrpts/h5rmflags | 8 | ||||
-rwxr-xr-x | bin/trace | 157 |
6 files changed, 169 insertions, 75 deletions
diff --git a/bin/format_source b/bin/format_source index b0b695c..1128def 100755 --- a/bin/format_source +++ b/bin/format_source @@ -1,6 +1,26 @@ #!/bin/bash +# +# Recursively format all C & C++ sources and header files, except those in the +# 'config' directory and generated files, such as H5LTanalyze.c, etc. +# +# Note that any files or directories that are excluded here should also be +# added to the 'exclude' list in .github/workflows/clang-format-check.yml +# +# (Remember to update both bin/format_source and bin/format_source_patch) + find . -type d \( -path ./config \) -prune \ - -o -iname *.h -o -iname *.c -o -iname *.cpp -o -iname *.hpp \ + -or \( \( \! \( \ + -name H5LTanalyze.c \ + -or -name H5LTparse.c \ + -or -name H5LTparse.h \ + -or -name H5Epubgen.h \ + -or -name H5Einit.h \ + -or -name H5Eterm.h \ + -or -name H5Edefin.h \ + -or -name H5version.h \ + -or -name H5overflow.h \ + \) \) \ + -and \( -iname *.h -or -iname *.c -or -iname *.cpp -or -iname *.hpp \) \) \ | xargs clang-format -style=file -i -fallback-style=none -exit 0
\ No newline at end of file +exit 0 diff --git a/bin/format_source_patch b/bin/format_source_patch index 4c531ea..8d6be01 100755 --- a/bin/format_source_patch +++ b/bin/format_source_patch @@ -1,6 +1,26 @@ #!/bin/bash +# +# Recursively format all C & C++ sources and header files, except those in the +# 'config' directory and generated files, such as H5LTanalyze.c, etc. +# +# Note that any files or directories that are excluded here should also be +# added to the 'exclude' list in .github/workflows/clang-format-check.yml +# +# (Remember to update both bin/format_source and bin/format_source_patch) + find . -type d \( -path ./config \) -prune \ - -o -iname *.h -o -iname *.c -o -iname *.cpp -o -iname *.hpp \ + -or \( \( \! \( \ + -name H5LTanalyze.c \ + -or -name H5LTparse.c \ + -or -name H5LTparse.h \ + -or -name H5Epubgen.h \ + -or -name H5Einit.h \ + -or -name H5Eterm.h \ + -or -name H5Edefin.h \ + -or -name H5version.h \ + -or -name H5overflow.h \ + \) \) \ + -and \( -iname *.h -or -iname *.c -or -iname *.cpp -or -iname *.hpp \) \) \ | xargs clang-format -style=file -i -fallback-style=none git diff > clang_format.patch @@ -11,4 +31,4 @@ then rm clang_format.patch fi -exit 0
\ No newline at end of file +exit 0 diff --git a/bin/genparser b/bin/genparser index e6aee5b..ab40775 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 @@ -200,17 +200,20 @@ if [ "$verbose" = true ] ; then fi ${HDF5_FLEX} --nounistd -PH5LTyy -o ${path_to_hl_src}/H5LTanalyze.c ${path_to_hl_src}/H5LTanalyze.l -# fix H5LTparse.c to declare H5LTyyparse return type as an hid_t -# instead of int. Currently the generated function H5LTyyparse is +# fix H5LTparse.c and H5LTlparse.h to declare H5LTyyparse return type as an +# hid_t 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 perl -0777 -pi -e 's/int\nyyparse/hid_t\nyyparse/igs' ${path_to_hl_src}/H5LTparse.c perl -0777 -pi -e 's/int H5LTyyparse/hid_t H5LTyyparse/igs' ${path_to_hl_src}/H5LTparse.c +perl -0777 -pi -e 's/int yyparse/hid_t yyparse/igs' ${path_to_hl_src}/H5LTparse.h +perl -0777 -pi -e 's/int\nyyparse/hid_t\nyyparse/igs' ${path_to_hl_src}/H5LTparse.h +perl -0777 -pi -e 's/int H5LTyyparse/hid_t H5LTyyparse/igs' ${path_to_hl_src}/H5LTparse.h # Add code that disables warnings in the flex/bison-generated code. # @@ -218,7 +221,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 +234,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 @@ -17,7 +17,7 @@ use strict; # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. # -# Robb Matzke <matzke@llnl.gov> +# Robb Matzke # 17 July 1998 ### Purpose diff --git a/bin/pkgscrpts/h5rmflags b/bin/pkgscrpts/h5rmflags index 80a249e..099956c 100755 --- a/bin/pkgscrpts/h5rmflags +++ b/bin/pkgscrpts/h5rmflags @@ -12,11 +12,9 @@ # help@hdfgroup.org. # -## This script wasextracted from h5redeploy to find hdf5 compile scripts and -## remove build paths from hdf5 compile scripts. Script is intended to be -## called from the make18xxTarFiles.pl script, so it could be stripped of options. -## Actions are predetermined and written in this script instead of in a command -## file. +## Remove paths to libraries used to build HDF5 when packaging HDF5 +## binaries. +## For help page, use "h5rmflags -help" # Constants definitions EXIT_SUCCESS=0 @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl ## # Copyright by The HDF Group. # Copyright by the Board of Trustees of the University of Illinois. @@ -12,6 +12,7 @@ # help@hdfgroup.org. ## require 5.003; +use warnings; $Source = ""; ############################################################################## @@ -30,28 +31,29 @@ $Source = ""; "hbool_t" => "b", "double" => "d", "H5D_alloc_time_t" => "Da", - "H5FD_mpio_collective_opt_t" => "Dc", + "H5FD_mpio_collective_opt_t" => "Dc", "H5D_fill_time_t" => "Df", "H5D_fill_value_t" => "DF", - "H5FD_mpio_chunk_opt_t" => "Dh", + "H5FD_mpio_chunk_opt_t" => "Dh", "H5D_mpio_actual_io_mode_t" => "Di", "H5D_layout_t" => "Dl", "H5D_mpio_no_collective_cause_t" => "Dn", "H5D_mpio_actual_chunk_opt_mode_t" => "Do", "H5D_space_status_t" => "Ds", "H5FD_mpio_xfer_t" => "Dt", + "H5FD_splitter_vfd_config_t" => "Dr", "herr_t" => "e", "H5E_direction_t" => "Ed", "H5E_error_t" => "Ee", - "H5E_type_t" => "Et", - "H5F_close_degree_t" => "Fd", + "H5E_type_t" => "Et", + "H5F_close_degree_t" => "Fd", "H5F_scope_t" => "Fs", - "H5F_libver_t" => "Fv", + "H5F_libver_t" => "Fv", "H5G_obj_t" => "Go", "H5G_stat_t" => "Gs", - "hsize_t" => "h", + "hsize_t" => "h", "hssize_t" => "Hs", - "H5E_major_t" => "i", + "H5E_major_t" => "i", "H5E_minor_t" => "i", "H5_iter_order_t" => "Io", "H5_index_t" => "Ii", @@ -61,16 +63,17 @@ $Source = ""; "unsigned" => "Iu", "unsigned int" => "Iu", "uint32_t" => "Iu", + "uint64_t" => "UL", "H5I_type_t" => "It", - "H5G_link_t" => "Ll", #Same as H5L_type_t now - "H5L_type_t" => "Ll", + "H5G_link_t" => "Ll", #Same as H5L_type_t now + "H5L_type_t" => "Ll", "MPI_Comm" => "Mc", "MPI_Info" => "Mi", "H5FD_mem_t" => "Mt", "off_t" => "o", "H5O_type_t" => "Ot", "H5P_class_t" => "p", - "hobj_ref_t" => "r", + "hobj_ref_t" => "r", "H5R_type_t" => "Rt", "char" => "s", "unsigned char" => "s", @@ -92,9 +95,9 @@ $Source = ""; "void" => "x", "FILE" => "x", "H5A_operator_t" => "x", - "H5A_operator1_t" => "x", - "H5A_operator2_t" => "x", - "H5A_info_t" => "x", + "H5A_operator1_t" => "x", + "H5A_operator2_t" => "x", + "H5A_info_t" => "x", "H5AC_cache_config_t" => "x", "H5D_gather_func_t" => "x", "H5D_operator_t" => "x", @@ -105,21 +108,24 @@ $Source = ""; "H5E_walk_t" => "x", "H5E_walk1_t" => "x", "H5E_walk2_t" => "x", - "H5F_info_t" => "x", + "H5F_info_t" => "x", "H5FD_t" => "x", "H5FD_class_t" => "x", "H5FD_stream_fapl_t" => "x", + "H5FD_ros3_fapl_t" => "x", + "H5FD_hdfs_fapl_t" => "x", "H5FD_file_image_callbacks_t" => "x", + "H5FD_mirror_fapl_t" => "x", "H5G_iterate_t" => "x", - "H5G_info_t" => "x", - "H5I_free_t" => "x", - "H5I_search_func_t" => "x", - "H5L_class_t" => "x", + "H5G_info_t" => "x", + "H5I_free_t" => "x", + "H5I_search_func_t" => "x", + "H5L_class_t" => "x", "H5L_elink_traverse_t" => "x", "H5L_iterate_t" => "x", "H5MM_allocate_t" => "x", "H5MM_free_t" => "x", - "H5O_info_t" => "x", + "H5O_info_t" => "x", "H5O_iterate_t" => "x", "H5O_mcdt_search_cb_t" => "x", "H5P_cls_create_func_t" => "x", @@ -147,9 +153,19 @@ $Source = ""; "ssize_t" => "Zs", ); + +############################################################################## +# Maximum length of H5TRACE macro line +# If the ColumnLimit in .clang-format is changed, this value will need to be updated +# +my $max_trace_macro_line_len = 110; + + ############################################################################## # Print an error message. # +my $found_errors = 0; + sub errmesg ($$@) { my ($file, $func, @mesg) = @_; my ($mesg) = join "", @mesg; @@ -159,6 +175,8 @@ sub errmesg ($$@) { $lineno = tr/\n/\n/; } + $found_errors = 1; + print "$file: in function \`$func\':\n"; print "$file:$lineno: $mesg\n"; } @@ -175,6 +193,11 @@ sub argstring ($$$) { # certain type qualifiers, and indirection. $atype =~ s/^\bconst\b//; $atype =~ s/\bH5_ATTR_UNUSED\b//g; + $atype =~ s/\bH5_ATTR_DEPRECATED_USED\b//g; + $atype =~ s/\bH5_ATTR_NDEBUG_UNUSED\b//g; + $atype =~ s/\bH5_ATTR_DEBUG_API_USED\b//g; + $atype =~ s/\bH5_ATTR_PARALLEL_UNUSED\b//g; + $atype =~ s/\bH5_ATTR_PARALLEL_USED\b//g; $atype =~ s/\s+/ /g; $ptr = length $1 if $atype =~ s/(\*+)//; $atype =~ s/^\s+//; @@ -215,7 +238,7 @@ sub rewrite_func ($$$$$) { # Parse arguments if ($args eq "void") { - $trace = "H5TRACE0(\"$rettype\",\"\");\n"; + $trace = "H5TRACE0(\"$rettype\", \"\");\n"; } else { # Split arguments. First convert `/*in,out*/' to get rid of the # comma, then split the arguments on commas. @@ -229,48 +252,64 @@ sub rewrite_func ($$$$$) { next; } unless ($arg=~/^(([a-z_A-Z]\w*\s+)+\**) - ([a-z_A-Z]\w*)(\[.*?\])? - (\s*\/\*\s*(in|out|in_out)\s*\*\/)?\s*$/x) { - errmesg $file, $name, "unable to parse \`$arg\'"; - goto error; + ([a-z_A-Z]\w*)(\[.*?\])? + (\s*\/\*\s*(in|out|in_out)\s*\*\/)?\s*$/x) { + errmesg $file, $name, "unable to parse \`$arg\'"; + goto error; } else { - my ($atype, $aname, $array, $adir) = ($1, $3, $4, $6); - $names{$aname} = $argno++; - $adir ||= "in"; - $atype =~ s/\s+$//; - push @arg_name, $aname; + my ($atype, $aname, $array, $adir) = ($1, $3, $4, $6); + $names{$aname} = $argno++; + $adir ||= "in"; + $atype =~ s/\s+$//; + push @arg_name, $aname; - if ($adir eq "out") { - push @arg_str, "x"; - } else { - if (defined $array) { - $atype .= "*"; - if ($array =~ /^\[\/\*([a-z_A-Z]\w*)\*\/\]$/) { - my $asize = $1; - if (exists $names{$asize}) { - $atype .= '[a' . $names{$asize} . ']'; - } else { - warn "bad array size: $asize"; - $atype .= "*"; - } - } - } - push @arg_str, argstring $file, $name, $atype; - } + if ($adir eq "out") { + push @arg_str, "x"; + } else { + if (defined $array) { + $atype .= "*"; + if ($array =~ /^\[\/\*([a-z_A-Z]\w*)\*\/\]$/) { + my $asize = $1; + if (exists $names{$asize}) { + $atype .= '[a' . $names{$asize} . ']'; + } else { + warn "bad array size: $asize"; + $atype .= "*"; + } + } + } + push @arg_str, argstring $file, $name, $atype; + } } } + + # Compose the trace macro $trace = "H5TRACE" . scalar(@arg_str) . "(\"$rettype\", \""; $trace .= join("", @arg_str) . "\""; - my $len = 4 + length $trace; + my $len = 4 + length $trace; # Add 4, for indenting the line for (@arg_name) { - if ($len + length >= 77) { - $trace .= ",\n $_"; - $len = 13 + length; + # Wrap lines that will be longer than the limit, after ');' is added + if ($len + length >= ($max_trace_macro_line_len - 2)) { + # Wrap line, with indention + $trace .= ",\n "; + $len = 13; # Set to 13, for indention + + # Indent an extra space to account for extra digit in 'H5TRACE' macro + if (scalar(@arg_str) >= 10) { + $trace .= " "; + $len++; + } } else { - $trace .= ", $_"; - $len += 1 + length; + $trace .= ", "; + $len += 2; # Add 2, for ', ' } + + # Append argument + $trace .= "$_"; + $len += length; # Add length of appended argument name } + + # Append final ');' for macro $trace .= ");\n"; } goto error if grep {/!/} @arg_str; @@ -280,7 +319,7 @@ sub rewrite_func ($$$$$) { # Ignored due to NO TRACE comment. } elsif ($body =~ s/((\n[ \t]*)H5TRACE\d+\s*\(.*?\);)\n/"$2$trace"/es) { # Replaced an H5TRACE macro. - } elsif ($body=~s/((\n[ \t]*)FUNC_ENTER\w*\s*(\(.*?\))?;??)\n/"$1$2$trace"/es) { + } elsif ($body=~s/((\n[ \t]*)FUNC_ENTER\w*[ \t]*(\(.*?\))?;??)\n/"$1$2$trace"/es) { # Added an H5TRACE macro after a FUNC_ENTER macro. } else { errmesg $file, $name, "unable to insert tracing information"; @@ -328,5 +367,13 @@ for $file (@ARGV) { } } -printf "Finished processing HDF5 API calls\n" +if ($found_errors eq 1) { + printf "\n"; + printf "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"; + printf "*** ERRORS FOUND *** ERRORS FOUND *** ERRORS FOUND ****\n"; + printf "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"; + exit 1; +} else { + printf "Finished processing HDF5 API calls\n"; +} |