Simon Pilgrim via llvm-dev
2021-Nov-23 12:57 UTC
[llvm-dev] Use of C++17 in the LLVM codebase
Making better use of C++17 came up several times in devmtg chats this year. I notice we have a number of cases in LLVM source which allows (optional) use of C++17, but it is never mandatory or assumed: e.g StringRef.h #if __cplusplus > 201402L #include <string_view> #endif ... // Constexpr version of std::strlen. static constexpr size_t strLen(const char *Str) { #if __cplusplus > 201402L return std::char_traits<char>::length(Str); #elif __has_builtin(__builtin_strlen) || defined(__GNUC__) || \ (defined(_MSC_VER) && _MSC_VER >= 1916) return __builtin_strlen(Str); #else const char *Begin = Str; while (*Str != '\0') ++Str; return Str - Begin; #endif } According to https://llvm.org/docs/CodingStandards.html - we only accept up to standard C++14 code that is supported by our minimum gcc/clang/msvc versions. Does anyone know what in particular is preventing us from bumping the minimum compiler versions to make 'compiler supported' C++17 a similar requirement to build LLVM at this time? https://lists.llvm.org/pipermail/llvm-dev/2018-October/127045.html https://reviews.llvm.org/D47073 AFAICT, the last time this was discussed (back in 2018/9), some developers still had a dependency on Ubuntu 1604 LTS (and other old distros), whose default gcc didn't have adequate C++17 support. Support for 1604 has been extended to April 2026 - I'm guessing we're not going to wait until then? Cheers, Simon.
Tobias Hieta via llvm-dev
2021-Nov-23 15:23 UTC
[llvm-dev] Use of C++17 in the LLVM codebase
On Tue, Nov 23, 2021 at 1:57 PM Simon Pilgrim via llvm-dev <llvm-dev at lists.llvm.org> wrote:> According to https://llvm.org/docs/CodingStandards.html - we only accept > up to standard C++14 code that is supported by our minimum > gcc/clang/msvc versions. > > Does anyone know what in particular is preventing us from bumping the > minimum compiler versions to make 'compiler supported' C++17 a similar > requirement to build LLVM at this time?There is a process for this that's documented here: https://llvm.org/docs/DeveloperPolicy.html#id23 An RFC like this should be written: https://lists.llvm.org/pipermail/llvm-dev/2019-January/129452.html I don't think anything is blocking it except that someone needs to do the work to investigate the different toolchains and summarize it in a RFC email to the list. -- Tobias