* How to start reading gcc source code.
@ 2004-11-28 18:18 hgbasm
2004-11-29 0:47 ` hgbasm
0 siblings, 1 reply; 2+ messages in thread
From: hgbasm @ 2004-11-28 18:18 UTC (permalink / raw)
To: gcc
I have posted my message here:
http://sourceforge.net/forum/forum.php?thread_id=1185705&forum_id=7134
a resposer of the messate
START----------------------------------------------------------------
Hi people.
I will like to know how gcc select the compiler, I can trace a little in
the code, also I need download flex and bison.
I will like to analise the output of the parsing, like I have understand
for this moment the output is a AST, I will like to know how to detect
when the AST is complete and let my analise it, and dont go more far
than that.
Specifically I whant to identify:
structs/unions
typedefs
#defines (and sure almost all the preprocessing done)
and functions
- Actually I can pass the switch -save-temps
And this one show me:
Functions and structures (I am running it in a .h file) I have renamed
the file to extension .cpp, because when I pass the .h warn me about
this...
Anyway, any help posible for undertand the AST, and for stop in this
place for let me analise (or find), or put out the AST, if both are
posible I will like to see the drawbacks...
----------------
Only a final thing, altought not necesary, I will like to know wich file
are part of X pass, for example parsing, generation of AST, generation
of RTL /(IR)?, optimizing, if you know about this, should be nice to
share :D.
Have a nice dy or night.
END-----------------------------------------------------------------------
Anyway I havent specificated that I only whant specially for interfacing
porpuoses , ie, I only whant to process headers files for get:
structs/unions and typedefs, numeric definitions (#define XTHING 3) ,
after I can recognogize that, pheraphs but not necesary, get a list of
functions in each file.
What I whant to do?
I use nasm (not much at all), but if something is left is have a good
and easy to put up to date include files.
A struct like:
struct X{
int a,b;
};
typedef struct X OTHER1, *OTHER2;
should be translated to:
struc X
.a resd
.b resd
endstruc
struc OTHER1
.a resd
.b resd
endstruc
%define OTHER2 dd (because the size of a pointer is double word)
Also I will like at less a little about handle unicode for choice
between A or U
Pheraphs group all the names that are repeated and the only character
that is diferent is the one, and the last should be A or U, then I can
group them.
And do
%if UNICODE
%define MessageBox MessageBoxU
........
%else
%define MessageBox MessageBoxA
......
%endif
I also whant to be distributed, ie not in a single include file, I whant
that for each h file referenced in a file, there would be one in file
produced (for maintaing this a little modularitized).
And that is what I whant to do at the end, a importer of headers
structs, unions, flag defines and prototypes of functions for use them
with nasm, I in fact only whant the info, not whant to generate actually
machine code, optimization, etc, only the declarations.
Like you see I dont whant to go more far (for the moment) than the AST
if Im correct for get this working.
Hope you have understood ;).
Have a nice day or night,
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: How to start reading gcc source code.
2004-11-28 18:18 How to start reading gcc source code hgbasm
@ 2004-11-29 0:47 ` hgbasm
0 siblings, 0 replies; 2+ messages in thread
From: hgbasm @ 2004-11-29 0:47 UTC (permalink / raw)
To: gcc
Hi there people, I beed watching some options, also reading some things,
now I know this:
C:\hgb_Progs\MinGW\include>gcc -c -save-temps -no-integrated-cpp
-aux-info winoutt.txt windows.c
windows.c:16:13: warning: #pragma system_header ignored outside include file
With this are generated the following files:
winoutt.txt => contain the names of a serie of all the functions defined
windows.I => contains typedefs, enums, structs and some lines like:
# 1 "<command line>"
# 1 "windows.c"
# 47 "windows.c"
# 1 "C:/hgb_Progs/MinGW/include/stdarg.h" 1 3
# 1 "C:/hgb_Progs/MinGW/lib/gcc-lib/mingw32/3.2.3/include/stdarg.h" 1 3
# 44 "C:/hgb_Progs/MinGW/lib/gcc-lib/mingw32/3.2.3/include/stdarg.h" 3
typedef __builtin_va_list __gnuc_va_list;
Some one can explain me what they mean?, I guess that handle the depth
level, but dont know how to read it......
I remember that with a switch I obtain a file with extension "II"
instead of only "I" or was a espegism?
Now the only other thing that I whant to get are the defines :), is
there a switch or a way I can get them?, like the file winoutt.txt
generated with -aux-info
By the way, the other switch are redundant?, and what mean:
windows.c:16:13: warning: #pragma system_header ignored outside include file
If I can get the defines listed in such a beatifull way I will really be
happy, and start coding a translator with some tool like antrl or some
like that, pheraphs a hand tool one.
I have downloaded the full packege gcc 4. I have some what understand a
little about three.def/.c/.h, the instructions gived in
http://gcc.gnu.org/install/ are sufficient to compile the entire package
for win?, or should I ask mingw how they port it? (sorry for that question)
Another question related to the information, is suficient with read
http://gcc.gnu.org/onlinedocs/ ? or I need to read more about how gcc work?
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-11-28 23:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-28 18:18 How to start reading gcc source code hgbasm
2004-11-29 0:47 ` hgbasm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).