[PATCH] D126864: [clang] Introduce -fstrict-flex-arrays for stricter handling of flexible arrays

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 8 11:45:27 PDT 2022


nickdesaulniers added a comment.

In D126864#3564519 <https://reviews.llvm.org/D126864#3564519>, @efriedma wrote:

>> As for SOCK_MAXADDRLEN, that's a horrid hack, and the definition of struct sockaddr needs to change. :)
>
> Do we want some builtin define so headers can check if we're in -fstrict-flex-arrays mode?  It might be hard to mess with the definitions otherwise.

Worst case, we don't need this at least for the kernel.

The kernel has machinery to test if a command line flag is available, and if so, set a preprocessor define via `-D` command line invocation which can be used as a guard in kernel sources.

Would this preprocessor define be handy for code outside the kernel? /me shrug

But for now we don't need it.

@kees maybe we should think about what would be needed for toolchains that don't yet support `-fstrict-flex-arrays` in kernel sources? Does this become a toolchain portability issue for older released toolchains we still intend to support?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126864/new/

https://reviews.llvm.org/D126864



More information about the cfe-commits mailing list