Re: RFC: Changing AC_PROG_CC to AC_PROG_CC_C99 in top level configure

2021-04-26 Thread Christian Biesinger via Gcc-patches
On Mon, Apr 26, 2021 at 2:32 PM Joseph Myers  wrote:
>
> On Mon, 26 Apr 2021, Nick Clifton via Gcc-patches wrote:
>
> > Hi Guys,
> >
> >   Given that gcc, gdb and now binutils are all now requiring C99 as a
> >   minimum version of C, are there any objections to updating
> >   configure.ac to reflect this ?
>
> This isn't an objection, since upgrading auto* for the toolchain can be
> complicated, but note that AC_PROG_CC_C99 is obsolete in Autoconf 2.70 and
> instead AC_PROG_CC enables C11 mode if supported.  (So moving to the
> latest Autoconf and Automake releases would supersede this change.)

But AC_PROG_CC_C99 makes sure that the compiler supports C99, and
AC_PROG_CC does not.

Christian


Re: V3 [PATCH 5/5] gnulib: Support variables from the top level Makefile

2021-01-05 Thread Christian Biesinger via Gcc-patches
On Fri, Jan 1, 2021 at 1:07 AM H.J. Lu via Gdb-patches
 wrote:
>
> On Thu, Dec 31, 2020 at 3:50 PM Joseph Myers  wrote:
> >
> > On Sat, 19 Dec 2020, H.J. Lu via Gcc-patches wrote:
> >
> > > Work around what appears to be a GNU make bug handling MAKEFLAGS
> > > values defined in terms of make variables, as is the case for CC and
> > > friends when we are called from the top level Makefile.
> >
> > This description, and the comment in Makefile.am repeating it, is rather
> > unhelpful as it provides no way for a reader to know what the supposed bug
> > is.  Reviewers need to be able to work out whether the proposed workaround
> > is correct or the right approach for working around the bug.  Maintainers
> > in future need to be able to tell what the bug is.  So the comment needs
> > to explain what the bug is and give a reference to a report for the bug in
> > the GNU make bug tracker, so that subsequent maintainers can look at that
> > bug to tell if the workaround is still needed at all.
> >
>
> I just copied the same workaround from other directories in GCC.

But could you explain under which circumstances the bug happens?

Christian


Re: [PATCH] Don't override various Makefile variables for gnulib et al

2020-02-12 Thread Christian Biesinger via gcc-patches
Ping

On Wed, Jan 29, 2020 at 8:07 AM Christian Biesinger
 wrote:
