This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: make header flag


Lucaz _ wrote:
Hello everybody, I'm new here, and I just like to share an idea for gcc.
I was thinking why I need to write headers "manually", this task (most of times) is very mechanic.

It looks like this has been mostly answered in the thread you referred too. It is easy enough to generate automatic prototypes, but C programs also contains variable declarations and definitions, defines, types, typedefs, etc. You won't be able to compile a file to generate the prototypes unless you put all of this stuff in the .c file, but then once you have the .h file, some of this stuff needs to be moved over, and the compiler in general won't be able to know which stuff to put in the .h file. Plus, once you have this stuff in the .h file, it needs to be removed from the .c file or else you will get duplicate definition errors, and you probably don't want your compiler to be editing your .c files behind your back. There is too much risk that it could break something.


It is simpler to write the .h files by hand. That is the way the language is intended to be used.

As for the prototypes, the -aux-info option will do that. This was designed for the protoize program, and may not do execatly what you want. You can probably get the result you want if you run the aux-info output through a sed/python/perl/whatever script.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]