diff options
author | serge-sans-paille <sguelton@redhat.com> | 2022-06-28 11:01:55 +0200 |
---|---|---|
committer | serge-sans-paille <sguelton@redhat.com> | 2022-07-18 12:45:52 +0200 |
commit | f764dc99b37e1e6428724a61f36bcb49c015dc70 (patch) | |
tree | 63232db1fb62062e17a95f4cbaf5e562d3304432 /llvm/unittests/Transforms/Utils/CloningTest.cpp | |
parent | 432cbd7827202e4316225820f3f90417b9fcce6c (diff) | |
download | llvm-f764dc99b37e1e6428724a61f36bcb49c015dc70.zip llvm-f764dc99b37e1e6428724a61f36bcb49c015dc70.tar.gz llvm-f764dc99b37e1e6428724a61f36bcb49c015dc70.tar.bz2 |
[clang] Introduce -fstrict-flex-arrays=<n> for stricter handling of flexible arrays
Some code [0] consider that trailing arrays are flexible, whatever their size.
Support for these legacy code has been introduced in
f8f632498307d22e10fab0704548b270b15f1e1e but it prevents evaluation of
__builtin_object_size and __builtin_dynamic_object_size in some legit cases.
Introduce -fstrict-flex-arrays=<n> to have stricter conformance when it is
desirable.
n = 0: current behavior, any trailing array member is a flexible array. The default.
n = 1: any trailing array member of undefined, 0 or 1 size is a flexible array member
n = 2: any trailing array member of undefined or 0 size is a flexible array member
This takes into account two specificities of clang: array bounds as macro id
disqualify FAM, as well as non standard layout.
Similar patch for gcc discuss here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836
[0] https://docs.freebsd.org/en/books/developers-handbook/sockets/#sockets-essential-functions
Diffstat (limited to 'llvm/unittests/Transforms/Utils/CloningTest.cpp')
0 files changed, 0 insertions, 0 deletions