>
> Ping
>
> On Sat, Nov 23, 2019 at 12:30 AM Christian Biesinger
>  wrote:
> >
> > Normally the toplevel Makefile will pass various CC=foo and other
> > flags down to subdir Makefiles. However, for Gnulib this is a problem
> > because Gnulib's configure specifically sets CC to something that
> > includes a -std=gnu11 flag on some systems, and this override would
> > set it back to CC=gcc, leading to compile errors in a GDB build
> > with an updated Gnulib.
> >
> > I don't believe this is needed outside of GCC, so this patch changes
> > Gnulib and other non-GCC modules to just not override any flags --
> > the values set during configure time should be fine. If a user
> > overrides them manually when invoking make, those will still work.
> >
> > Under the same condition, I also removed the host_exports. I don't
> > understand why this is ever necessary (this is only after configure
> > has run).
> >
> > The other option is to clear MAKEOVERRIDES in gnulib/Makefile.am, but
> > that means the user can't override any variables for this subdirectory.
> >
> > ChangeLog:
> >
> > 2019-11-22  Christian Biesinger  
> >
> > * Makefile.def: Pass no_exports_and_flags to various non-GCC
> > modules.
> > * Makefile.in: Allow passing a no_exports_and_flags argument to
> > "all" to suppress emitting exports and make flags. Useful when
> > invoked via host_modules from Makefile.def.
> > * Makefile.tpl: Regenerate.
> >
> > Change-Id: I7d80328cf81c133ba6157eec7d10c422b6790723
> > ---
> >  Makefile.def | 12 ++--
> >  Makefile.in  | 30 --
> >  Makefile.tpl |  9 ++---
> >  3 files changed, 24 insertions(+), 27 deletions(-)
> >
> > diff --git a/Makefile.def b/Makefile.def
> > index 311feb9de3..e1ff065202 100644
> > --- a/Makefile.def
> > +++ b/Makefile.def
> > @@ -33,7 +33,7 @@ build_modules= { module= fixincludes; };
> >  build_modules= { module= libcpp;
> >   extra_configure_flags='--disable-nls 
> > am_cv_func_iconv=no';};
> >
> > -host_modules= { module= bfd; bootstrap=true; };
> > +host_modules= { module= bfd; bootstrap=true; no_exports_and_flags=true; };
> >  host_modules= { module= opcodes; bootstrap=true; };
> >  host_modules= { module= binutils; bootstrap=true; };
> >  host_modules= { module= bison; no_check_cross= true; };
> > @@ -105,15 +105,15 @@ host_modules= { module= libiconv;
> > missing= install-html;
> > missing= install-info; };
> >  host_modules= { module= m4; };
> > -host_modules= { module= readline; };
> > +host_modules= { module= readline; no_exports_and_flags=true; };
> >  host_modules= { module= sid; };
> > -host_modules= { module= sim; };
> > +host_modules= { module= sim; no_exports_and_flags=true; };
> >  host_modules= { module= texinfo; no_install= true; };
> >  host_modules= { module= zlib; no_install=true; no_check=true;
> > bootstrap=true;
> > extra_configure_flags='@extra_host_zlib_configure_flags@';};
> > -host_modules= { module= gnulib; };
> > -host_modules= { module= gdb; };
> > +host_modules= { module= gnulib; no_exports_and_flags=true; };
> > +host_modules= { module= gdb; no_exports_and_flags=true; };
> >  host_modules= { module= expect; };
> >  host_modules= { module= guile; };
> >  host_modules= { module= tk; };
> > @@ -129,7 +129,7 @@ host_modules= { module= lto-plugin; bootstrap=true;
> > extra_make_flags='@extra_linker_plugin_flags@'; };
> >  host_modules= { module= libcc1; extra_configure_flags=--enable-shared; };
> >  host_modules= { module= gotools; };
> > -host_modules= { module= libctf; no_check=true;
> > +host_modules= { module= libctf; no_check=true; no_exports_and_flags=true;
> > bootstrap=true; };
> >
> >  target_modules = { module= libstdc++-v3;
> > diff --git a/Makefile.in b/Makefile.in
> > index 1aabf6ede4..bd41753543 100644
> > --- a/Makefile.in
> > +++ b/Makefile.in
> > @@ -3414,10 +3414,9 @@ maybe-all-bfd: all-bfd
> >  all-bfd: configure-bfd
> > @r=`${PWD_COMMAND}`; export r; \
> > s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> > -   $(HOST_EXPORTS)  \
> > +\
> > (cd $(HOST_SUBDIR)/bfd && \
> > - $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) 
> > $(STAGE1_FLAGS_TO_PASS)  \
> > -   $(TARGET-bfd))
> > + $(MAKE) $(TARGET-bfd))
> >  @endif bfd
> >
> >
> > @@ -25530,10 +25529,9 @@ all-readline: configure-readline
> > @: $(MAKE); $(unstage)
> > @r=`${PWD_COMMAND}`; export r; \
> > s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> > -   $(HOST_EXPORTS)  \
> > +\
> > (cd $(HOST_SUBDIR)/readline && \
> > - $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) 
> > $(STAGE1_FLAGS_TO_PASS)  \
> > -   $(TARGET-readline))
> > + $(MAKE) $(TARGET-readline))
> >  @endif readline
> >
> >
> > @@ 

Re: [PATCH] Don't override various Makefile variables for gnulib et al

2020-01-29 Thread Christian Biesinger via gcc-patches
Ping

On Sat, Nov 23, 2019 at 12:30 AM Christian Biesinger
 wrote:
