Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: Priit on August 03, 2005, 06:59:52 pm

Title: View all compiler commands
Post by: Priit on August 03, 2005, 06:59:52 pm
Is there a 'box' where are listed all commands (CFLAGS when using gcc) that will be passed to compiler?

Using CB 1.0RC1-1 and Windows xp sp2
Title: Re: View all compiler commands
Post by: rickg22 on August 03, 2005, 07:04:27 pm
Yes, in compiler settings, advanced options, "show full command line" (it's in a combobox)
Title: Re: View all compiler commands
Post by: Priit on August 03, 2005, 07:23:40 pm
Yes, in compiler settings, advanced options, "show full command line" (it's in a combobox)

I knew that one. But i see these command when i am already compiling my project. I want to see them before.

And when i mark new compiler flag (for example strip executable), then it would be nice when -s appears in the 'box' in addition previous flags.

Like MSVC6 has/had.



Not from english speaking country :D
Title: Re: View all compiler commands
Post by: rickg22 on August 03, 2005, 07:54:49 pm
Hmmm mind providing us with some screenshots telling us exactly what is what you want to see?

Thanks.
Title: Re: View all compiler commands
Post by: Priit on August 03, 2005, 08:19:17 pm
http://www-nc.troja.mff.cuni.cz/~kodys/Work/Utils/CPPNewProj4.GIF

MSVC6. There is a 'box' (Project options) what i would like to see in CB too.
Title: Re: View all compiler commands
Post by: rickg22 on August 03, 2005, 08:49:32 pm
AHHHH so you want a visible rendering of the options you clicked, right?

(Just curious, why do you use it for?)
Title: Re: View all compiler commands
Post by: Priit on August 03, 2005, 10:12:09 pm
AHHHH so you want a visible rendering of the options you clicked, right?

(Just curious, why do you use it for?)

It helps to learn different compilers (digitalmars, mingw,  ms toolkit etc).
Sometimes i know a command i want to use...so instead spending time selecting/finding right line to check, i add it manually.
Sometimes i wan't to remove specific commandline option (the one i know)....so again it is easier to remove it manually.
.
.
.


I think it makes CB a better IDE :P


Title: Re: View all compiler commands
Post by: rickg22 on August 03, 2005, 11:01:49 pm
Hmmm.... so it's not just a display thing, you want to edit ALL the compiler flags manually.

Well um, there IS such an option. It's called "other options". Options are one per line (I think... I never asked Yiannis how that one works).
Title: Re: View all compiler commands
Post by: Priit on August 04, 2005, 08:42:44 am
Hmmm.... so it's not just a display thing, you want to edit ALL the compiler flags manually.

yes.
I want them to be linked with compiler flags tab. When i change something in one tab(compiler flags for example), then i see flags changed immediately in Other options tab and vice versa.


Well um, there IS such an option. It's called "other options". Options are one per line (I think... I never asked Yiannis how that one works).


Project-Build options-Other options tab....is that it?
If it is, then all i see is an empty box although i have marked some options in Compiler Flags tab :(
Title: Re: View all compiler commands
Post by: thomas on August 04, 2005, 09:15:39 am
That is because these are the "other" options. "Other" in the sense of "additional".
Whatever you enter in that box is concatenated to the compiler options that are generated by the checkboxes above. The two are *not* linked.
If one wants to make sure the exact options that are used, one can skip the buttons alltogether (or, you can give a few switches for sure, it does no harm. The last switch, in this case the one you type in, is always the one that counts. Thus, for example -O -O3 will be -O3.)
Like rickg22 said, the complete list is displayed with the full command line when compiling.
Title: Re: View all compiler commands
Post by: tiwag on August 04, 2005, 09:26:05 am
Hmmm.... so it's not just a display thing, you want to edit ALL the compiler flags manually.
yes.
I want them to be linked with compiler flags tab. When i change something in one tab(compiler flags for example), then i see flags changed immediately in Other options tab and vice versa.
That's a good idea, i second that- in the past i also wished to have at least a window what shows me the actually selected compiler & linker options

Well um, there IS such an option. It's called "other options". Options are one per line (I think... I never asked Yiannis how that one works).
unfortunately it is NOT exactly this,
because "Other-options" shows only options which are not covered by the already implemented options from the "Compiler flags" checkbox-list
as the name says exactly it shows - OTHER OPTIONS !
- and you are right, options are one by line

general comment:
the bad thing is - if you put an entry of an already implemented option manually in the "Other-options" list, it will be thrown away !!!
 - this behaviour should really be improved i think.
a simple improvement would be to write the actually used commandline-switch into the "Compiler flags" checkbox-list text-description.
Title: Re: View all compiler commands
Post by: thomas on August 04, 2005, 09:43:05 am
general comment:
the bad thing is - if you put an entry of an already implemented option manually in the "Other-options" list, it will be thrown away !!!
Hmm... they're not precisely thrown away. What is done is that redundant entries are listed exactly once, which I think is pretty cool actually.

EDIT:
Getting back to the original question, this kind of "box" will probably be rather hard to implement. It is possible, without any doubt, but maybe the amount of work does not correlate to the benefit in this case?

What Priit asked for, if I am not mistaken, is a textedit field which receives events from the ckecklistbox and inserts text fragments accordingly, however still generates no redundant entries, and, at the same time parses input as you type, and sends events back to the checklistbox. That is already quite a lot to deal with to only support one compiler. Note that code::blocks can handle any number of compilers, so things get a lot more complicated (or must be farther abstracted).
Title: Re: View all compiler commands
Post by: tiwag on August 04, 2005, 10:07:26 am
general comment:
the bad thing is - if you put an entry of an already implemented option manually in the "Other-options" list, it will be thrown away !!!
Hmm... they're not precisely thrown away. What is done is that redundant entries are listed exactly once, which I think is pretty cool actually.

That's what i've done in the past (before CB RC1) too, i wrote all options to the "Other options" list and they got saved to the *.cbp and
parsed and shown in the "Compiler Flags" checkbox-list afterwards.

That behaviour seems to be changed in the latest CB-cvs HEAD version - now they are thrown away as i described it.

@thomas
have you tried it with the latest RC1 ?
Title: Re: View all compiler commands
Post by: thomas on August 04, 2005, 10:09:42 am
RC1, yes.

On first compile, the options are set twice, and on saving the project, only the checklistbox stays activated, the redundant one is eleminated.
Title: Re: View all compiler commands
Post by: tiwag on August 04, 2005, 10:17:41 am
RC1, yes.

On first compile, the options are set twice, and on saving the project, only the checklistbox stays activated, the redundant one is eleminated.

try the following:
1) create a new console application project using gcc and compile it.

2) then save, close and reopen the project,

3) add optimizing switches
Code
-Os
-O1

to "Other options"

4) and save, close and reopen the project,

5) Do you find the optimizing switches anywhere ?

here by me they are thrown away,
the only possibility to set them is with the "Compiler Flags" checkbox-list.

thanks
Title: Re: View all compiler commands
Post by: thomas on August 04, 2005, 10:51:25 am
Same command line every time:
Code
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   
Title: Re: View all compiler commands
Post by: tiwag on August 04, 2005, 11:08:45 am
Same command line every time:

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


1) when i try this after i've removed all switches, it compiles with
Code
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
-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
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
src\plugins\compilergcc\compileroptionsdlg.cpp
void CompilerOptionsDlg::OptionsToText()

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

thanks
Title: Re: View all compiler commands
Post by: 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
(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
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
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 :)
Title: Re: View all compiler commands
Post by: tiwag on August 07, 2005, 02:57:48 pm
Ah, I think I found the cause.

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

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

btw that's the workaround for what i've looked - thanks  8)
Title: Re: View all compiler commands
Post by: grv575 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...
Title: Re: View all compiler commands
Post by: tiwag 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...