summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorCristian Rodríguez <crodriguez@owncloud.com>2022-11-09 23:56:46 +0000
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-11-10 21:07:59 +0900
commitafd8e1d94527cf663a8dc013f2190a90218666bd (patch)
treedfa1540d4e4d88a7d042362a6d585ccc57b91bf6 /meson.build
parent7618ab1b71bbb013b61dc02697edc00c476d3b75 (diff)
downloadsystemd-afd8e1d94527cf663a8dc013f2190a90218666bd.tar.gz
build: Use -fstrict-flex-arrays=1 if supported
Due to "historical reasons" both gcc and clang treat *all* trailing arrays members as flexible arrays, this has an evil side effect of inhibiting bounds checks on such members as __builtin_object_size cannot say for sure that: struct { ... type foo[3]; } has a trailing foo member of fixed size rather than unspecified. Ideally we should use -fstrict-flex-arrays as is, but we have to tolerate kernel uapi headers that use [0] and third party libraries written in c89 that may use [1] like curl.
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build1
1 files changed, 1 insertions, 0 deletions
diff --git a/meson.build b/meson.build
index a2bf457ead..00daeac1b6 100644
--- a/meson.build
+++ b/meson.build
@@ -451,6 +451,7 @@ possible_cc_flags = possible_common_cc_flags + [
'-fno-strict-aliasing',
'-fstack-protector',
'-fstack-protector-strong',
+ '-fstrict-flex-arrays=1',
'-fvisibility=hidden',
'--param=ssp-buffer-size=4',
]