Add C++17 build to Travis #18591

pull sipa wants to merge 4 commits into bitcoin:master from sipa:202004_c++17 changing 5 files +470 −38
  1. sipa commented at 7:43 am on April 11, 2020: member

    This adds a --enable-c++17 option to the configure script, fixes the only C++17 incompatibility (with a commit taken from #18468), and adds a Travis test for it.

    This is all off by default, and release builds remain C++11.

    It implements the first step of the plan in #16684.

  2. fanquake added the label Build system on Apr 11, 2020
  3. in configure.ac:73 in 48313a3e9a outdated
    70+  [use_cxx17=$enableval],
    71+  [use_cxx17=no])
    72+
    73+dnl Require C++11 or C++17 compiler (no GNU extensions)
    74+if test "x$use_cxx17" = xyes; then
    75+  AX_CXX_COMPILE_STDCXX([17], [noext], [mandatory], [nodefault])
    


    fanquake commented at 7:48 am on April 11, 2020:
    Given it’s been removed in the ax_cxx_compile_stdcxx.m4 macro update, the [nodefault] argument should be removed here and below.

    sipa commented at 9:15 am on April 11, 2020:
    Done.

    hebasto commented at 9:19 pm on April 11, 2020:

    The [nodefault] argument was added in our patch: https://github.com/bitcoin/bitcoin/pull/9831/commits/9829c54de2725037ee0702306cbaa99fc9aa1826

    Why is it possible to drop it?


    sipa commented at 9:29 pm on April 11, 2020:
    Ouch. I had no idea this was a local modification.

    sipa commented at 9:39 pm on April 11, 2020:

    Ah, it seems the new upstream version actually changed behaviour and now does what we called “nodefault” regardless.

    Even with compilers that support c++17, if we request c++11, we’ll only get c++11 (which can be verified from the Travis build logs).


    fanquake commented at 10:20 pm on April 11, 2020:
    I should have made that more clear. I’ve got the same change as part of #18088.
  4. fanquake commented at 7:53 am on April 11, 2020: member
    Is this just to ensure continued C++17 compatibility of the codebase going forward?
  5. sipa commented at 8:02 am on April 11, 2020: member
    @fanquake No, just the first step. See the plan in #16684.
  6. fanquake commented at 8:07 am on April 11, 2020: member

    No, just the first step. See the plan in #16684.

    I mean, is the point of the CI addition just to ensure that after the last C++17 incompatibility is fixed (https://github.com/bitcoin/bitcoin/pull/18591/commits/10b4f256d4ab891e23977b1d3610a5b758f7bcb1), that there are no trivial regressions? I understand that this can’t do much else.

  7. sipa commented at 9:01 am on April 11, 2020: member
    Yeah, to demonstrate that it works, and to start introducing support in our build system.
  8. Update ax_cxx_compile_stdcxx.m4 7cbfebbf3d
  9. Support conversion between Spans of compatible types 0fbde488b2
  10. Add configure option for c++17 7829685e27
  11. sipa force-pushed on Apr 11, 2020
  12. MarcoFalke added this to the milestone 0.21.0 on Apr 11, 2020
  13. in .travis.yml:152 in 5c57d82ace outdated
    147@@ -148,6 +148,11 @@ jobs:
    148       env: >-
    149         FILE_ENV="./ci/test/00_setup_env_native_valgrind.sh"
    150 
    151+    - stage: test
    152+      name: 'x86_64 Linux  [GOAL: install]  [focal]  [no depends, only system libs, c++17]'
    


    MarcoFalke commented at 10:17 am on April 11, 2020:
    Our releases are built with bionic, and I think there are no plans to drop support for bionic in 0.22.0. So this should probably run on bionic?

    sipa commented at 8:42 pm on April 11, 2020:
    Done. Travis passes.
  14. MarcoFalke commented at 10:17 am on April 11, 2020: member
    Concept ACK
  15. DrahtBot commented at 12:38 pm on April 11, 2020: member

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #18088 (build: ensure we aren’t using GNU extensions by fanquake)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  16. Add C++17 test to Travis c31cbe7cfe
  17. sipa force-pushed on Apr 11, 2020
  18. hebasto commented at 9:11 pm on April 11, 2020: member
    Concept ACK.
  19. elichai commented at 9:19 am on April 13, 2020: contributor

    Concept ACK

    For ease review this is the same implicit conversion impl that libc++ has: https://github.com/llvm-mirror/libcxx/blob/b857e811b34ae637ce49bbca19ae5bae26a9c4e8/include/span#L229

  20. hebasto approved
  21. hebasto commented at 2:12 pm on April 13, 2020: member

    ACK c31cbe7cfefc18123eb85ffb2ce509748435efde, tested on Linux Mint 19.3 both C++11 and C++17 modes. Compiled and passed tests locally.

    Verified, that build fails in C++17 mode without “Support conversion between Spans of compatible types” commit (0fbde488b24f62b4bbbde216647941dcac65c81a).

  22. practicalswift commented at 5:15 pm on April 13, 2020: contributor

    Concept ACK

    Asserting that we compile and pass tests also with a C++17 mode build is valuable.

  23. laanwj commented at 5:47 pm on April 16, 2020: member
    Concept ACK, thanks for adding.
  24. elichai commented at 10:11 am on April 23, 2020: contributor

    tACK c31cbe7cfefc18123eb85ffb2ce509748435efde

    Checked that with and without --enable-c++17 it compiles(including Qt and everything) and tests pass. Checked with make -n that without the flag it still passes -std=c++11 and with it it passes -std=c++17. Checked that with the span changes reverted it still works on c++11 but fails on c++17 with:

      0test/util_tests.cpp: In member function void util_tests::test_spanparsing::test_method():                                                                                                                                                                                                                                                                                                  
      1test/util_tests.cpp:1832:24: error: no match for operator= (operand types are Span<const char> and Span<char>)                                                                                                                                                                                                                                                                         
      2 1832 |     sp = MakeSpan(input);                                                                                                                                                                                                                                                                                                                                                            
      3      |                        ^                                                                                                                                                                                                                                                                                                                                                             
      4In file included from ./serialize.h:25,                                                                                                                                                                                                                                                                                                                                                      
      5                 from ./hash.h:13,                                                                                                                                                                                                                                                                                                                                                           
      6                 from test/util_tests.cpp:8:                                                                                                                                                                                                                                                                                                                                                 
      7./span.h:18:7: note: candidate: constexpr Span<const char>& Span<const char>::operator=(const Span<const char>&)                                                                                                                                                                                                                                                                           
      8   18 | class Span                                                                                                                                                                                                                                                                                                                                                                           
      9      |       ^~~~                                                                                                                                                                                                                                                                                                                                                                           
     10./span.h:18:7: note:   no known conversion for argument 1 from Span<char> to const Span<const char>&                                                                                                                                                                                                                                                                                     
     11./span.h:18:7: note: candidate: constexpr Span<const char>& Span<const char>::operator=(Span<const char>&&)                                                                                                                                                                                                                                                                                
     12./span.h:18:7: note:   no known conversion for argument 1 from Span<char> to Span<const char>&&                                                                                                                                                                                                                                                                                          
     13test/util_tests.cpp:1857:24: error: no match for operator= (operand types are Span<const char> and Span<char>)                                                                                                                                                                                                                                                                         
     14 1857 |     sp = MakeSpan(input);                                                                                                                                                                                                                                                                                                                                                            
     15      |                        ^                                                                                                                                                                                                                                                                                                                                                             
     16In file included from ./serialize.h:25,                                                                                                                                                                                                                                                                                                                                                      
     17                 from ./hash.h:13,                                                                                                                                                                                                                                                                                                                                                           
     18                 from test/util_tests.cpp:8:                                                                                                                                                                                                                                                                                                                                                 
     19./span.h:18:7: note: candidate: constexpr Span<const char>& Span<const char>::operator=(const Span<const char>&)                                                                                                                                                                                                                                                                           
     20   18 | class Span                                                                                                                                                                                                                                                                                                                                                                           
     21      |       ^~~~                                                                                                                                                                                                                                                                                                                                                                           
     22./span.h:18:7: note:   no known conversion for argument 1 from Span<char> to const Span<const char>&
     23./span.h:18:7: note: candidate: constexpr Span<const char>& Span<const char>::operator=(Span<const char>&&)
     24./span.h:18:7: note:   no known conversion for argument 1 from Span<char> to Span<const char>&&
     25test/util_tests.cpp:1880:24: error: no match for operator= (operand types are Span<const char> and Span<char>)
     26 1880 |     sp = MakeSpan(input);
     27      |                        ^
     28In file included from ./serialize.h:25,
     29                 from ./hash.h:13,
     30                 from test/util_tests.cpp:8:
     31./span.h:18:7: note: candidate: constexpr Span<const char>& Span<const char>::operator=(const Span<const char>&)
     32   18 | class Span
     33      |       ^~~~
     34./span.h:18:7: note:   no known conversion for argument 1 from Span<char> to const Span<const char>&
     35./span.h:18:7: note: candidate: constexpr Span<const char>& Span<const char>::operator=(Span<const char>&&)
     36./span.h:18:7: note:   no known conversion for argument 1 from Span<char> to Span<const char>&&
     37test/util_tests.cpp:1886:24: error: no match for operator= (operand types are Span<const char> and Span<char>)
     38 1886 |     sp = MakeSpan(input);
     39      |                        ^
     40In file included from ./serialize.h:25,
     41                 from ./hash.h:13,
     42                 from test/util_tests.cpp:8:
     43./span.h:18:7: note: candidate: constexpr Span<const char>& Span<const char>::operator=(const Span<const char>&)
     44   18 | class Span
     45      |       ^~~~
     46./span.h:18:7: note:   no known conversion for argument 1 from Span<char> to const Span<const char>&
     47./span.h:18:7: note: candidate: constexpr Span<const char>& Span<const char>::operator=(Span<const char>&&)
     48./span.h:18:7: note:   no known conversion for argument 1 from Span<char> to Span<const char>&&
     49test/util_tests.cpp:1892:24: error: no match for operator= (operand types are Span<const char> and Span<char>)
     50 1892 |     sp = MakeSpan(input);
     51      |                        ^
     52In file included from ./serialize.h:25,
     53                 from ./hash.h:13,
     54                 from test/util_tests.cpp:8:
     55./span.h:18:7: note: candidate: constexpr Span<const char>& Span<const char>::operator=(const Span<const char>&)
     56   18 | class Span
     57      |       ^~~~
     58./span.h:18:7: note:   no known conversion for argument 1 from Span<char> to const Span<const char>&
     59./span.h:18:7: note: candidate: constexpr Span<const char>& Span<const char>::operator=(Span<const char>&&)
     60./span.h:18:7: note:   no known conversion for argument 1 from Span<char> to Span<const char>&&
     61test/util_tests.cpp:1898:24: error: no match for operator= (operand types are Span<const char> and Span<char>)
     62 1898 |     sp = MakeSpan(input);
     63      |                        ^
     64In file included from ./serialize.h:25,
     65                 from ./hash.h:13,
     66                 from test/util_tests.cpp:8:
     67./span.h:18:7: note: candidate: constexpr Span<const char>& Span<const char>::operator=(const Span<const char>&)
     68   18 | class Span
     69      |       ^~~~
     70./span.h:18:7: note:   no known conversion for argument 1 from Span<char> to const Span<const char>&
     71./span.h:18:7: note: candidate: constexpr Span<const char>& Span<const char>::operator=(Span<const char>&&)
     72./span.h:18:7: note:   no known conversion for argument 1 from Span<char> to Span<const char>&&
     73test/util_tests.cpp:1904:24: error: no match for operator= (operand types are Span<const char> and Span<char>)
     74 1904 |     sp = MakeSpan(input);
     75      |                        ^
     76In file included from ./serialize.h:25,
     77                 from ./hash.h:13,
     78                 from test/util_tests.cpp:8:
     79./span.h:18:7: note: candidate: constexpr Span<const char>& Span<const char>::operator=(const Span<const char>&)
     80   18 | class Span
     81      |       ^~~~
     82./span.h:18:7: note:   no known conversion for argument 1 from Span<char> to const Span<const char>&
     83./span.h:18:7: note: candidate: constexpr Span<const char>& Span<const char>::operator=(Span<const char>&&)
     84./span.h:18:7: note:   no known conversion for argument 1 from Span<char> to Span<const char>&&
     85test/util_tests.cpp:1913:29: error: invalid initialization of reference of type const Span<const char>& from expression of type Span<char>
     86 1913 |     results = Split(MakeSpan(input), 'x');
     87      |                     ~~~~~~~~^~~~~~~
     88In file included from test/util_tests.cpp:20:
     89./util/spanparsing.h:46:61: note: in passing argument 1 of std::vector<Span<const char> > spanparsing::Split(const Span<const char>&, char)
     90   46 | std::vector<Span<const char>> Split(const Span<const char>& sp, char sep);
     91      |                                     ~~~~~~~~~~~~~~~~~~~~~~~~^~
     92test/util_tests.cpp:1921:29: error: invalid initialization of reference of type const Span<const char>& from expression of type Span<char>
     93 1921 |     results = Split(MakeSpan(input), '-');
     94      |                     ~~~~~~~~^~~~~~~
     95In file included from test/util_tests.cpp:20:
     96./util/spanparsing.h:46:61: note: in passing argument 1 of std::vector<Span<const char> > spanparsing::Split(const Span<const char>&, char)
     97   46 | std::vector<Span<const char>> Split(const Span<const char>& sp, char sep);
     98      |                                     ~~~~~~~~~~~~~~~~~~~~~~~~^~
     99test/util_tests.cpp:1926:29: error: invalid initialization of reference of type const Span<const char>& from expression of type Span<char>
    100 1926 |     results = Split(MakeSpan(input), '#');
    101      |                     ~~~~~~~~^~~~~~~
    102In file included from test/util_tests.cpp:20:
    103./util/spanparsing.h:46:61: note: in passing argument 1 of std::vector<Span<const char> > spanparsing::Split(const Span<const char>&, char)
    104   46 | std::vector<Span<const char>> Split(const Span<const char>& sp, char sep);
    105      |                                     ~~~~~~~~~~~~~~~~~~~~~~~~^~
    106test/util_tests.cpp:1933:29: error: invalid initialization of reference of type const Span<const char>& from expression of type Span<char>
    107 1933 |     results = Split(MakeSpan(input), '*');
    108      |                     ~~~~~~~~^~~~~~~
    109In file included from test/util_tests.cpp:20:
    110./util/spanparsing.h:46:61: note: in passing argument 1 of std::vector<Span<const char> > spanparsing::Split(const Span<const char>&, char)
    111   46 | std::vector<Span<const char>> Split(const Span<const char>& sp, char sep);
    
  25. practicalswift commented at 6:13 pm on April 26, 2020: contributor
    Tested ACK c31cbe7cfefc18123eb85ffb2ce509748435efde
  26. laanwj merged this on Apr 30, 2020
  27. laanwj closed this on Apr 30, 2020

  28. sidhujag referenced this in commit c3bc34f50a on May 2, 2020
  29. laanwj referenced this in commit b8740d6737 on Jun 18, 2020
  30. sidhujag referenced this in commit fe4d13dfc7 on Jul 7, 2020
  31. jasonbcox referenced this in commit 1541dc4c01 on Nov 23, 2020
  32. MarkLTZ referenced this in commit 9cfc8e5837 on Feb 16, 2021
  33. kittywhiskers referenced this in commit f073ad5f79 on Mar 10, 2021
  34. kittywhiskers referenced this in commit 5ead9dfbb1 on Mar 10, 2021
  35. kittywhiskers referenced this in commit 0a670fdbe9 on Mar 10, 2021
  36. kittywhiskers referenced this in commit 673bc5507d on Mar 23, 2021
  37. kittywhiskers referenced this in commit ea92b5adf1 on Mar 23, 2021
  38. kittywhiskers referenced this in commit 0f4d00adfd on Mar 23, 2021
  39. kittywhiskers referenced this in commit 64c3ab05ab on Mar 23, 2021
  40. ftrader referenced this in commit 195296fe20 on Apr 14, 2021
  41. kittywhiskers referenced this in commit fdb4b2a303 on Apr 18, 2021
  42. kittywhiskers referenced this in commit de0af7b7b3 on Apr 23, 2021
  43. UdjinM6 referenced this in commit bf01ed7881 on Apr 27, 2021
  44. cculianu referenced this in commit 48683ee392 on May 7, 2021
  45. random-zebra referenced this in commit 56f10aaa51 on Jul 21, 2021
  46. random-zebra referenced this in commit b4751e10ce on Aug 11, 2021
  47. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-18 18:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me