Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: ollydbg on January 28, 2026, 06:43:08 am

Title: special handling of the macro replacement ""?
Post by: ollydbg on January 28, 2026, 06:43:08 am
Hi, when I'm using the gd_on's unified workspace/code::blocks cbp files, I see something strange.

See here: it looks like GCC works OK, but GDB failed to find the dll(setting wrong PATH)

Re: crash when I try to open a wxsmith file under C::B against wx 3.3.1 (https://forums.codeblocks.org/index.php/topic,26232.msg178330.html#msg178330)

If a variable a has a filed name b, and its value is
Code
""
, and if we have
Code
AAA$(#a.b)
, we will finally get
Code
AAA""

The current implementation treats an empty string "" as a valid value and performs the replacement, resulting in
Code
AAA""
instead of the expected
Code
AAA
.

I'd like to see your options on this issue.

Thanks.
Title: Re: special handling of the macro replacement ""?
Post by: AndrewCot on January 28, 2026, 09:21:14 am
Make sure you get approval by MortenMacFlybefore making any changes. Check out the SF tickets for posts on macro and hopefully you will fins the ticket and have a read before you spend time on this as you may end up wasting your time.
BTW I agree with you.
Title: Re: special handling of the macro replacement ""?
Post by: ollydbg on January 28, 2026, 09:33:30 am
Make sure you get approval by MortenMacFlybefore making any changes. Check out the SF tickets for posts on macro and hopefully you will fins the ticket and have a read before you spend time on this as you may end up wasting your time.
BTW I agree with you.

Hi, AndrewCot,  long time no see.
I think it is a good direction.
Maybe there are similar topics in the sourceforge tickets.
So I will search for that.

To switch between the debug version of wx library,  using the unified workspace or cbp project is much easier.  We don't need to replace or editor each cbp files.


Title: Re: special handling of the macro replacement ""?
Post by: gd_on on January 28, 2026, 05:54:21 pm
To add some informations:
In standard cbp files, there is an environment variable defined as:
Code
<Variable name="WX_CFG" value="" />
When it is used in standard cbp files, as:
Code
<Add directory="$(#wx33_64.lib)/gcc_dll$(WX_CFG)
there are no problems.

In my unified workspace/cbp files, I define a wxwidgets path as, in my case, C:\wxWidgets-3.3.1 as the base, and in a user-defined field, I have created a wx_cfg variable. If I set this variable with nothing (an empty field), the variable is eliminated after a click on the save button. It's why, as in standard cbp files, I tried to set an empty string by "". Apparently, this is the problem described by ollydbg when I use a variable as:
Code
<Add directory="$(#WXWIDGETS)/lib/gcc_dll$(#WXWIDGETS.WX_CFG)
Title: Re: special handling of the macro replacement ""?
Post by: ollydbg on January 29, 2026, 04:10:26 am
I did some test, and if the empty value key is allowed to add in the global compiler variable, the result may be that there are a lot of predefined keys saved to the config file, for example, see below:

Code
		<sets>
<default>
<cccccc>
<DDD>
<str>
<![CDATA[]]>
</str>
</DDD>
<BBB>
<str>
<![CDATA[xxx]]>
</str>
</BBB>
<CFLAGS>
<str>
<![CDATA[]]>
</str>
</CFLAGS>
<BIN>
<str>
<![CDATA[]]>
</str>
</BIN>
<LFLAGS>
<str>
<![CDATA[]]>
</str>
</LFLAGS>
<OBJ>
<str>
<![CDATA[]]>
</str>
</OBJ>
<LIB>
<str>
<![CDATA[]]>
</str>
</LIB>
<INCLUDE>
<str>
<![CDATA[]]>
</str>
</INCLUDE>
<BASE>
<str>
<![CDATA[aaaa]]>
</str>
</BASE>
</cccccc>

You can see, I don't want to do that DDD is a user defined key, and its value is empty. While the CFLAGS is predefined key, and its value is also empty.

So, I think the solution is: using the predefined value string, for example, a value named: __EMPTY__ or just an empty string "", then in the code when we get the value, we have to check the result, and remove the __EMPTY__ or "" in the command line.

Title: Re: special handling of the macro replacement ""?
Post by: ollydbg on January 29, 2026, 04:53:05 am
Oh, I change the mind, it looks like this patch should solve the issue, see here:

* sdk: try to handle empty valued members in global compiler variable (https://github.com/asmwarrior/codeblocks_sfmirror/commit/499288dbed2a588873b80e7a058ee273848f3292)
Title: Re: special handling of the macro replacement ""?
Post by: AndrewCot on January 30, 2026, 10:41:01 am
Have a look at https://sourceforge.net/p/codeblocks/tickets/1188/ .....
Title: Re: special handling of the macro replacement ""?
Post by: ollydbg on January 30, 2026, 10:53:50 am
Have a look at https://sourceforge.net/p/codeblocks/tickets/1188/ .....

I looked at your patch file in the above link, it is a bit complex, I think my patch is much simple, we can just leave the gcd variable as empty.
Title: Re: special handling of the macro replacement ""?
Post by: ollydbg on February 13, 2026, 03:43:20 pm
Committed in r13786.

I think supporting the unified cbp file is an important feature.
Title: Re: special handling of the macro replacement ""?
Post by: ollydbg on February 21, 2026, 04:17:30 am
Hi, gd_on, I am grad to see this commit, great!

Adjustments in doc after svn 13786 gerard-durand/codeblocks_gd_cbps@adc256b (https://github.com/gerard-durand/codeblocks_gd_cbps/commit/adc256b99ba636ebc99cec49ae650e3eaf89053f)
Title: Re: special handling of the macro replacement ""?
Post by: Wkerry on February 21, 2026, 06:57:43 am
Any chance of moving to a commons CBP set for each environment to save allot of file and then duplication etc when a new WxWidget version comes out.
The file in https://github.com/gerard-durand/codeblocks_gd_cbps/tree/master/src look like they have solved this for windows only.
Title: Re: special handling of the macro replacement ""?
Post by: Wkerry on February 24, 2026, 11:10:52 am
Any chance of getting the following in once update to make the cbp's consistent as this will also reduce the cbp quantity?
     https://github.com/stahta01/CodeBlocks_Unofficial_Testing/blob/master/src/CodeBlocks_Unix_MacOS.cbp

Any chance for noobs for the following?
   https://github.com/stahta01/CodeBlocks_Unofficial_Testing/blob/master/src/CodeBlocks_Windows_MSYS2.cbp
Title: Re: special handling of the macro replacement ""?
Post by: ollydbg on February 24, 2026, 02:01:03 pm
Any chance for noobs for the following?
   https://github.com/stahta01/CodeBlocks_Unofficial_Testing/blob/master/src/CodeBlocks_Windows_MSYS2.cbp

If I remember correctly. the msys2's wx library is shared library, so it has many separate libraries. I'm not sure it is easy to add to gd_on's cbp.