|
Home > Archive > Unix Programming > May 2007 > gcc: extract function prototypes
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
gcc: extract function prototypes
|
|
|
| hi,
is there any option of gcc in order to extract the function prototypes
of the functions written in a file (.c or .c++) ?
i would appreciate very much any comment or help
tks in advance
| |
| William.Deans@gmail.com 2007-05-16, 7:17 am |
| On May 15, 11:06 am, rhXX <rh00...@gmail.com> wrote:
> hi,
>
> is there any option of gcc in order to extract the function prototypes
> of the functions written in a file (.c or .c++) ?
>
> i would appreciate very much any comment or help
>
> tks in advance
I am sure there is a better solution than this, but in case no one
steps forward with one:
---------------------
Greetings,
I don't know the answer to your question but I do know that some IDE's
have a tree view which includes functions prototypes. If your job was
on a medium to large scale you could automate the extraction using
that code. Simply modify the IDE such that it logs the function
prototypes as it adds them to the tree view. Unless you run into some
difficulty, I do not see why this logging code should take longer than
a few minutes to add.
Hope this helps,
William
| |
|
|
|
| > Greetings,
>
> I don't know the answer to your question but I do know that some IDE's
> have a tree view which includes functions prototypes. If your job was
> on a medium to large scale you could automate the extraction using
> that code. Simply modify the IDE such that it logs the function
> prototypes as it adds them to the tree view. Unless you run into some
> difficulty, I do not see why this logging code should take longer than
> a few minutes to add.
>
> Hope this helps,
> William
i'm not sure, but many years ago, i remember that there was an option
in the compiler (maybe borland C???) that generate all the prototypes
of the project.
now i wanted to include this option in the makefile and have all
prototypes updated. really it is not a BIG project, only i want to do
it .... im not working with ide enviroment but simple comand line
just yesterday i found in internet cprot (already refered in the next
answer), it worked ok for C
tks a lot!
| |
|
| On May 16, 12:42 pm, Thomas Dickey <dic...@saltmine.radix.net> wrote:
> rhXX <rh00...@gmail.com> wrote:
>
> protoize works for C (except that it changes the parameter types).
> cproto also works for C (doesn't change the parameter types).
>
> http://invisible-island.net/cproto/
>
> --
> Thomas E. Dickeyhttp://invisible-island.netftp://invisible-island.net
tks a lot! yesterday, before i read ur note, i found internet cproto,
i compiled it and worked fine. anyway i will check ur link also about
protoize.
tks very much!
| |
|
| > > protoize works for C (except that it changes the parameter types).[vbcol=seagreen]
hi thomas,
i was looking about protoize, but i'm a bit confused:
protoize works in the same .c file, and as u told, it changes the
parameters types, for example a function i wrote as
test() it changes to test(void)
that is ok
it introduces at the begining of .c file, ONLY the prototypes of
functions forward refered, not ALL of the functions defined in the
file, ok????
the huge .X file contains ALL the definition found for that .c file
including ALL the headers found?
cproto, gives me a cute file, only with the functions defined in
the .c file. ok?????
so i can't obtain the similar results of cproto with protoize?????
tks in advance
| |
|
| > > > protoize works for C (except that it changes the parameter types).
so at the end, the useful file, .X, can be obtained directly with the
option -aux-info in gcc??? (very huge file)
in this case any .c or .h file are changed
ok???
tks in advance
| |
| Thomas Dickey 2007-05-22, 7:18 am |
| rhXX <rh00667@gmail.com> wrote:
[vbcol=seagreen]
> hi thomas,
> i was looking about protoize, but i'm a bit confused:
> protoize works in the same .c file, and as u told, it changes the
> parameters types, for example a function i wrote as
> test() it changes to test(void)
that's ok, but not what I meant. Something like
int foo(a) char a; {}
would be handled by protoize as
int foo(char a) {}
which may seem right, except that's not the way K&R code is mapped to ANSI.
The default promotion rule for "char a;" makes it really "int a;":
int foo(int a) {}
--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
|
|
|
|
|