lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi] PATCH: Building lmi with gcc 10 and C++20


From: Vadim Zeitlin
Subject: [lmi] PATCH: Building lmi with gcc 10 and C++20
Date: Mon, 11 May 2020 00:12:11 +0200

 Hello,

 I couldn't help myself and decided to test compilation of lmi in C++20
mode as soon as g++ 10.1, implementing support for C++20, became available
in Debian.

 This didn't work completely out of the box, but the problems were not
difficult to fix:

- There were some errors in wxWidgets due to the new comparison operator
  semantics and deletion of std::ostream::operator<< overloads for wchar_t
  and "const wchar_t*". PR https://github.com/wxWidgets/wxWidgets/pull/1851
  fixes those and I'll merge it in wxWidgets soon.

- sigfpe.cpp:78:8: error: compound assignment with ‘volatile’-qualified left 
operand is deprecated [-Werror=volatile]
   78 |     d2 *= dm;
      |     ~~~^~~~~
   (...same...)
   85 |     d2 /= dm;
      |     ~~~^~~~~

  I have no idea what is this code trying to do, but just using
  non-compound assignments allows to avoid this error without, hopefully,
  breaking the intention of the code, whatever it is.

- pdf_command_wx.cpp:2458:53: error: implicit capture of ‘this’ via ‘[=]’ is 
deprecated in C++20 [-Werror=deprecated]
 2458 |         auto const output_two_column_super_header = [=,&table_gen]
      |                                                     ^
  pdf_command_wx.cpp:2458:53: note: add explicit ‘this’ or ‘*this’ capture

  Here I've followed the compiler advice by capturing "this" (we don't want
  to make a copy of this object by capturing "*this") and also getting rid
  of the implicit capture mode and capturing everything we need explicitly.
  
- rate_table.cpp:1659:34: error: implicit capture of ‘this’ via ‘[=]’ is 
deprecated in C++20 [-Werror=deprecated]
 1659 |     auto const is_select_table = [=]() {
      |                                  ^

  Same thing as above, except that there was really no reason to ever use
  implicit capture in the first place here.

- I left the last and the least pleasant one for the end: there are also
  errors in Boost.Regex when using C++20. The error messages are too long
  for it to be useful to paste them here, but basically we need to disable
  -Wdeprecated-copy for gcc 10 too, as it was already done by clang, in
  boost_regex.hpp and we also need to define BOOST_NO_STD_ALLOCATOR in
  addition to BOOST_NO_AUTO_PTR to compile it to prevent it from using
  std::allocator::const_reference, which was already deprecated in C++17
  and is removed completely in C++20.


 I've collected all the changes needed to fix lmi compilation with gcc 10
in C++20 mode in https://github.com/vadz/lmi/pull/142 and I think there is
no real reason not to apply them, even if we're probably not going to
upgrade to gcc 10 any time soon yet, as they shouldn't have any drawbacks
when using the existing compiler neither.

 As you probably noticed, I've committed one change to master too, to make
it possible to build lmi successfully when using autotools, hopefully you
don't mind even if it added a couple of "MD5 !!" markers -- but they
just parallel those already present in objects.make.

 Please let me know if you have any questions,
VZ

Attachment: pgp6NwmqfM4SG.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]