public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Michael Meissner <meissner@linux.ibm.com>,
	gcc-patches@gcc.gnu.org, David Edelsohn <dje.gcc@gmail.com>,
	Bill Schmidt <wschmidt@linux.ibm.com>,
	Peter Bergner <bergner@linux.ibm.com>,
	Joseph Myers <joseph@codesourcery.com>
Subject: Re: [PATCH 2/3 V2] Do not include stdio.h in libgcc's Decimal/Float128 conversions.
Date: Mon, 1 Mar 2021 17:15:44 -0600	[thread overview]
Message-ID: <20210301231544.GG29191@gate.crashing.org> (raw)
In-Reply-To: <20210301171852.GB9185@ibm-toto.the-meissners.org>

On Mon, Mar 01, 2021 at 12:18:52PM -0500, Michael Meissner wrote:
> The _sprintfkf.c file was including stdio.h to get the definition of sprintf.

(declaration of)

> This patch modifies this so that stdio.h is not included in order to support
> freestanding cross compilers that might not provide stdio.h.

So the code cannot work at all there?  Will not link?

> +   We use __builtin_sprintf so that we don't have to include stdio.h to define
> +   sprintf.  Stdio.h might not be present for freestanding cross compilers that
> +   do not need to include a library.  */

"declare sprintf", and the function is called stdio.g (all lowercase).
It is often written <stdio.h>, which makes it easier to handle in
sentences.

> @@ -54,5 +57,5 @@ int __sprintfkf (char *restrict string,
>    if (__sprintfieee128)
>      return __sprintfieee128 (string, format, number);
>  
> -  return sprintf (string, format, (long double) number);
> +  return __builtin_sprintf (string, format, (long double) number);

sprintf as well as __builtin_sprintf do not exist exactly when <stdio.h>
does not (or are not guaranteed to exist, anyway).


Segher

  reply	other threads:[~2021-03-01 23:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-01 17:14 [PATCH 0/3 V2] Honor --disable-decimal-float in PowerPC libgcc _Float128 Michael Meissner
2021-03-01 17:17 ` [PATCH 1/3 V2] Fix __sprintfkf prototype in libgcc Michael Meissner
2021-03-01 22:37   ` Segher Boessenkool
2021-03-01 17:18 ` [PATCH 2/3 V2] Do not include stdio.h in libgcc's Decimal/Float128 conversions Michael Meissner
2021-03-01 23:15   ` Segher Boessenkool [this message]
2021-03-02 21:25     ` Michael Meissner
2021-03-02 21:53       ` Segher Boessenkool
2021-03-03 19:12         ` Michael Meissner
2021-03-03 23:33           ` Joseph Myers
2021-03-04  1:01             ` Michael Meissner
2021-03-09 18:35           ` Segher Boessenkool
2021-03-01 17:19 ` [PATCH 3/3 V2] Do not build Decimal/Float128 conversions if decimal is disabled Michael Meissner

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=20210301231544.GG29191@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=bergner@linux.ibm.com \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=joseph@codesourcery.com \
    --cc=meissner@linux.ibm.com \
    --cc=wschmidt@linux.ibm.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).