A quick test showed that the code actually does quote paths with spaces.
This leads me to believe that you have setup a global (or user) variable for C::B SDK, i.e.
CB_SDK=C:\Documents and Settings\yop\My Documents\Workbench\codeblocks\src
So this is actually expanded without quotes...
Is this the case?
One part of the optimizations, has to do with macro expansion being performed just once, after the command-line has been generated. This would explain the change of behaviour.
Have you tried quotting the variable's value?