>
> Normally the toplevel Makefile will pass various CC=foo and other
> flags down to subdir Makefiles. However, for Gnulib this is a problem
> because Gnulib's configure specifically sets CC to something that
> includes a -std=gnu11 flag on some systems, and this override would
> set it back to CC=gcc, leading to compile errors in a GDB build
> with an updated Gnulib.
>
> I don't believe this is needed outside of GCC, so this patch changes
> Gnulib and other non-GCC modules to just not override any flags --
> the values set during configure time should be fine. If a user
> overrides them manually when invoking make, those will still work.
>
> Under the same condition, I also removed the host_exports. I don't
> understand why this is ever necessary (this is only after configure
> has run).
>
> The other option is to clear MAKEOVERRIDES in gnulib/Makefile.am, but
> that means the user can't override any variables for this subdirectory.
>
> ChangeLog:
>
> 2019-11-22  Christian Biesinger  
>
> * Makefile.def: Pass no_exports_and_flags to various non-GCC
> modules.
> * Makefile.in: Allow passing a no_exports_and_flags argument to
> "all" to suppress emitting exports and make flags. Useful when
> invoked via host_modules from Makefile.def.
> * Makefile.tpl: Regenerate.
>
> Change-Id: I7d80328cf81c133ba6157eec7d10c422b6790723
> ---
>  Makefile.def | 12 ++--
>  Makefile.in  | 30 --
>  Makefile.tpl |  9 ++---
>  3 files changed, 24 insertions(+), 27 deletions(-)
>
> diff --git a/Makefile.def b/Makefile.def
> index 311feb9de3..e1ff065202 100644
> --- a/Makefile.def
> +++ b/Makefile.def
> @@ -33,7 +33,7 @@ build_modules= { module= fixincludes; };
>  build_modules= { module= libcpp;
>   extra_configure_flags='--disable-nls am_cv_func_iconv=no';};
>
> -host_modules= { module= bfd; bootstrap=true; };
> +host_modules= { module= bfd; bootstrap=true; no_exports_and_flags=true; };
>  host_modules= { module= opcodes; bootstrap=true; };
>  host_modules= { module= binutils; bootstrap=true; };
>  host_modules= { module= bison; no_check_cross= true; };
> @@ -105,15 +105,15 @@ host_modules= { module= libiconv;
> missing= install-html;
> missing= install-info; };
>  host_modules= { module= m4; };
> -host_modules= { module= readline; };
> +host_modules= { module= readline; no_exports_and_flags=true; };
>  host_modules= { module= sid; };
> -host_modules= { module= sim; };
> +host_modules= { module= sim; no_exports_and_flags=true; };
>  host_modules= { module= texinfo; no_install= true; };
>  host_modules= { module= zlib; no_install=true; no_check=true;
> bootstrap=true;
> extra_configure_flags='@extra_host_zlib_configure_flags@';};
> -host_modules= { module= gnulib; };
> -host_modules= { module= gdb; };
> +host_modules= { module= gnulib; no_exports_and_flags=true; };
> +host_modules= { module= gdb; no_exports_and_flags=true; };
>  host_modules= { module= expect; };
>  host_modules= { module= guile; };
>  host_modules= { module= tk; };
> @@ -129,7 +129,7 @@ host_modules= { module= lto-plugin; bootstrap=true;
> extra_make_flags='@extra_linker_plugin_flags@'; };
>  host_modules= { module= libcc1; extra_configure_flags=--enable-shared; };
>  host_modules= { module= gotools; };
> -host_modules= { module= libctf; no_check=true;
> +host_modules= { module= libctf; no_check=true; no_exports_and_flags=true;
> bootstrap=true; };
>
>  target_modules = { module= libstdc++-v3;
> diff --git a/Makefile.in b/Makefile.in
> index 1aabf6ede4..bd41753543 100644
> --- a/Makefile.in
> +++ b/Makefile.in
> @@ -3414,10 +3414,9 @@ maybe-all-bfd: all-bfd
>  all-bfd: configure-bfd
> @r=`${PWD_COMMAND}`; export r; \
> s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> -   $(HOST_EXPORTS)  \
> +\
> (cd $(HOST_SUBDIR)/bfd && \
> - $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) 
> $(STAGE1_FLAGS_TO_PASS)  \
> -   $(TARGET-bfd))
> + $(MAKE) $(TARGET-bfd))
>  @endif bfd
>
>
> @@ -25530,10 +25529,9 @@ all-readline: configure-readline
> @: $(MAKE); $(unstage)
> @r=`${PWD_COMMAND}`; export r; \
> s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> -   $(HOST_EXPORTS)  \
> +\
> (cd $(HOST_SUBDIR)/readline && \
> - $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) 
> $(STAGE1_FLAGS_TO_PASS)  \
> -   $(TARGET-readline))
> + $(MAKE) $(TARGET-readline))
>  @endif readline
>
>
> @@ -26412,10 +26410,9 @@ all-sim: configure-sim
> @: $(MAKE); $(unstage)
> @r=`${PWD_COMMAND}`; export r; \
> s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
> -   $(HOST_EXPORTS)  \
> +\
> (cd $(HOST_SUBDIR)/sim && \
> - $(MAKE) $(BASE_FLAGS_TO_PASS) 

[PATCH] Don't override various Makefile variables for gnulib et al

2019-11-22 Thread Christian Biesinger via gcc-patches
Normally the toplevel Makefile will pass various CC=foo and other
flags down to subdir Makefiles. However, for Gnulib this is a problem
because Gnulib's configure specifically sets CC to something that
includes a -std=gnu11 flag on some systems, and this override would
set it back to CC=gcc, leading to compile errors in a GDB build
with an updated Gnulib.

I don't believe this is needed outside of GCC, so this patch changes
Gnulib and other non-GCC modules to just not override any flags --
the values set during configure time should be fine. If a user
overrides them manually when invoking make, those will still work.

Under the same condition, I also removed the host_exports. I don't
understand why this is ever necessary (this is only after configure
has run).

The other option is to clear MAKEOVERRIDES in gnulib/Makefile.am, but
that means the user can't override any variables for this subdirectory.

ChangeLog:

2019-11-22  Christian Biesinger  

* Makefile.def: Pass no_exports_and_flags to various non-GCC
modules.
* Makefile.in: Allow passing a no_exports_and_flags argument to
"all" to suppress emitting exports and make flags. Useful when
invoked via host_modules from Makefile.def.
* Makefile.tpl: Regenerate.

Change-Id: I7d80328cf81c133ba6157eec7d10c422b6790723
---
 Makefile.def | 12 ++--
 Makefile.in  | 30 --
 Makefile.tpl |  9 ++---
 3 files changed, 24 insertions(+), 27 deletions(-)

diff --git a/Makefile.def b/Makefile.def
index 311feb9de3..e1ff065202 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -33,7 +33,7 @@ build_modules= { module= fixincludes; };
 build_modules= { module= libcpp;
  extra_configure_flags='--disable-nls am_cv_func_iconv=no';};
 
-host_modules= { module= bfd; bootstrap=true; };
+host_modules= { module= bfd; bootstrap=true; no_exports_and_flags=true; };
 host_modules= { module= opcodes; bootstrap=true; };
 host_modules= { module= binutils; bootstrap=true; };
 host_modules= { module= bison; no_check_cross= true; };
@@ -105,15 +105,15 @@ host_modules= { module= libiconv;
missing= install-html;
missing= install-info; };
 host_modules= { module= m4; };
-host_modules= { module= readline; };
+host_modules= { module= readline; no_exports_and_flags=true; };
 host_modules= { module= sid; };
-host_modules= { module= sim; };
+host_modules= { module= sim; no_exports_and_flags=true; };
 host_modules= { module= texinfo; no_install= true; };
 host_modules= { module= zlib; no_install=true; no_check=true;
bootstrap=true;
extra_configure_flags='@extra_host_zlib_configure_flags@';};
-host_modules= { module= gnulib; };
-host_modules= { module= gdb; };
+host_modules= { module= gnulib; no_exports_and_flags=true; };
+host_modules= { module= gdb; no_exports_and_flags=true; };
 host_modules= { module= expect; };
 host_modules= { module= guile; };
 host_modules= { module= tk; };
@@ -129,7 +129,7 @@ host_modules= { module= lto-plugin; bootstrap=true;
extra_make_flags='@extra_linker_plugin_flags@'; };
 host_modules= { module= libcc1; extra_configure_flags=--enable-shared; };
 host_modules= { module= gotools; };
-host_modules= { module= libctf; no_check=true;
+host_modules= { module= libctf; no_check=true; no_exports_and_flags=true;
bootstrap=true; };
 
 target_modules = { module= libstdc++-v3;
diff --git a/Makefile.in b/Makefile.in
index 1aabf6ede4..bd41753543 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -3414,10 +3414,9 @@ maybe-all-bfd: all-bfd
 all-bfd: configure-bfd
@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-   $(HOST_EXPORTS)  \
+\
(cd $(HOST_SUBDIR)/bfd && \
- $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) 
$(STAGE1_FLAGS_TO_PASS)  \
-   $(TARGET-bfd))
+ $(MAKE) $(TARGET-bfd))
 @endif bfd
 
 
@@ -25530,10 +25529,9 @@ all-readline: configure-readline
@: $(MAKE); $(unstage)
@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-   $(HOST_EXPORTS)  \
+\
(cd $(HOST_SUBDIR)/readline && \
- $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) 
$(STAGE1_FLAGS_TO_PASS)  \
-   $(TARGET-readline))
+ $(MAKE) $(TARGET-readline))
 @endif readline
 
 
