From: Christopher Li <sparse@chrisli.org>
To: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Cc: Sparse Mailing-list <linux-sparse@vger.kernel.org>
Subject: Re: [PATCH 3/5] Fix some "unknown format" warnings
Date: Thu, 23 May 2013 08:42:51 -0700 [thread overview]
Message-ID: <519E38FB.2020207@chrisli.org> (raw)
In-Reply-To: <519BC851.5090202@ramsay1.demon.co.uk>
On 05/21/2013 12:17 PM, Ramsay Jones wrote:
> +#if !defined(__MINGW32__)
> buf += sprintf(buf, "%Lf", expr->fvalue);
> +#else
> + buf += sprintf(buf, "%f", (double)expr->fvalue);
> +#endif
I don't like to stash !define(__MINW32__) all over the sparse
code. Let's move this to the compat abstract layer. Can you create a
function "char *print_float(float value)" function in compat-mingw.c and
the normal implementation in compat/*.c
> +#if !defined(__MINGW32__)
> strftime(buffer, 12, "%b %e %Y", localtime(&t));
> +#else
> + strftime(buffer, 12, "%b %d %Y", localtime(&t));
> + if (buffer[4] == '0') buffer[4] = ' ';
> +#endif
Same here, try to move to the compat layer.
> +#if !defined(__MINGW32__)
> printf("\tmovf.%d\t\tv%d,$%Lf\n", expr->ctype->bit_size, new, value);
> +#else
> + printf("\tmovf.%d\t\tv%d,$%f\n", expr->ctype->bit_size, new, (double)value);
> +#endif
Here we can reuse the previous print_float() function.
Chris
prev parent reply other threads:[~2013-05-23 15:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-21 19:17 [PATCH 3/5] Fix some "unknown format" warnings Ramsay Jones
2013-05-21 22:05 ` Josh Triplett
2013-05-22 22:01 ` Ramsay Jones
2013-05-22 22:54 ` Josh Triplett
2013-05-25 19:26 ` Ramsay Jones
2013-05-25 20:30 ` Josh Triplett
2013-05-23 15:42 ` Christopher Li [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=519E38FB.2020207@chrisli.org \
--to=sparse@chrisli.org \
--cc=linux-sparse@vger.kernel.org \
--cc=ramsay@ramsay1.demon.co.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).