Skip to content

Avoid passing Linux-like flags on Windows distros #1094

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 37 additions & 30 deletions .evergreen/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ cc_flags=()
cxx_flags=()

case "${OSTYPE:?}" in
cygwin) ;;
cygwin)
# Most compiler flags are not applicable to builds on Windows distros.
;;
darwin*)
cc_flags+=("${cc_flags_init[@]}")
cxx_flags+=("${cxx_flags_init[@]}" -stdlib=libc++)
Expand All @@ -175,35 +177,40 @@ linux*)
;;
esac

# Sanitizers overwrite the usual compiler flags.
if [[ "${USE_SANITIZER_ASAN:-}" == "ON" ]]; then
cxx_flags=(
"${cxx_flags_init[@]}"
-D_GLIBCXX_USE_CXX11_ABI=0
-fsanitize=address
-O1 -g -fno-omit-frame-pointer
)
fi
if [[ "${USE_SANITIZER_UBSAN:-}" == "ON" ]]; then
cxx_flags=(
"${cxx_flags_init[@]}"
-D_GLIBCXX_USE_CXX11_ABI=0
-fsanitize=undefined
-fsanitize-blacklist="$(pwd)/../etc/ubsan.ignorelist"
-fno-sanitize-recover=undefined
-O1 -g -fno-omit-frame-pointer
)
fi

# Ignore warnings generated by core::optional in mnmlstc/core.
if [[ "${OSTYPE:?}" == linux* && "${HOSTTYPE:?}" == powerpc64le ]]; then
cxx_flags+=(-Wno-error=maybe-uninitialized)
fi

# Ignore deprecation warnings when building on a release branch.
if [ "$(echo "${branch_name:?}" | cut -f2 -d'/')" != "${branch_name:?}" ]; then
cc_flags+=(-Wno-deprecated-declarations)
cxx_flags+=(-Wno-deprecated-declarations)
# Most compiler flags are not applicable to builds on Windows distros.
if [[ "${OSTYPE:?}" != cygwin ]]; then
# Sanitizers overwrite the usual compiler flags.
if [[ "${USE_SANITIZER_ASAN:-}" == "ON" ]]; then
cxx_flags=(
"${cxx_flags_init[@]}"
-D_GLIBCXX_USE_CXX11_ABI=0
-fsanitize=address
-O1 -g -fno-omit-frame-pointer
)
fi

# Sanitizers overwrite the usual compiler flags.
if [[ "${USE_SANITIZER_UBSAN:-}" == "ON" ]]; then
cxx_flags=(
"${cxx_flags_init[@]}"
-D_GLIBCXX_USE_CXX11_ABI=0
-fsanitize=undefined
-fsanitize-blacklist="$(pwd)/../etc/ubsan.ignorelist"
-fno-sanitize-recover=undefined
-O1 -g -fno-omit-frame-pointer
)
fi

# Ignore warnings generated by core::optional in mnmlstc/core.
if [[ "${OSTYPE:?}" != linux* && "${HOSTTYPE:?}" == powerpc64le ]]; then
cxx_flags+=(-Wno-error=maybe-uninitialized)
fi

# Ignore deprecation warnings when building on a release branch.
if [[ "$(echo "${branch_name:?}" | cut -f2 -d'/')" != "${branch_name:?}" ]]; then
cc_flags+=(-Wno-deprecated-declarations)
cxx_flags+=(-Wno-deprecated-declarations)
fi
fi

if [[ "${#cc_flags[@]}" -gt 0 ]]; then
Expand Down