Author Topic: View all compiler commands  (Read 19227 times)

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: View all compiler commands
« Reply #15 on: August 04, 2005, 10:51:25 am »
Same command line every time:
Code: [Select]
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."

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: View all compiler commands
« Reply #16 on: August 04, 2005, 11:08:45 am »
Same command line every time:

can you please try to add to "Other options"
Code: [Select]
-Os
-O1
after you have removed all compiler switches


1) when i try this after i've removed all switches, it compiles with
Code: [Select]
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"
Code: [Select]
-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
 
Code: [Select]
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

Code: [Select]
src\plugins\compilergcc\compileroptionsdlg.cpp
void CompilerOptionsDlg::OptionsToText()

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

thanks

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: View all compiler commands
« Reply #17 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
(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:
Code: [Select]
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:
Code: [Select]
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 :)
« Last Edit: August 06, 2005, 02:28:37 pm by thomas »
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: View all compiler commands
« Reply #18 on: August 07, 2005, 02:57:48 pm »
Ah, I think I found the cause.

You wrote your switches line by line:
Code: [Select]
-Os
-O1

I wrote them like I would do on the commandline:
Code: [Select]
-Os -O1

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

Offline grv575

  • Official tester
  • Regular
  • ***
  • Posts: 381
Re: View all compiler commands
« Reply #19 on: August 09, 2005, 07:43:39 am »
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...

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: View all compiler commands
« Reply #20 on: August 09, 2005, 07:54:50 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...
« Last Edit: August 09, 2005, 07:58:19 am by tiwag »