[wwwdocs] gcc-14: Mention that some warnings are now errors

2024-04-13 Thread Sebastian Huber
---
 htdocs/gcc-14/changes.html | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/htdocs/gcc-14/changes.html b/htdocs/gcc-14/changes.html
index 8ac08e9a..a183fad8 100644
--- a/htdocs/gcc-14/changes.html
+++ b/htdocs/gcc-14/changes.html
@@ -231,6 +231,17 @@ a work-in-progress.
   previous options -std=c2x, -std=gnu2x
   and -Wc11-c2x-compat, which are deprecated but remain
   supported.
+  The following warnings are now errors (see also
+Porting to GCC 14):
+
+  -Werror=declaration-missing-parameter-type
+  -Werror=implicit-function-declaration
+  -Werror=implicit-int
+  -Werror=incompatible-pointer-types
+  -Werror=int-conversion
+  -Werror=return-mismatch
+
+  
 
 
 C++
-- 
2.35.3



Re: [PATCH 2/3] c++/modules: Propagate using decls from partitions

2024-04-13 Thread Nathaniel Shead
On Fri, Apr 12, 2024 at 01:50:47PM -0400, Jason Merrill wrote:
> On 4/11/24 20:40, Nathaniel Shead wrote:
> > Bootstrapped and regtested on x86_64-pc-linux-gnu, OK for trunk?
> > 
> > -- >8 --
> > 
> > The modules code currently neglects to set OVL_USING_P on the dependency
> > created for a using-decl, which causes it not to remember that the
> > OVL_EXPORT_P flag had been set on it when emitted from the primary
> > interface unit. This patch ensures that it occurs.
> > 
> > gcc/cp/ChangeLog:
> > 
> > * module.cc (depset::hash::add_binding_entity): Propagate
> > OVL_USING_P for using-declarations.
> > 
> > gcc/testsuite/ChangeLog:
> > 
> > * g++.dg/modules/using-15_a.C: New test.
> > * g++.dg/modules/using-15_b.C: New test.
> > * g++.dg/modules/using-15_c.C: New test.
> > 
> > Signed-off-by: Nathaniel Shead 
> > ---
> >   gcc/cp/module.cc  |  4 
> >   gcc/testsuite/g++.dg/modules/using-15_a.C | 13 +
> >   gcc/testsuite/g++.dg/modules/using-15_b.C |  5 +
> >   gcc/testsuite/g++.dg/modules/using-15_c.C |  7 +++
> >   4 files changed, 29 insertions(+)
> >   create mode 100644 gcc/testsuite/g++.dg/modules/using-15_a.C
> >   create mode 100644 gcc/testsuite/g++.dg/modules/using-15_b.C
> >   create mode 100644 gcc/testsuite/g++.dg/modules/using-15_c.C
> > 
> > diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
> > index 9d054c4c792..527c9046c67 100644
> > --- a/gcc/cp/module.cc
> > +++ b/gcc/cp/module.cc
> > @@ -12915,10 +12915,12 @@ depset::hash::add_binding_entity (tree decl, 
> > WMB_Flags flags, void *data_)
> > /* Ignore NTTP objects.  */
> > return false;
> > +  bool unscoped_enum_const_p = false;
> > if (!(flags & WMB_Using) && CP_DECL_CONTEXT (decl) != data->ns)
> > {
> >   /* A using that lost its wrapper or an unscoped enum
> >  constant.  */
> > + unscoped_enum_const_p = (TREE_CODE (decl) == CONST_DECL);
> 
> How does this interact with C++20 using enum?

Looks like it ignores those (so they still suffer from this error).  But
in general we don't handle usings of non-functions correctly anyway yet
(for the reasons I described in the cover letter); I just added this for
now to prevent regressing some test-cases caused by importing enum
consts wrapped in an OVERLOAD.

Otherwise happy to defer this patch until GCC 15 when I can look at
exploring what needs to be done to handle non-function using-decls
correctly, but I'll need to work out a new testcase for the followup
patch in this series (or just defer that one too, I suppose).

> >   flags = WMB_Flags (flags | WMB_Using);
> >   if (DECL_MODULE_EXPORT_P (TREE_CODE (decl) == CONST_DECL
> > ? TYPE_NAME (TREE_TYPE (decl))
> > @@ -12979,6 +12981,8 @@ depset::hash::add_binding_entity (tree decl, 
> > WMB_Flags flags, void *data_)
> > if (flags & WMB_Using)
> > {
> >   decl = ovl_make (decl, NULL_TREE);
> > + if (!unscoped_enum_const_p)
> > +   OVL_USING_P (decl) = true;
> >   if (flags & WMB_Export)
> > OVL_EXPORT_P (decl) = true;
> > }
> > diff --git a/gcc/testsuite/g++.dg/modules/using-15_a.C 
> > b/gcc/testsuite/g++.dg/modules/using-15_a.C
> > new file mode 100644
> > index 000..23895bd8c4a
> > --- /dev/null
> > +++ b/gcc/testsuite/g++.dg/modules/using-15_a.C
> > @@ -0,0 +1,13 @@
> > +// { dg-additional-options "-fmodules-ts -Wno-global-module" }
> > +// { dg-module-cmi M:a }
> > +
> > +module;
> > +namespace foo {
> > +  void a();
> > +};
> > +export module M:a;
> > +
> > +namespace bar {
> > +  // propagate usings from partitions
> > +  export using foo::a;
> > +};
> > diff --git a/gcc/testsuite/g++.dg/modules/using-15_b.C 
> > b/gcc/testsuite/g++.dg/modules/using-15_b.C
> > new file mode 100644
> > index 000..a88f86af61f
> > --- /dev/null
> > +++ b/gcc/testsuite/g++.dg/modules/using-15_b.C
> > @@ -0,0 +1,5 @@
> > +// { dg-additional-options "-fmodules-ts" }
> > +// { dg-module-cmi M }
> > +
> > +export module M;
> > +export import :a;
> > diff --git a/gcc/testsuite/g++.dg/modules/using-15_c.C 
> > b/gcc/testsuite/g++.dg/modules/using-15_c.C
> > new file mode 100644
> > index 000..0651efffc91
> > --- /dev/null
> > +++ b/gcc/testsuite/g++.dg/modules/using-15_c.C
> > @@ -0,0 +1,7 @@
> > +// { dg-additional-options "-fmodules-ts" }
> > +import M;
> > +
> > +int main() {
> > +  bar::a();
> > +  foo::a();  // { dg-error "not been declared" }
> > +}
> 


[PATCH] Fortran: ALLOCATE of fixed-length CHARACTER with SOURCE/MOLD [PR113793]

2024-04-13 Thread Harald Anlauf
Dear all,

the attached patch adds the following:

- diagnostics of different string length of allocate-object and of the
  source-expr (SOURCE/MOLD) as hard error when it can be determined at
  compile-time

- a runtime-diagnostics und -fcheck=bounds (reuse of existing checks)

- a fallback solution (GNU extension) to use the length of allocate-object
  if the length mismatch is not diagnosed at compile-time or runtime.
  This avoids heap corruption and leads to string truncation or padding
  during assignment.

F2008 demands same values of the kind type parameters, and this is
diagnosed by NAG.  It also always gives a hard error, even at runtime.

Some brands (NVidia, AMD flang) tolerate a length mismatch silently
and perform string truncation or padding, without crashing.

Regtested on x86_64-pc-linux-gnu.  OK for mainline?

Thanks,
Harald

From b9ece695a178319e35cd9f36cc731855302dd57f Mon Sep 17 00:00:00 2001
From: Harald Anlauf 
Date: Sat, 13 Apr 2024 19:09:24 +0200
Subject: [PATCH] Fortran: ALLOCATE of fixed-length CHARACTER with SOURCE/MOLD
 [PR113793]

F2008 requires for ALLOCATE with SOURCE= or MOLD= specifier that the kind
type parameters of allocate-object and source-expr have the same values.
Add compile-time diagnostics for different character length and a runtime
check (under -fcheck=bounds).  Use length from allocate-object to prevent
heap corruption and to allow string padding or truncation on assignment.

gcc/fortran/ChangeLog:

	PR fortran/113793
	* resolve.cc (resolve_allocate_expr): Reject ALLOCATE with SOURCE=
	or MOLD= specifier for unequal length.
	* trans-stmt.cc (gfc_trans_allocate): If an allocatable character
	variable has fixed length, use it and do not use the source length.
	With bounds-checking enabled, add a runtime check for same length.

gcc/testsuite/ChangeLog:

	PR fortran/113793
	* gfortran.dg/allocate_with_source_29.f90: New test.
	* gfortran.dg/allocate_with_source_30.f90: New test.
	* gfortran.dg/allocate_with_source_31.f90: New test.
---
 gcc/fortran/resolve.cc| 10 
 gcc/fortran/trans-stmt.cc | 36 +++--
 .../gfortran.dg/allocate_with_source_29.f90   | 48 +
 .../gfortran.dg/allocate_with_source_30.f90   | 51 +++
 .../gfortran.dg/allocate_with_source_31.f90   | 38 ++
 5 files changed, 179 insertions(+), 4 deletions(-)
 create mode 100644 gcc/testsuite/gfortran.dg/allocate_with_source_29.f90
 create mode 100644 gcc/testsuite/gfortran.dg/allocate_with_source_30.f90
 create mode 100644 gcc/testsuite/gfortran.dg/allocate_with_source_31.f90

diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index 4cbf7186119..6b3e5ba4fcb 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -8278,6 +8278,16 @@ resolve_allocate_expr (gfc_expr *e, gfc_code *code, bool *array_alloc_wo_spec)
 	  goto failure;
 	}

+  /* Check F2008:C639: "Corresponding kind type parameters of
+	 allocate-object and source-expr shall have the same values."  */
+  if (e->ts.type == BT_CHARACTER
+	  && !e->ts.deferred
+	  && e->ts.u.cl->length
+	  && code->expr3->ts.type == BT_CHARACTER
+	  && !gfc_check_same_strlen (e, code->expr3, "ALLOCATE with "
+ "SOURCE= or MOLD= specifier"))
+	goto failure;
+
   /* Check TS18508, C702/C703.  */
   if (code->expr3->ts.type == BT_DERIVED
 	  && ((codimension && gfc_expr_attr (code->expr3).event_comp)
diff --git a/gcc/fortran/trans-stmt.cc b/gcc/fortran/trans-stmt.cc
index 7997c167bae..c34e0b4c0cd 100644
--- a/gcc/fortran/trans-stmt.cc
+++ b/gcc/fortran/trans-stmt.cc
@@ -6829,10 +6829,26 @@ gfc_trans_allocate (gfc_code * code, gfc_omp_namelist *omp_allocate)
 	 in the array is needed, which is the product of the len and
 	 esize for char arrays.  For unlimited polymorphics len can be
 	 zero, therefore take the maximum of len and one.  */
+	  tree lhs_len;
+
+	  /* If an allocatable character variable has fixed length, use it.
+	 Otherwise use source length.  As different lengths are not
+	 allowed by the standard, generate a runtime check.  */
+	  if (expr->ts.type == BT_CHARACTER && !expr->ts.deferred)
+	{
+	  gfc_trans_same_strlen_check ("ALLOCATE with SOURCE= or MOLD=",
+	   &code->expr3->where,
+	   se.string_length, expr3_len,
+	   &block);
+	  lhs_len = fold_convert (TREE_TYPE (expr3_len), se.string_length);
+	}
+	  else
+	lhs_len = expr3_len;
+
 	  tmp = fold_build2_loc (input_location, MAX_EXPR,
  TREE_TYPE (expr3_len),
- expr3_len, fold_convert (TREE_TYPE (expr3_len),
-			  integer_one_node));
+ lhs_len, fold_convert (TREE_TYPE (expr3_len),
+			integer_one_node));
 	  tmp = fold_build2_loc (input_location, MULT_EXPR,
  TREE_TYPE (expr3_esize), expr3_esize,
  fold_convert (TREE_TYPE (expr3_esize), tmp));
@@ -6877,10 +6893,22 @@ gfc_trans_allocate (gfc_code * code, gfc_omp_namelist *omp_allocate)
 	 allocate.

 	 expr3_len is set w

Re: [wwwdocs] gcc-14: Mention that some warnings are now errors

2024-04-13 Thread Eric Gallager
On Sat, Apr 13, 2024 at 5:51 AM Sebastian Huber
 wrote:
>
> ---
>  htdocs/gcc-14/changes.html | 11 +++
>  1 file changed, 11 insertions(+)
>
> diff --git a/htdocs/gcc-14/changes.html b/htdocs/gcc-14/changes.html
> index 8ac08e9a..a183fad8 100644
> --- a/htdocs/gcc-14/changes.html
> +++ b/htdocs/gcc-14/changes.html
> @@ -231,6 +231,17 @@ a work-in-progress.
>previous options -std=c2x, -std=gnu2x
>and -Wc11-c2x-compat, which are deprecated but remain
>supported.
> +  The following warnings are now errors (see also
> +Porting to GCC 14):
> +
> +  -Werror=declaration-missing-parameter-type
> +  -Werror=implicit-function-declaration
> +  -Werror=implicit-int
> +  -Werror=incompatible-pointer-types
> +  -Werror=int-conversion
> +  -Werror=return-mismatch
> +
> +  
>  
>

I'd suggest adding the words "by default" to emphasize that they can
be turned back into warnings, and/or disabled. Perhaps others will
have other wording suggestions.

>  C++
> --
> 2.35.3
>


Re: [wwwdocs] gcc-14: Mention that some warnings are now errors

2024-04-13 Thread Sam James
Eric Gallager  writes:

> On Sat, Apr 13, 2024 at 5:51 AM Sebastian Huber
>  wrote:
>>
>> ---
>>  htdocs/gcc-14/changes.html | 11 +++
>>  1 file changed, 11 insertions(+)
>>
>> diff --git a/htdocs/gcc-14/changes.html b/htdocs/gcc-14/changes.html
>> index 8ac08e9a..a183fad8 100644
>> --- a/htdocs/gcc-14/changes.html
>> +++ b/htdocs/gcc-14/changes.html
>> @@ -231,6 +231,17 @@ a work-in-progress.
>>previous options -std=c2x, -std=gnu2x
>>and -Wc11-c2x-compat, which are deprecated but remain
>>supported.
>> +  The following warnings are now errors (see also
>> +Porting to GCC 14):
>> +
>> +  -Werror=declaration-missing-parameter-type
>> +  -Werror=implicit-function-declaration
>> +  -Werror=implicit-int
>> +  -Werror=incompatible-pointer-types
>> +  -Werror=int-conversion
>> +  -Werror=return-mismatch
>> +
>> +  
>>  
>>
>
> I'd suggest adding the words "by default" to emphasize that they can
> be turned back into warnings, and/or disabled. Perhaps others will
> have other wording suggestions.

Works for me with that added, although I can't formally approve.

It's fine without it though too.

>
>>  C++
>> --
>> 2.35.3
>>


signature.asc
Description: PGP signature


Re: [PATCH] c++/modules: optimize tree flag streaming

2024-04-13 Thread Iain Sandoe
Hi Patrick,

> On 10 Apr 2024, at 17:33, Jason Merrill  wrote:
> 
> On 4/10/24 11:26, Patrick Palka wrote:
>> On Wed, 10 Apr 2024, Patrick Palka wrote:
>>> 
>>> On Tue, 9 Apr 2024, Jason Merrill wrote:
>>> 
 On 2/16/24 10:06, Patrick Palka wrote:
> On Thu, 15 Feb 2024, Patrick Palka wrote:
> 



> Let's keep documenting the inheritance relationship here, i.e.
> 
>  bytes_in : data
> 
>> @@ -694,13 +656,132 @@ protected:
>>/* Instrumentation.  */
>>static unsigned spans[4];
>>static unsigned lengths[4];
>> -  static int is_set;
>> +  friend struct bits_out;
> 
> It might be a little more elegant for bits_in/out to be nested classes of 
> bytes_in/out, returned from member functions, rather than friends constructed 
> directly?  OK either way, with the above comment tweak.

Unfortunately, this seems to break x86_64 Darwin bootstrap with fails as below 
- I did not yet have a chance to look in any morre detail, so this is a head’s 
up - unless you have any immediate ideas?

thanks
Iain


/src-local/gcc-master/gcc/cp/module.cc: In member function 
‘{anonymous}::bytes_in::bits_in {anonymous}::bytes_in::stream_bits()’:
/src-local/gcc-master/gcc/cp/module.cc:735:24: error: use of deleted function 
‘{anonymous}::bytes_in::bits_in::bits_in(const {anonymous}::bytes_in::bits_in&)’
  735 |   return bits_in (*this);
  |^
/src-local/gcc-master/gcc/cp/module.cc:709:3: note: declared here
  709 |   bits_in(const bits_in&) = delete;
  |   ^~~
/src-local/gcc-master/gcc/cp/module.cc: In member function 
‘{anonymous}::bytes_out::bits_out {anonymous}::bytes_out::stream_bits()’:
/src-local/gcc-master/gcc/cp/module.cc:796:25: error: use of deleted function 
‘{anonymous}::bytes_out::bits_out::bits_out(const 
{anonymous}::bytes_out::bits_out&)’
  796 |   return bits_out (*this);
  | ^
/src-local/gcc-master/gcc/cp/module.cc:755:3: note: declared here
  755 |   bits_out(const bits_out&) = delete;
  |   ^~~~




Re: [PATCH] c++/modules: optimize tree flag streaming

2024-04-13 Thread Patrick Palka
On Sat, 13 Apr 2024, Iain Sandoe wrote:

> Hi Patrick,
> 
> > On 10 Apr 2024, at 17:33, Jason Merrill  wrote:
> > 
> > On 4/10/24 11:26, Patrick Palka wrote:
> >> On Wed, 10 Apr 2024, Patrick Palka wrote:
> >>> 
> >>> On Tue, 9 Apr 2024, Jason Merrill wrote:
> >>> 
>  On 2/16/24 10:06, Patrick Palka wrote:
> > On Thu, 15 Feb 2024, Patrick Palka wrote:
> > 
> 
> 
> 
> > Let's keep documenting the inheritance relationship here, i.e.
> > 
> >  bytes_in : data
> > 
> >> @@ -694,13 +656,132 @@ protected:
> >>/* Instrumentation.  */
> >>static unsigned spans[4];
> >>static unsigned lengths[4];
> >> -  static int is_set;
> >> +  friend struct bits_out;
> > 
> > It might be a little more elegant for bits_in/out to be nested classes of 
> > bytes_in/out, returned from member functions, rather than friends 
> > constructed directly?  OK either way, with the above comment tweak.
> 
> Unfortunately, this seems to break x86_64 Darwin bootstrap with fails as 
> below - I did not yet have a chance to look in any morre detail, so this is a 
> head’s up - unless you have any immediate ideas?
> 
> thanks
> Iain
> 
> 
> /src-local/gcc-master/gcc/cp/module.cc: In member function 
> ‘{anonymous}::bytes_in::bits_in {anonymous}::bytes_in::stream_bits()’:
> /src-local/gcc-master/gcc/cp/module.cc:735:24: error: use of deleted function 
> ‘{anonymous}::bytes_in::bits_in::bits_in(const 
> {anonymous}::bytes_in::bits_in&)’
>   735 |   return bits_in (*this);
>   |^
> /src-local/gcc-master/gcc/cp/module.cc:709:3: note: declared here
>   709 |   bits_in(const bits_in&) = delete;
>   |   ^~~
> /src-local/gcc-master/gcc/cp/module.cc: In member function 
> ‘{anonymous}::bytes_out::bits_out {anonymous}::bytes_out::stream_bits()’:
> /src-local/gcc-master/gcc/cp/module.cc:796:25: error: use of deleted function 
> ‘{anonymous}::bytes_out::bits_out::bits_out(const 
> {anonymous}::bytes_out::bits_out&)’
>   796 |   return bits_out (*this);
>   | ^
> /src-local/gcc-master/gcc/cp/module.cc:755:3: note: declared here
>   755 |   bits_out(const bits_out&) = delete;
>   |   ^~~~

Drat, sorry for the breakage.  We need to define defaulted move ctors
for these classes I think.  I'll take care of it ASAP.

[pushed] c++/modules: make bits_in/out move-constructible

2024-04-13 Thread Patrick Palka
Pushed as obvious after verifying C++11 bootstrap is restored.

-- >8 --

gcc/cp/ChangeLog:

* module.cc (struct bytes_in::bits_in): Define defaulted
move ctor.
(struct bytes_out::bits_out): Likewise.
---
 gcc/cp/module.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
index bbed82652d4..c6f71e11515 100644
--- a/gcc/cp/module.cc
+++ b/gcc/cp/module.cc
@@ -706,6 +706,7 @@ struct bytes_in::bits_in {
 bflush ();
   }
 
+  bits_in(bits_in&&) = default;
   bits_in(const bits_in&) = delete;
   bits_in& operator=(const bits_in&) = delete;
 
@@ -752,6 +753,7 @@ struct bytes_out::bits_out {
 bflush ();
   }
 
+  bits_out(bits_out&&) = default;
   bits_out(const bits_out&) = delete;
   bits_out& operator=(const bits_out&) = delete;
 
-- 
2.44.0.591.g8f7582d995



[COMMITTED] Regenerate c.opt.urls

2024-04-13 Thread Mark Wielaard
Fixes: df7bfdb7dbf2 ("c++: reference cast, conversion fn [PR113141]")

A new warning option -Wcast-user-defined was added to c.opt and
documented in doc/invoke.texi. But c.opt.urls wasn't regenerate.

gcc/c-family/ChangeLog:

* c.opt.urls: Regenerate.
---
 gcc/c-family/c.opt.urls | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/c-family/c.opt.urls b/gcc/c-family/c.opt.urls
index 631719863a5e..dd455d7c0dc7 100644
--- a/gcc/c-family/c.opt.urls
+++ b/gcc/c-family/c.opt.urls
@@ -208,6 +208,9 @@ 
UrlSuffix(gcc/Warning-Options.html#index-Wcast-function-type)
 Wcast-qual
 UrlSuffix(gcc/Warning-Options.html#index-Wcast-qual)
 
+Wcast-user-defined
+UrlSuffix(gcc/Warning-Options.html#index-Wcast-user-defined)
+
 Wcatch-value
 UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wcatch-value)
 
-- 
2.39.3



[PATCH 0/3] Recover in-tree libiconv build support

2024-04-13 Thread Arsen Arsenović
Evening!

This patchset recovers support for building the toolchain tree with
in-tree libiconv being used for host modules and gettext.  As spotted by
Kévin Le Gouguec , I accidentally removed this
functionality earlier.

This patchset includes the patch sent as:

https://inbox.sourceware.gcc-patches/20231221193243.368541-1-ar...@aarsen.me/

... and so, supersedes that patchset.

For the in-tree case, the old patch functionality was restored and
rebased on top of current iconv.m4.  Of course, this does not work for
gettext, an out-of-tree lib depending on the in-tree libiconv, so, for
that case, we needed to provide the right information to configure, and
suppress logic in iconv.m4 using cache vars.

Build-tested on arm64-apple-darwin21.6.0, and I intend to do further
testing tomorrow.

OK for trunk?  It would be good to get these patches into GCC 14.

I apologize for being quite late with delivering these, I have,
unfortunately, been busied by various external factors.  Hopefully, it
is not too late yet.

Thanks in advance, have a lovely night!

Arsen Arsenović (3):
  toplevel: don't override gettext-runtime/configure-discovered build
args
  gitignore: ignore /libiconv*
  *: support in-tree libiconv again

 .gitignore |   1 +
 Makefile.def   |   9 +-
 Makefile.in| 100 -
 Makefile.tpl   |   8 +-
 config/iconv.m4|  50 +++--
 configure  |  25 +
 configure.ac   |  21 
 gcc/configure  | 240 +++--
 libcpp/configure   | 206 ---
 libstdc++-v3/configure | 121 -
 10 files changed, 601 insertions(+), 180 deletions(-)

-- 
2.44.0



[PATCH 1/3] toplevel: don't override gettext-runtime/configure-discovered build args

2024-04-13 Thread Arsen Arsenović
ChangeLog:
PR bootstrap/112534
* Makefile.def (host-gettext): Set all_args_override="".
* Makefile.in: Regenerate.
* Makefile.tpl (all--args): Define as a helper macro for
computing extra arguments to make.
(all): Use all--args over args.
---
 Makefile.def |  2 ++
 Makefile.in  | 40 +---
 Makefile.tpl |  8 +---
 3 files changed, 28 insertions(+), 22 deletions(-)

diff --git a/Makefile.def b/Makefile.def
index 19954e7d7318..d25edb6ed76d 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -76,6 +76,8 @@ host_modules= { module= gprof; };
 host_modules= { module= gprofng; };
 host_modules= { module= gettext; bootstrap=true; no_install=true;
 module_srcdir= "gettext/gettext-runtime";
+   // Don't override configure-discovered build arguments
+   all_args_override="";
// We always build gettext with pic, because some packages 
(e.g. gdbserver)
// need it in some configuratons, which is determined via 
nontrivial tests.
// Always enabling pic seems to make sense for something tied to
diff --git a/Makefile.in b/Makefile.in
index db4fa6c62605..f71f515b7aa1 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -3174,6 +3174,8 @@ TAGS: do-TAGS
 
 
 
+
+
 # --
 # Modules which run on the build machine
 # --
@@ -20195,7 +20197,7 @@ all-gettext: configure-gettext
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(HOST_EXPORTS)  \
(cd $(HOST_SUBDIR)/gettext && \
- $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) 
$(STAGE1_FLAGS_TO_PASS)  \
+ $(MAKE) $(BASE_FLAGS_TO_PASS)  $(STAGE1_FLAGS_TO_PASS)  \
$(TARGET-gettext))
 @endif gettext
 
@@ -20225,7 +20227,7 @@ all-stage1-gettext: configure-stage1-gettext
CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-   $(EXTRA_HOST_FLAGS)  \
+ \
$(STAGE1_FLAGS_TO_PASS)  \
TFLAGS="$(STAGE1_TFLAGS)"  \
$(TARGET-stage1-gettext)
@@ -20240,7 +20242,7 @@ clean-stage1-gettext:
  $(MAKE) stage1-start; \
fi; \
cd $(HOST_SUBDIR)/gettext && \
-   $(MAKE) $(EXTRA_HOST_FLAGS)  \
+   $(MAKE)   \
$(STAGE1_FLAGS_TO_PASS)  clean
 @endif gettext-bootstrap
 
@@ -20270,7 +20272,7 @@ all-stage2-gettext: configure-stage2-gettext
CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-   $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  \
+$(POSTSTAGE1_FLAGS_TO_PASS)  \
TFLAGS="$(STAGE2_TFLAGS)"  \
$(TARGET-stage2-gettext)
 
@@ -20284,7 +20286,7 @@ clean-stage2-gettext:
  $(MAKE) stage2-start; \
fi; \
cd $(HOST_SUBDIR)/gettext && \
-   $(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
+   $(MAKE)  $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif gettext-bootstrap
 
 
@@ -20313,7 +20315,7 @@ all-stage3-gettext: configure-stage3-gettext
CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-   $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  \
+$(POSTSTAGE1_FLAGS_TO_PASS)  \
TFLAGS="$(STAGE3_TFLAGS)"  \
$(TARGET-stage3-gettext)
 
@@ -20327,7 +20329,7 @@ clean-stage3-gettext:
  $(MAKE) stage3-start; \
fi; \
cd $(HOST_SUBDIR)/gettext && \
-   $(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
+   $(MAKE)  $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif gettext-bootstrap
 
 
@@ -20356,7 +20358,7 @@ all-stage4-gettext: configure-stage4-gettext
CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \
-   $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  \
+$(POSTSTAGE1_FLAGS_TO_PASS)  \
TFLAGS="$(STAGE4_TFLAGS)"  \
$(TARGET-stage4-gettext)
 
@@ -20370,7 +20372,7 @@ clean-stage4-gettext:
  $(MAKE) stage4-start; \
fi; \
cd $(HOST_SUBDIR)/gettext && \
-   $(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS)  clean
+   $(MAKE)  $(POSTSTAGE1_FLAGS_TO_PASS)  clean
 @endif gettext-bootstrap
 
 
@@ -20399,7 +20401,7 @@ all-stageprofile-gettext: configure-stageprofile-gettext
CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \
CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \
LIBCFL

[PATCH 3/3] *: support in-tree libiconv again

2024-04-13 Thread Arsen Arsenović
ChangeLog:

* Makefile.def: Inform gettext of our freshly-built libiconv.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac (LIBICONV_SIBLING): If an in-tree host libiconv
is being built, set this variable to the path to libiconv.a
(LTLIBICONV_SIBLING): If an in-tree host libiconv is being
built, set this variable to the path to libiconv.la.
(LIBICONV_EXTRA_CPPFLAGS): If an in-tree host libiconv is being,
set this variable to the appropriate CPPFLAGS for using the new
libiconv.
(LIBICONV_CVS): If an in-tree host libiconv is being, set this
variable to the cache variables that iconv.m4 uses that need to
be specicified in order to use the related variables.

config/ChangeLog:

* iconv.m4: Restore modifications from GCC commit
d485982286692075d175dbbcf17d00431106ce96 and co.

gcc/ChangeLog:

* configure: Regenerate.

libcpp/ChangeLog:

* configure: Regenerate.

libstdc++-v3/ChangeLog:

* configure: Regenerate.
---
 Makefile.def   |   7 +-
 Makefile.in|  60 +--
 config/iconv.m4|  50 +++--
 configure  |  25 +
 configure.ac   |  21 
 gcc/configure  | 240 +++--
 libcpp/configure   | 206 ---
 libstdc++-v3/configure | 121 -
 8 files changed, 572 insertions(+), 158 deletions(-)

diff --git a/Makefile.def b/Makefile.def
index d25edb6ed76d..c37f78f2e1da 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -78,11 +78,16 @@ host_modules= { module= gettext; bootstrap=true; 
no_install=true;
 module_srcdir= "gettext/gettext-runtime";
// Don't override configure-discovered build arguments
all_args_override="";
+   // The toolchain build system overrides LDFLAGS that configure
+   // discovers, so specifying these flags as part of the
+   // configure arguments will not work.  Instead, we need to
+   // export them at configure time as well as make time.
+   extra_exports='LDFLAGS="@LTLIBICONV_SIBLING@ $$LDFLAGS"; export 
LDFLAGS;';
// We always build gettext with pic, because some packages 
(e.g. gdbserver)
// need it in some configuratons, which is determined via 
nontrivial tests.
// Always enabling pic seems to make sense for something tied to
// user-facing output.
-   extra_configure_flags='--disable-shared --disable-threads 
--disable-java --disable-csharp --with-pic --disable-libasprintf';
+   extra_configure_flags='--disable-shared --disable-threads 
--disable-java --disable-csharp --with-pic --disable-libasprintf 
CPPFLAGS="@LIBICONV_EXTRA_CPPFLAGS@ $$CPPFLAGS" @LIBICONV_CVS@';
missing= pdf;
missing= html;
missing= info;
diff --git a/Makefile.in b/Makefile.in
index f71f515b7aa1..d65b4b2994a7 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -19856,7 +19856,7 @@ configure-gettext:
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
test ! -f $(HOST_SUBDIR)/gettext/Makefile || exit 0; \
$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gettext; \
-   $(HOST_EXPORTS)  \
+   $(HOST_EXPORTS) LDFLAGS="@LTLIBICONV_SIBLING@ $$LDFLAGS"; export 
LDFLAGS; \
echo Configuring in $(HOST_SUBDIR)/gettext; \
cd "$(HOST_SUBDIR)/gettext" || exit 1; \
case $(srcdir) in \
@@ -19869,7 +19869,7 @@ configure-gettext:
  $$s/$$module_srcdir/configure \
  --srcdir=$${topdir}/$$module_srcdir \
  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
- --target=${target_alias} --disable-shared --disable-threads 
--disable-java --disable-csharp --with-pic --disable-libasprintf \
+ --target=${target_alias} --disable-shared --disable-threads 
--disable-java --disable-csharp --with-pic --disable-libasprintf 
CPPFLAGS="@LIBICONV_EXTRA_CPPFLAGS@ $$CPPFLAGS" @LIBICONV_CVS@ \
  || exit 1
 @endif gettext
 
@@ -19889,7 +19889,7 @@ configure-stage1-gettext:
$(HOST_EXPORTS) \
CFLAGS="$(STAGE1_CFLAGS)"; export CFLAGS; \
CXXFLAGS="$(STAGE1_CXXFLAGS)"; export CXXFLAGS; \
-   LIBCFLAGS="$(LIBCFLAGS)"; export LIBCFLAGS;  \
+   LIBCFLAGS="$(LIBCFLAGS)"; export LIBCFLAGS; 
LDFLAGS="@LTLIBICONV_SIBLING@ $$LDFLAGS"; export LDFLAGS; \
echo Configuring stage 1 in $(HOST_SUBDIR)/gettext; \
$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gettext; \
cd $(HOST_SUBDIR)/gettext || exit 1; \
@@ -19905,7 +19905,7 @@ configure-stage1-gettext:
  --target=${target_alias} \
   \
  $(STAGE1_CONFIGURE_FLAGS) \
- --disable-shared --disable-threads --disable-java --disable-csharp 
--with-pic --disable-libasprintf
+ --disable-shar

[PATCH 2/3] gitignore: ignore /libiconv*

2024-04-13 Thread Arsen Arsenović
ChangeLog:

* .gitignore: Ignore /libiconv* as with other possibly-in-tree
libs.
---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index 93a16b0b950c..3528d9a115ee 100644
--- a/.gitignore
+++ b/.gitignore
@@ -70,3 +70,4 @@ stamp-*
 /gmp*
 /isl*
 /gettext*
+/libiconv*
-- 
2.44.0