@@ -26412,10 +26410,9 @@ all-sim: configure-sim
@: $(MAKE); $(unstage)
@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-   $(HOST_EXPORTS)  \
+\
(cd $(HOST_SUBDIR)/sim && \
- $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) 
$(STAGE1_FLAGS_TO_PASS)  \
-   $(TARGET-sim))
+ $(MAKE) $(TARGET-sim))
 @endif sim
 
 
@@ -28150,10 +28147,9 @@ all-gnulib: configure-gnulib
@: $(MAKE); $(unstage)
@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); 

Re: [PATCH] Remove unused #include "vec.h" from hash-table.h

2019-09-25 Thread Christian Biesinger via gcc-patches
On Mon, Sep 23, 2019 at 3:15 PM Jason Merrill  wrote:
>
> On Mon, Sep 23, 2019 at 3:52 PM Christian Biesinger via gcc-patches
>  wrote:
> >
> > From: Christian Biesinger 
> >
> > Removes an unused include as a cleanup. Requires updating
> > lots of files who previously relied on this transitive include.
> >
> > I have only been able to test this on x86_64 because I failed
> > at building a cross compiler.
> >
> > gcc/ChangeLog:
> >
> > 2019-09-23  Christian Biesinger  
> >
> > * bitmap.c: Include vec.h.
> > * common/common-target.h: Likewise.
> > * common/common-targhooks.h: Likewise.
> > * config/aarch64/aarch64-protos.h: Likewise.
> > * config/aarch64/aarch64.c: Likewise.
> > * config/aarch64/cortex-a57-fma-steering.c: Likewise.
> > * config/arc/arc.c: Likewise.
> > * config/avr/avr-c.c: Likewise.
> > * config/c6x/c6x.c: Likewise.
> > * config/cris/cris.c: Likewise.
> > * config/darwin.c: Likewise.
> > * config/epiphany/resolve-sw-modes.c: Likewise.
> > * config/i386/i386-features.c: Likewise.
> > * config/i386/i386.c: Likewise.
> > * config/ia64/ia64.c: Likewise.
> > * config/mips/mips.c: Likewise.
> > * config/mn10300/mn10300.c: Likewise.
> > * config/nds32/nds32-relax-opt.c: Likewise.
> > * config/nds32/nds32.c: Likewise.
> > * config/nvptx/nvptx.c: Likewise.
> > * config/pa/pa.c: Likewise.
> > * config/pdp11/pdp11.c: Likewise.
> > * config/rs6000/rs6000-c.c: Likewise.
> > * config/rx/rx.c: Likewise.
> > * config/s390/s390-c.c: Likewise.
> > * config/s390/s390.c: Likewise.
> > * config/sparc/sparc.c: Likewise.
> > * config/visium/visium.c: Likewise.
> > * config/vms/vms.c: Likewise.
> > * config/vxworks.c: Likewise.
> > * dbgcnt.c: Likewise.
> > * diagnostic-show-locus.c: Likewise.
> > * edit-context.c: Likewise.
> > * fibonacci_heap.h: Likewise.
> > * function.h: Likewise.
> > * genmatch.c: Likewise.
> > * ggc-common.c: Likewise.
> > * graphds.h: Likewise.
> > * hash-table.h: Remove unused include of vec.h.
> > * input.c: Include vec.h.
> > * json.h: Likewise.
> > * opt-suggestions.h: Likewise.
> > * opts.h: Likewise.
> > * rtl.h: Likewise.
> > * target.h: Likewise.
> > * timevar.c: Likewise.
> > * tree-core.h: Likewise.
> > * typed-splay-tree.c: Likewise.
> > * vec.c: Likewise.
> > * vector-builder.h: Likewise.
> > * vtable-verify.h: Likewise.
>
> This is a surprising list of files.  For instance, common-target.h
> uses nothing from vec.h, and most of these files include tree-core.h,
> so adding the include there should avoid the need in most other files.

