News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Observations on using CodeBlocks_wx33_64.cbp and friends

Started by everSome, August 20, 2025, 09:23:52 PM

Previous topic - Next topic

everSome

I've generalized my version of the *_wx33_64.cbp files to the form used in src/CodeBlocks_wx33_64.cbp where in the project wide compiler options begin with

<Add option="-Wall" />
<Add option="-m64" />
<Add option="$(#CB_RELEASE_TYPE)" />
with one caveat. I removed the option
<Add option="$(#CB_CPP_STD)" />
from all the target compiler option lists and moved it into the Project compiler list so that I now use the combination:
<Add option="-Wall" />
<Add option="-m64" />
<Add option="$(#CB_CPP_STD)" />
<Add option="$(#CB_RELEASE_TYPE)" />

Doing it this way allows one to define CB_CPP_STD as "-std=gnu17 -std=gnu++20". This works when using a variant of CompilerMINGW as it uses the specifications CFlags and CPPFlags in
src\plugins\compilergcc\resources\compilers\options_common_sort.xml
to determine what is inappropriate for C or C++ compilations.

The current lists therein are sufficient for distinguishing where it is
appropriate to use "-std=gnu17" versus "-std=gnu++20".

Nonetheless, these CFlags and CPPFlags specs could use a minor update. Seems both gcc and clang support the new CFlags, but of the as yet future C++ standard, g++ uses std=c++26 -std=gnu++26 where clang++ uses -std=c++2c -std=gnu++2c
diff -r 332d682e3f78 -r ad163b81827c src/plugins/compilergcc/resources/compilers/options_common_sort.xml
--- a/src/plugins/compilergcc/resources/compilers/options_common_sort.xml       Sat Aug 16 07:44:16 2025 -0700
+++ b/src/plugins/compilergcc/resources/compilers/options_common_sort.xml       Sat Aug 16 07:47:40 2025 -0700
@@ -3,10 +3,10 @@
<CodeBlocks_compiler_options>
     <Sort CFlags="-std=c89 -std=gnu89 -std=c90 -std=gnu90 -std=iso9899:1990 -std=iso9899:1994
                   -std=c99 -std=gnu99 -std=iso9899:1999 -std=c11 -std=gnu11 -std=iso9899:2011
-                  -std=c17 -std=iso9899:2017"/>
+                  -std=c17 -std=gnu17 -std=iso9899:2017 -std=c23 -std=gnu23 -std=c2y -std=gnu2y" />
     <Sort CPPFlags="-std=c++98 -std=gnu++98 -std=c++03 -std=gnu++03 -std=c++11 -std=gnu++11
                     -std=c++14 -std=gnu++14 -std=c++17 -std=gnu++17 -std=c++20 -std=gnu++20
-                    -std=c++23 -std=gnu++23  std=c++26 -std=gnu++26
+                    -std=c++23 -std=gnu++23  std=c++26 -std=gnu++26 -std=c++2c -std=gnu++2c
                     -static-libstdc++ -shared-libstdc++ -fpermissive -fdeduce-init-list -fcheck-new -fstrict-enums
                     -Weffc++ -Wctor-dtor-privacy -Wdelete-non-virtual-dtor -Wliteral-suffix -Wc++11-compat -Wnoexcept
                     -Wnon-virtual-dtor -Wreorder -Wstrict-null-sentinel -Wno-non-template-friend -Wnon-template-friend

ollydbg

Hi, you mean that you put the option line:


<Add option="$(#CB_CPP_STD)" />


From the target option level to the project option level?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.