This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: RFD: selective linking of floating point support for *printf / *scanf
- From: Freddie Chopin <freddie_chopin at op dot pl>
- To: newlib at sourceware dot org
- Date: Wed, 03 Sep 2014 22:08:41 +0200
- Subject: Re: RFD: selective linking of floating point support for *printf / *scanf
- Authentication-results: sourceware.org; auth=none
- References: <CAMqJFCpWKXVmmc-YLKf9XO6H8C_YnTEcgzkJAidE21MirJbi-w at mail dot gmail dot com>
Hi!
Sorry if I missed something, but I have an idea that wasn't (probably)
mentioned.
How about implementing printf()/scanf() to call external functions to do
processing of a token? For example when printf() encounters %f it calls
__printf_handle_f(). This calls would be implemented in a way that this
function can actually do nothing (just consume some input in case of
scanf() or load variable from va_list and print nothing in case of
printf(), but do nothing else), so you could have 2 versions of these
functions - one normal, which does what it's supposed to do (so uses
floating point calculations), and another one, which would be a stub
just consuming input or printing nothing (this is pretty simple and no
floating point math). The version could be selected with a switch for
linker, manually selecting the library or some other way.
In the first stage it would be quite OK to have only "normal" versions
and we could just redefine symbols in user code to point to empty stubs (;
Regards,
FCh