summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/errors2
-rwxr-xr-xbin/format_source24
-rwxr-xr-xbin/format_source_patch24
-rwxr-xr-xbin/genparser29
-rwxr-xr-xbin/h5vers2
-rwxr-xr-xbin/trace38
-rwxr-xr-xbin/warnhist2
7 files changed, 97 insertions, 24 deletions
diff --git a/bin/errors b/bin/errors
index 107bb9c..a5bad3a 100755
--- a/bin/errors
+++ b/bin/errors
@@ -17,7 +17,7 @@ use Text::Tabs;
# 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
# 30 Aug 1997
#
# Purpose: This script will read standard input which should be a
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/h5vers b/bin/h5vers
index 659a081..6093eb0 100755
--- a/bin/h5vers
+++ b/bin/h5vers
@@ -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/trace b/bin/trace
index fd0248e..ff91873 100755
--- a/bin/trace
+++ b/bin/trace
@@ -210,6 +210,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.
#
@@ -287,7 +295,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.
@@ -331,18 +339,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;
diff --git a/bin/warnhist b/bin/warnhist
index a88474b..3b2cec6 100755
--- a/bin/warnhist
+++ b/bin/warnhist
@@ -15,7 +15,7 @@ use warnings;
# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
# access to either file, you may request a copy from help@hdfgroup.org.
#
-# Quincey Koziol, koziol@hdfgroup.org
+# Quincey Koziol
# 9 Aug 2013
#
# Purpose: Given an input file containing the output from a build of the