Skip to content

Commit 886b7d9

Browse files
authored
Avoid passing Linux-like flags on Windows distros (#1096)
1 parent 16a5fa3 commit 886b7d9

File tree

1 file changed

+37
-30
lines changed

1 file changed

+37
-30
lines changed

.evergreen/compile.sh

Lines changed: 37 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,9 @@ cc_flags=()
160160
cxx_flags=()
161161

162162
case "${OSTYPE:?}" in
163-
cygwin) ;;
163+
cygwin)
164+
# Most compiler flags are not applicable to builds on Windows distros.
165+
;;
164166
darwin*)
165167
cc_flags+=("${cc_flags_init[@]}")
166168
cxx_flags+=("${cxx_flags_init[@]}" -stdlib=libc++)
@@ -175,35 +177,40 @@ linux*)
175177
;;
176178
esac
177179

178-
# Sanitizers overwrite the usual compiler flags.
179-
if [[ "${USE_SANITIZER_ASAN:-}" == "ON" ]]; then
180-
cxx_flags=(
181-
"${cxx_flags_init[@]}"
182-
-D_GLIBCXX_USE_CXX11_ABI=0
183-
-fsanitize=address
184-
-O1 -g -fno-omit-frame-pointer
185-
)
186-
fi
187-
if [[ "${USE_SANITIZER_UBSAN:-}" == "ON" ]]; then
188-
cxx_flags=(
189-
"${cxx_flags_init[@]}"
190-
-D_GLIBCXX_USE_CXX11_ABI=0
191-
-fsanitize=undefined
192-
-fsanitize-blacklist="$(pwd)/../etc/ubsan.ignorelist"
193-
-fno-sanitize-recover=undefined
194-
-O1 -g -fno-omit-frame-pointer
195-
)
196-
fi
197-
198-
# Ignore warnings generated by core::optional in mnmlstc/core.
199-
if [[ "${OSTYPE:?}" == linux* && "${HOSTTYPE:?}" == powerpc64le ]]; then
200-
cxx_flags+=(-Wno-error=maybe-uninitialized)
201-
fi
202-
203-
# Ignore deprecation warnings when building on a release branch.
204-
if [ "$(echo "${branch_name:?}" | cut -f2 -d'/')" != "${branch_name:?}" ]; then
205-
cc_flags+=(-Wno-deprecated-declarations)
206-
cxx_flags+=(-Wno-deprecated-declarations)
180+
# Most compiler flags are not applicable to builds on Windows distros.
181+
if [[ "${OSTYPE:?}" != cygwin ]]; then
182+
# Sanitizers overwrite the usual compiler flags.
183+
if [[ "${USE_SANITIZER_ASAN:-}" == "ON" ]]; then
184+
cxx_flags=(
185+
"${cxx_flags_init[@]}"
186+
-D_GLIBCXX_USE_CXX11_ABI=0
187+
-fsanitize=address
188+
-O1 -g -fno-omit-frame-pointer
189+
)
190+
fi
191+
192+
# Sanitizers overwrite the usual compiler flags.
193+
if [[ "${USE_SANITIZER_UBSAN:-}" == "ON" ]]; then
194+
cxx_flags=(
195+
"${cxx_flags_init[@]}"
196+
-D_GLIBCXX_USE_CXX11_ABI=0
197+
-fsanitize=undefined
198+
-fsanitize-blacklist="$(pwd)/../etc/ubsan.ignorelist"
199+
-fno-sanitize-recover=undefined
200+
-O1 -g -fno-omit-frame-pointer
201+
)
202+
fi
203+
204+
# Ignore warnings generated by core::optional in mnmlstc/core.
205+
if [[ "${OSTYPE:?}" != linux* && "${HOSTTYPE:?}" == powerpc64le ]]; then
206+
cxx_flags+=(-Wno-error=maybe-uninitialized)
207+
fi
208+
209+
# Ignore deprecation warnings when building on a release branch.
210+
if [[ "$(echo "${branch_name:?}" | cut -f2 -d'/')" != "${branch_name:?}" ]]; then
211+
cc_flags+=(-Wno-deprecated-declarations)
212+
cxx_flags+=(-Wno-deprecated-declarations)
213+
fi
207214
fi
208215

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

0 commit comments

Comments
 (0)