linux-surface / iptsd

Userspace daemon for Intel Precise Touch & Stylus
GNU General Public License v2.0
86 stars 39 forks source link

Doesn't compile on clang 15 #118

Closed danielzgtg closed 1 year ago

danielzgtg commented 1 year ago

iptsd fails to build on clang 15.

Environment

home@daniel-desktop3:~$ clang --version
Ubuntu clang version 15.0.7
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
home@daniel-desktop3:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.10
Release:        22.10
Codename:       kinetic

Expected Behavior

It should compile successfully just like on gcc.

Actual Behavior

ninja -C build
ninja: Entering directory `build'
[1/2] Compiling C++ object src/debug/iptsd-dump.p/dump.cpp.o
FAILED: src/debug/iptsd-dump.p/dump.cpp.o 
clang++ -Isrc/debug/iptsd-dump.p -Isrc/debug -I../src/debug -Isrc -I../src -I../subprojects/GSL-4.0.0/include -Isubprojects/hidrd -flto -fcolor-diagnostics -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -Wpedantic -Werror -std=c++20 -O3 -g -Wuninitialized -Wno-unused-result -Wmissing-include-dirs -Wpointer-arith -Winit-self -Wendif-labels -Wstrict-aliasing=2 -Woverflow -Wno-missing-braces -Wno-missing-field-initializers -Wno-unused-parameter -march=x86-64-v3 -D_GLIBCXX_ASSERTIONS -isystem/home/home/CLionProjects/iptsd/build/subprojects/hidrd/dist/usr/local/include -DSPDLOG_SHARED_LIB -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -MD -MQ src/debug/iptsd-dump.p/dump.cpp.o -MF src/debug/iptsd-dump.p/dump.cpp.o.d -o src/debug/iptsd-dump.p/dump.cpp.o -c ../src/debug/dump.cpp
../src/debug/dump.cpp:61:24: error: call to consteval function 'fmt::basic_format_string<char, unsigned long &>::basic_format_string<const char *, 0>' is not a constant expression
                                it = format_to(it, pfxstr, i);
                                                   ^
/usr/include/fmt/core.h:794:64: note: in instantiation of function template specialization 'fmt::formatter<gsl::span<const unsigned char, 18446744073709551615>>::format<fmt::basic_format_context<fmt::appender, char>>' requested here
    -> decltype(typename Context::template formatter_type<T>().format(
                                                               ^
/usr/include/fmt/core.h:805:10: note: while substituting deduced template arguments into function template 'has_const_formatter_impl' [with Context = fmt::basic_format_context<fmt::appender, char>, T = gsl::span<const unsigned char, 18446744073709551615>]
  return has_const_formatter_impl<Context>(static_cast<T*>(nullptr));
         ^
/usr/include/fmt/core.h:1466:23: note: in instantiation of function template specialization 'fmt::detail::has_const_formatter<gsl::span<const unsigned char, 18446744073709551615>, fmt::basic_format_context<fmt::appender, char>>' requested here
      : bool_constant<has_const_formatter<U, Context>() ||
                      ^
/usr/include/fmt/core.h:1477:39: note: in instantiation of template class 'fmt::detail::arg_mapper<fmt::basic_format_context<fmt::appender, char>>::formattable<const gsl::span<const unsigned char, 18446744073709551615> &, gsl::span<const unsigned char, 18446744073709551615>>' requested here
  template <typename T, FMT_ENABLE_IF(formattable<T>::value)>
                                      ^
/usr/include/fmt/core.h:1478:33: note: while substituting prior template arguments into non-type template parameter [with T = const gsl::span<const unsigned char, 18446744073709551615> &]
  FMT_CONSTEXPR FMT_INLINE auto do_map(T&& val) -> T& {
                                ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/fmt/core.h:1495:25: note: (skipping 1 context in backtrace; use -ftemplate-backtrace-limit=0 to see all)
      -> decltype(this->do_map(std::forward<T>(val))) {
                        ^
/usr/include/fmt/core.h:1511:50: note: while substituting deduced template arguments into function template 'map' [with T = const gsl::span<const unsigned char, 18446744073709551615> &, U = (no value), $2 = (no value)]
    type_constant<decltype(arg_mapper<Context>().map(std::declval<const T&>())),
                                                 ^
/usr/include/fmt/core.h:2710:7: note: in instantiation of template type alias 'mapped_type_constant' requested here
      mapped_type_constant<T, context>::value != type::custom_type,
      ^
/usr/include/fmt/core.h:2923:23: note: in instantiation of function template specialization 'fmt::detail::parse_format_specs<gsl::span<const unsigned char, 18446744073709551615>, fmt::detail::compile_parse_context<char>>' requested here
        parse_funcs_{&parse_format_specs<Args, parse_context_type>...},
                      ^
/usr/include/fmt/core.h:3116:47: note: in instantiation of member function 'fmt::detail::format_string_checker<char, fmt::detail::error_handler, gsl::span<const unsigned char, 18446744073709551615>>::format_string_checker' requested here
      detail::parse_format_string<true>(str_, checker(s, {}));
                                              ^
../src/debug/dump.cpp:199:17: note: in instantiation of function template specialization 'fmt::basic_format_string<char, const gsl::span<const unsigned char, 18446744073709551615> &>::basic_format_string<char[6], 0>' requested here
                        spdlog::info("{:ox}", buf);
                                     ^
/usr/include/fmt/core.h:3105:67: note: read of non-constexpr variable 'pfxstr' is not allowed in a constant expression
  FMT_CONSTEVAL FMT_INLINE basic_format_string(const S& s) : str_(s) {
                                                                  ^
../src/debug/dump.cpp:61:24: note: in call to 'basic_format_string(pfxstr)'
                                it = format_to(it, pfxstr, i);
                                                   ^
../src/debug/dump.cpp:53:15: note: declared here
                char const *pfxstr = prefix == 'o' ? "{:04x}: " : "{:04X}: ";
                            ^
../src/debug/dump.cpp:64:24: error: call to consteval function 'fmt::basic_format_string<char, const unsigned char &>::basic_format_string<const char *, 0>' is not a constant expression
                                it = format_to(it, fmtstr, buf[i + j]);
                                                   ^
/usr/include/fmt/core.h:3105:67: note: read of non-constexpr variable 'fmtstr' is not allowed in a constant expression
  FMT_CONSTEVAL FMT_INLINE basic_format_string(const S& s) : str_(s) {
                                                                  ^
../src/debug/dump.cpp:64:24: note: in call to 'basic_format_string(fmtstr)'
                                it = format_to(it, fmtstr, buf[i + j]);
                                                   ^
../src/debug/dump.cpp:54:15: note: declared here
                char const *fmtstr = hexfmt == 'x' ? "{:02x} " : "{:02X} ";
                            ^
../src/debug/dump.cpp:69:24: error: call to consteval function 'fmt::basic_format_string<char, const unsigned char &>::basic_format_string<const char *, 0>' is not a constant expression
                                it = format_to(it, fmtstr, buf[i + j]);
                                                   ^
/usr/include/fmt/core.h:3105:67: note: read of non-constexpr variable 'fmtstr' is not allowed in a constant expression
  FMT_CONSTEVAL FMT_INLINE basic_format_string(const S& s) : str_(s) {
                                                                  ^
../src/debug/dump.cpp:69:24: note: in call to 'basic_format_string(fmtstr)'
                                it = format_to(it, fmtstr, buf[i + j]);
                                                   ^
../src/debug/dump.cpp:54:15: note: declared here
                char const *fmtstr = hexfmt == 'x' ? "{:02x} " : "{:02X} ";
                            ^
../src/debug/dump.cpp:74:24: error: call to consteval function 'fmt::basic_format_string<char, const unsigned char &>::basic_format_string<const char *, 0>' is not a constant expression
                                it = format_to(it, fmtstr, buf[i + j]);
                                                   ^
/usr/include/fmt/core.h:3105:67: note: read of non-constexpr variable 'fmtstr' is not allowed in a constant expression
  FMT_CONSTEVAL FMT_INLINE basic_format_string(const S& s) : str_(s) {
                                                                  ^
../src/debug/dump.cpp:74:24: note: in call to 'basic_format_string(fmtstr)'
                                it = format_to(it, fmtstr, buf[i + j]);
                                                   ^
../src/debug/dump.cpp:54:15: note: declared here
                char const *fmtstr = hexfmt == 'x' ? "{:02x} " : "{:02X} ";
                            ^
../src/debug/dump.cpp:79:24: error: call to consteval function 'fmt::basic_format_string<char, const unsigned char &>::basic_format_string<const char *, 0>' is not a constant expression
                                it = format_to(it, fmtstr, buf[i + j]);
                                                   ^
/usr/include/fmt/core.h:3105:67: note: read of non-constexpr variable 'fmtstr' is not allowed in a constant expression
  FMT_CONSTEVAL FMT_INLINE basic_format_string(const S& s) : str_(s) {
                                                                  ^
../src/debug/dump.cpp:79:24: note: in call to 'basic_format_string(fmtstr)'
                                it = format_to(it, fmtstr, buf[i + j]);
                                                   ^
../src/debug/dump.cpp:54:15: note: declared here
                char const *fmtstr = hexfmt == 'x' ? "{:02x} " : "{:02X} ";
                            ^
5 errors generated.
ninja: build stopped: subcommand failed.

Process finished with exit code 1
danielzgtg commented 1 year ago

Oops I may have accidentally cleaned before but not cleaned after checking out the new branch. But thanks for fixing it, when I was having to comment out that line every time on my local C++20 branch.