For no good reason, this code was previously stuck right in the middle
of code reporting the final results of previous checks, (after the
case reporting that errors were found and before the case reporting
that no errors were found).
It's more clean to have the warning-option detection happen before any
of that reporting.
errors=$((errors + 1))
fi
errors=$((errors + 1))
fi
+printf "int main(void){return 0;}\n" > minimal.c
+
+WARN_CFLAGS=""
+printf "Checking for available C compiler warning flags:\n"
+for flag in -Wall -Wextra -Wmissing-declarations; do
+ if ${CC} $flag -o minimal minimal.c > /dev/null 2>&1
+ then
+ WARN_CFLAGS="${WARN_CFLAGS}${WARN_CFLAGS:+ }${flag}"
+ fi
+done
+printf "\t${WARN_CFLAGS}\n"
+
+rm -f minimal minimal.c
+
if [ $errors -gt 0 ]; then
cat <<EOF
if [ $errors -gt 0 ]; then
cat <<EOF
-printf "int main(void){return 0;}\n" > minimal.c
-
-WARN_CFLAGS=""
-printf "Checking for available C compiler warning flags... "
-for flag in -Wall -Wextra -Wmissing-declarations; do
- if ${CC} $flag -o minimal minimal.c > /dev/null 2>&1
- then
- WARN_CFLAGS="${WARN_CFLAGS}${WARN_CFLAGS:+ }${flag}"
- fi
-done
-printf "\n\t${WARN_CFLAGS}\n"
-
-rm -f minimal minimal.c
-
cat <<EOF
All required packages were found.
cat <<EOF
All required packages were found.