[PATCH] D131727: Enable -Wctad-maybe-unsupported in LLVM build

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 12 16:50:11 PDT 2022


dblaikie marked an inline comment as done.
dblaikie added a comment.

In D131727#3720405 <https://reviews.llvm.org/D131727#3720405>, @jloser wrote:

> In D131727#3720366 <https://reviews.llvm.org/D131727#3720366>, @dblaikie wrote:
>
>> Still open to ideas as to what to do with libc++. I mean it seems it's only a warning and not an error there, even in an `LLVM_ENABLE_WERROR` build, so maybe it can be committed as-is? But I'm not sure/wouldn't mind a libc++ developer to weigh in. (@ldionne?)
>
> Do you have some examples of `libc++` code that this new warning flags? I'm happy to take a look.

My concern is it looks more like some cases of warning false positive, possibly because of the way libc++ builds itself (does it `#define _VSTD` to be empty or something other than `std` for its own test builds, perhaps, so as not to interfere with the system compiler's standard library entities?) - which might be thwarting the warning's general suppression for standard library things.

Also some implementation details too, like `filesystem/operations.cpp:scope_exit`

Anyway, here's the first set of warnings I get when I run `ninja cxx`:

  In file included from /usr/local/google/home/blaikie/dev/llvm/src/libcxx/src/charconv.cpp:12:
  /usr/local/google/home/blaikie/dev/llvm/src/libcxx/src/include/to_chars_floating_point.h:901:82: warning: 'less' may not intend to support class template argument deduction [-Wctad-maybe-unsupported]
                  return _VSTD::lower_bound(_Table_begin, _Table_end, _Uint_value, less{});
                                                                                   ^
  /usr/local/google/home/blaikie/dev/llvm/build/default/include/c++/v1/__functional/operations.h:366:29: note: add a deduction guide to suppress this warning
  struct _LIBCPP_TEMPLATE_VIS less
                              ^
  In file included from /usr/local/google/home/blaikie/dev/llvm/src/libcxx/src/charconv.cpp:12:
  /usr/local/google/home/blaikie/dev/llvm/src/libcxx/src/include/to_chars_floating_point.h:901:82: warning: 'less' may not intend to support class template argument deduction [-Wctad-maybe-unsupported]
                  return _VSTD::lower_bound(_Table_begin, _Table_end, _Uint_value, less{});
                                                                                   ^
  /usr/local/google/home/blaikie/dev/llvm/src/libcxx/src/include/to_chars_floating_point.h:1067:20: note: in instantiation of function template specialization 'std::_Floating_to_chars_general_precision<double>' requested here
              return _Floating_to_chars_general_precision(_First, _Last, _Value, _Precision);
                     ^
  /usr/local/google/home/blaikie/dev/llvm/src/libcxx/src/charconv.cpp:77:10: note: in instantiation of function template specialization 'std::_Floating_to_chars<std::_Floating_to_chars_overload::_Format_precision, double>' requested here
    return _Floating_to_chars<_Floating_to_chars_overload::_Format_precision>(__first, __last, __value, __fmt,
           ^
  /usr/local/google/home/blaikie/dev/llvm/build/default/include/c++/v1/__functional/operations.h:366:29: note: add a deduction guide to suppress this warning
  struct _LIBCPP_TEMPLATE_VIS less
                              ^
  2 warnings generated.
  [479/563] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/charconv.cpp.o
  In file included from /usr/local/google/home/blaikie/dev/llvm/src/libcxx/src/charconv.cpp:12:
  /usr/local/google/home/blaikie/dev/llvm/src/libcxx/src/include/to_chars_floating_point.h:901:82: warning: 'less' may not intend to support class template argument deduction [-Wctad-maybe-unsupported]
                  return _VSTD::lower_bound(_Table_begin, _Table_end, _Uint_value, less{});
                                                                                   ^
  /usr/local/google/home/blaikie/dev/llvm/build/default/include/c++/v1/__functional/operations.h:366:29: note: add a deduction guide to suppress this warning
  struct _LIBCPP_TEMPLATE_VIS less
                              ^
  In file included from /usr/local/google/home/blaikie/dev/llvm/src/libcxx/src/charconv.cpp:12:
  /usr/local/google/home/blaikie/dev/llvm/src/libcxx/src/include/to_chars_floating_point.h:901:82: warning: 'less' may not intend to support class template argument deduction [-Wctad-maybe-unsupported]
                  return _VSTD::lower_bound(_Table_begin, _Table_end, _Uint_value, less{});
                                                                                   ^
  /usr/local/google/home/blaikie/dev/llvm/src/libcxx/src/include/to_chars_floating_point.h:1067:20: note: in instantiation of function template specialization 'std::_Floating_to_chars_general_precision<double>' requested here
              return _Floating_to_chars_general_precision(_First, _Last, _Value, _Precision);
                     ^
  /usr/local/google/home/blaikie/dev/llvm/src/libcxx/src/charconv.cpp:77:10: note: in instantiation of function template specialization 'std::_Floating_to_chars<std::_Floating_to_chars_overload::_Format_precision, double>' requested here
    return _Floating_to_chars<_Floating_to_chars_overload::_Format_precision>(__first, __last, __value, __fmt,
           ^
  /usr/local/google/home/blaikie/dev/llvm/build/default/include/c++/v1/__functional/operations.h:366:29: note: add a deduction guide to suppress this warning
  struct _LIBCPP_TEMPLATE_VIS less
                              ^
  2 warnings generated.
  [556/563] Building CXX object libcxx/src/CMakeFiles/cxx_static.dir/filesystem/operations.cpp.o
  /usr/local/google/home/blaikie/dev/llvm/src/libcxx/src/filesystem/operations.cpp:1427:5: warning: 'scope_exit' may not intend to support class template argument deduction [-Wctad-maybe-unsupported]
      scope_exit close_stream([=] { ::closedir(stream); });
      ^
  /usr/local/google/home/blaikie/dev/llvm/src/libcxx/src/filesystem/operations.cpp:1401:8: note: add a deduction guide to suppress this warning
  struct scope_exit {
         ^
  1 warning generated.
  [558/563] Building CXX object libcxx/src/CMakeFiles/cxx_shared.dir/filesystem/operations.cpp.o
  /usr/local/google/home/blaikie/dev/llvm/src/libcxx/src/filesystem/operations.cpp:1427:5: warning: 'scope_exit' may not intend to support class template argument deduction [-Wctad-maybe-unsupported]
      scope_exit close_stream([=] { ::closedir(stream); });
      ^
  /usr/local/google/home/blaikie/dev/llvm/src/libcxx/src/filesystem/operations.cpp:1401:8: note: add a deduction guide to suppress this warning
  struct scope_exit {
         ^
  1 warning generated.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131727



More information about the llvm-commits mailing list