I did add it to tree-core.h, but it did not help. (Note: I added it to
the files in config/ without verifying if it is strictly needed,
because I couldn't try compiling most of them; they do all use vec<>
or auto_vec<>. However, all the other files did need the include)

I added it to common-target.h because of:
n file included from ../../gcc/gcc/params.c:24:
../../gcc/gcc/common/common-target.def:98:2: error: ‘vec’ does not name a type
  vec, (int option_code, const char *prefix),
  ^~~
../../gcc/gcc/common/common-target.h:62:48: note: in definition of
macro ‘DEFHOOK’
 #define DEFHOOK(NAME, DOC, TYPE, PARAMS, INIT) TYPE (* NAME) PARAMS;
^~~~

Including it in common-target.def doesn't seem to work; I'm not
entirely sure why.

It sounds like you're saying that in GCC, it's common and OK to rely
on transitive includes for the classes you use?

Bernhard: Thanks, I will look into that

Segher: reduce-headers seems to not work for header files, or maybe I
used it wrong. (it couldn't find the output file for hash-table.h)

Thanks,
Christian


Re: [RFC] Move hash-table.h and related files to libiberty

2019-09-25 Thread Christian Biesinger via gcc-patches
On Sat, Sep 21, 2019 at 7:41 AM Richard Biener
 wrote:
>
> On September 21, 2019 12:28:57 PM GMT+02:00, Christian Biesinger 
>  wrote:
> >On Sat, Sep 21, 2019 at 7:22 PM Richard Biener
> > wrote:
> >>
> >> On September 21, 2019 11:12:38 AM GMT+02:00, Christian Biesinger via
> >gcc-patches  wrote:
> >> >Hello,
> >> >
> >> >I would like to move hash-table.h, hash-map.h and related files
> >> >to libiberty, so that GDB can make use of it.
> >> >
> >> >I see that gcc already has a C++ file in include/ (unique-ptr.h),
> >> >which I understand is libiberty.
> >> >
> >> >However, this patch is not complete yet (for a start, it doesn't
> >> >compile). Before I go further down this road, is this acceptable
> >> >in principle to the gcc/libiberty maintainers?
> >> >
> >> >(the bulk of the patch is including vec.h in a lot of files,
> >> >because hash-table.h previously included it. It doesn't
> >> >actually use it, and I didn't think it was necessary to
> >> >move that to libiberty as well, so I removed that include
> >> >and instead am adding it to all the files that now don't
> >> >compile.)
> >>
> >> The bulk seems to be hash_table to hash_table_ggc renaming. Can you
> >explain?
> >
> >Yeah, sure. If hash-table.h lives in libiberty, I wanted to reduce the
> >dependencies on other headers. GCC's garbage collector seems like
> >something that does not belong there, so I moved this create function
> >to a separate header, which required renaming it since it now can't be
> >part of the same class. (the other option would be some kind of #ifdef
> >GCC thing, but that seemed ugly to me)
>
> As long as gengtype can still pick up everything correctly via the GTY 
> annotations that's probably OK.

OK, I've decided to give up on this project for now -- there are too
many GCC dependencies in this file. But I may try forking the file for
GDB.

Christian


[PATCH] Remove unused #include "vec.h" from hash-table.h

2019-09-23 Thread Christian Biesinger via gcc-patches
From: Christian Biesinger 

Removes an unused include as a cleanup. Requires updating
lots of files who previously relied on this transitive include.

I have only been able to test this on x86_64 because I failed
at building a cross compiler.

gcc/ChangeLog:

2019-09-23  Christian Biesinger  

* bitmap.c: Include vec.h.
* common/common-target.h: Likewise.
* common/common-targhooks.h: Likewise.
* config/aarch64/aarch64-protos.h: Likewise.
* config/aarch64/aarch64.c: Likewise.
* config/aarch64/cortex-a57-fma-steering.c: Likewise.
* config/arc/arc.c: Likewise.
* config/avr/avr-c.c: Likewise.
* config/c6x/c6x.c: Likewise.
* config/cris/cris.c: Likewise.
* config/darwin.c: Likewise.
* config/epiphany/resolve-sw-modes.c: Likewise.
* config/i386/i386-features.c: Likewise.
* config/i386/i386.c: Likewise.
* config/ia64/ia64.c: Likewise.
* config/mips/mips.c: Likewise.
* config/mn10300/mn10300.c: Likewise.
* config/nds32/nds32-relax-opt.c: Likewise.
* config/nds32/nds32.c: Likewise.
* config/nvptx/nvptx.c: Likewise.
* config/pa/pa.c: Likewise.
* config/pdp11/pdp11.c: Likewise.
* config/rs6000/rs6000-c.c: Likewise.
* config/rx/rx.c: Likewise.
* config/s390/s390-c.c: Likewise.
* config/s390/s390.c: Likewise.
* config/sparc/sparc.c: Likewise.
* config/visium/visium.c: Likewise.
* config/vms/vms.c: Likewise.
* config/vxworks.c: Likewise.
* dbgcnt.c: Likewise.
* diagnostic-show-locus.c: Likewise.
* edit-context.c: Likewise.
* fibonacci_heap.h: Likewise.
* function.h: Likewise.
* genmatch.c: Likewise.
* ggc-common.c: Likewise.
* graphds.h: Likewise.
* hash-table.h: Remove unused include of vec.h.
* input.c: Include vec.h.
* json.h: Likewise.
* opt-suggestions.h: Likewise.
* opts.h: Likewise.
* rtl.h: Likewise.
* target.h: Likewise.
* timevar.c: Likewise.
* tree-core.h: Likewise.
* typed-splay-tree.c: Likewise.
* vec.c: Likewise.
* vector-builder.h: Likewise.
* vtable-verify.h: Likewise.

gcc/fortran/ChangeLog:

2019-09-23  Christian Biesinger  

* gfortran.h: Include vec.h.
---
 gcc/bitmap.c | 1 +
 gcc/common/common-target.h   | 1 +
 gcc/common/common-targhooks.h| 2 ++
 gcc/config/aarch64/aarch64-protos.h  | 1 +
 gcc/config/aarch64/aarch64.c | 1 +
 gcc/config/aarch64/cortex-a57-fma-steering.c | 1 +
 gcc/config/arc/arc.c | 1 +
 gcc/config/avr/avr-c.c   | 1 +
 gcc/config/c6x/c6x.c | 1 +
 gcc/config/cris/cris.c   | 1 +
 gcc/config/darwin.c  | 1 +
 gcc/config/epiphany/resolve-sw-modes.c   | 1 +
 gcc/config/i386/i386-features.c  | 1 +
 gcc/config/i386/i386.c   | 1 +
 gcc/config/ia64/ia64.c   | 1 +
 gcc/config/mips/mips.c   | 1 +
 gcc/config/mn10300/mn10300.c | 1 +
 gcc/config/nds32/nds32-relax-opt.c   | 1 +
 gcc/config/nds32/nds32.c | 1 +
 gcc/config/nvptx/nvptx.c | 1 +
 gcc/config/pa/pa.c   | 1 +
 gcc/config/pdp11/pdp11.c | 1 +
 gcc/config/rs6000/rs6000-c.c | 1 +
 gcc/config/rx/rx.c   | 1 +
 gcc/config/s390/s390-c.c | 1 +
 gcc/config/s390/s390.c   | 1 +
 gcc/config/sparc/sparc.c | 1 +
 gcc/config/visium/visium.c   | 1 +
 gcc/config/vms/vms.c | 1 +
 gcc/config/vxworks.c | 1 +
 gcc/dbgcnt.c | 1 +
 gcc/diagnostic-show-locus.c  | 1 +
 gcc/edit-context.c   | 1 +
 gcc/fibonacci_heap.h | 2 ++
 gcc/fortran/gfortran.h   | 1 +
 gcc/function.h   | 1 +
 gcc/genmatch.c   | 1 +
 gcc/ggc-common.c | 1 +
 gcc/graphds.h| 2 ++
 gcc/hash-table.h | 1 -
 gcc/input.c  | 1 +
 gcc/json.h   | 2 ++
 gcc/opt-suggestions.h| 2 ++
 gcc/opts.h   | 1 +
 gcc/rtl.h| 1 +
 gcc/target.h | 1 +
 gcc/timevar.c| 1 +
 gcc/tree-core.h  | 1 +
 gcc/typed-splay-tree.c   | 1 +
 gcc/vec.c   

Re: [RFC] Move hash-table.h and related files to libiberty

2019-09-21 Thread Christian Biesinger via gcc-patches
On Sat, Sep 21, 2019 at 7:22 PM Richard Biener
 wrote:
>
> On September 21, 2019 11:12:38 AM GMT+02:00, Christian Biesinger via 
> gcc-patches  wrote:
> >Hello,
> >
> >I would like to move hash-table.h, hash-map.h and related files
> >to libiberty, so that GDB can make use of it.
> >
> >I see that gcc already has a C++ file in include/ (unique-ptr.h),
> >which I understand is libiberty.
> >
> >However, this patch is not complete yet (for a start, it doesn't
> >compile). Before I go further down this road, is this acceptable
> >in principle to the gcc/libiberty maintainers?
> >
> >(the bulk of the patch is including vec.h in a lot of files,
> >because hash-table.h previously included it. It doesn't
> >actually use it, and I didn't think it was necessary to
> >move that to libiberty as well, so I removed that include
> >and instead am adding it to all the files that now don't
> >compile.)
>
> The bulk seems to be hash_table to hash_table_ggc renaming. Can you explain?

Yeah, sure. If hash-table.h lives in libiberty, I wanted to reduce the
dependencies on other headers. GCC's garbage collector seems like
something that does not belong there, so I moved this create function
to a separate header, which required renaming it since it now can't be
part of the same class. (the other option would be some kind of #ifdef
GCC thing, but that seemed ugly to me)

> Also we can then rename create_ggc back to create?

Sure, that'd work.

Christian


[RFC] Move hash-table.h and related files to libiberty

2019-09-21 Thread Christian Biesinger via gcc-patches
Hello,

I would like to move hash-table.h, hash-map.h and related files
to libiberty, so that GDB can make use of it.

I see that gcc already has a C++ file in include/ (unique-ptr.h),
which I understand is libiberty.

However, this patch is not complete yet (for a start, it doesn't
compile). Before I go further down this road, is this acceptable
in principle to the gcc/libiberty maintainers?

(the bulk of the patch is including vec.h in a lot of files,
because hash-table.h previously included it. It doesn't
actually use it, and I didn't think it was necessary to
move that to libiberty as well, so I removed that include
and instead am adding it to all the files that now don't
compile.)

Thanks!
Christian

Index: Makefile.in
===
--- Makefile.in (revision 275695)
+++ Makefile.in (working copy)
@@ -1490,7 +1490,6 @@
spellcheck-tree.o \
sreal.o \
stack-ptr-mod.o \
-   statistics.o \
stmt.o \
stor-layout.o \
store-motion.o \
Index: bitmap.c
===
--- bitmap.c(revision 275695)
+++ bitmap.c(working copy)
@@ -22,6 +22,7 @@
 #include "coretypes.h"
 #include "bitmap.h"
 #include "selftest.h"
+#include "vec.h"
 
 /* Memory allocation statistics purpose instance.  */
 mem_alloc_description bitmap_mem_desc;
Index: cfgloop.c
===
--- cfgloop.c   (revision 275695)
+++ cfgloop.c   (working copy)
@@ -1135,7 +1135,7 @@
 
   gcc_assert (current_loops->exits == NULL);
   current_loops->exits
-= hash_table::create_ggc (2 * number_of_loops (cfun));
+= hash_table_ggc::create_ggc (2 * number_of_loops 
(cfun));
 
   FOR_EACH_BB_FN (bb, cfun)
 {
Index: cgraph.c
===
--- cgraph.c(revision 275695)
+++ cgraph.c(working copy)
@@ -183,7 +183,7 @@
   version_info_node->this_node = this;
 
   if (cgraph_fnver_htab == NULL)
-cgraph_fnver_htab = hash_table::create_ggc (2);
+cgraph_fnver_htab = hash_table_ggc::create_ggc 
(2);
 
   *cgraph_fnver_htab->find_slot (version_info_node, INSERT)
 = version_info_node;
@@ -760,7 +760,7 @@
 
   if (n > 100)
 {
-  call_site_hash = hash_table::create_ggc (120);
+  call_site_hash = hash_table_ggc::create_ggc (120);
   for (e2 = callees; e2; e2 = e2->next_callee)
cgraph_add_edge_to_call_site_hash (e2);
   for (e2 = indirect_calls; e2; e2 = e2->next_callee)
Index: common/common-target.h
===
--- common/common-target.h  (revision 275695)
+++ common/common-target.h  (working copy)
@@ -22,6 +22,7 @@
 #ifndef GCC_COMMON_TARGET_H
 #define GCC_COMMON_TARGET_H
 
+#include "vec.h"
 
 /* Sets of optimization levels at which an option may be enabled by
default_options_optimization.  */
Index: common/common-targhooks.h
===
--- common/common-targhooks.h   (revision 275695)
+++ common/common-targhooks.h   (working copy)
@@ -20,6 +20,8 @@
 #ifndef GCC_COMMON_TARGHOOKS_H
 #define GCC_COMMON_TARGHOOKS_H
 
+#include "vec.h"
+
 extern enum unwind_info_type default_except_unwind_info (struct gcc_options *);
 extern enum unwind_info_type dwarf2_except_unwind_info (struct gcc_options *);
 extern enum unwind_info_type sjlj_except_unwind_info (struct gcc_options *);
Index: config/darwin.c
===
--- config/darwin.c (revision 275695)
+++ config/darwin.c (working copy)
@@ -572,7 +572,7 @@
   sprintf (buffer, "&%s%c%s%s%s%s", quote, L_or_l, prefix, name, suffix, 
quote);
 
   if (!machopic_indirections)
-machopic_indirections = hash_table::create_ggc (37);
+machopic_indirections = hash_table_ggc::create_ggc 
(37);
 
   machopic_indirection **slot
 = machopic_indirections->find_slot_with_hash (buffer,
@@ -3454,7 +3454,7 @@
   rest_of_decl_compilation (cfstring_class_reference, 0, 0);
 
   /* Initialize the hash table used to hold the constant CFString objects.  */
-  cfstring_htab = hash_table::create_ggc (31);
+  cfstring_htab = hash_table_ggc::create_ggc (31);
 
   return cfstring_type_node;
 }
Index: config/i386/i386.c
===
--- config/i386/i386.c  (revision 275695)
+++ config/i386/i386.c  (working copy)
@@ -95,6 +95,7 @@
 #include "i386-builtins.h"
 #include "i386-expand.h"
 #include "i386-features.h"
+#include "hash-table-ggc.h"
 
 /* This file should be included last.  */
 #include "target-def.h"
@@ -11048,7 +11049,7 @@
   rtx rtl;
 
   if (!dllimport_map)
-dllimport_map = hash_table::create_ggc (512);
+dllimport_map = hash_table_ggc::create_ggc (512);
 
   in.hash = htab_hash_pointer (decl);
   in.base.from = decl;
Index: cp/constexpr.c