LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-14-2007, 02:06 AM   #1
George2
Member
 
Registered: Oct 2003
Posts: 354

Rep: Reputation: 30
gcc -E -dM/-dD


Hello everyone,


I am learning some other's code -- build files. Here are two samples which I am confused.

gcc -E -o ListDef -dM -P YourSrcCode.c

gcc -E -o ListDef -dD -P YourSrcCode.c

I have tried that in ListDef file (new generated after either of the two commands) and it contains several hundred lines of #define, typedef and some other definitions. Could anyone help to answer what is the function of the two commands? Differences between -dM and -dD?


thanks in advance,
George
 
Old 10-14-2007, 06:59 AM   #2
reverse
Member
 
Registered: Apr 2007
Distribution: Gentoo
Posts: 337

Rep: Reputation: 30
`man gcc` explains all the options used.

You're welcome, in advance.
 
Old 10-14-2007, 09:25 AM   #3
George2
Member
 
Registered: Oct 2003
Posts: 354

Original Poster
Rep: Reputation: 30
Thanks reverse,


Quote:
Originally Posted by reverse View Post
`man gcc` explains all the options used.

You're welcome, in advance.
I have read the gcc PDF manual and also tried by myself. I can not fully understand in what situation do we need -dM and in what situation do we need -dD. Any experiences?


regards,
George
 
Old 10-14-2007, 10:17 AM   #4
Alien_Hominid
Senior Member
 
Registered: Oct 2005
Location: Lithuania
Distribution: Hybrid
Posts: 2,247

Rep: Reputation: 53
dD - Dump all macro definitions, at the end of preprocessing, in addition to normal output.
dM - Dump after performing the machine dependent reorganization pass, to file.35.mach.
 
Old 10-15-2007, 09:37 AM   #5
George2
Member
 
Registered: Oct 2003
Posts: 354

Original Poster
Rep: Reputation: 30
Thanks Alien_Hominid,


Quote:
Originally Posted by Alien_Hominid View Post
dD - Dump all macro definitions, at the end of preprocessing, in addition to normal output.
dM - Dump after performing the machine dependent reorganization pass, to file.35.mach.
So, using -dM is more accurate to real preprocessor work? (since you mentioned it also performed machine dependent reorganization pass)?


regards,
George
 
Old 10-15-2007, 02:31 PM   #6
Alien_Hominid
Senior Member
 
Registered: Oct 2005
Location: Lithuania
Distribution: Hybrid
Posts: 2,247

Rep: Reputation: 53
Those are used only for debugging the compiler.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Tools: GCC 3.4.6, Final GCC 3 Release LXer Syndicated Linux News 0 05-30-2006 02:21 AM
gcc wont install, 'failed dependencies: glibc-devel is needed by gcc-3.3.3-41' TdlSnare SUSE / openSUSE 3 11-29-2004 02:13 PM
Kernel compiling: gcc-3.3 is 586, should be gcc-3.3 386 Erik Plaggenmar Linux - Software 0 10-01-2004 11:38 AM
a doubt with host gcc and arm-linux-gcc renjithgopal Linux - General 1 09-11-2003 04:02 PM
export CC=/usr/bin/gcc-3.2 - switch gcc version? ferreter Linux - Software 1 08-20-2003 12:07 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration