public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libstdc++: Ensure headers used by fast_float are included
@ 2023-04-12 13:45 Patrick Palka
  2023-04-12 15:04 ` Jonathan Wakely
  0 siblings, 1 reply; 3+ messages in thread
From: Patrick Palka @ 2023-04-12 13:45 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++, Patrick Palka

This makes floating_from_chars.cc explicitly include all headers
that are used by the original fast_float amalgamation according to
r12-6647-gf5c8b82512f9d3, except:

  1. <cctype> since fast_float doesn't seem to use anything from it
  2. <cinttypes> since fast_float doesn't seem to use anything directly
     from it (as opposed to from <cstdint>)
  3. <system_error> since std::errc is naturally already available
     from <charconv>

This avoids potential build failures on platforms for which some
required headers (namely <cstdint>) end up not getting transitively
included from elsewhere.

Tested on x86_64-pc-linux-gnu, does this look OK for trunk/12?

libstdc++-v3/ChangeLog:

	* src/c++17/floating_from_chars.cc: Include <algorithm>,
	<iterator>, <limits> and <cstdint>.
---
 libstdc++-v3/src/c++17/floating_from_chars.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libstdc++-v3/src/c++17/floating_from_chars.cc b/libstdc++-v3/src/c++17/floating_from_chars.cc
index 5d18ca32dbb..3a411cf546a 100644
--- a/libstdc++-v3/src/c++17/floating_from_chars.cc
+++ b/libstdc++-v3/src/c++17/floating_from_chars.cc
@@ -30,14 +30,18 @@
 // Prefer to use std::pmr::string if possible, which requires the cxx11 ABI.
 #define _GLIBCXX_USE_CXX11_ABI 1
 
+#include <algorithm>
 #include <array>
 #include <charconv>
 #include <bit>
+#include <iterator>
+#include <limits>
 #include <string>
 #include <memory_resource>
 #include <cfenv>
 #include <cfloat>
 #include <cmath>
+#include <cstdint>
 #include <cstdlib>
 #include <cstring>
 #include <locale.h>
-- 
2.40.0.315.g0607f793cb


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libstdc++: Ensure headers used by fast_float are included
  2023-04-12 13:45 [PATCH] libstdc++: Ensure headers used by fast_float are included Patrick Palka
@ 2023-04-12 15:04 ` Jonathan Wakely
  2023-04-12 16:59   ` Patrick Palka
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Wakely @ 2023-04-12 15:04 UTC (permalink / raw)
  To: Patrick Palka; +Cc: gcc-patches, libstdc++

On Wed, 12 Apr 2023 at 14:45, Patrick Palka via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> This makes floating_from_chars.cc explicitly include all headers
> that are used by the original fast_float amalgamation according to
> r12-6647-gf5c8b82512f9d3, except:
>
>   1. <cctype> since fast_float doesn't seem to use anything from it
>   2. <cinttypes> since fast_float doesn't seem to use anything directly
>      from it (as opposed to from <cstdint>)
>   3. <system_error> since std::errc is naturally already available
>      from <charconv>
>
> This avoids potential build failures on platforms for which some
> required headers (namely <cstdint>) end up not getting transitively
> included from elsewhere.
>
> Tested on x86_64-pc-linux-gnu, does this look OK for trunk/12?

Yes for both, thanks.


>
> libstdc++-v3/ChangeLog:
>
>         * src/c++17/floating_from_chars.cc: Include <algorithm>,
>         <iterator>, <limits> and <cstdint>.
> ---
>  libstdc++-v3/src/c++17/floating_from_chars.cc | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/libstdc++-v3/src/c++17/floating_from_chars.cc b/libstdc++-v3/src/c++17/floating_from_chars.cc
> index 5d18ca32dbb..3a411cf546a 100644
> --- a/libstdc++-v3/src/c++17/floating_from_chars.cc
> +++ b/libstdc++-v3/src/c++17/floating_from_chars.cc
> @@ -30,14 +30,18 @@
>  // Prefer to use std::pmr::string if possible, which requires the cxx11 ABI.
>  #define _GLIBCXX_USE_CXX11_ABI 1
>
> +#include <algorithm>
>  #include <array>
>  #include <charconv>
>  #include <bit>
> +#include <iterator>
> +#include <limits>
>  #include <string>
>  #include <memory_resource>
>  #include <cfenv>
>  #include <cfloat>
>  #include <cmath>
> +#include <cstdint>
>  #include <cstdlib>
>  #include <cstring>
>  #include <locale.h>
> --
> 2.40.0.315.g0607f793cb
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libstdc++: Ensure headers used by fast_float are included
  2023-04-12 15:04 ` Jonathan Wakely
@ 2023-04-12 16:59   ` Patrick Palka
  0 siblings, 0 replies; 3+ messages in thread
From: Patrick Palka @ 2023-04-12 16:59 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: gcc-patches, libstdc++

On Wed, Apr 12, 2023 at 11:04 AM Jonathan Wakely <jwakely@redhat.com> wrote:
>
> On Wed, 12 Apr 2023 at 14:45, Patrick Palka via Libstdc++
> <libstdc++@gcc.gnu.org> wrote:
> >
> > This makes floating_from_chars.cc explicitly include all headers
> > that are used by the original fast_float amalgamation according to
> > r12-6647-gf5c8b82512f9d3, except:
> >
> >   1. <cctype> since fast_float doesn't seem to use anything from it
> >   2. <cinttypes> since fast_float doesn't seem to use anything directly
> >      from it (as opposed to from <cstdint>)
> >   3. <system_error> since std::errc is naturally already available
> >      from <charconv>
> >
> > This avoids potential build failures on platforms for which some
> > required headers (namely <cstdint>) end up not getting transitively
> > included from elsewhere.
> >
> > Tested on x86_64-pc-linux-gnu, does this look OK for trunk/12?
>
> Yes for both, thanks.

Thanks, pushed as r13-7159-g13669111e7219e and r12-9396-g43ab94d20e1f68

>
>
> >
> > libstdc++-v3/ChangeLog:
> >
> >         * src/c++17/floating_from_chars.cc: Include <algorithm>,
> >         <iterator>, <limits> and <cstdint>.
> > ---
> >  libstdc++-v3/src/c++17/floating_from_chars.cc | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/libstdc++-v3/src/c++17/floating_from_chars.cc b/libstdc++-v3/src/c++17/floating_from_chars.cc
> > index 5d18ca32dbb..3a411cf546a 100644
> > --- a/libstdc++-v3/src/c++17/floating_from_chars.cc
> > +++ b/libstdc++-v3/src/c++17/floating_from_chars.cc
> > @@ -30,14 +30,18 @@
> >  // Prefer to use std::pmr::string if possible, which requires the cxx11 ABI.
> >  #define _GLIBCXX_USE_CXX11_ABI 1
> >
> > +#include <algorithm>
> >  #include <array>
> >  #include <charconv>
> >  #include <bit>
> > +#include <iterator>
> > +#include <limits>
> >  #include <string>
> >  #include <memory_resource>
> >  #include <cfenv>
> >  #include <cfloat>
> >  #include <cmath>
> > +#include <cstdint>
> >  #include <cstdlib>
> >  #include <cstring>
> >  #include <locale.h>
> > --
> > 2.40.0.315.g0607f793cb
> >
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-04-12 16:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-12 13:45 [PATCH] libstdc++: Ensure headers used by fast_float are included Patrick Palka
2023-04-12 15:04 ` Jonathan Wakely
2023-04-12 16:59   ` Patrick Palka

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).