public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-8325] system.h: Include <initializer_list> in system.h unconditionally
@ 2022-05-02 5:11 Jakub Jelinek
0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2022-05-02 5:11 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:860b71fa94b3966a6b67f45c91299e51f3093fe7
commit r12-8325-g860b71fa94b3966a6b67f45c91299e51f3093fe7
Author: Jakub Jelinek <jakub@redhat.com>
Date: Mon May 2 07:10:14 2022 +0200
system.h: Include <initializer_list> in system.h unconditionally
On Sun, May 01, 2022 at 07:06:53PM +0100, Jonathan Wakely wrote:
> > >> the reason is that "gcc/analyzer/region-model.cc” uses initializer_lists, and it seems that <initializer_list>
> > >> is not transitively included by any used headers for _LIBCPP_VERSION < 4000. I fixed that locally by
> > >> adding initializer_list into system.h (and adding INCLUDE_INITIALIZER_LIST to the top of gcc/analyzer/region-model.cc)
> > >> - with that change those versions do bootstrap and test OK***
> > >
> > > From what I can see, with libstdc++ it works because <utility> which is
> > > included by system.h includes <initializer_list>.
> > > If I rename initializer_list in analyzer/region-model.ii to initializer_listx, I
> > > also get:
> > > ../../gcc/analyzer/region-model.cc: In function ‘void ana::selftest::test_binop_svalue_folding()’:
> > > ../../gcc/analyzer/region-model.cc:4966:48: error: deducing from brace-enclosed initializer list requires ‘#include <initializer_list>’
> > > 4508 |
> > > +++ |+#include <initializer_list>
> > > 4509 | static void
> > > ......
> > > 4966 | for (auto op : {BIT_IOR_EXPR, TRUTH_OR_EXPR})
> > > | ^
> > > ../../gcc/analyzer/region-model.cc:4978:49: error: deducing from brace-enclosed initializer list requires ‘#include <initializer_list>’
> > > 4978 | for (auto op : {BIT_AND_EXPR, TRUTH_AND_EXPR})
> > > | ^
> > >
> > > I think we have 2 options, one is do what you wrote above,
> > > INCLUDE_INITIALIZER_LIST defined before system.h to get #include <initializer_list>.
> > > The other option is just to include that unconditionally, it is a very small
> > > header. For libstdc++ it will make no difference as it is included anyway
> > > and the header is really small there, libc++ includes <cstddef> which isn't
> > > normally included and system.h includes <stddef.h> instead.
> >
> > I’d say unconditionally would be OK. I suppose the chance that any host
> > C++ is good enough to build GCC as-is but fails to provide
> > <initializer_list> is zero?
> >
>
> Yes, definitely.
>
> > I’d be OK to do this change without a new RC even.
2022-05-02 Jakub Jelinek <jakub@redhat.com>
* system.h: Include initializer_list.
(cherry picked from commit 4a0e89b10f6bdc1e285e0b9e6a435a0062f8936c)
Diff:
---
gcc/system.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/gcc/system.h b/gcc/system.h
index c25cd64366f..c5562cc49a3 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -239,6 +239,7 @@ extern int errno;
# include <functional>
#endif
# include <cstring>
+# include <initializer_list>
# include <new>
# include <utility>
# include <type_traits>
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-05-02 5:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-02 5:11 [gcc r12-8325] system.h: Include <initializer_list> in system.h unconditionally Jakub Jelinek
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).