Re: Disable printf
- From: "RedDevilDan" <kldan_ng@xxxxxxxxx>
- Date: 30 Nov 2006 19:31:11 -0800
Thanks for the reply at first.
I tried the gcc -D "printf(x)=" way. However, it complains about the
printf(x) at the stdio.h, "/usr/include/stdio.h:329:58: macro "printf"
passed 2 arguments, but takes just 1"
I guess the gcc doesn't know how to handle the std c lib if you
I like the idea of putting #include "common.h" line into each c or cpp
files. Do you know how? What kind of script can do this?
William Hughes wrote:
I am working on a Memory Footprint Reduction project. I came across an
idea to disable all printf statements so that less memory is required.
In addition, when there is no single printf statement, the printf
library will not be linked, so it further reduces the executable size.
Is there an easy way to disable printf in a large project? In my
project, we have thousands of C & C++ files. They don't have a common
included common header. Otherwise, I can do a #define printf(x) in the
common header. I am using GNU GCC compiler and run the program in both
Linux and VxWorks platform.
Any of you have a suggestion on disabling all printf statements?
I also think about to add a common header file into the whole project.
However, I would need to put a #include "common.h" line into each c
file. It's gonna take a while to do that. Is there any way to insert
the line automatically into each c file?
This is of course about tool sets, not about the C language.
Some random ideas.
You might be able to use gcc's -D'name(args..)=definition' option.
Depending on how things are arranged you might be able to
alias gcc or you may have to play around a blit with "PATH" and
the names of binary executables.
You could use your favourite scripting language to
insert the line #include "common.h" at the start of any file
ending ".c" or "cpp". Or you could compile generic.c by compiling
a file containing
Again, you should be able to wrap this in a script, call it gcc, change
the PATH variable so that your gcc is called first and link
actual_gcc to /usr/bin/gcc and call actual_gcc from within the srcipt.
Then when the makefiles call gcc, they will get your version
- William Hughes
- Prev by Date: Re: [OT] Re: Reading a string of unknown size
- Next by Date: Re: Binary Division Problem Help
- Previous by thread: Re: Disable printf
- Next by thread: Re: Disable printf