News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

View all compiler commands

Started by Priit, August 03, 2005, 06:59:52 PM

Previous topic - Next topic

thomas

Same command line every time:

Switching to target: default
mingw32-g++.exe   -Os -O  -march=i686    -IC:\MinGW\include -IC:\MinGW\include\wx -IC:\MinGW\include\codeblocks -IC:\MinGW\include\wx\msw -c main.cpp -o .objs\main.o
mingw32-g++.exe    -LC:\CodeBlocks\lib -LC:\CodeBlocks -LC:\MinGW\lib -o D:\repos\d\console.exe .objs\main.o      -luuid -lwsock32 -lole32 -lgdi32 -lkernel32 -luser32   
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

tiwag

Quote from: thomas on August 04, 2005, 10:51:25 AM
Same command line every time:

can you please try to add to "Other options"
-Os
-O1

after you have removed all compiler switches


1) when i try this after i've removed all switches, it compiles with
Project   : Console application
Compiler  : GNU GCC Compiler (called directly)
Directory : D:\cpp\_projects\CodeBlocks\TESTS\
--------------------------------------------------------------------------------
Switching to target: default
mingw32-gcc.exe       -c main.c -o .objs\main.o
mingw32-g++.exe    -o D:\cpp\_projects\CodeBlocks\TESTS\test_options.exe .objs\main.o       
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings


2) then i add to "Other optios"
-Os
-O1

and result is same as above

3) then check within "Compiler Flags"

x Optimize more (for speed)
x Optimize generated code (for size)

and now the two switches -Os and -O1 are got added

Project   : Console application
Compiler  : GNU GCC Compiler (called directly)
Directory : D:\cpp\_projects\CodeBlocks\TESTS\
--------------------------------------------------------------------------------
Switching to target: default
mingw32-gcc.exe   -Os -O1     -c main.c -o .objs\main.o
mingw32-g++.exe    -o D:\cpp\_projects\CodeBlocks\TESTS\test_options.exe .objs\main.o       
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings


i can't believe that CB behaves in an other way by you,
i checked the code in

src\plugins\compilergcc\compileroptionsdlg.cpp
void CompilerOptionsDlg::OptionsToText()


and it didn't change from RC1 to HEAD (3.8.05)

thanks

thomas

#17
Ah, I think I found the cause.

You wrote your switches line by line:
-Os
-O1


I wrote them like I would do on the commandline:
-Os -O1
(did use -O instead of -O1 the first time, but it matters not, same result).

The line break in between seems insignificant, but that is what makes the difference, the former strips off *everything* whether you enable checkboxes or not, and the latter runs as:
Switching to target: default
mingw32-g++.exe   -Os -O1 -Os -O1  -D__GNUWIN32__ -DWXUSINGDLL -DBUILDING_PLUGIN    -IC:\MinGW\include -IC:\MinGW\include\codeblocks -IC:\MinGW\include\wx -IC:\MinGW\include\tinyxml -IC:\MinGW\include\GL -c main.cpp -o .objs\main.o
mingw32-g++.exe    -LC:\CodeBlocks -LC:\CodeBlocks\lib -o D:\Desktop\asasaas\console.exe .objs\main.o      -s    -lcodeblocks -lwxmsw242 -lcodeblocks -lwxmsw242
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings


CompilerOptionsDlg::DoGetCompileOptions()  in plugins\compilergcc\compileroptionsdlg.cpp does a lot of work to break the textcontrol's contents into a wxArrayString. Does not make sense to me personally, but there is certainly a good reasoning for that (is array.Clear(); intentional?).
If it were me, I would not care to do such an awful lot with manual options, instead I would do something like this:

compileroptions = DoGetAllCheckBoxOptionsFirst();
tmp = extraOptionsControl->GetValue();
tmp.Replace("\n", " ");
tmp.Replace("\r", " ");
tmp = " " + tmp + " ";
compileroptions.Add(tmp);


That way, the user could use the checkboxes as he likes and can add anything that supersedes these settings under "additional options". Everything is passed as one single option, but the compiler does not know, anyway :)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

tiwag

Quote from: thomas on August 06, 2005, 02:24:43 PM
Ah, I think I found the cause.

You wrote your switches line by line:
-Os
-O1


I wrote them like I would do on the commandline:
-Os -O1

btw that's the workaround for what i've looked - thanks  8)

grv575

Wouldn't that be buggy behavior?  The default options under other options for some project targets is stuff like
-fno-exceptions
-Dblah
etc

all one per line.  And these seem to work as expected...

tiwag

#20
Quote from: grv575 on August 09, 2005, 07:43:39 AM
Wouldn't that be buggy behavior?...
yes, the workaround works around the bug ... :)
till the bug will be fixed.

it's not worth now to fix it, because it doesn't harm as it is now
and the compiler-plugins will be completely overworked in near future...