I just bumped the minimum compiler versions to support C++14 in D66188.
Following our process and our previous agreement, I'm now officially bumping the C++ version to 14 and updating the documentation.
Differential D66195
Move to C++14 jfb on Aug 13 2019, 10:16 PM. Authored by
Details
I just bumped the minimum compiler versions to support C++14 in D66188. Following our process and our previous agreement, I'm now officially bumping the C++ version to 14 and updating the documentation.
Diff Detail
Event TimelineComment Actions I can, but that seems odd: aren’t release notes for users of LLVM, not developers? In other words, what would someone reading this note take away from it, and do based on reading it?
Comment Actions I think the releases are also used by folks doing various kinds of out-of-tree LLVM stuff, and this change might let them use C++14 in their code by default. But yeah, not a huge deal maybe.
Comment Actions I agree with Hans that there should be an LLVM release note. Another action for an LLVM user (who, to be clear, is a developer of an LLVM-based compiler) would be to update their host toolchain before trying to migrate to the newer LLVM version.
Comment Actions It looks like building with gcc 5.1 (the new minimum) is broken after this change, while it worked fine previously: /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/bin/g++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/lld/ELF -I/b/s/w/ir/cache/builder/src/third_party/llvm/lld/ELF -I/b/s/w/ir/cache/builder/src/third_party/llvm/lld/include -Itools/lld/include -I/usr/include/libxml2 -Iinclude -I/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include -DLLVM_FORCE_HEAD_REVISION -fvisibility-inlines-hidden -Werror=date-time -std=c++14 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -UNDEBUG -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -MD -MT tools/lld/ELF/CMakeFiles/lldELF.dir/LinkerScript.cpp.o -MF tools/lld/ELF/CMakeFiles/lldELF.dir/LinkerScript.cpp.o.d -o tools/lld/ELF/CMakeFiles/lldELF.dir/LinkerScript.cpp.o -c /b/s/w/ir/cache/builder/src/third_party/llvm/lld/ELF/LinkerScript.cpp In file included from /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/bits/stl_algobase.h:71:0, from /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/memory:62, from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/Optional.h:22, from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/STLExtras.h:19, from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/StringRef.h:12, from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/StringMap.h:16, from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/Support/Host.h:16, from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/Hashing.h:48, from /b/s/w/ir/cache/builder/src/third_party/llvm/lld/include/lld/Common/LLVM.h:19, from /b/s/w/ir/cache/builder/src/third_party/llvm/lld/include/lld/Common/ErrorHandler.h:71, from /b/s/w/ir/cache/builder/src/third_party/llvm/lld/ELF/Config.h:12, from /b/s/w/ir/cache/builder/src/third_party/llvm/lld/ELF/LinkerScript.h:12, from /b/s/w/ir/cache/builder/src/third_party/llvm/lld/ELF/LinkerScript.cpp:13: /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/bits/predefined_ops.h: In instantiation of ‘constexpr bool __gnu_cxx::__ops::_Iter_comp_iter<_Compare>::operator()(_Iterator1, _Iterator2) [with _Iterator1 = lld::elf::InputSectionBase*; _Iterator2 = lld::elf::InputSectionBase*; _Compare = std::function<bool(lld::elf::InputSectionBase*, lld::elf::InputSectionBase*)>]’: /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/functional:1982:6: required by substitution of ‘template<class _Res, class ... _ArgTypes> template<class _Functor> using _Invoke = decltype (std::__callable_functor(declval<_Functor&>())((declval<_ArgTypes>)()...)) [with _Functor = __gnu_cxx::__ops::_Iter_comp_iter<std::function<bool(lld::elf::InputSectionBase*, lld::elf::InputSectionBase*)> >; _Res = bool; _ArgTypes = {lld::elf::InputSectionBase*, lld::elf::InputSectionBase*}]’ /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/functional:1992:56: required by substitution of ‘template<class _Res, class ... _ArgTypes> template<class _Functor> using _Callable = std::__and_<std::function<_Res(_ArgTypes ...)>::_NotSelf<_Functor>, std::__check_func_return_type<std::function<_Res(_ArgTypes ...)>::_Invoke<_Functor>, _Res> > [with _Functor = __gnu_cxx::__ops::_Iter_comp_iter<std::function<bool(lld::elf::InputSectionBase*, lld::elf::InputSectionBase*)> >; _Res = bool; _ArgTypes = {lld::elf::InputSectionBase*, lld::elf::InputSectionBase*}]’ /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/functional:2057:9: required by substitution of ‘template<class _Functor, class> std::function<_Res(_ArgTypes ...)>::function(_Functor) [with _Functor = __gnu_cxx::__ops::_Iter_comp_iter<std::function<bool(lld::elf::InputSectionBase*, lld::elf::InputSectionBase*)> >; <template-parameter-1-2> = <missing>]’ /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/bits/predefined_ops.h:130:46: required from ‘constexpr __gnu_cxx::__ops::_Iter_comp_iter<_Compare> __gnu_cxx::__ops::__iter_comp_iter(_Compare) [with _Compare = std::function<bool(lld::elf::InputSectionBase*, lld::elf::InputSectionBase*)>]’ /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/bits/stl_algo.h:4933:43: required from ‘void std::stable_sort(_RAIter, _RAIter, _Compare) [with _RAIter = lld::elf::InputSection**; _Compare = std::function<bool(lld::elf::InputSectionBase*, lld::elf::InputSectionBase*)>]’ /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/STLExtras.h:1322:19: required from ‘void llvm::stable_sort(R&&, Compare) [with R = llvm::MutableArrayRef<lld::elf::InputSection*>&; Compare = std::function<bool(lld::elf::InputSectionBase*, lld::elf::InputSectionBase*)>]’ /b/s/w/ir/cache/builder/src/third_party/llvm/lld/ELF/LinkerScript.cpp:347:44: required from here /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/bits/predefined_ops.h:123:46: error: no match for call to ‘(std::function<bool(lld::elf::InputSectionBase*, lld::elf::InputSectionBase*)>) (lld::elf::InputSectionBase&, lld::elf::InputSectionBase&)’ { return bool(_M_comp(*__it1, *__it2)); } ^ In file included from /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/memory:79:0, from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/Optional.h:22, from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/STLExtras.h:19, from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/StringRef.h:12, from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/StringMap.h:16, from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/Support/Host.h:16, from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/Hashing.h:48, from /b/s/w/ir/cache/builder/src/third_party/llvm/lld/include/lld/Common/LLVM.h:19, from /b/s/w/ir/cache/builder/src/third_party/llvm/lld/include/lld/Common/ErrorHandler.h:71, from /b/s/w/ir/cache/builder/src/third_party/llvm/lld/ELF/Config.h:12, from /b/s/w/ir/cache/builder/src/third_party/llvm/lld/ELF/LinkerScript.h:12, from /b/s/w/ir/cache/builder/src/third_party/llvm/lld/ELF/LinkerScript.cpp:13: /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/functional:2266:5: note: candidate: _Res std::function<_Res(_ArgTypes ...)>::operator()(_ArgTypes ...) const [with _Res = bool; _ArgTypes = {lld::elf::InputSectionBase*, lld::elf::InputSectionBase*}] function<_Res(_ArgTypes...)>:: ^ /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/functional:2266:5: note: no known conversion for argument 1 from ‘lld::elf::InputSectionBase’ to ‘lld::elf::InputSectionBase*’ Has anyone seen this before? Any known workarounds? Comment Actions Our process already handles this:
So it's the soft-error that tells developers what to do, not release notes. I can certainly add something, but it doesn't seem to be the right audience. If we do want something in the release notes, I think we should amend the process document to say so, and it should be done when we change the toolchain requirements, not when we change the language version.
Comment Actions Ugh that's an ugly one... Looks like we do the following: template <typename R, typename Compare> void stable_sort(R &&Range, Compare C) { std::stable_sort(adl_begin(Range), adl_end(Range), C); } static void sortSections(MutableArrayRef<InputSection *> vec, SortSectionPolicy k) { if (k != SortSectionPolicy::Default && k != SortSectionPolicy::None) llvm::stable_sort(vec, getComparator(k)); } static std::function<bool(InputSectionBase *, InputSectionBase *)> getComparator(SortSectionPolicy k) { switch (k) { case SortSectionPolicy::Alignment: return [](InputSectionBase *a, InputSectionBase *b) { // ">" is not a mistake. Sections with larger alignments are placed // before sections with smaller alignments in order to reduce the // amount of padding necessary. This is compatible with GNU. return a->alignment > b->alignment; }; case SortSectionPolicy::Name: return [](InputSectionBase *a, InputSectionBase *b) { return a->name < b->name; }; case SortSectionPolicy::Priority: return [](InputSectionBase *a, InputSectionBase *b) { return getPriority(a->name) < getPriority(b->name); }; default: llvm_unreachable("unknown sort policy"); } }
I haven't seen it before... taking a look now. Comment Actions I have a repro, will try to figure out a workaround. It's fixed in 5.2. Talking to Jonathan Wakely we'd probably be better off on 5.5, but that'll be a separate discussion. Comment Actions
I have a fix. Building and testing... Will send a patch soon. Comment Actions Thanks, that helped! Next one (build step 3810/3982, so hopefully not too much left after this): FAILED: tools/llvm-nm/CMakeFiles/llvm-nm.dir/llvm-nm.cpp.o /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/bin/g++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/llvm-nm -I/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/tools/llvm-nm -I/usr/include/libxml2 -Iinclude -I/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include -DLLVM_FORCE_HEAD_REVISION -fvisibility-inlines-hidden -Werror=date-time -std=c++14 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -UNDEBUG -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -MD -MT tools/llvm-nm/CMakeFiles/llvm-nm.dir/llvm-nm.cpp.o -MF tools/llvm-nm/CMakeFiles/llvm-nm.dir/llvm-nm.cpp.o.d -o tools/llvm-nm/CMakeFiles/llvm-nm.dir/llvm-nm.cpp.o -c /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/tools/llvm-nm/llvm-nm.cpp In file included from /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/bits/stl_algobase.h:71:0, from /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/memory:62, from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/Optional.h:22, from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/STLExtras.h:19, from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/StringRef.h:12, from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/StringSwitch.h:15, from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/tools/llvm-nm/llvm-nm.cpp:18: /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/bits/predefined_ops.h: In instantiation of ‘constexpr bool __gnu_cxx::__ops::_Iter_comp_iter<_Compare>::operator()(_Iterator1, _Iterator2) [with _Iterator1 = {anonymous}::NMSymbol; _Iterator2 = {anonymous}::NMSymbol; _Compare = std::function<bool(const {anonymous}::NMSymbol&, const {anonymous}::NMSymbol&)>]’: /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/functional:1982:6: required by substitution of ‘template<class _Res, class ... _ArgTypes> template<class _Functor> using _Invoke = decltype (std::__callable_functor(declval<_Functor&>())((declval<_ArgTypes>)()...)) [with _Functor = __gnu_cxx::__ops::_Iter_comp_iter<std::function<bool(const {anonymous}::NMSymbol&, const {anonymous}::NMSymbol&)> >; _Res = bool; _ArgTypes = {const {anonymous}::NMSymbol&, const {anonymous}::NMSymbol&}]’ /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/functional:1992:56: required by substitution of ‘template<class _Res, class ... _ArgTypes> template<class _Functor> using _Callable = std::__and_<std::function<_Res(_ArgTypes ...)>::_NotSelf<_Functor>, std::__check_func_return_type<std::function<_Res(_ArgTypes ...)>::_Invoke<_Functor>, _Res> > [with _Functor = __gnu_cxx::__ops::_Iter_comp_iter<std::function<bool(const {anonymous}::NMSymbol&, const {anonymous}::NMSymbol&)> >; _Res = bool; _ArgTypes = {const {anonymous}::NMSymbol&, const {anonymous}::NMSymbol&}]’ /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/functional:2057:9: required by substitution of ‘template<class _Functor, class> std::function<_Res(_ArgTypes ...)>::function(_Functor) [with _Functor = __gnu_cxx::__ops::_Iter_comp_iter<std::function<bool(const {anonymous}::NMSymbol&, const {anonymous}::NMSymbol&)> >; <template-parameter-1-2> = <missing>]’ /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/bits/predefined_ops.h:130:46: required from ‘constexpr __gnu_cxx::__ops::_Iter_comp_iter<_Compare> __gnu_cxx::__ops::__iter_comp_iter(_Compare) [with _Compare = std::function<bool(const {anonymous}::NMSymbol&, const {anonymous}::NMSymbol&)>]’ /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/bits/stl_algo.h:4729:70: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator<{anonymous}::NMSymbol*, std::vector<{anonymous}::NMSymbol> >; _Compare = std::function<bool(const {anonymous}::NMSymbol&, const {anonymous}::NMSymbol&)>]’ /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/STLExtras.h:1125:12: required from ‘void llvm::sort(IteratorTy, IteratorTy, Compare) [with IteratorTy = __gnu_cxx::__normal_iterator<{anonymous}::NMSymbol*, std::vector<{anonymous}::NMSymbol> >; Compare = std::function<bool(const {anonymous}::NMSymbol&, const {anonymous}::NMSymbol&)>]’ /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/STLExtras.h:1130:13: required from ‘void llvm::sort(Container&&, Compare) [with Container = std::vector<{anonymous}::NMSymbol>&; Compare = std::function<bool(const {anonymous}::NMSymbol&, const {anonymous}::NMSymbol&)>]’ /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/tools/llvm-nm/llvm-nm.cpp:724:31: required from here /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/bits/predefined_ops.h:123:31: error: no match for ‘operator*’ (operand type is ‘{anonymous}::NMSymbol’) { return bool(_M_comp(*__it1, *__it2)); } ^ In file included from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/APFloat.h:19:0, from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/IR/Type.h:17, from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/IR/DerivedTypes.h:23, from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/IR/Function.h:29, from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/tools/llvm-nm/llvm-nm.cpp:21: /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/APInt.h:2097:14: note: candidate: llvm::APInt llvm::operator*(llvm::APInt, uint64_t) inline APInt operator*(APInt a, uint64_t RHS) { ^ /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/APInt.h:2097:14: note: candidate expects 2 arguments, 1 provided /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/APInt.h:2102:14: note: candidate: llvm::APInt llvm::operator*(uint64_t, llvm::APInt) inline APInt operator*(uint64_t LHS, APInt b) { ^ /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/APInt.h:2102:14: note: candidate expects 2 arguments, 1 provided In file included from /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/bits/stl_algobase.h:71:0, from /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/memory:62, from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/Optional.h:22, from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/STLExtras.h:19, from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/StringRef.h:12, from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/StringSwitch.h:15, from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/tools/llvm-nm/llvm-nm.cpp:18: /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/bits/predefined_ops.h:123:39: error: no match for ‘operator*’ (operand type is ‘{anonymous}::NMSymbol’) { return bool(_M_comp(*__it1, *__it2)); } ^ In file included from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/APFloat.h:19:0, from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/IR/Type.h:17, from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/IR/DerivedTypes.h:23, from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/IR/Function.h:29, from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/tools/llvm-nm/llvm-nm.cpp:21: /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/APInt.h:2097:14: note: candidate: llvm::APInt llvm::operator*(llvm::APInt, uint64_t) inline APInt operator*(APInt a, uint64_t RHS) { ^ /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/APInt.h:2097:14: note: candidate expects 2 arguments, 1 provided /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/APInt.h:2102:14: note: candidate: llvm::APInt llvm::operator*(uint64_t, llvm::APInt) inline APInt operator*(uint64_t LHS, APInt b) { ^ /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/APInt.h:2102:14: note: candidate expects 2 arguments, 1 provided |
Useless handling of C++1Y?
All compilers have to support C++14 now.