Without ;;&, /bin/sh gives Syntax error: ")" unexpected (expecting ";;").
;;& triggers shellcheck's ^-- SC2127 (error): To use cases with ;;&, specify #!/usr/bin/env bash notice.
Other than not useusing /bin/sh, how to fallthrough? Have no wish to use /bin/sh, but /bin/sh is the "lowest common denominator" (whichof which all Unix consolesshells are supersets), so cross-platform code is supposed to use this.
The specific use for this particular fallthroughfall-through is this function, which has this switch:
case "${5}" in #/* Language determines which flags to use */
"C")
export CFLAGS="${CFLAGS} ${1}${SUSUWU_DEPENDENCY_INCLUDE_PATH}"
export CXXFLAGS="${CXXFLAGS} ${1}${SUSUWU_DEPENDENCY_INCLUDE_PATH}" #/* As far as lib support, C++ is a superset */
;;
"C++")
export CXXFLAGS="${CXXFLAGS} ${1}${SUSUWU_DEPENDENCY_INCLUDE_PATH}";;
*) #/* Include flags for unknown languages export to all build scripts */
export FLAGS_USER="${FLAGS_USER} ${1}${SUSUWU_DEPENDENCY_INCLUDE_PATH}";; #/* Todo: allow to use this after `SUSUWU_SETUP_BUILD_FLAGS()` */
esac
The wish is to remove the duplicate export CXXFLAGS="${CXXFLAGS} ${1}${SUSUWU_DEPENDENCY_INCLUDE_PATH}" if the "C" codeflowcode flow can fallthroughfall through to the "C++" codeflowcode flow.
- The reason to remove duplicate code is to reduce the risk that future versions (with more code) will end up with 1 flow updated out-of-sync with the other flow.
The reason to remove duplicate code is to reduce the risk that future versions (with more code) will end up with 1 flow updated out-of-sync with the other flow.