Author Topic: Change to C++17?  (Read 216 times)

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1916
Change to C++17?
« on: Today at 02:04:03 pm »
There is an updated version of astyle library (3.6.18) that fixes some issues (see ticket 1643, but it uses the stupid C++17-only std::string_view and we currently are using C++11.

There is also some C++17-only code, like [fallthrough] in clangd_client, generating warnings.

Should we change to C++17?

Offline LETARTARE

  • Lives here!
  • ****
  • Posts: 604
  • L'ami de l'homme. The friend of man.
    • LETARTARE
Re: Change to C++17?
« Reply #1 on: Today at 03:03:09 pm »
Have you tried to compile the full version with C++17 (Win-xx, Linux-xx) ?
If so, what warnings have you obtained ?
CB-14011, plugins-sdk-2.26.0 : Collector-2.6.5, AddOnForQt-5.1.2
1- Win7 Business Pack1 64bits : wx-3.2.8, gcc-15.2.0,
2- OpenSuse::Leap-15.6-64bits : wx-3.2.8;gtk3-u, gcc-15.2.0,
=> !! The messages are translated by 'Deepl'

Offline LETARTARE

  • Lives here!
  • ****
  • Posts: 604
  • L'ami de l'homme. The friend of man.
    • LETARTARE
Re: Change to C++17?
« Reply #2 on: Today at 03:18:30 pm »
Leap-15.6-64bits, wx-3.2.8;gtk3-u, gc-15.2
'r14003.cbp' ( no 'contrib' )
Here is the compilation log with 'C++17' :
CB-14011, plugins-sdk-2.26.0 : Collector-2.6.5, AddOnForQt-5.1.2
1- Win7 Business Pack1 64bits : wx-3.2.8, gcc-15.2.0,
2- OpenSuse::Leap-15.6-64bits : wx-3.2.8;gtk3-u, gcc-15.2.0,
=> !! The messages are translated by 'Deepl'

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1916
Re: Change to C++17?
« Reply #3 on: Today at 04:38:02 pm »
Quote
Have you tried to compile the full version with C++17

I have not tried, developers must agree on the change beforehand. Changing the CBP is easy, the problem may come later from autotools.

Errors in Squirrel can be fixed, but it uses tricky memory accesses that may be a headache.

Offline gd_on

  • Lives here!
  • ****
  • Posts: 865
Re: Change to C++17?
« Reply #4 on: Today at 05:49:27 pm »
Just to inform you that with my CodeBlocks_Windows.workspace, and setting my global variable cb_build.cpp_std to gnu++20, codeblocks compiles correctly as far as I have tested. Of course, this does not cover all build methods.
Windows 11 64 bits (25H2), svn C::B (last version or almost!), wxWidgets 3.3.3, Msys2 Compilers 16.2.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

Offline christo

  • Developer
  • Multiple posting newcomer
  • *****
  • Posts: 90
Re: Change to C++17?
« Reply #5 on: Today at 06:50:06 pm »
Hi Miguel,

I've been using c++20 for a long time without any issues in my custom branch's  autotools build on ubuntu. I think we can upgrade to c++20 directly.

For autotools, following change should be sufficient : https://github.com/josephch/codeblocks/commit/c56d5feaf0ce0c5d511263d1fba29e3713af68e2

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2973
Re: Change to C++17?
« Reply #6 on: Today at 06:51:50 pm »
I use wx2.3.8 and wx3.3.3 for CodeBlocks (all compiled at c++20) every day.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1916
Re: Change to C++17?
« Reply #7 on: Today at 07:02:09 pm »
Should we use gnu++20 or plain c++20?

Offline christo

  • Developer
  • Multiple posting newcomer
  • *****
  • Posts: 90
Re: Change to C++17?
« Reply #8 on: Today at 07:17:29 pm »
I think plain c++20 should be okay as we do not use any gnu specific extensions.

Regarding squirrel warnings, looks like it is fixed upstream by casting : https://github.com/albertodemichelis/squirrel/commit/6ad6f6427157757c4431907dde0a1e5712a5cf67

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7834
    • My Best Post
Re: Change to C++17?
« Reply #9 on: Today at 07:50:38 pm »
Remember to update the file from "https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html" in the "m4" folder.

The link above did not work searching found this link "https://github.com/autoconf-archive/autoconf-archive/blob/master/m4/ax_cxx_compile_stdcxx.m4"

« Last Edit: Today at 07:53:04 pm by stahta01 »
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5583
Re: Change to C++17?
« Reply #10 on: Today at 08:07:09 pm »
I am building the nightlies for a few weeks (?months) with -std=c++23.

I would suggest to step up to 23, and let's avoid extension, so I would suggest not to use 'gnu++xx'.

What do you think ?