Files
mongo/bazel/toolchains/cc/mongo_linux/mongo_defines.bzl
patricearruda84 232f876e4d SERVER-102939: Move most of the Apple compiler flags to features. (#34952)
GitOrigin-RevId: 9e2c7abde82a20a5cb5818690167818eb2a3ecf5
2025-04-12 00:38:27 +00:00

25 lines
1.1 KiB
Python

"""This module provides a list of defines that is passed in to compiling specifically to linux builds.
"""
visibility(["//bazel/toolchains/cc/mongo_linux"])
DEFINES = [
# On linux, C code compiled with gcc/clang -std=c11 causes
# __STRICT_ANSI__ to be set, and that drops out all of the feature test
# definitions, resulting in confusing errors when we run C language
# configure checks and expect to be able to find newer POSIX things.
# Explicitly enabling _XOPEN_SOURCE fixes that, and should be mostly
# harmless as on Linux, these macros are cumulative. The C++ compiler
# already sets _XOPEN_SOURCE, and, notably, setting it again does not
# disable any other feature test macros, so this is safe to do. Other
# platforms like macOS and BSD have crazy rules, so don't try this
# there.
#
# Furthermore, as both C++ compilers appear to define _GNU_SOURCE
# unconditionally (because libstdc++ requires it), it seems prudent to
# explicitly add that too, so that C language checks see a consistent
# set of definitions.
"_XOPEN_SOURCE=700",
"_GNU_SOURCE",
]