[PATCH] D116608: [flang] Document the requirements for the `flang` wrapper script
Andrzej Warzynski via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 12 01:42:34 PST 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG38e745b00623: [flang] Make the `flang` wrapper script check the Bash version (authored by awarzynski).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116608/new/
https://reviews.llvm.org/D116608
Files:
flang/tools/f18/flang
Index: flang/tools/f18/flang
===================================================================
--- flang/tools/f18/flang
+++ flang/tools/f18/flang
@@ -12,6 +12,9 @@
# * run Flang's compiler driver to unparse the input source files
# * use the external compiler (defined via FLANG_FC environment variable) to
# compile the unparsed source files
+#
+# Tested with Bash 4.4.23. This script will exit immediately if you use an
+# older version of Bash.
#===------------------------------------------------------------------------===#
set -euo pipefail
@@ -25,6 +28,27 @@
PREPROCESS_ONLY="False"
PRINT_VERSION="False"
+# === check_bash_version ======================================================
+#
+# Checks the Bash version that's used to run this script. Exits immediately if
+# it's lower than 4.4.23
+# =============================================================================
+check_bash_version() {
+ message="Error: Your Bash is too old. Please use Bash >= 4.4.23"
+ # Major version
+ [[ "${BASH_VERSINFO[0]:-0}" -lt 4 ]] && echo $message && exit 1
+
+ # Minor version
+ if [[ "${BASH_VERSINFO[0]}" == 4 ]]; then
+ [[ "${BASH_VERSINFO[1]:-0}" -lt 4 ]] && echo $message && exit 1
+ fi
+
+ # Patch version
+ if [[ "${BASH_VERSINFO[0]}" == 4 ]] && [[ "${BASH_VERSINFO[1]}" == 4 ]] ; then
+ [[ "${BASH_VERSINFO[2]:-0}" -lt 23 ]] && echo $message && exit 1
+ fi
+}
+
# === parse_args ==============================================================
#
# Parse the input arguments passed to this script. Sets the global variables
@@ -324,6 +348,7 @@
# Main entry point for this script
# =============================================================================
main() {
+ check_bash_version
parse_args "$@"
if [[ $PRINT_VERSION == "True" ]]; then
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116608.399254.patch
Type: text/x-patch
Size: 1801 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220112/e372e56f/attachment.bin>
More information about the llvm-commits
mailing list