summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-10-07 16:08:35 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-10-07 16:08:35 (GMT)
commit75567cbe8f6ec97df3db5b73f0c94625f63a4d0b (patch)
treeb34f6f0f71bed343775349fa98150315cf133150 /bin
parentd1adf43852c29d9c81372a83b5ed2a5b943c5c6d (diff)
downloadhdf5-75567cbe8f6ec97df3db5b73f0c94625f63a4d0b.zip
hdf5-75567cbe8f6ec97df3db5b73f0c94625f63a4d0b.tar.gz
hdf5-75567cbe8f6ec97df3db5b73f0c94625f63a4d0b.tar.bz2
Merge from develop
github updates bin scripts updates parser changes remove obsolete file
Diffstat (limited to 'bin')
-rwxr-xr-xbin/format_source24
-rwxr-xr-xbin/format_source_patch24
-rwxr-xr-xbin/genparser29
-rwxr-xr-xbin/release28
-rwxr-xr-xbin/trace38
5 files changed, 108 insertions, 35 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
diff --git a/bin/release b/bin/release
index a775faf..f087ae8 100755
--- a/bin/release
+++ b/bin/release
@@ -39,14 +39,14 @@ USAGE()
{
cat << EOF
Usage: $0 -d <dir> [--docver BRANCHNAME] [-h] [--nocheck] [--private] <methods> ...
- -d DIR The name of the directory where the releas(es) should be
- placed.
+ -d DIR The name of the directory where the releas(es) should be
+ placed.
--docver BRANCHNAME This is added for 1.8 and beyond to get the correct
version of documentation files from the hdf5docs
repository. BRANCHNAME for v1.8 should be hdf5_1_8.
- -h print the help page.
- --nocheck Ignore errors in MANIFEST file.
- --private Make a private release with today's date in version information.
+ -h print the help page.
+ --nocheck Ignore errors in MANIFEST file.
+ --private Make a private release with today's date in version information.
This must be run at the top level of the source directory.
The other command-line options are the names of the programs to use
@@ -149,8 +149,8 @@ tar2zip()
find $ztmpdir/$version | \
while read inf; do \
if file $inf | grep "$inf\: .*text" > /dev/null 2>&1 ; then \
- unix2dos -q -k $inf; \
- fi \
+ unix2dos -q -k $inf; \
+ fi\
done
# step 3: make zipball
# -9 maximum compression
@@ -248,7 +248,7 @@ tar2cmakezip()
while read inf; do \
if file $inf | grep "$inf\: .*text" > /dev/null 2>&1 ; then \
unix2dos -q -k $inf; \
- fi \
+ fi\
done
# step 3: make zipball
@@ -442,7 +442,7 @@ check=yes
release_date=`date +%F`
today=`date +%Y%m%d`
pmode='no'
-tmpdir="../#release_tmp.$$" # tmp work directory
+tmpdir="../#release_tmp.$$" # tmp work directory
DOC_URL=https://git@bitbucket.hdfgroup.org/scm/hdffv/hdf5doc.git
CPPLUS_RM_NAME=cpplus_RM
MAINT_MODE_ENABLED=""
@@ -597,17 +597,17 @@ for comp in $methods; do
case $comp in
tar)
cp -p $tmpdir/$HDF5_VERS.tar $DEST/$HDF5_VERS.tar
- (cd $DEST; md5sum $HDF5_VERS.tar >> $MD5file)
+ (cd $DEST; md5sum $HDF5_VERS.tar >> $MD5file)
;;
gzip)
test "$verbose" && echo " Running gzip..." 1>&2
gzip -9 <$tmpdir/$HDF5_VERS.tar >$DEST/$HDF5_VERS.tar.gz
- (cd $DEST; md5sum $HDF5_VERS.tar.gz >> $MD5file)
+ (cd $DEST; md5sum $HDF5_VERS.tar.gz >> $MD5file)
;;
cmake-tgz)
test "$verbose" && echo " Creating CMake tar.gz file..." 1>&2
tar2cmaketgz $HDF5_VERS $tmpdir/$HDF5_VERS.tar $DEST/CMake-$HDF5_VERS.tar.gz 1>&2
- (cd $DEST; md5sum CMake-$HDF5_VERS.tar.gz >> $MD5file)
+ (cd $DEST; md5sum CMake-$HDF5_VERS.tar.gz >> $MD5file)
;;
hpc-cmake-tgz)
test "$verbose" && echo " Creating HPC-CMake tar.gz file..." 1>&2
@@ -617,12 +617,12 @@ for comp in $methods; do
bzip2)
test "$verbose" && echo " Running bzip2..." 1>&2
bzip2 -9 <$tmpdir/$HDF5_VERS.tar >$DEST/$HDF5_VERS.tar.bz2
- (cd $DEST; md5sum $HDF5_VERS.tar.bz2 >> $MD5file)
+ (cd $DEST; md5sum $HDF5_VERS.tar.bz2 >> $MD5file)
;;
zip)
test "$verbose" && echo " Creating zip ball..." 1>&2
tar2zip $HDF5_VERS $tmpdir/$HDF5_VERS.tar $DEST/$HDF5_VERS.zip 1>&2
- (cd $DEST; md5sum $HDF5_VERS.zip >> $MD5file)
+ (cd $DEST; md5sum $HDF5_VERS.zip >> $MD5file)
;;
cmake-zip)
test "$verbose" && echo " Creating CMake-zip ball..." 1>&2
diff --git a/bin/trace b/bin/trace
index 42b89b5..5fedddb 100755
--- a/bin/trace
+++ b/bin/trace
@@ -165,6 +165,14 @@ $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.
#
@@ -242,7 +250,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.
@@ -286,18 +294,34 @@ sub rewrite_func ($$$$$) {
}
}
}
+
+ # 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;