Re: Question on -fwrapv and -fwrapv-pointer

2023-09-15 Thread Arsen Arsenović via Gcc-patches

Qing Zhao  writes:

> Even though unsigned integer overflow is well defined, it might be
> unintentional, shall we warn user about this?

This would be better addressed by providing operators or functions that
do overflow checking in the language, so that they can be explicitly
used where overflow is unexpected.  One could easily imagine a scenario
where overflow is not expected in some region of code but is in the
larger application.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [Patch] contrib/gcc-changelog: Check whether revert-commit exists

2023-09-05 Thread Arsen Arsenović via Gcc-patches

Tobias Burnus  writes:

> Attached an old patch. See attached patch for the current one.
>
> Difference is one line: the warning that is shown in the example output
> below.

Python-wise, the changes seem fine.  Unsure if it does the right thing,
though, since I'm not familiar with the full script.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH] libstdc++ Add cstdarg to freestanding

2023-08-16 Thread Arsen Arsenović via Gcc-patches

Jonathan Wakely  writes:

> On Fri, 21 Jul 2023 at 22:23, Paul M. Bendixen via Libstdc++
>  wrote:
>>
>> P1642 includes the header cstdarg to the freestanding implementation.
>> This was probably left out by accident, this patch puts it in.
>> Since this is one of the headers that go in whole cloth, there should be no
>> further actions needed.
>
> Thanks for the patch. I agree that  should be freestanding,
> but I think  and  were also missed from the
> change. Arsen?

Indeed, we should include all three, and according to [compliance],
there's a couple more headers that we should provide (cwchar, cstring,
cerrno, and cmath, but these are probably significantly more involved,
so we can handle them separately).

As guessed, the omission was not intentional.

If you could, add those two to the patch as well, edit Makefile.am and
regenerate using automake 1.15.1, and see
https://gcc.gnu.org/contribute.html wrt. changelogs in commit messages.

Thank you!  Have a lovely day :-)

[compliance]: https://eel.is/c++draft/compliance

> Also, the patch should change include/Makefile.am as well (the .in
> file is autogenerated from that one).
>
>
>> This might be related to PR106953, but since that one touches the partial
>> headers I'm not sure

The headers mentioned in this PR are provided in freestanding,
partially, in 13 already, indeed.

>> /Paul M. Bendixen
>>
>> --
>> • − − •/• −/• • −/• − • •/− • • •/•/− •/− • •/• •/− • • −/•/− •/• − − •−
>> •/− − •/− −/• −/• •/• − • •/• − • − • −/− • − •/− − −/− −//


-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH v2 2/2] libstdc++: Replace all manual FTM definitions and use

2023-08-16 Thread Arsen Arsenović via Gcc-patches

Jonathan Wakely  writes:

> [..snip..]
> Thanks for adding the comments like "// C++ < 20".
>
> I think in  the comment on the #endif can be just __cpp_lib_any
> rather than defined(__cpp_lib_any). Similarly for
> __cpp_lib_atomic_float in . Oh, and __cpp_lib_atomic_ref. And
> in , and several others. I think I'd like those to be
> consistent, and usually we just name the macro in the #endif comment,
> sometimes abbreviated for clarity, without the explicit defined(...).

ACK.  Fixed all of those.

> For this error in  please add <> around "version" and remove
> the question mark:
> +# error "libstdc++ bug: no lock-free atomics but they were emitted in 
> version?"
>
> Similarly, please remove the question marks from the two #errors in
> :
> +#  error "libstdc++ bug: is_corresponding_member and
> is_layout_compatible are provided but their FTM is not set?"
> +#  error "libstdc++ bug: is_pointer_interconvertible available but FTM 
> unset?"
>
> In  you have:
> +# error "libstdc++ bug: string_contents not defined when it should be"
> That should be contains, not contents.
>
> OK for trunk with the #error changes. The #endif cleanup can be
> fixed in a follow-up.
> 
> It seems like there's some inconsistency (probably some preexisting)
> about whether you use:
> #if __cpp_lib_xxx
> or
> #ifdef __cpp_lib_xxx
> That can be tidied up later.
>
> Currently we define many of the macros in the "bits" headers, e.g. in
> bits/stl_iterator.h
>
> +#define __glibcxx_want_constexpr_iterator
> +#define __glibcxx_want_array_constexpr
> +#define __glibcxx_want_make_reverse_iterator
> +#define __glibcxx_want_move_iterator_concept
> +#include 
>
> We should consider only defining those in  itself. So that
> when other parts of the lib include bits/stl_iterator.h they don't
> define the macros. That would mean that
> __cpp_lib_make_reverse_iterator is not defined by  and
> , for example. Even though they do actually provide the
> features, the macro would only be defined by  and .
> This might encourage users to include the right headers, instead of
> relying on transitive includes.

> If we do that, our own internal checks for features would all need to use:
> #if __glibcxx_make_reverse_iterator
> because they wouldn't have the __cpp_lib_xxx macro, because they only
> include the internal bits header not .
>
> That's for another day though.

Yes, that sounds quite reasonable.  I like the idea that headers should
export narrower FTMs.

Pushed.  Thanks :-)
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH v2 1/2] libstdc++: Implement more maintainable header

2023-08-14 Thread Arsen Arsenović via Gcc-patches

Arsen Arsenović  writes:

> This commit replaces the ad-hoc logic in  with an AutoGen
> database that (mostly) declaratively generates a version.h bit which
> combines all of the FTM logic across all headers together.
>
> This generated header defines macros of the form __glibcxx_foo,
> equivalent to their __cpp_lib_foo variants, according to rules specified
> in version.def and, optionally, if __glibcxx_want_foo or
> __glibcxx_want_all are defined, also defines __cpp_lib_foo forms with
> the same definition.
>
> libstdc++-v3/ChangeLog:
>
>   * include/Makefile.am (bits_freestanding): Add version.h.
>   (allcreated): Add version.h.
>   (${bits_srcdir}/version.h): New rule.  Regenerates
>   version.h out of version.{def,tpl}.
>   * include/Makefile.in: Regenerate.
>   * include/bits/version.def: New file.  Declares a list of
>   all feature test macros, their values and their preconditions.
>   * include/bits/version.tpl: New file.  Turns version.def
>   into a sequence of #if blocks.
>   * include/bits/version.h: New file.  Generated from
>   version.def.
>   * include/std/version: Replace with a __glibcxx_want_all define
>   and bits/version.h include.
> ---
> This patchset is a rebase of
> https://inbox.sourceware.org/libstdc++/20230429101640.1697750-1-ar...@aarsen.me/
>
> ... passing the same two checks (difall / vercmp) I wrote for the first
> pass.  Testsuite runs are still pending.
>
> Changes in this revision:
> - Replace the ${bits_srcdir}/version.h rule with a update-version phony,
> - Add the new __cpp_lib_chrono value,
> - Add __cpp_lib_{ranges_{contains,find_last,fold,iota}},
> - Add comments to various replaced conditions which summarize their
>   condition,
> - Correct a few minor errors spotted in review
>
> OK for trunk (if those testsuite runs end up clean)?

Same tests as the first time around passed on x86_64-pc-linux-gnu (that
is, regression testing + a large libstdc++ harness).
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


[PATCH v2 1/2] libstdc++: Implement more maintainable header

2023-08-13 Thread Arsen Arsenović via Gcc-patches
This commit replaces the ad-hoc logic in  with an AutoGen
database that (mostly) declaratively generates a version.h bit which
combines all of the FTM logic across all headers together.

This generated header defines macros of the form __glibcxx_foo,
equivalent to their __cpp_lib_foo variants, according to rules specified
in version.def and, optionally, if __glibcxx_want_foo or
__glibcxx_want_all are defined, also defines __cpp_lib_foo forms with
the same definition.

libstdc++-v3/ChangeLog:

* include/Makefile.am (bits_freestanding): Add version.h.
(allcreated): Add version.h.
(${bits_srcdir}/version.h): New rule.  Regenerates
version.h out of version.{def,tpl}.
* include/Makefile.in: Regenerate.
* include/bits/version.def: New file.  Declares a list of
all feature test macros, their values and their preconditions.
* include/bits/version.tpl: New file.  Turns version.def
into a sequence of #if blocks.
* include/bits/version.h: New file.  Generated from
version.def.
* include/std/version: Replace with a __glibcxx_want_all define
and bits/version.h include.
---
This patchset is a rebase of
https://inbox.sourceware.org/libstdc++/20230429101640.1697750-1-ar...@aarsen.me/

... passing the same two checks (difall / vercmp) I wrote for the first
pass.  Testsuite runs are still pending.

Changes in this revision:
- Replace the ${bits_srcdir}/version.h rule with a update-version phony,
- Add the new __cpp_lib_chrono value,
- Add __cpp_lib_{ranges_{contains,find_last,fold,iota}},
- Add comments to various replaced conditions which summarize their
  condition,
- Correct a few minor errors spotted in review

OK for trunk (if those testsuite runs end up clean)?

 libstdc++-v3/include/Makefile.am  |   10 +-
 libstdc++-v3/include/Makefile.in  |   10 +-
 libstdc++-v3/include/bits/version.def | 1597 
 libstdc++-v3/include/bits/version.h   | 1942 +
 libstdc++-v3/include/bits/version.tpl |  210 +++
 libstdc++-v3/include/std/version  |  350 +
 6 files changed, 3770 insertions(+), 349 deletions(-)
 create mode 100644 libstdc++-v3/include/bits/version.def
 create mode 100644 libstdc++-v3/include/bits/version.h
 create mode 100644 libstdc++-v3/include/bits/version.tpl

diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index a880e8ee227..9c71c75393a 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -154,6 +154,7 @@ bits_freestanding = \
${bits_srcdir}/stl_raw_storage_iter.h \
${bits_srcdir}/stl_relops.h \
${bits_srcdir}/stl_uninitialized.h \
+   ${bits_srcdir}/version.h \
${bits_srcdir}/string_view.tcc \
${bits_srcdir}/uniform_int_dist.h \
${bits_srcdir}/unique_ptr.h \
@@ -1113,7 +1114,8 @@ allcreated = \
${host_builddir}/c++config.h \
${host_builddir}/largefile-config.h \
${thread_host_headers} \
-   ${pch_build}
+   ${pch_build} \
+   ${bits_srcdir}/version.h
 
 # Here are the rules for building the headers
 all-local: ${allstamped} ${allcreated}
@@ -1463,6 +1465,12 @@ ${pch3_output}: ${pch3_source} ${pch2_output}
-mkdir -p ${pch3_output_builddir}
$(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pch3_source} -o $@
 
+# AutoGen .
+.PHONY: update-version
+update-version:
+   cd ${bits_srcdir} && \
+   autogen version.def
+
 # The real deal.
 install-data-local: install-headers
 install-headers:
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index 0ff875b280b..f5b04d3fe8a 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -509,6 +509,7 @@ bits_freestanding = \
${bits_srcdir}/stl_raw_storage_iter.h \
${bits_srcdir}/stl_relops.h \
${bits_srcdir}/stl_uninitialized.h \
+   ${bits_srcdir}/version.h \
${bits_srcdir}/string_view.tcc \
${bits_srcdir}/uniform_int_dist.h \
${bits_srcdir}/unique_ptr.h \
@@ -1441,7 +1442,8 @@ allcreated = \
${host_builddir}/c++config.h \
${host_builddir}/largefile-config.h \
${thread_host_headers} \
-   ${pch_build}
+   ${pch_build} \
+   ${bits_srcdir}/version.h
 
 
 # Host includes for threads
@@ -1937,6 +1939,12 @@ ${pch3_output}: ${pch3_source} ${pch2_output}
-mkdir -p ${pch3_output_builddir}
$(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pch3_source} -o $@
 
+# AutoGen .
+${bits_srcdir}/version.h: ${bits_srcdir}/version.def \
+   ${bits_srcdir}/version.tpl
+   cd $(@D) && \
+   autogen version.def
+
 # The real deal.
 install-data-local: install-headers
 install-headers:
diff --git a/libstdc++-v3/include/bits/version.def 
b/libstdc++-v3/include/bits/version.def
new file mode 100644
index 000..e63715e17e7
--- /dev/null
+++ 

Re: [PATCHv2] Use toplevel configure for GMP and MPFR for gdb

2023-08-10 Thread Arsen Arsenović via Gcc-patches

Matthias Klose via Gcc-patches  writes:

> On 10.11.22 20:05, apinski--- via Binutils wrote:
>> From: Andrew Pinski 
>> This patch uses the toplevel configure parts for GMP/MPFR for
>> gdb. The only thing is that gdb now requires MPFR for building.
>> Before it was a recommended but not required library.
>> Also this allows building of GMP and MPFR with the toplevel
>> directory just like how it is done for GCC.
>> We now error out in the toplevel configure of the version
>> of GMP and MPFR that is wrong.
>> OK after GDB 13 branches? Build gdb 3 ways:
>> with GMP and MPFR in the toplevel (static library used at that point for 
>> both)
>> With only MPFR in the toplevel (GMP distro library used and MPFR built from 
>> source)
>> With neither GMP and MPFR in the toplevel (distro libraries used)
>
> this still seems to be broken for a gdb trunk build, using GMP and MPFR system
> libraries:
>
> linking gdb:
>
> [...]
> ../gnulib/import/libgnu.a   -Lyes/lib -lmpfr -lgmp -lsource-highlight
> -lboost_regex  -lxxhash  -ldebuginfod   -ldl
> -Wl,--dynamic-list=/<>/gdb/proc-service.list
> ./libtool: line 5209: cd: yes/lib: No such file or directory
> libtool: link: cannot determine absolute directory name of `yes/lib'
> make[3]: *** [Makefile:2174: gdb] Error 1
> make[3]: Leaving directory '/<>/build/default/gdb'
>
> full build log at
> https://launchpad.net/~doko/+archive/ubuntu/toolchain/+sourcepub/15065515/+listing-archive-extra
>
>
> the toplevel config.log has:
>
> configure:8183: checking for the correct version of gmp.h
> configure:8202: x86_64-linux-gnu-gcc -c  -Iyes/include  -fPIC conftest.c >&5
> configure:8202: $? = 0
> configure:8220: x86_64-linux-gnu-gcc -c  -Iyes/include  -fPIC conftest.c >&5
> configure:8220: $? = 0
> configure:8221: result: yes
> configure:8237: checking for the correct version of mpfr.h
> configure:8255: x86_64-linux-gnu-gcc -c  -Iyes/include  -fPIC conftest.c >&5
> configure:8255: $? = 0
> configure:8272: x86_64-linux-gnu-gcc -c  -Iyes/include  -fPIC conftest.c >&5
> configure:8272: $? = 0
> configure:8273: result: yes
> configure:8342: checking for the correct version of the gmp/mpfr libraries
> configure:8366: x86_64-linux-gnu-gcc -o conftest  -Iyes/include  -fPIC
> conftest.c  -Lyes/lib -lmpfr -lgmp >&5
> configure:8366: $? = 0
> configure:8367: result: yes
> configure:8615: checking for isl 0.15 or later
> configure:8628: x86_64-linux-gnu-gcc -o conftest   -Iyes/include  -fPIC   
> -lisl
> -Lyes/lib -lmpfr -lgmp conftest.c  -lisl -lgmp >&5
> configure:8628: $? = 0

Seems that you're passing simply --with-mpfr, however:

  AC_ARG_WITH(mpfr,
  [AS_HELP_STRING([--with-mpfr=PATH],
  [specify prefix directory for installed MPFR package.
   Equivalent to --with-mpfr-include=PATH/include
   plus --with-mpfr-lib=PATH/lib])])

... so it is interpreted to mean that the prefix MPFR is installed in is
yes/include (perhaps we should warn for the 'yes' case - that'd be less
confusing).  I think you should be able to get away without passing
--with-mpfr at all if your toolchain has mpfr available (and there's no
mpfr in the toplevel, to inhibit the toplevel trying to build its own
copy).

Hope that helps, have a lovely night.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH 00/24] Sync shared build infrastructure with binutils-gdb

2023-08-08 Thread Arsen Arsenović via Gcc-patches

Joseph Myers  writes:

> On Tue, 8 Aug 2023, Arsen Arsenović via Gcc-patches wrote:
>
>> Yes.  Libtool was forked over a decade ago.  My next project is syncing
>> upstream and us back up.  Unsure about pkg.m4.
>
> Note as per previous discussions that libtool commit 
> 3334f7ed5851ef1e96b052f2984c4acdbf39e20c will need reverting in GCC when 
> updating libtool because of incompatible usage of --with-sysroot.

I wanted to, somehow, coalesce the two back together, so that both are
available.  Presumably, this means adding an option to libtool to accept
host-sysroot or such, but I haven't done too much looking into this.

Is my interpretation of the issue correct?  (i.e. GCC uses sysroot to
mean *target* sysroot rather than host sysroot)

> Reportedly libtool is based on upstream commit 
> 2c9c38d8a12eb0a2ce7fe9c3862523026c3d5622 (with *many* local changes, some 
> of which may not be present upstream).

Thanks, sharing that base will save me a good amount of time.

Have a lovely night.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH 00/24] Sync shared build infrastructure with binutils-gdb

2023-08-07 Thread Arsen Arsenović via Gcc-patches

Eric Gallager  writes:

> Hi, with the updates to libtool.m4 and pkg.m4, those files originally
> come from upstream libtool and pkg-config, correct? Won't patching
> GCC's local copies make re-syncing them with upstream
> libtool/pkg-config more difficult, or have these patches already been
> sent there, too? Also, when updating .m4 files, aren't you supposed to
> increment the serial number that they have near the top, too?

Yes.  Libtool was forked over a decade ago.  My next project is syncing
upstream and us back up.  Unsure about pkg.m4.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH 24/24] toplevel: Makefile.def: add install-strip dependency on libsframe

2023-08-07 Thread Arsen Arsenović via Gcc-patches

Jeff Law  writes:

> OK.
>
> I know I skipped over a few.  I'll try to get those wrapped up shortly.

Thanks, I've pushed all of those (since I received all the reviews).

> While I strongly dislike git submodules, this may be one of those occasions
> where their use might be justified.  Something to ponder because these shared
> toplevel files are painful to keep sync'd.

I'm not sure how viable this is in the toplevel directory.  The inverse
is quite possible: the shared build system contains all the other
directories as modules, but that's undesirable for other reasons, I
presume.

I'll see if there's some solution.

> jeff


-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH 2/2] libstdc++: Replace all manual FTM definitions and use

2023-08-07 Thread Arsen Arsenović via Gcc-patches

Jonathan Wakely  writes:

> On Sat, 29 Apr 2023 at 11:24, Arsen Arsenović via Libstdc++ <
> libstd...@gcc.gnu.org> wrote:
>
>> libstdc++-v3/ChangeLog:
>>
>> * libsupc++/typeinfo: Switch to bits/version.h for
>> __cpp_lib_constexpr_typeinfo.
>>
>>
> Does this change have an impact on compilation speed?
> With this change we'll be re-including bits/version.h multiple times in
> most compilations, and unlike other headers the preprocessor can't optimize
> away the second and subsequent times its' included, because the header
> isn't idempotent.
> It will only affect the preprocessing phase, which is a fraction of the
> time taken by template instantiation and middle end optimizations, but I'd
> like to know it's not *too* expensive before committing to this approach.
>

Whoops, I forgot to provide these measurements.

  ~/gcc/build$ time for x in $(seq 1 100); do _pfx/bin/g++ -x c++ - \
   -S -o /dev/null <<< '#include '; done
  
  real  3m4.104s
  user  2m53.394s
  sys   0m10.132s

  ~/gcc/pristine-bld$ time for x in $(seq 1 100); do _pfx/bin/g++ \
   -x c++ - -S -o /dev/null \
   <<< '#include '; done
  
  real  2m56.430s
  user  2m46.898s
  sys   0m8.967s

The top is a build of gcc with (a rebase of) this patchset, and the
bottom is the merge base.  The configuration for both was:

  ../configure --enable-languages=c++ \
   --disable-libsanitizers \
   --prefix="$(pwd)/_pfx"

This should imply that the difference is minor compared to compilation
time.

Of course, for preprocessing, the difference is far more significant
(same testcase, but with -E): 0m17.248s vs 0m28.382s.

This seems okay to me.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH 2/2] libstdc++: Replace all manual FTM definitions and use

2023-08-07 Thread Arsen Arsenović via Gcc-patches

Jonathan Wakely  writes:

> On Sat, 29 Apr 2023 at 11:24, Arsen Arsenović via Libstdc++ <
> libstd...@gcc.gnu.org> wrote:
>
>> libstdc++-v3/ChangeLog:
>>
>> * libsupc++/typeinfo: Switch to bits/version.h for
>> __cpp_lib_constexpr_typeinfo.
>>
>>
> Does this change have an impact on compilation speed?
> With this change we'll be re-including bits/version.h multiple times in
> most compilations, and unlike other headers the preprocessor can't optimize
> away the second and subsequent times its' included, because the header
> isn't idempotent.
> It will only affect the preprocessing phase, which is a fraction of the
> time taken by template instantiation and middle end optimizations, but I'd
> like to know it's not *too* expensive before committing to this approach.



>
>> @@ -234,9 +234,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>>return __atomic_test_and_set (&_M_i, int(__m));
>>  }
>>
>> -#if __cplusplus > 201703L
>> -#define __cpp_lib_atomic_flag_test 201907L
>> -
>> +#ifdef __cpp_lib_atomic_flag_test
>>  _GLIBCXX_ALWAYS_INLINE bool
>>  test(memory_order __m = memory_order_seq_cst) const noexcept
>>  {
>>
>
> This is more "structured" and maintainable than the current ad-hoc way we
> deal with FTMs, but this seems like a readability/usability regression in
> terms of being able to open the header and see "ah this feature is only
> available for C++20 and up". Instead you can see it's available for the
> specified FTM, but now you have to go and find where that's defined, and
> that's not even defined in C++, it's in the version.def file. It's also
> defined in bits/version.h, but that's a generated file and so is very
> verbose and long.
>
>
> diff --git a/libstdc++-v3/include/bits/move_only_function.h
>> b/libstdc++-v3/include/bits/move_only_function.h
>> index 71d52074978..81d7d9f7c0a 100644
>> --- a/libstdc++-v3/include/bits/move_only_function.h
>> +++ b/libstdc++-v3/include/bits/move_only_function.h
>> @@ -32,7 +32,10 @@
>>
>>  #pragma GCC system_header
>>
>> -#if __cplusplus > 202002L
>> +#define __glibcxx_want_move_only_function
>> +#include 
>> +
>> +#ifdef __cpp_lib_move_only_function
>>
>
> Here's another case where I think the __cplusplus > 202002L is more
> discoverable.
>
> Although maybe I'm biased, because I look at that and immediately see
> "C++23 and up". Maybe the average user finds that less clear. Maybe the
> average user doesn't need to look at this anyway, but I know *I* do it
> fairly often.
>
> I wonder if it would help if we kept a comment there with a (possibly
> imprecise) hint about the conditions under which the feature is defined. So
> in this case:
>
> // Only defined for C++23
> #ifdef __cpp_lib_move_only_function
>
> That retains the info that's currently there, and is even more readable
> than the __cplusplus check.
>
> There's a risk that those comments would get out of step with reality,
> which is one of the things this patch set aims to solve. But I think in
> practice that's unlikely. std::move_only_function isn't suddenly going to
> become available in C++20, or stop being available in C++23 and move to
> C++26.
>
> What do you think?

I think that's reasonable.  And, yes, I doubt these conditions change
much.  I'll go over the conditions and insert a hint.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH 1/2] libstdc++: Implement more maintainable header

2023-08-07 Thread Arsen Arsenović via Gcc-patches

Jonathan Wakely  writes:
> [...snip...]
> It looks like this will regenerate the bits/version.h file if it's older
> than the definitions or the autogen template, right?
>
> Generally we don't want to touch anything in the source tree as part of a
> normal build. It's OK to do that when configured with
> --enable-maintainer-mode (which nobody working on libstdc++ actually uses,
> because it causes problems IME) or via a dedicated target which is not
> built by default (e.g. doc/Makefile.am has the doc-html-docbook-regenerate
> target, which is isn't a prereq of any other targets so it's only run if
> you explicitly request it).
>
> The problem with modifying the source tree as part of a normal build is
> that it might be on read-only media, and so the build will fail if this
> target can't be updated. We would also want to add the version.h header to
> the contrib/gcc_update script that updates the timestamps of generated
> files, so that they are always newer than their prereqs.
>
> Maybe the best option here is to assume that version.h is always up to
> date, and add a custom target to regen it manually, which we can run after
> editing the .def or .tpl files. What do you think?

Ah, I wasn't aware of this concern.  I'll make it a phony target, yeah.

> My only other concern with this patch is that I don't speak lisp so the
> Guile code in version.tpl is opaque and unmaintainable for me. That is
> fixable though.

The algorithm the code implements is quite simple, it just verifies that
the three numeric fields associated with each FTM are in a non-ascending
order (which ensures that the most broad option comes last in the
#if/#elif chain).  It's a sanity check that's caught a couple of
transcription errors I made during the initial conversion.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


[PATCH 22/24] libtool.m4: augment symcode for Solaris 11

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: Nick Alcock 

This reports common symbols like GNU nm, via a type code of 'C'.

ChangeLog:

* libtool.m4 (lt_cv_sys_global_symbol_pipe): Augment symcode for
Solaris 11.

gcc/ChangeLog:

* configure: Regenerate.

libatomic/ChangeLog:

* configure: Regenerate.

libbacktrace/ChangeLog:

* configure: Regenerate.

libcc1/ChangeLog:

* configure: Regenerate.

libffi/ChangeLog:

* configure: Regenerate.

libgfortran/ChangeLog:

* configure: Regenerate.

libgm2/ChangeLog:

* configure: Regenerate.

libgomp/ChangeLog:

* configure: Regenerate.

libitm/ChangeLog:

* configure: Regenerate.

libobjc/ChangeLog:

* configure: Regenerate.

libphobos/ChangeLog:

* configure: Regenerate.

libquadmath/ChangeLog:

* configure: Regenerate.

libsanitizer/ChangeLog:

* configure: Regenerate.

libssp/ChangeLog:

* configure: Regenerate.

libstdc++-v3/ChangeLog:

* configure: Regenerate.

libvtv/ChangeLog:

* configure: Regenerate.

lto-plugin/ChangeLog:

* configure: Regenerate.

zlib/ChangeLog:

* configure: Regenerate.
---
 gcc/configure  | 2 +-
 libatomic/configure| 2 +-
 libbacktrace/configure | 2 +-
 libcc1/configure   | 2 +-
 libffi/configure   | 2 +-
 libgfortran/configure  | 2 +-
 libgm2/configure   | 2 +-
 libgomp/configure  | 2 +-
 libitm/configure   | 2 +-
 libobjc/configure  | 2 +-
 libphobos/configure| 2 +-
 libquadmath/configure  | 2 +-
 libsanitizer/configure | 2 +-
 libssp/configure   | 2 +-
 libstdc++-v3/configure | 2 +-
 libtool.m4 | 2 +-
 libvtv/configure   | 2 +-
 lto-plugin/configure   | 2 +-
 zlib/configure | 2 +-
 19 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/gcc/configure b/gcc/configure
index e5e95e7c1c8..ea1ad6606a6 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -15346,7 +15346,7 @@ osf*)
   symcode='[BCDEGQRST]'
   ;;
 solaris*)
-  symcode='[BDRT]'
+  symcode='[BCDRT]'
   ;;
 sco3.2v5*)
   symcode='[DT]'
diff --git a/libatomic/configure b/libatomic/configure
index 75096735c61..57f320753e1 100755
--- a/libatomic/configure
+++ b/libatomic/configure
@@ -6593,7 +6593,7 @@ osf*)
   symcode='[BCDEGQRST]'
   ;;
 solaris*)
-  symcode='[BDRT]'
+  symcode='[BCDRT]'
   ;;
 sco3.2v5*)
   symcode='[DT]'
diff --git a/libbacktrace/configure b/libbacktrace/configure
index f3ef3fc3f23..c3e7b884e36 100755
--- a/libbacktrace/configure
+++ b/libbacktrace/configure
@@ -7038,7 +7038,7 @@ osf*)
   symcode='[BCDEGQRST]'
   ;;
 solaris*)
-  symcode='[BDRT]'
+  symcode='[BCDRT]'
   ;;
 sco3.2v5*)
   symcode='[DT]'
diff --git a/libcc1/configure b/libcc1/configure
index edf03334f30..1a63a0e4e1a 100755
--- a/libcc1/configure
+++ b/libcc1/configure
@@ -6299,7 +6299,7 @@ osf*)
   symcode='[BCDEGQRST]'
   ;;
 solaris*)
-  symcode='[BDRT]'
+  symcode='[BCDRT]'
   ;;
 sco3.2v5*)
   symcode='[DT]'
diff --git a/libffi/configure b/libffi/configure
index a1ded4f617b..9eac9c907bf 100755
--- a/libffi/configure
+++ b/libffi/configure
@@ -6825,7 +6825,7 @@ osf*)
   symcode='[BCDEGQRST]'
   ;;
 solaris*)
-  symcode='[BDRT]'
+  symcode='[BCDRT]'
   ;;
 sco3.2v5*)
   symcode='[DT]'
diff --git a/libgfortran/configure b/libgfortran/configure
index 7b408515498..cd176b04a14 100755
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -8227,7 +8227,7 @@ osf*)
   symcode='[BCDEGQRST]'
   ;;
 solaris*)
-  symcode='[BDRT]'
+  symcode='[BCDRT]'
   ;;
 sco3.2v5*)
   symcode='[DT]'
diff --git a/libgm2/configure b/libgm2/configure
index 2d54302129c..f576681098f 100755
--- a/libgm2/configure
+++ b/libgm2/configure
@@ -8129,7 +8129,7 @@ osf*)
   symcode='[BCDEGQRST]'
   ;;
 solaris*)
-  symcode='[BDRT]'
+  symcode='[BCDRT]'
   ;;
 sco3.2v5*)
   symcode='[DT]'
diff --git a/libgomp/configure b/libgomp/configure
index 6d4b6e3850e..a12b30f1b0f 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -6607,7 +6607,7 @@ osf*)
   symcode='[BCDEGQRST]'
   ;;
 solaris*)
-  symcode='[BDRT]'
+  symcode='[BCDRT]'
   ;;
 sco3.2v5*)
   symcode='[DT]'
diff --git a/libitm/configure b/libitm/configure
index 83ff24b73e8..02e8de7896b 100755
--- a/libitm/configure
+++ b/libitm/configure
@@ -7268,7 +7268,7 @@ osf*)
   symcode='[BCDEGQRST]'
   ;;
 solaris*)
-  symcode='[BDRT]'
+  symcode='[BCDRT]'
   ;;
 sco3.2v5*)
   symcode='[DT]'
diff --git a/libobjc/configure b/libobjc/configure
index fd590e628ab..752f6fdfebd 100755
--- a/libobjc/configure
+++ b/libobjc/configure
@@ -5995,7 +5995,7 @@ osf*)
   symcode='[BCDEGQRST]'
   ;;
 solaris*)
-  symcode='[BDRT]'
+  symcode='[BCDRT]'
   ;;
 sco3.2v5*)
   symcode='[DT]'
diff --git a/libphobos/configure b/libphobos/configure
index 814cacc1120..b7276d95010 100755
--- a/libphobos/configure
+++ b/libphobos/configure
@@ -7272,7 +7272,7 @@ osf*)
   symcode='[BCDEGQRST]'
   ;;
 solaris*)
-  symcode='[BDRT]'
+  symcode='[BCDRT]'
   ;;
 sco3.2v5*)
   symcode='[DT]'
diff --git 

[PATCH 19/24] Deprecate a.out support for NetBSD targets.

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: John Ericson 

As discussed previously, a.out support is now quite deprecated, and in
some cases removed, in both Binutils itself and NetBSD, so this legacy
default makes little sense. `netbsdelf*` and `netbsdaout*` still work
allowing the user to be explicit about there choice. Additionally, the
configure script warns about the change as Nick Clifton requested.

One possible concern was the status of NetBSD on NS32K, where only a.out
was supported. But per [1] NetBSD has removed support, and if it were to
come back, it would be with ELF. The binutils implementation is
therefore marked obsolete, per the instructions in the last message.

With that patch and this one applied, I have confirmed the following:

--target=i686-unknown-netbsd
--target=i686-unknown-netbsdelf
  builds completely

--target=i686-unknown-netbsdaout
  properly fails because target is deprecated.

--target=vax-unknown-netbsdaout builds completely except for gas, where
the target is deprecated.

[1]: https://mail-index.netbsd.org/tech-toolchain/2021/07/19/msg004025.html

config/ChangeLog:

* picflag.m4: Simplify SHmedia NetBSD match by presuming ELF.

gcc/ChangeLog:

* configure: Regenerate.

libada/ChangeLog:

* configure: Regenerate.

libgcc/ChangeLog:

* configure: Regenerate.

libiberty/ChangeLog:

* configure: Regenerate.
---
 config/picflag.m4   | 4 +---
 gcc/configure   | 8 +++-
 libada/configure| 4 +---
 libgcc/configure| 4 +---
 libiberty/configure | 4 +---
 5 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/config/picflag.m4 b/config/picflag.m4
index 0aefcf619bf..3f3ac744c96 100644
--- a/config/picflag.m4
+++ b/config/picflag.m4
@@ -63,9 +63,7 @@ case "${$2}" in
 sh-*-linux* | sh[[2346lbe]]*-*-linux*)
$1=-fpic
;;
-# FIXME: Simplify to sh*-*-netbsd*?
-sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
-  sh64-*-netbsd* | sh64l*-*-netbsd*)
+sh*-*-netbsd*)
$1=-fpic
;;
 # Default to -fPIC unless specified otherwise.
diff --git a/gcc/configure b/gcc/configure
index cd9919e858d..e5e95e7c1c8 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -5480,9 +5480,7 @@ case "${target}" in
 sh-*-linux* | sh[2346lbe]*-*-linux*)
PICFLAG_FOR_TARGET=-fpic
;;
-# FIXME: Simplify to sh*-*-netbsd*?
-sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
-  sh64-*-netbsd* | sh64l*-*-netbsd*)
+sh*-*-netbsd*)
PICFLAG_FOR_TARGET=-fpic
;;
 # Default to -fPIC unless specified otherwise.
@@ -19888,7 +19886,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 19891 "configure"
+#line 19889 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -19994,7 +19992,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 19997 "configure"
+#line 19995 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/libada/configure b/libada/configure
index 9c8b133d817..ac4dad3ad3b 100755
--- a/libada/configure
+++ b/libada/configure
@@ -3231,9 +3231,7 @@ case "${host}" in
 sh-*-linux* | sh[2346lbe]*-*-linux*)
PICFLAG=-fpic
;;
-# FIXME: Simplify to sh*-*-netbsd*?
-sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
-  sh64-*-netbsd* | sh64l*-*-netbsd*)
+sh*-*-netbsd*)
PICFLAG=-fpic
;;
 # Default to -fPIC unless specified otherwise.
diff --git a/libgcc/configure b/libgcc/configure
index 1e727367ba3..cf149209652 100755
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -2422,9 +2422,7 @@ case "${host}" in
 sh-*-linux* | sh[2346lbe]*-*-linux*)
PICFLAG=-fpic
;;
-# FIXME: Simplify to sh*-*-netbsd*?
-sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
-  sh64-*-netbsd* | sh64l*-*-netbsd*)
+sh*-*-netbsd*)
PICFLAG=-fpic
;;
 # Default to -fPIC unless specified otherwise.
diff --git a/libiberty/configure b/libiberty/configure
index bdc860f1623..dd896270dc6 100755
--- a/libiberty/configure
+++ b/libiberty/configure
@@ -5368,9 +5368,7 @@ case "${host}" in
 sh-*-linux* | sh[2346lbe]*-*-linux*)
PICFLAG=-fpic
;;
-# FIXME: Simplify to sh*-*-netbsd*?
-sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
-  sh64-*-netbsd* | sh64l*-*-netbsd*)
+sh*-*-netbsd*)
PICFLAG=-fpic
;;
 # Default to -fPIC unless specified otherwise.
-- 
2.41.0



[PATCH 14/24] libtool.m4: fix nm BSD flag detection

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: Nick Alcock 

Libtool needs to get BSD-format (or MS-format) output out of the system
nm, so that it can scan generated object files for symbol names for
-export-symbols-regex support.  Some nms need specific flags to turn on
BSD-formatted output, so libtool checks for this in its AC_PATH_NM.
Unfortunately the code to do this has a pair of interlocking flaws:

 - it runs the test by doing an nm of /dev/null.  Some platforms
   reasonably refuse to do an nm on a device file, but before now this
   has only been worked around by assuming that the error message has a
   specific textual form emitted by Tru64 nm, and that getting this
   error means this is Tru64 nm and that nm -B would work to produce
   BSD-format output, even though the test never actually got anything
   but an error message out of nm -B.  This is fixable by nm'ing *nm
   itself* (since we necessarily have a path to it).

 - the test is entirely skipped if NM is set in the environment, on the
   grounds that the user has overridden the test: but the user cannot
   reasonably be expected to know that libtool wants not only nm but
   also flags forcing BSD-format output.  Worse yet, one such "user" is
   the top-level Cygnus configure script, which neither tests for
   nor specifies any BSD-format flags.  So platforms needing BSD-format
   flags always fail to set them when run in a Cygnus tree, breaking
   -export-symbols-regex on such platforms.  Libtool also needs to
   augment $LD on some platforms, but this is done unconditionally,
   augmenting whatever the user specified: the nm check should do the
   same.

   One wrinkle: if the user has overridden $NM, a path might have been
   provided: so we use the user-specified path if there was one, and
   otherwise do the path search as usual.  (If the nm specified doesn't
   work, this might lead to a few extra pointless path searches -- but
   the test is going to fail anyway, so that's not a problem.)

(Tested with NM unset, and set to nm, /usr/bin/nm, my-nm where my-nm is a
symlink to /usr/bin/nm on the PATH, and /not-on-the-path/my-nm where
*that* is a symlink to /usr/bin/nm.)

ChangeLog:

* libtool.m4 (LT_PATH_NM): Try BSDization flags with a user-provided
NM, if there is one.  Run nm on itself, not on /dev/null, to avoid
errors from nms that refuse to work on non-regular files.  Remove
other workarounds for this problem.  Strip out blank lines from the
nm output.

fixincludes/ChangeLog:

* configure: Regenerate.

gcc/ChangeLog:

* configure: Regenerate.

libatomic/ChangeLog:

* configure: Regenerate.

libbacktrace/ChangeLog:

* configure: Regenerate.

libcc1/ChangeLog:

* configure: Regenerate.

libffi/ChangeLog:

* configure: Regenerate.

libgfortran/ChangeLog:

* configure: Regenerate.

libgm2/ChangeLog:

* configure: Regenerate.

libgomp/ChangeLog:

* configure: Regenerate.

libitm/ChangeLog:

* configure: Regenerate.

libobjc/ChangeLog:

* configure: Regenerate.

libphobos/ChangeLog:

* configure: Regenerate.

libquadmath/ChangeLog:

* configure: Regenerate.

libsanitizer/ChangeLog:

* configure: Regenerate.

libssp/ChangeLog:

* configure: Regenerate.

libstdc++-v3/ChangeLog:

* configure: Regenerate.

libvtv/ChangeLog:

* configure: Regenerate.

lto-plugin/ChangeLog:

* configure: Regenerate.

zlib/ChangeLog:

* configure: Regenerate.
---
 fixincludes/configure  |   3 +-
 gcc/configure  |  89 ++--
 libatomic/configure|  89 ++--
 libbacktrace/configure |  89 ++--
 libcc1/configure   |  89 ++--
 libffi/configure   |  89 ++--
 libgfortran/configure  |  89 ++--
 libgm2/configure   |  89 ++--
 libgomp/configure  |  89 ++--
 libitm/configure   |  89 ++--
 libobjc/configure  |  89 ++--
 libphobos/configure|  89 ++--
 libquadmath/configure  |  89 ++--
 libsanitizer/configure |  89 ++--
 libssp/configure   |  89 ++--
 libstdc++-v3/configure | 101 +
 libtool.m4 |  88 +--
 libvtv/configure   |  89 ++--
 lto-plugin/configure   |  89 ++--
 zlib/configure |  89 ++--
 20 files changed, 863 insertions(+), 842 deletions(-)

diff --git a/fixincludes/configure b/fixincludes/configure
index f1748ebef74..b9770489adc 100755
--- 

[PATCH 24/24] toplevel: Makefile.def: add install-strip dependency on libsframe

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: Indu Bhagat 

As noted in PR libsframe/30014 - FTBFS: install-strip fails because
bfdlib relinks and fails to find libsframe, the install time
dependencies of libbfd need to be updated.

ChangeLog:

* Makefile.def: Reflect that libsframe needs to installed before
libbfd.  Reorder a bit to better track libsframe dependencies.
* Makefile.in: Regenerate.
---
 Makefile.def | 5 -
 Makefile.in  | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/Makefile.def b/Makefile.def
index 0c6784b6da1..870150183b9 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -492,7 +492,6 @@ dependencies = { module=install-binutils; 
on=install-opcodes; };
 dependencies = { module=install-strip-binutils; on=install-strip-opcodes; };
 
 // Likewise for ld, libctf, and bfd.
-dependencies = { module=install-bfd; on=install-libsframe; };
 dependencies = { module=install-libctf; on=install-bfd; };
 dependencies = { module=install-ld; on=install-bfd; };
 dependencies = { module=install-ld; on=install-libctf; };
@@ -500,6 +499,10 @@ dependencies = { module=install-strip-libctf; 
on=install-strip-bfd; };
 dependencies = { module=install-strip-ld; on=install-strip-bfd; };
 dependencies = { module=install-strip-ld; on=install-strip-libctf; };
 
+// libbfd depends on libsframe
+dependencies = { module=install-bfd; on=install-libsframe; };
+dependencies = { module=install-strip-bfd; on=install-strip-libsframe; };
+
 // libopcodes depends on libbfd
 dependencies = { module=configure-opcodes; on=configure-bfd; hard=true; };
 dependencies = { module=install-opcodes; on=install-bfd; };
diff --git a/Makefile.in b/Makefile.in
index 35a5d8c575d..c97130a2338 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -66496,13 +66496,14 @@ all-stageautoprofile-binutils: 
maybe-all-stageautoprofile-libsframe
 all-stageautofeedback-binutils: maybe-all-stageautofeedback-libsframe
 install-binutils: maybe-install-opcodes
 install-strip-binutils: maybe-install-strip-opcodes
-install-bfd: maybe-install-libsframe
 install-libctf: maybe-install-bfd
 install-ld: maybe-install-bfd
 install-ld: maybe-install-libctf
 install-strip-libctf: maybe-install-strip-bfd
 install-strip-ld: maybe-install-strip-bfd
 install-strip-ld: maybe-install-strip-libctf
+install-bfd: maybe-install-libsframe
+install-strip-bfd: maybe-install-strip-libsframe
 configure-opcodes: configure-bfd
 configure-stage1-opcodes: configure-stage1-bfd
 configure-stage2-opcodes: configure-stage2-bfd
-- 
2.41.0



[PATCH 23/24] bfd: linker: merge .sframe sections

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: Indu Bhagat 

The linker merges all the input .sframe sections.  When merging, the
linker verifies that all the input .sframe sections have the same
abi/arch.

The linker uses libsframe library to perform key actions on the
.sframe sections - decode, read, and create output data.  This
implies buildsystem changes to make and install libsframe before
libbfd.

The linker places the output .sframe section in a new segment of its
own: PT_GNU_SFRAME.  A new segment is not added, however, if the
generated .sframe section is empty.

When a section is discarded from the final link, the corresponding
entries in the .sframe section for those functions are also deleted.

The linker sorts the SFrame FDEs on start address by default and sets
the SFRAME_F_FDE_SORTED flag in the .sframe section.

This patch also adds support for generation of SFrame unwind
information for the .plt* sections on x86_64.  SFrame unwind info is
generated for IBT enabled PLT, lazy/non-lazy PLT.

The existing linker option --no-ld-generated-unwind-info has been
adapted to include the control of whether .sframe unwind information
will be generated for the linker generated sections like PLT.

Changes to the linker script have been made as necessary.

ChangeLog:

* Makefile.def: Add install dependency on libsframe for libbfd.
* Makefile.in: Regenerated.
---
 Makefile.def |  4 
 Makefile.in  | 11 +++
 2 files changed, 15 insertions(+)

diff --git a/Makefile.def b/Makefile.def
index 86d25f43762..0c6784b6da1 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -459,11 +459,14 @@ dependencies = { module=all-gdbsupport; on=all-gnulib; };
 dependencies = { module=all-gdbsupport; on=all-intl; };
 
 // Host modules specific to binutils.
+// build libsframe before bfd for encoder/decoder support for linking
+// SFrame sections
 dependencies = { module=configure-bfd; on=configure-libiberty; hard=true; };
 dependencies = { module=configure-bfd; on=configure-intl; };
 dependencies = { module=all-bfd; on=all-libiberty; };
 dependencies = { module=all-bfd; on=all-intl; };
 dependencies = { module=all-bfd; on=all-zlib; };
+dependencies = { module=all-bfd; on=all-libsframe; };
 dependencies = { module=configure-opcodes; on=configure-libiberty; hard=true; 
};
 dependencies = { module=all-opcodes; on=all-libiberty; };
 
@@ -489,6 +492,7 @@ dependencies = { module=install-binutils; 
on=install-opcodes; };
 dependencies = { module=install-strip-binutils; on=install-strip-opcodes; };
 
 // Likewise for ld, libctf, and bfd.
+dependencies = { module=install-bfd; on=install-libsframe; };
 dependencies = { module=install-libctf; on=install-bfd; };
 dependencies = { module=install-ld; on=install-bfd; };
 dependencies = { module=install-ld; on=install-libctf; };
diff --git a/Makefile.in b/Makefile.in
index 214a2a15544..35a5d8c575d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -66354,6 +66354,16 @@ all-stagetrain-bfd: maybe-all-stagetrain-zlib
 all-stagefeedback-bfd: maybe-all-stagefeedback-zlib
 all-stageautoprofile-bfd: maybe-all-stageautoprofile-zlib
 all-stageautofeedback-bfd: maybe-all-stageautofeedback-zlib
+all-bfd: maybe-all-libsframe
+all-stage1-bfd: maybe-all-stage1-libsframe
+all-stage2-bfd: maybe-all-stage2-libsframe
+all-stage3-bfd: maybe-all-stage3-libsframe
+all-stage4-bfd: maybe-all-stage4-libsframe
+all-stageprofile-bfd: maybe-all-stageprofile-libsframe
+all-stagetrain-bfd: maybe-all-stagetrain-libsframe
+all-stagefeedback-bfd: maybe-all-stagefeedback-libsframe
+all-stageautoprofile-bfd: maybe-all-stageautoprofile-libsframe
+all-stageautofeedback-bfd: maybe-all-stageautofeedback-libsframe
 configure-opcodes: configure-libiberty
 configure-stage1-opcodes: configure-stage1-libiberty
 configure-stage2-opcodes: configure-stage2-libiberty
@@ -66486,6 +66496,7 @@ all-stageautoprofile-binutils: 
maybe-all-stageautoprofile-libsframe
 all-stageautofeedback-binutils: maybe-all-stageautofeedback-libsframe
 install-binutils: maybe-install-opcodes
 install-strip-binutils: maybe-install-strip-opcodes
+install-bfd: maybe-install-libsframe
 install-libctf: maybe-install-bfd
 install-ld: maybe-install-bfd
 install-ld: maybe-install-libctf
-- 
2.41.0



[PATCH 16/24] Add support for the haiku operating system

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: Alexander von Gluck IV 

These are the os support patches we have been grooming and maintaining
for quite a few years over on git.haiku-os.org.  All of these
architectures are working and most have been stable for quite some time.

ChangeLog:

* configure: Regenerate.
* configure.ac: Add Haiku to list of ELF OSes
* libtool.m4: Update sys_lib_dlsearch_path_spec on Haiku.

gcc/ChangeLog:

* configure: Regenerate.

libatomic/ChangeLog:

* configure: Regenerate.

libbacktrace/ChangeLog:

* configure: Regenerate.

libcc1/ChangeLog:

* configure: Regenerate.

libffi/ChangeLog:

* configure: Regenerate.

libgfortran/ChangeLog:

* configure: Regenerate.

libgm2/ChangeLog:

* configure: Regenerate.

libgomp/ChangeLog:

* configure: Regenerate.

libitm/ChangeLog:

* configure: Regenerate.

libobjc/ChangeLog:

* configure: Regenerate.

libphobos/ChangeLog:

* configure: Regenerate.

libquadmath/ChangeLog:

* configure: Regenerate.

libsanitizer/ChangeLog:

* configure: Regenerate.

libssp/ChangeLog:

* configure: Regenerate.

libstdc++-v3/ChangeLog:

* configure: Regenerate.

libvtv/ChangeLog:

* configure: Regenerate.

lto-plugin/ChangeLog:

* configure: Regenerate.

zlib/ChangeLog:

* configure: Regenerate.
---
 configure  | 2 +-
 configure.ac   | 2 +-
 gcc/configure  | 4 ++--
 libatomic/configure| 2 +-
 libbacktrace/configure | 2 +-
 libcc1/configure   | 4 ++--
 libffi/configure   | 4 ++--
 libgfortran/configure  | 4 ++--
 libgm2/configure   | 4 ++--
 libgomp/configure  | 4 ++--
 libitm/configure   | 4 ++--
 libobjc/configure  | 2 +-
 libphobos/configure| 2 +-
 libquadmath/configure  | 2 +-
 libsanitizer/configure | 4 ++--
 libssp/configure   | 2 +-
 libstdc++-v3/configure | 4 ++--
 libtool.m4 | 2 +-
 libvtv/configure   | 4 ++--
 lto-plugin/configure   | 2 +-
 zlib/configure | 2 +-
 21 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/configure b/configure
index 907ebe71777..28f0913bdd4 100755
--- a/configure
+++ b/configure
@@ -3077,7 +3077,7 @@ case "${ENABLE_GOLD}" in
   *-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
   | *-*-linux* | *-*-gnu* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
   | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* \
-  | *-*-solaris2* | *-*-nto* | *-*-nacl*)
+  | *-*-solaris2* | *-*-nto* | *-*-nacl* | *-*-haiku*)
 case "${target}" in
   *-*-linux*aout* | *-*-linux*oldld*)
 ;;
diff --git a/configure.ac b/configure.ac
index 6a2e585a39a..5d25dc864c3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -349,7 +349,7 @@ case "${ENABLE_GOLD}" in
   *-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
   | *-*-linux* | *-*-gnu* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
   | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* \
-  | *-*-solaris2* | *-*-nto* | *-*-nacl*)
+  | *-*-solaris2* | *-*-nto* | *-*-nacl* | *-*-haiku*)
 case "${target}" in
   *-*-linux*aout* | *-*-linux*oldld*)
 ;;
diff --git a/gcc/configure b/gcc/configure
index c58a99f5d40..e97433d8743 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -19068,7 +19068,7 @@ haiku*)
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LIBRARY_PATH
   shlibpath_overrides_runpath=yes
-  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib 
/boot/beos/system/lib'
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib 
/boot/system/lib'
   hardcode_into_libs=yes
   ;;
 
@@ -22743,7 +22743,7 @@ haiku*)
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LIBRARY_PATH
   shlibpath_overrides_runpath=yes
-  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib 
/boot/beos/system/lib'
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib 
/boot/system/lib'
   hardcode_into_libs=yes
   ;;
 
diff --git a/libatomic/configure b/libatomic/configure
index 648f0dd7e52..75096735c61 100755
--- a/libatomic/configure
+++ b/libatomic/configure
@@ -10582,7 +10582,7 @@ haiku*)
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LIBRARY_PATH
   shlibpath_overrides_runpath=yes
-  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib 
/boot/beos/system/lib'
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib 
/boot/system/lib'
   hardcode_into_libs=yes
   ;;
 
diff --git a/libbacktrace/configure b/libbacktrace/configure
index 73611a3b994..f3ef3fc3f23 100755
--- a/libbacktrace/configure
+++ b/libbacktrace/configure
@@ -10759,7 +10759,7 @@ haiku*)
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LIBRARY_PATH
   shlibpath_overrides_runpath=yes
-  

[PATCH 13/24] configure: reinstate 32b PA-RISC HP-UX target in toplevel

2023-08-07 Thread Arsen Arsenović via Gcc-patches
The Binutils still support this target.

ChangeLog:

* configure.ac: Reinstate 32b PA-RISC HP-UX targets
* configure: Regenerate.
---
 configure| 10 ++
 configure.ac | 10 ++
 2 files changed, 20 insertions(+)

diff --git a/configure b/configure
index b6b7487f834..907ebe71777 100755
--- a/configure
+++ b/configure
@@ -3572,6 +3572,11 @@ case "${target}" in
   hppa*64*-*-hpux*)
 noconfigdirs="$noconfigdirs target-libffi"
 ;;
+  hppa*-hp-hpux11*)
+;;
+  hppa*-*-hpux*)
+noconfigdirs="$noconfigdirs target-libffi"
+;;
   ia64*-*-*vms*)
 noconfigdirs="$noconfigdirs target-libffi"
 ;;
@@ -3878,9 +3883,14 @@ case "${target}" in
   h8500-*-*)
 noconfigdirs="$noconfigdirs target-libgloss"
 ;;
+  hppa1.1-*-osf* | hppa1.1-*-bsd* )
+;;
   hppa*64*-*-hpux*)
 noconfigdirs="$noconfigdirs gdb"
 ;;
+  hppa*-*-hpux11*)
+noconfigdirs="$noconfigdirs gdb ld"
+;;
   hppa*64*-*-linux*)
 ;;
   hppa*-*-linux*)
diff --git a/configure.ac b/configure.ac
index 39e5649f360..6a2e585a39a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -802,6 +802,11 @@ case "${target}" in
   hppa*64*-*-hpux*)
 noconfigdirs="$noconfigdirs target-libffi"
 ;;
+  hppa*-hp-hpux11*)
+;;
+  hppa*-*-hpux*)
+noconfigdirs="$noconfigdirs target-libffi"
+;;
   ia64*-*-*vms*)
 noconfigdirs="$noconfigdirs target-libffi"
 ;;
@@ -1105,9 +1110,14 @@ case "${target}" in
   h8500-*-*)
 noconfigdirs="$noconfigdirs target-libgloss"
 ;;
+  hppa1.1-*-osf* | hppa1.1-*-bsd* )
+;;
   hppa*64*-*-hpux*)
 noconfigdirs="$noconfigdirs gdb"
 ;;
+  hppa*-*-hpux11*)
+noconfigdirs="$noconfigdirs gdb ld"
+;;
   hppa*64*-*-linux*)
 ;;
   hppa*-*-linux*)
-- 
2.41.0



[PATCH 15/24] libtool.m4: fix the NM="/nm/over/here -B/option/with/path" case

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: Nick Alcock 

My previous nm patch handled all cases but one -- if the user set NM in
the environment to a path which contained an option, libtool's nm
detection tries to run nm against a copy of nm with the options in it:
e.g. if NM was set to "nm --blargle", and nm was found in /usr/bin, the
test would try to run "/usr/bin/nm --blargle /usr/bin/nm --blargle".
This is unlikely to be desirable: in this case we should run
"/usr/bin/nm --blargle /usr/bin/nm".

Furthermore, as part of this nm has to detect when the passed-in $NM
contains a path, and in that case avoid doing a path search itself.
This too was thrown off if an option contained something that looked
like a path, e.g. NM="nm -B../prev-gcc"; libtool then tries to run
"nm -B../prev-gcc nm" which rarely works well (and indeed it looks
to see whether that nm exists, finds it doesn't, and wrongly concludes
that nm -p or whatever does not work).

Fix all of these by clipping all options (defined as everything
including and after the first " -") before deciding whether nm
contains a path (but not using the clipped value for anything else),
and then removing all options from the path-modified nm before
looking to see whether that nm existed.

NM=my-nm now does a path search and runs e.g.
  /usr/bin/my-nm -B /usr/bin/my-nm

NM=/usr/bin/my-nm now avoids a path search and runs e.g.
  /usr/bin/my-nm -B /usr/bin/my-nm

NM="my-nm -p../wombat" now does a path search and runs e.g.
  /usr/bin/my-nm -p../wombat -B /usr/bin/my-nm

NM="../prev-binutils/new-nm -B../prev-gcc" now avoids a path search:
  ../prev-binutils/my-nm -B../prev-gcc -B ../prev-binutils/my-nm

This seems to be all combinations, including those used by GCC bootstrap
(which, before this commit, fails to bootstrap when configured
--with-build-config=bootstrap-lto, because the lto plugin is now using
--export-symbols-regex, which requires libtool to find a working nm,
while also using -B../prev-gcc to point at the lto plugin associated
with the GCC just built.)

Regenerate all affected configure scripts.

ChangeLog:

* libtool.m4 (LT_PATH_NM): Handle user-specified NM with
options, including options containing paths.

gcc/ChangeLog:

* configure: Regenerate.

libatomic/ChangeLog:

* configure: Regenerate.

libbacktrace/ChangeLog:

* configure: Regenerate.

libcc1/ChangeLog:

* configure: Regenerate.

libffi/ChangeLog:

* configure: Regenerate.

libgfortran/ChangeLog:

* configure: Regenerate.

libgm2/ChangeLog:

* configure: Regenerate.

libgomp/ChangeLog:

* configure: Regenerate.

libitm/ChangeLog:

* configure: Regenerate.

libobjc/ChangeLog:

* configure: Regenerate.

libphobos/ChangeLog:

* configure: Regenerate.

libquadmath/ChangeLog:

* configure: Regenerate.

libsanitizer/ChangeLog:

* configure: Regenerate.

libssp/ChangeLog:

* configure: Regenerate.

libstdc++-v3/ChangeLog:

* configure: Regenerate.

libvtv/ChangeLog:

* configure: Regenerate.

lto-plugin/ChangeLog:

* configure: Regenerate.

zlib/ChangeLog:

* configure: Regenerate.
---
 gcc/configure  | 20 +---
 libatomic/configure| 20 +---
 libbacktrace/configure | 20 +---
 libcc1/configure   | 20 +---
 libffi/configure   | 20 +---
 libgfortran/configure  | 20 +---
 libgm2/configure   | 20 +---
 libgomp/configure  | 20 +---
 libitm/configure   | 20 +---
 libobjc/configure  | 20 +---
 libphobos/configure| 20 +---
 libquadmath/configure  | 20 +---
 libsanitizer/configure | 20 +---
 libssp/configure   | 20 +---
 libstdc++-v3/configure | 32 +++-
 libtool.m4 | 16 +++-
 libvtv/configure   | 20 +---
 lto-plugin/configure   | 20 +---
 zlib/configure | 20 +---
 19 files changed, 251 insertions(+), 137 deletions(-)

diff --git a/gcc/configure b/gcc/configure
index 81b93c1b599..c58a99f5d40 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -14144,25 +14144,31 @@ else
  lt_nm_to_check="$lt_nm_to_check nm"
fi
  fi
- for lt_tmp_nm in $lt_nm_to_check; do
+ for lt_tmp_nm in "$lt_nm_to_check"; do
lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
  IFS="$lt_save_ifs"
  test -z "$ac_dir" && ac_dir=.
- case "$lt_tmp_nm" in
+ # Strip out any user-provided options from the nm to test twice,
+ # the first time to test to see if nm (rather than its options) has
+ # an explicit path, the second time to yield a file which can be
+ # nm'ed itself.
+ tmp_nm_path="`$ECHO "$lt_tmp_nm" | sed 's, -.*$,,'`"
+ case 

[PATCH 10/24] gprofng: a new GNU profiler

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: Vladimir Mezentsev 

ChangeLog:

* Makefile.def: Add gprofng module.
* configure.ac: Add --enable-gprofng option.
* Makefile.in: Regenerate.
* configure: Regenerate.

include/ChangeLog:

* collectorAPI.h: New file.
* libcollector.h: New file.
* libfcollector.h: New file.
---
 Makefile.def|  11 +
 Makefile.in | 497 
 configure   |  18 ++
 configure.ac|  14 ++
 include/collectorAPI.h  |  73 ++
 include/libcollector.h  |  89 +++
 include/libfcollector.h |  42 
 7 files changed, 744 insertions(+)
 create mode 100644 include/collectorAPI.h
 create mode 100644 include/libcollector.h
 create mode 100644 include/libfcollector.h

diff --git a/Makefile.def b/Makefile.def
index 9b4a8a2bf7a..86d25f43762 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -73,6 +73,7 @@ host_modules= { module= isl; lib_path=.libs; bootstrap=true;
no_install= true; };
 host_modules= { module= gold; bootstrap=true; };
 host_modules= { module= gprof; };
+host_modules= { module= gprofng; };
 // intl acts on 'host_shared' directly, and does not support --with-pic.
 host_modules= { module= intl; bootstrap=true; };
 host_modules= { module= tcl;
@@ -511,6 +512,16 @@ dependencies = { module=all-gprof; on=all-bfd; };
 dependencies = { module=all-gprof; on=all-opcodes; };
 dependencies = { module=all-gprof; on=all-intl; };
 dependencies = { module=all-gprof; on=all-gas; };
+
+dependencies = { module=configure-gprofng; on=configure-intl; };
+dependencies = { module=all-gprofng; on=all-libiberty; };
+dependencies = { module=all-gprofng; on=all-bfd; };
+dependencies = { module=all-gprofng; on=all-opcodes; };
+dependencies = { module=all-gprofng; on=all-intl; };
+dependencies = { module=all-gprofng; on=all-gas; };
+dependencies = { module=install-gprofng; on=install-opcodes; };
+dependencies = { module=install-gprofng; on=install-bfd; };
+
 dependencies = { module=configure-ld; on=configure-intl; };
 dependencies = { module=all-ld; on=all-libiberty; };
 dependencies = { module=all-ld; on=all-bfd; };
diff --git a/Makefile.in b/Makefile.in
index 6539fb201dc..f177ce176fb 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1089,6 +1089,7 @@ configure-host:  \
 maybe-configure-isl \
 maybe-configure-gold \
 maybe-configure-gprof \
+maybe-configure-gprofng \
 maybe-configure-intl \
 maybe-configure-tcl \
 maybe-configure-itcl \
@@ -1242,6 +1243,7 @@ all-host: maybe-all-isl
 all-host: maybe-all-gold
 @endif gold-no-bootstrap
 all-host: maybe-all-gprof
+all-host: maybe-all-gprofng
 @if intl-no-bootstrap
 all-host: maybe-all-intl
 @endif intl-no-bootstrap
@@ -1381,6 +1383,7 @@ info-host: maybe-info-mpc
 info-host: maybe-info-isl
 info-host: maybe-info-gold
 info-host: maybe-info-gprof
+info-host: maybe-info-gprofng
 info-host: maybe-info-intl
 info-host: maybe-info-tcl
 info-host: maybe-info-itcl
@@ -1471,6 +1474,7 @@ dvi-host: maybe-dvi-mpc
 dvi-host: maybe-dvi-isl
 dvi-host: maybe-dvi-gold
 dvi-host: maybe-dvi-gprof
+dvi-host: maybe-dvi-gprofng
 dvi-host: maybe-dvi-intl
 dvi-host: maybe-dvi-tcl
 dvi-host: maybe-dvi-itcl
@@ -1561,6 +1565,7 @@ pdf-host: maybe-pdf-mpc
 pdf-host: maybe-pdf-isl
 pdf-host: maybe-pdf-gold
 pdf-host: maybe-pdf-gprof
+pdf-host: maybe-pdf-gprofng
 pdf-host: maybe-pdf-intl
 pdf-host: maybe-pdf-tcl
 pdf-host: maybe-pdf-itcl
@@ -1651,6 +1656,7 @@ html-host: maybe-html-mpc
 html-host: maybe-html-isl
 html-host: maybe-html-gold
 html-host: maybe-html-gprof
+html-host: maybe-html-gprofng
 html-host: maybe-html-intl
 html-host: maybe-html-tcl
 html-host: maybe-html-itcl
@@ -1741,6 +1747,7 @@ TAGS-host: maybe-TAGS-mpc
 TAGS-host: maybe-TAGS-isl
 TAGS-host: maybe-TAGS-gold
 TAGS-host: maybe-TAGS-gprof
+TAGS-host: maybe-TAGS-gprofng
 TAGS-host: maybe-TAGS-intl
 TAGS-host: maybe-TAGS-tcl
 TAGS-host: maybe-TAGS-itcl
@@ -1831,6 +1838,7 @@ install-info-host: maybe-install-info-mpc
 install-info-host: maybe-install-info-isl
 install-info-host: maybe-install-info-gold
 install-info-host: maybe-install-info-gprof
+install-info-host: maybe-install-info-gprofng
 install-info-host: maybe-install-info-intl
 install-info-host: maybe-install-info-tcl
 install-info-host: maybe-install-info-itcl
@@ -1921,6 +1929,7 @@ install-dvi-host: maybe-install-dvi-mpc
 install-dvi-host: maybe-install-dvi-isl
 install-dvi-host: maybe-install-dvi-gold
 install-dvi-host: maybe-install-dvi-gprof
+install-dvi-host: maybe-install-dvi-gprofng
 install-dvi-host: maybe-install-dvi-intl
 install-dvi-host: maybe-install-dvi-tcl
 install-dvi-host: maybe-install-dvi-itcl
@@ -2011,6 +2020,7 @@ install-pdf-host: maybe-install-pdf-mpc
 install-pdf-host: maybe-install-pdf-isl
 install-pdf-host: maybe-install-pdf-gold
 install-pdf-host: maybe-install-pdf-gprof
+install-pdf-host: maybe-install-pdf-gprofng
 install-pdf-host: maybe-install-pdf-intl
 install-pdf-host: maybe-install-pdf-tcl
 

[PATCH 17/24] egrep in binutils

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: Alan Modra 

Apparently some distros have a nagging egrep that helpfully tells you
egrep is deprecated and to use "grep -E".  The nag message causes a ld
testsuite failure.  What's more the advice isn't that good.  The "-E"
flag may not be available with older versions of grep.

This patch fixes bare invocation of egrep within binutils, replacing
it with the autoconf $EGREP or with grep.

config/ChangeLog:

* lib-ld.m4 (AC_LIB_PROG_LD_GNU): Require AC_PROG_EGREP and
invoke $EGREP.
(AC_LIB_PROG_LD): Likewise.

gcc/ChangeLog:

* configure: Regenerate.

intl/ChangeLog:

* configure: Regenerate.

libcpp/ChangeLog:

* configure: Regenerate.

libgcc/ChangeLog:

* configure: Regenerate.

libstdc++-v3/ChangeLog:

* configure: Regenerate.
---
 config/lib-ld.m4   | 8 +---
 gcc/configure  | 4 ++--
 intl/configure | 4 ++--
 libcpp/configure   | 4 ++--
 libgcc/configure   | 2 +-
 libstdc++-v3/configure | 4 ++--
 6 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/config/lib-ld.m4 b/config/lib-ld.m4
index 11d0ce77342..73cf9571b57 100644
--- a/config/lib-ld.m4
+++ b/config/lib-ld.m4
@@ -12,9 +12,10 @@ dnl with libtool.m4.
 
 dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
 AC_DEFUN([AC_LIB_PROG_LD_GNU],
-[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
-if $LD -v 2>&1 &5; then
+if $LD -v 2>&1 &5; then
   acl_cv_prog_gnu_ld=yes
 else
   acl_cv_prog_gnu_ld=no
@@ -29,6 +30,7 @@ AC_DEFUN([AC_LIB_PROG_LD],
 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
 AC_REQUIRE([AC_PROG_CC])dnl
 AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_PROG_EGREP])dnl
 # Prepare PATH_SEPARATOR.
 # The user is always right.
 if test "${PATH_SEPARATOR+set}" != set; then
@@ -88,7 +90,7 @@ AC_CACHE_VAL(acl_cv_path_LD,
   # Check to see if the program is GNU ld.  I'd rather use --version,
   # but apparently some GNU ld's only accept -v.
   # Break only if it was the GNU/non-GNU ld that we prefer.
-  if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > 
/dev/null; then
+  if "$acl_cv_path_LD" -v 2>&1 < /dev/null | $EGREP '(GNU|with BFD)' > 
/dev/null; then
test "$with_gnu_ld" != no && break
   else
test "$with_gnu_ld" != yes && break
diff --git a/gcc/configure b/gcc/configure
index e97433d8743..cd9919e858d 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -11299,7 +11299,7 @@ else
   # Check to see if the program is GNU ld.  I'd rather use --version,
   # but apparently some GNU ld's only accept -v.
   # Break only if it was the GNU/non-GNU ld that we prefer.
-  if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > 
/dev/null; then
+  if "$acl_cv_path_LD" -v 2>&1 < /dev/null | $EGREP '(GNU|with BFD)' > 
/dev/null; then
test "$with_gnu_ld" != no && break
   else
test "$with_gnu_ld" != yes && break
@@ -11327,7 +11327,7 @@ if ${acl_cv_prog_gnu_ld+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   # I'd rather use --version here, but apparently some GNU ld's only accept -v.
-if $LD -v 2>&1 &5; then
+if $LD -v 2>&1 &5; then
   acl_cv_prog_gnu_ld=yes
 else
   acl_cv_prog_gnu_ld=no
diff --git a/intl/configure b/intl/configure
index 79bb5831a47..42b2a26b5bf 100755
--- a/intl/configure
+++ b/intl/configure
@@ -5094,7 +5094,7 @@ else
   # Check to see if the program is GNU ld.  I'd rather use --version,
   # but apparently some GNU ld's only accept -v.
   # Break only if it was the GNU/non-GNU ld that we prefer.
-  if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > 
/dev/null; then
+  if "$acl_cv_path_LD" -v 2>&1 < /dev/null | $EGREP '(GNU|with BFD)' > 
/dev/null; then
test "$with_gnu_ld" != no && break
   else
test "$with_gnu_ld" != yes && break
@@ -5122,7 +5122,7 @@ if ${acl_cv_prog_gnu_ld+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   # I'd rather use --version here, but apparently some GNU ld's only accept -v.
-if $LD -v 2>&1 &5; then
+if $LD -v 2>&1 &5; then
   acl_cv_prog_gnu_ld=yes
 else
   acl_cv_prog_gnu_ld=no
diff --git a/libcpp/configure b/libcpp/configure
index 1389ddab544..ed98f40a1c1 100755
--- a/libcpp/configure
+++ b/libcpp/configure
@@ -6811,7 +6811,7 @@ else
   # Check to see if the program is GNU ld.  I'd rather use --version,
   # but apparently some GNU ld's only accept -v.
   # Break only if it was the GNU/non-GNU ld that we prefer.
-  if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > 
/dev/null; then
+  if "$acl_cv_path_LD" -v 2>&1 < /dev/null | $EGREP '(GNU|with BFD)' > 
/dev/null; then
test "$with_gnu_ld" != no && break
   else
test "$with_gnu_ld" != yes && break

[PATCH 20/24] PKG_CHECK_MODULES: Check if $pkg_cv_[]$1[]_LIBS works

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: "H.J. Lu" 

It is quite normal to have headers without library on multilib OSes.
Add AC_TRY_LINK to PKG_CHECK_MODULES to check if $pkg_cv_[]$1[]_LIBS
works.

config/ChangeLog:

* pkg.m4 (PKG_CHECK_MODULES): Add AC_TRY_LINK to check if
$pkg_cv_[]$1[]_LIBS works.
---
 config/pkg.m4 | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/config/pkg.m4 b/config/pkg.m4
index 13a88901786..45587e97c8b 100644
--- a/config/pkg.m4
+++ b/config/pkg.m4
@@ -147,6 +147,12 @@ AC_MSG_CHECKING([for $2])
 _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
 _PKG_CONFIG([$1][_LIBS], [libs], [$2])
 
+dnl Check whether $pkg_cv_[]$1[]_LIBS works.
+pkg_save_LDFLAGS="$LDFLAGS"
+LDFLAGS="$LDFLAGS $pkg_cv_[]$1[]_LIBS"
+AC_TRY_LINK([],[return 0;], [pkg_failed=no], [pkg_failed=yes])
+LDFLAGS=$pkg_save_LDFLAGS
+
 m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables 
$1[]_CFLAGS
 and $1[]_LIBS to avoid the need to call pkg-config.
 See the pkg-config man page for more details.])
-- 
2.41.0



[PATCH 21/24] PKG_CHECK_MODULES: Properly check if $pkg_cv_[]$1[]_LIBS works

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: "H.J. Lu" 

There is no need to check $pkg_cv_[]$1[]_LIBS works if package check
failed.

config/ChangeLog:

* pkg.m4 (PKG_CHECK_MODULES): Use AC_TRY_LINK only if
$pkg_failed = no.
---
 config/pkg.m4 | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/config/pkg.m4 b/config/pkg.m4
index 45587e97c8b..7ebf517cd6a 100644
--- a/config/pkg.m4
+++ b/config/pkg.m4
@@ -148,10 +148,12 @@ _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
 _PKG_CONFIG([$1][_LIBS], [libs], [$2])
 
 dnl Check whether $pkg_cv_[]$1[]_LIBS works.
-pkg_save_LDFLAGS="$LDFLAGS"
-LDFLAGS="$LDFLAGS $pkg_cv_[]$1[]_LIBS"
-AC_TRY_LINK([],[return 0;], [pkg_failed=no], [pkg_failed=yes])
-LDFLAGS=$pkg_save_LDFLAGS
+if test $pkg_failed = no; then
+  pkg_save_LDFLAGS="$LDFLAGS"
+  LDFLAGS="$LDFLAGS $pkg_cv_[]$1[]_LIBS"
+  AC_TRY_LINK([],[], [], [pkg_failed=yes])
+  LDFLAGS=$pkg_save_LDFLAGS
+fi
 
 m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables 
$1[]_CFLAGS
 and $1[]_LIBS to avoid the need to call pkg-config.
-- 
2.41.0



[PATCH 04/24] Sync with binutils: GCC: Pass --plugin to AR and RANLIB

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: "H.J. Lu" 

Sync with binutils for building binutils with LTO:

50ad1254d50 GCC: Pass --plugin to AR and RANLIB

Detect GCC LTO plugin.  Pass --plugin to AR and RANLIB to support LTO
build.

ChangeLog:

* Makefile.tpl (AR): Add @AR_PLUGIN_OPTION@
(RANLIB): Add @RANLIB_PLUGIN_OPTION@.
* configure.ac: Include config/gcc-plugin.m4.
AC_SUBST AR_PLUGIN_OPTION and RANLIB_PLUGIN_OPTION.
* libtool.m4 (_LT_CMD_OLD_ARCHIVE): Pass --plugin to AR and
RANLIB if possible.
* Makefile.in: Regenerated.
* configure: Likewise.

config/ChangeLog:

* gcc-plugin.m4 (GCC_PLUGIN_OPTION): New.

libiberty/ChangeLog:

* Makefile.in (AR): Add @AR_PLUGIN_OPTION@
(RANLIB): Add @RANLIB_PLUGIN_OPTION@.
(configure_deps): Depend on ../config/gcc-plugin.m4.
* configure.ac: AC_SUBST AR_PLUGIN_OPTION and
RANLIB_PLUGIN_OPTION.
* aclocal.m4: Regenerated.
* configure: Likewise.

zlib/ChangeLog:

* configure: Regenerated.

gcc/ChangeLog:

* configure: Regenerate.

libatomic/ChangeLog:

* configure: Regenerate.

libbacktrace/ChangeLog:

* configure: Regenerate.

libcc1/ChangeLog:

* configure: Regenerate.

libffi/ChangeLog:

* configure: Regenerate.

libgfortran/ChangeLog:

* configure: Regenerate.

libgm2/ChangeLog:

* configure: Regenerate.

libgomp/ChangeLog:

* configure: Regenerate.

libitm/ChangeLog:

* configure: Regenerate.

libobjc/ChangeLog:

* configure: Regenerate.

libphobos/ChangeLog:

* configure: Regenerate.

libquadmath/ChangeLog:

* configure: Regenerate.

libsanitizer/ChangeLog:

* configure: Regenerate.

libssp/ChangeLog:

* configure: Regenerate.

libstdc++-v3/ChangeLog:

* configure: Regenerate.

libvtv/ChangeLog:

* configure: Regenerate.

lto-plugin/ChangeLog:

* configure: Regenerate.
---
 Makefile.in|  5 +++--
 Makefile.tpl   |  5 +++--
 config/gcc-plugin.m4   | 28 
 configure  | 39 +++
 configure.ac   | 15 +++
 gcc/configure  | 27 +--
 libatomic/configure| 27 +--
 libbacktrace/configure | 27 +--
 libcc1/configure   | 27 +--
 libffi/configure   | 27 +--
 libgfortran/configure  | 27 +--
 libgm2/configure   | 27 +--
 libgomp/configure  | 27 +--
 libiberty/Makefile.in  |  5 +++--
 libiberty/aclocal.m4   |  1 +
 libiberty/configure| 37 +
 libiberty/configure.ac | 12 
 libitm/configure   | 27 +--
 libobjc/configure  | 27 +--
 libphobos/configure| 27 +--
 libquadmath/configure  | 27 +--
 libsanitizer/configure | 27 +--
 libssp/configure   | 27 +--
 libstdc++-v3/configure | 39 +++
 libtool.m4 | 25 -
 libvtv/configure   | 27 +--
 lto-plugin/configure   | 27 +--
 zlib/configure | 27 +--
 28 files changed, 621 insertions(+), 49 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index 144bccd2603..6539fb201dc 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -417,7 +417,7 @@ MAKEINFOFLAGS = --split-size=500
 # -
 
 AS = @AS@
-AR = @AR@
+AR = @AR@ @AR_PLUGIN_OPTION@
 AR_FLAGS = rc
 CC = @CC@
 CXX = @CXX@
@@ -428,7 +428,7 @@ LIPO = @LIPO@
 NM = @NM@
 OBJDUMP = @OBJDUMP@
 OTOOL = @OTOOL@
-RANLIB = @RANLIB@
+RANLIB = @RANLIB@ @RANLIB_PLUGIN_OPTION@
 READELF = @READELF@
 STRIP = @STRIP@
 WINDRES = @WINDRES@
@@ -66748,6 +66748,7 @@ AUTOCONF = autoconf
 $(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(srcdir)/config/acx.m4 \
$(srcdir)/config/override.m4 $(srcdir)/config/proginstall.m4 \
$(srcdir)/config/elf.m4 $(srcdir)/config/isl.m4 \
+   $(srcdir)/config/gcc-plugin.m4 \
$(srcdir)/libtool.m4 $(srcdir)/ltoptions.m4 $(srcdir)/ltsugar.m4 \
$(srcdir)/ltversion.m4 $(srcdir)/lt~obsolete.m4
cd $(srcdir) && $(AUTOCONF)
diff --git a/Makefile.tpl b/Makefile.tpl
index 4fdca604eb0..6586e907964 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -420,7 +420,7 @@ MAKEINFOFLAGS = --split-size=500
 # -
 
 AS = @AS@
-AR = @AR@
+AR = @AR@ @AR_PLUGIN_OPTION@
 AR_FLAGS = rc
 CC = @CC@
 CXX = @CXX@
@@ -431,7 +431,7 @@ LIPO = @LIPO@
 NM = @NM@
 OBJDUMP = @OBJDUMP@
 OTOOL = @OTOOL@
-RANLIB = @RANLIB@
+RANLIB = @RANLIB@ @RANLIB_PLUGIN_OPTION@
 READELF = 

[PATCH 18/24] PR27116, Spelling errors found by Debian style checker

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: Alan Modra 

config/ChangeLog:

* override.m4: Correct comment grammar.
---
 config/override.m4 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config/override.m4 b/config/override.m4
index d3e815bb1b4..5a1bffe6018 100644
--- a/config/override.m4
+++ b/config/override.m4
@@ -32,7 +32,7 @@ m4_ifndef([_GCC_AUTOCONF_VERSION],
   [m4_define([_GCC_AUTOCONF_VERSION], [2.69])])
 
 dnl Test for the exact version when AC_INIT is expanded.
-dnl This allows to update the tree in steps (for testing)
+dnl This allows one to update the tree in steps (for testing)
 dnl by putting
 dnl   m4_define([_GCC_AUTOCONF_VERSION], [X.Y])
 dnl in configure.ac before AC_INIT,
-- 
2.41.0



[PATCH 12/24] Pass PKG_CONFIG_PATH down from top-level Makefile

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: Simon Marchi 

[Sending to binutils, gdb-patches and gcc-patches, since it touches the
top-level Makefile/configure]

I have my debuginfod library installed in a non-standard location
(/opt/debuginfod), which requires me to set
PKG_CONFIG_PATH=/opt/debuginfod/lib/pkg-config.  If I just set it during
configure:

$ PKG_CONFIG_PATH=/opt/debuginfod/lib/pkg-config ./configure 
--with-debuginfod
$ make

or

$ ./configure --with-debuginfod 
PKG_CONFIG_PATH=/opt/debuginfod/lib/pkg-config
$ make

Then PKG_CONFIG_PATH is only present (and ignored) during the top-level
configure.  When running make (which runs gdb's and binutils'
configure), PKG_CONFIG_PATH is not set, which results in their configure
script not finding the library:

checking for libdebuginfod >= 0.179... no
configure: error: "--with-debuginfod was given, but libdebuginfod is 
missing or unusable."

Change the top-level configure/Makefile system to capture the value
passed when configuring the top-level and pass it down to
subdirectories (similar to CFLAGS, LDFLAGS, etc).

I don't know much about the top-level build system, so I really don't
know if I did this correctly.  The changes are:

 - Use AC_SUBST(PKG_CONFIG_PATH) in configure.ac, so that
   @PKG_CONFIG_PATH@ gets replaced with the actual PKG_CONFIG_PATH value
   in config files (i.e. Makefile)
 - Add a PKG_CONFIG_PATH Makefile variable in Makefile.tpl, initialized
   to @PKG_CONFIG_PATH@
 - Add PKG_CONFIG_PATH to HOST_EXPORTS in Makefile.tpl, which are the
   variables set when running the sub-configures

I initially added PKG_CONFIG_PATH to flags_to_pass, in Makefile.def, but
I don't think it's needed.  AFAIU, this defines the flags to pass down
when calling "make" in subdirectories.  We only need PKG_CONFIG_PATH to
be passed down during configure.  After that, it's captured in
gdb/config.status, so even if a "make" causes a re-configure later
(because gdb/configure has changed, for example), the PKG_CONFIG_PATH
value will be remembered.

Change-Id: I91138dfca41c43b05e53e445f62e4b27882536bf

ChangeLog:

* configure.ac: Add AC_SUBST(PKG_CONFIG_PATH).
* configure: Re-generate.
* Makefile.tpl (HOST_EXPORTS): Pass PKG_CONFIG_PATH.
(PKG_CONFIG_PATH): New.
* Makefile.in: Re-generate.
---
 Makefile.in  | 3 +++
 Makefile.tpl | 3 +++
 configure| 2 ++
 configure.ac | 1 +
 4 files changed, 9 insertions(+)

diff --git a/Makefile.in b/Makefile.in
index f177ce176fb..214a2a15544 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -221,6 +221,7 @@ HOST_EXPORTS = \
OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
OTOOL="$(OTOOL)"; export OTOOL; \
+   PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)"; export PKG_CONFIG_PATH; \
READELF="$(READELF)"; export READELF; \
AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \
@@ -447,6 +448,8 @@ GOCFLAGS = $(CFLAGS)
 GDCFLAGS = @GDCFLAGS@
 GM2FLAGS = $(CFLAGS)
 
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+
 # Pass additional PGO and LTO compiler options to the PGO build.
 BUILD_CFLAGS = $(PGO_BUILD_CFLAGS) $(PGO_BUILD_LTO_CFLAGS)
 override CFLAGS += $(BUILD_CFLAGS)
diff --git a/Makefile.tpl b/Makefile.tpl
index 6586e907964..36fa20950d4 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -224,6 +224,7 @@ HOST_EXPORTS = \
OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
OTOOL="$(OTOOL)"; export OTOOL; \
+   PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)"; export PKG_CONFIG_PATH; \
READELF="$(READELF)"; export READELF; \
AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \
@@ -450,6 +451,8 @@ GOCFLAGS = $(CFLAGS)
 GDCFLAGS = @GDCFLAGS@
 GM2FLAGS = $(CFLAGS)
 
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+
 # Pass additional PGO and LTO compiler options to the PGO build.
 BUILD_CFLAGS = $(PGO_BUILD_CFLAGS) $(PGO_BUILD_LTO_CFLAGS)
 override CFLAGS += $(BUILD_CFLAGS)
diff --git a/configure b/configure
index faa1aedaa04..b6b7487f834 100755
--- a/configure
+++ b/configure
@@ -622,6 +622,7 @@ CXX_FOR_TARGET
 CC_FOR_TARGET
 RANLIB_PLUGIN_OPTION
 AR_PLUGIN_OPTION
+PKG_CONFIG_PATH
 GDCFLAGS
 READELF
 OTOOL
@@ -13017,6 +13018,7 @@ fi
 
 GDCFLAGS=${GDCFLAGS-${CFLAGS}}
 
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -plugin option" >&5
 $as_echo_n "checking for -plugin option... " >&6; }
 
diff --git a/configure.ac b/configure.ac
index a0dff0ecac8..39e5649f360 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3708,6 +3708,7 @@ AC_SUBST(CXXFLAGS)
 AC_SUBST(GDC)
 AC_SUBST(GDCFLAGS)
 GDCFLAGS=${GDCFLAGS-${CFLAGS}}
+AC_SUBST(PKG_CONFIG_PATH)
 
 GCC_PLUGIN_OPTION(PLUGIN_OPTION)
 AR_PLUGIN_OPTION=
-- 
2.41.0



[PATCH 05/24] GCC: Check if AR works with --plugin and rc

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: "H.J. Lu" 

AR from older binutils doesn't work with --plugin and rc:

[hjl@gnu-cfl-2 bin]$ touch foo.c
[hjl@gnu-cfl-2 bin]$ ar --plugin 
/usr/libexec/gcc/x86_64-redhat-linux/10/liblto_plugin.so rc libfoo.a foo.c
[hjl@gnu-cfl-2 bin]$ ./ar --plugin 
/usr/libexec/gcc/x86_64-redhat-linux/10/liblto_plugin.so rc libfoo.a foo.c
./ar: no operation specified
[hjl@gnu-cfl-2 bin]$ ./ar --version
GNU ar (Linux/GNU Binutils) 2.29.51.0.1.20180112
Copyright (C) 2018 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) any later version.
This program has absolutely no warranty.
[hjl@gnu-cfl-2 bin]$

Check if AR works with --plugin and rc before passing --plugin to AR and
RANLIB.

ChangeLog:

* configure: Regenerated.
* libtool.m4 (_LT_CMD_OLD_ARCHIVE): Check if AR works with
--plugin and rc before enabling --plugin.

config/ChangeLog:

* gcc-plugin.m4 (GCC_PLUGIN_OPTION): Check if AR works with
--plugin and rc before enabling --plugin.

gcc/ChangeLog:

* configure: Regenerate.

libatomic/ChangeLog:

* configure: Regenerate.

libbacktrace/ChangeLog:

* configure: Regenerate.

libcc1/ChangeLog:

* configure: Regenerate.

libffi/ChangeLog:

* configure: Regenerate.

libgfortran/ChangeLog:

* configure: Regenerate.

libgm2/ChangeLog:

* configure: Regenerate.

libgomp/ChangeLog:

* configure: Regenerate.

libiberty/ChangeLog:

* configure: Regenerate.

libitm/ChangeLog:

* configure: Regenerate.

libobjc/ChangeLog:

* configure: Regenerate.

libphobos/ChangeLog:

* configure: Regenerate.

libquadmath/ChangeLog:

* configure: Regenerate.

libsanitizer/ChangeLog:

* configure: Regenerate.

libssp/ChangeLog:

* configure: Regenerate.

libstdc++-v3/ChangeLog:

* configure: Regenerate.

libvtv/ChangeLog:

* configure: Regenerate.

lto-plugin/ChangeLog:

* configure: Regenerate.

zlib/ChangeLog:

* configure: Regenerate.
---
 config/gcc-plugin.m4   |  12 +
 configure  | 103 +
 gcc/configure  |  14 --
 libatomic/configure|  14 --
 libbacktrace/configure |  14 --
 libcc1/configure   |  14 --
 libffi/configure   |  14 --
 libgfortran/configure  |  14 --
 libgm2/configure   |  14 --
 libgomp/configure  |  14 --
 libiberty/configure| 103 +
 libitm/configure   |  14 --
 libobjc/configure  |  14 --
 libphobos/configure|  14 --
 libquadmath/configure  |  14 --
 libsanitizer/configure |  14 --
 libssp/configure   |  14 --
 libstdc++-v3/configure |  26 +++
 libtool.m4 |   9 +++-
 libvtv/configure   |  14 --
 lto-plugin/configure   |  14 --
 zlib/configure |  14 --
 22 files changed, 430 insertions(+), 61 deletions(-)

diff --git a/config/gcc-plugin.m4 b/config/gcc-plugin.m4
index d782d52858e..c731a6fab38 100644
--- a/config/gcc-plugin.m4
+++ b/config/gcc-plugin.m4
@@ -150,6 +150,18 @@ for plugin in $plugin_names; do
 break
   fi
 done
+dnl Check if ${AR} $plugin_option rc works.
+AC_CHECK_TOOL(AR, ar)
+if test "${AR}" = "" ; then
+  AC_MSG_ERROR([Required archive tool 'ar' not found on PATH.])
+fi
+touch conftest.c
+${AR} $plugin_option rc conftest.a conftest.c
+if test "$?" != 0; then
+  AC_MSG_WARN([Failed: $AR $plugin_option rc])
+  plugin_option=
+fi
+rm -f conftest.*
 if test -n "$plugin_option"; then
   $1="$plugin_option"
   AC_MSG_RESULT($plugin_option)
diff --git a/configure b/configure
index 4aa1ca21a38..3fe4a1804cf 100755
--- a/configure
+++ b/configure
@@ -12966,6 +12966,109 @@ for plugin in $plugin_names; do
 break
   fi
 done
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ar", so it can be a program 
name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AR+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$AR"; then
+  ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ac_cv_prog_AR="${ac_tool_prefix}ar"
+$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" 
>&5
+break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+$as_echo "$AR" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5

[PATCH 07/24] binutils, gdb: support zstd compressed debug sections

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: Fangrui Song 

PR29397 PR29563: Add new configure option --with-zstd which defaults to
auto.  If pkgconfig/libzstd.pc is found, define HAVE_ZSTD and support
zstd compressed debug sections for most tools.

* bfd: for addr2line, objdump --dwarf, gdb, etc
* gas: support --compress-debug-sections=zstd
* ld: support ELFCOMPRESS_ZSTD input and --compress-debug-sections=zstd
* objcopy: support ELFCOMPRESS_ZSTD input for
  --decompress-debug-sections and --compress-debug-sections=zstd
* gdb: support ELFCOMPRESS_ZSTD input.  The bfd change references zstd
  symbols, so gdb has to link against -lzstd in this patch.

If zstd is not supported, ELFCOMPRESS_ZSTD input triggers an error.  We
can avoid HAVE_ZSTD if binutils-gdb imports zstd/ like zlib/, but this
is too heavyweight, so don't do it for now.

```
% ld/ld-new a.o
ld/ld-new: a.o: section .debug_abbrev is compressed with zstd, but BFD is not 
built with zstd support
...

% ld/ld-new a.o --compress-debug-sections=zstd
ld/ld-new: --compress-debug-sections=zstd: ld is not built with zstd support

% binutils/objcopy --compress-debug-sections=zstd a.o b.o
binutils/objcopy: --compress-debug-sections=zstd: binutils is not built with 
zstd support

% binutils/objcopy b.o --decompress-debug-sections
binutils/objcopy: zstd.o: section .debug_abbrev is compressed with zstd, but 
BFD is not built with zstd support
...
```

config/ChangeLog:

* zstd.m4: New file.

ChangeLog:
* configure: Regenerate.
* configure.ac: Add --with-zstd.
---
 config/zstd.m4 | 23 +++
 configure  | 10 ++
 configure.ac   |  3 +++
 3 files changed, 36 insertions(+)
 create mode 100644 config/zstd.m4

diff --git a/config/zstd.m4 b/config/zstd.m4
new file mode 100644
index 000..6da4db68c58
--- /dev/null
+++ b/config/zstd.m4
@@ -0,0 +1,23 @@
+dnl Copyright (C) 2022 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+dnl Enable features using the zstd library.
+AC_DEFUN([AC_ZSTD], [
+AC_ARG_WITH(zstd,
+  [AS_HELP_STRING([--with-zstd], [support zstd compressed debug sections 
(default=auto)])],
+  [], [with_zstd=auto])
+
+AS_IF([test "$with_zstd" != no],
+  [PKG_CHECK_MODULES(ZSTD, [libzstd], [
+AC_DEFINE(HAVE_ZSTD, 1, [Define to 1 if zstd is enabled.])
+  ], [
+if test "$with_zstd" = yes; then
+  AC_MSG_ERROR([--with-zstd was given, but pkgconfig/libzstd.pc is not 
found])
+fi
+  ])
+  ])
+])
diff --git a/configure b/configure
index 04369383079..a5f6282bb0e 100755
--- a/configure
+++ b/configure
@@ -800,6 +800,7 @@ ac_user_opts='
 enable_option_checking
 with_build_libsubdir
 with_system_zlib
+with_zstd
 enable_as_accelerator_for
 enable_offload_targets
 enable_offload_defaulted
@@ -1589,6 +1590,8 @@ Optional Packages:
   --without-PACKAGE   do not use PACKAGE (same as --with-PACKAGE=no)
   --with-build-libsubdir=DIR  Directory where to find libraries for build 
system
   --with-system-zlib  use installed libz
+  --with-zstd Support zstd compressed debug sections
+  (default=auto)
   --with-mpc=PATH specify prefix directory for installed MPC package.
   Equivalent to --with-mpc-include=PATH/include plus
   --with-mpc-lib=PATH/lib
@@ -2962,6 +2965,13 @@ if test x$with_system_readline = xyes ; then
   noconfigdirs="$noconfigdirs readline"
 fi
 
+
+# Check whether --with-zstd was given.
+if test "${with_zstd+set}" = set; then :
+  withval=$with_zstd;
+fi
+
+
 # some tools are so dependent upon X11 that if we're not building with X,
 # it's not even worth trying to configure, much less build, that tool.
 
diff --git a/configure.ac b/configure.ac
index 3632216fd1c..e820940c81e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -254,6 +254,9 @@ if test x$with_system_readline = xyes ; then
   noconfigdirs="$noconfigdirs readline"
 fi
 
+AC_ARG_WITH(zstd,
+[AS_HELP_STRING([--with-zstd], [Support zstd compressed debug sections 
(default=auto)])])
+
 # some tools are so dependent upon X11 that if we're not building with X, 
 # it's not even worth trying to configure, much less build, that tool.
 
-- 
2.41.0



[PATCH 08/24] configure: require libzstd >= 1.4.0

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: Christophe Lyon 

gas uses ZSTD_compressStream2 which is only available with libzstd >=
1.4.0, leading to build errors when an older version is installed.

This patch updates the check libzstd presence to check its version is
>= 1.4.0. However, since gas seems to be the only component requiring
such a recent version this may imply that we disable ZSTD support for
all components although some would still benefit from an older
version.

I ran 'autoreconf -f' in all directories containing a configure.ac
file, using vanilla autoconf-2.69 and automake-1.15.1. I noticed
several errors from autoheader in readline, as well as warnings in
intl, but they are unrelated to this patch.

This should fix some of the buildbots.

OK for trunk?

Thanks,

Christophe

config/ChangeLog:

* zstd.m4: Add minimum version requirement of 1.4.0.
---
 config/zstd.m4 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config/zstd.m4 b/config/zstd.m4
index 6da4db68c58..eb34c0f36d7 100644
--- a/config/zstd.m4
+++ b/config/zstd.m4
@@ -12,7 +12,7 @@ AC_ARG_WITH(zstd,
   [], [with_zstd=auto])
 
 AS_IF([test "$with_zstd" != no],
-  [PKG_CHECK_MODULES(ZSTD, [libzstd], [
+  [PKG_CHECK_MODULES(ZSTD, [libzstd >= 1.4.0], [
 AC_DEFINE(HAVE_ZSTD, 1, [Define to 1 if zstd is enabled.])
   ], [
 if test "$with_zstd" = yes; then
-- 
2.41.0



[PATCH 02/24] PR29961, plugin-api.h: "Could not detect architecture endianess"

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: Alan Modra 

Found when attempting to build binutils on sparc sunos-5.8 where
sys/byteorder.h defines _BIG_ENDIAN but not any of the BYTE_ORDER
variants.  This patch adds the extra tests to cope with the old
machine, and tidies the header a little.

include/ChangeLog:

* plugin-api.h: When handling non-gcc or gcc < 4.6.0 include
necessary header files before testing macros.  Make more use
of #elif.  Test _LITTLE_ENDIAN and _BIG_ENDIAN in final tests.
---
 include/plugin-api.h | 49 ++--
 1 file changed, 25 insertions(+), 24 deletions(-)

diff --git a/include/plugin-api.h b/include/plugin-api.h
index 395d5bcc598..f3cf2d8101b 100644
--- a/include/plugin-api.h
+++ b/include/plugin-api.h
@@ -37,7 +37,7 @@
 #error cannot find uint64_t type
 #endif
 
-/* Detect endianess based on __BYTE_ORDER__ macro.  */
+/* Detect endianess based on gcc's (>=4.6.0) __BYTE_ORDER__ macro.  */
 #if defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && \
 defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_PDP_ENDIAN__)
 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
@@ -47,46 +47,47 @@
 #elif __BYTE_ORDER__ == __ORDER_PDP_ENDIAN__
 #define PLUGIN_PDP_ENDIAN 1
 #endif
+
 #else
-/* Older GCC releases (<4.6.0) can make detection from glibc macros.  */
+/* Include header files to define endian macros.  */
 #if defined(__GLIBC__) || defined(__GNU_LIBRARY__) || defined(__ANDROID__)
 #include 
-#ifdef __BYTE_ORDER
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define PLUGIN_LITTLE_ENDIAN 1
-#elif __BYTE_ORDER == __BIG_ENDIAN
-#define PLUGIN_BIG_ENDIAN 1
-#endif
-#endif
-#endif
-/* Include all necessary header files based on target.  */
-#if defined(__SVR4) && defined(__sun)
+
+#elif defined(__SVR4) && defined(__sun)
 #include 
-#endif
-#if defined(__FreeBSD__) || defined(__NetBSD__) || \
-defined(__DragonFly__) || defined(__minix)
+
+#elif defined(__FreeBSD__) || defined(__NetBSD__) || \
+  defined(__DragonFly__) || defined(__minix)
 #include 
-#endif
-#if defined(__OpenBSD__)
+
+#elif defined(__OpenBSD__)
 #include 
 #endif
+
+/* Detect endianess based on __BYTE_ORDER.  */
+#ifdef __BYTE_ORDER
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define PLUGIN_LITTLE_ENDIAN 1
+#elif __BYTE_ORDER == __BIG_ENDIAN
+#define PLUGIN_BIG_ENDIAN 1
+#endif
+
 /* Detect endianess based on _BYTE_ORDER.  */
-#ifdef _BYTE_ORDER
+#elif defined _BYTE_ORDER
 #if _BYTE_ORDER == _LITTLE_ENDIAN
 #define PLUGIN_LITTLE_ENDIAN 1
 #elif _BYTE_ORDER == _BIG_ENDIAN
 #define PLUGIN_BIG_ENDIAN 1
 #endif
-#endif
+
 /* Detect based on _WIN32.  */
-#if defined(_WIN32)
+#elif defined _WIN32
 #define PLUGIN_LITTLE_ENDIAN 1
-#endif
+
 /* Detect based on __BIG_ENDIAN__ and __LITTLE_ENDIAN__ */
-#ifdef __LITTLE_ENDIAN__
+#elif defined __LITTLE_ENDIAN__ || defined _LITTLE_ENDIAN
 #define PLUGIN_LITTLE_ENDIAN 1
-#endif
-#ifdef __BIG_ENDIAN__
+#elif defined __BIG_ENDIAN__ || defined _BIG_ENDIAN
 #define PLUGIN_BIG_ENDIAN 1
 #endif
 #endif
-- 
2.41.0



[PATCH 06/24] toplevel: Recover tilegx/tilepro targets

2023-08-07 Thread Arsen Arsenović via Gcc-patches
These are still supported in Binutils.

ChangeLog:

* configure: Regenerate.
* configure.ac: Recover tilegx/tilepro targets.
---
 configure| 5 -
 configure.ac | 5 -
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 3fe4a1804cf..04369383079 100755
--- a/configure
+++ b/configure
@@ -3072,7 +3072,7 @@ case "${ENABLE_GOLD}" in
   # Check for target supported by gold.
   case "${target}" in
 i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-* \
-| aarch64*-*-* | mips*-*-* | s390*-*-* | loongarch*-*-*)
+| aarch64*-*-* | tilegx*-*-* | mips*-*-* | s390*-*-* | loongarch*-*-*)
  configdirs="$configdirs gold"
  if test x${ENABLE_GOLD} = xdefault; then
default_ld=gold
@@ -3977,6 +3977,9 @@ case "${target}" in
   tic6x-*-*)
 noconfigdirs="$noconfigdirs sim"
 ;;
+  tilepro*-*-* | tilegx*-*-*)
+noconfigdirs="$noconfigdirs sim"
+;;
   v810-*-*)
 noconfigdirs="$noconfigdirs bfd binutils gas gdb ld opcodes 
target-libgloss"
 ;;
diff --git a/configure.ac b/configure.ac
index a11b1006427..3632216fd1c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -360,7 +360,7 @@ case "${ENABLE_GOLD}" in
   # Check for target supported by gold.
   case "${target}" in
 i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-* \
-| aarch64*-*-* | mips*-*-* | s390*-*-* | loongarch*-*-*)
+| aarch64*-*-* | tilegx*-*-* | mips*-*-* | s390*-*-* | loongarch*-*-*)
  configdirs="$configdirs gold"
  if test x${ENABLE_GOLD} = xdefault; then
default_ld=gold
@@ -1227,6 +1227,9 @@ case "${target}" in
   tic6x-*-*)
 noconfigdirs="$noconfigdirs sim"
 ;;
+  tilepro*-*-* | tilegx*-*-*)
+noconfigdirs="$noconfigdirs sim"
+;;
   v810-*-*)
 noconfigdirs="$noconfigdirs bfd binutils gas gdb ld opcodes 
target-libgloss"
 ;;
-- 
2.41.0



[PATCH 11/24] Disable year 2038 support on 32-bit hosts by default

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: Luis Machado 

With a recent import of gnulib, code has been pulled that tests and enables
64-bit time_t by default on 32-bit hosts that support it.

Although gdb can use the gnulib support, bfd doesn't use gnulib and currently
doesn't do these checks.

As a consequence, if we have a 32-bit host that supports 64-bit time_t, we'll
have a mismatch between gdb's notion of time_t and bfd's notion of time_t.

This will lead to mismatches in the struct stat size, leading to memory
corruption and crashes.

This patch disables the year 2038 check for now, which makes things work
reliably again.

I'd consider this a temporary fix until we have proper bfd checks for the year
2038, if it makes sense.  64-bit hosts seems to be more common these days, so
I'm not sure how important it is to have this support enabled and how soon
we want to enable it.

Thoughts?

ChangeLog:

* configure.ac: Disable year2038 by default on 32-bit hosts.
* configure: Regenerate.
---
 configure| 22 ++
 configure.ac | 18 ++
 2 files changed, 40 insertions(+)

diff --git a/configure b/configure
index 35c0c75ee12..faa1aedaa04 100755
--- a/configure
+++ b/configure
@@ -809,6 +809,7 @@ enable_ld
 enable_gprofng
 enable_compressed_debug_sections
 enable_default_compressed_debug_sections_algorithm
+enable_year2038
 enable_libquadmath
 enable_libquadmath_support
 enable_libada
@@ -1552,6 +1553,7 @@ Optional Features:
   --enable-default-compressed-debug-sections-algorithm={zlib,zstd}
   Default compression algorithm for
   --enable-compressed-debug-sections.
+  --enable-year2038   enable support for timestamps past the year 2038
   --disable-libquadmath   do not build libquadmath directory
   --disable-libquadmath-support
   disable libquadmath support for Fortran
@@ -3194,6 +3196,20 @@ case "${host}" in
 ;;
 esac
 
+# Default to --disable-year2038 until we can handle differences between
+# projects that use gnulib (which understands year 2038) and projects that
+# do not (like BFD).
+# Check whether --enable-year2038 was given.
+if test "${enable_year2038+set}" = set; then :
+  enableval=$enable_year2038; ENABLE_YEAR2038=$enableval
+else
+  ENABLE_YEAR2038=no
+fi
+
+enable_year2038=
+if test "${ENABLE_YEAR2038}" = "no" ; then
+  enable_year2038=no
+fi
 
 # Check whether --enable-libquadmath was given.
 if test "${enable_libquadmath+set}" = set; then :
@@ -10215,9 +10231,15 @@ if test "$silent" = yes; then
   baseargs="$baseargs --silent"
   tbaseargs="$tbaseargs --silent"
 fi
+
 baseargs="$baseargs --disable-option-checking"
 tbaseargs="$tbaseargs --disable-option-checking"
 
+if test "$enable_year2038" = no; then
+  baseargs="$baseargs --disable-year2038"
+  tbaseargs="$tbaseargs --disable-year2038"
+fi
+
 # Record and document user additions to sub configure arguments.
 
 
diff --git a/configure.ac b/configure.ac
index 71b923d316f..a0dff0ecac8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -459,6 +459,18 @@ case "${host}" in
 ;;
 esac
 
+# Default to --disable-year2038 until we can handle differences between
+# projects that use gnulib (which understands year 2038) and projects that
+# do not (like BFD).
+AC_ARG_ENABLE(year2038,
+AS_HELP_STRING([--enable-year2038],
+  [enable support for timestamps past the year 2038]),
+ENABLE_YEAR2038=$enableval,
+ENABLE_YEAR2038=no)
+enable_year2038=
+if test "${ENABLE_YEAR2038}" = "no" ; then
+  enable_year2038=no
+fi
 
 AC_ARG_ENABLE(libquadmath,
 AS_HELP_STRING([--disable-libquadmath],
@@ -3339,9 +3351,15 @@ if test "$silent" = yes; then
   baseargs="$baseargs --silent"
   tbaseargs="$tbaseargs --silent"
 fi
+
 baseargs="$baseargs --disable-option-checking"
 tbaseargs="$tbaseargs --disable-option-checking"
 
+if test "$enable_year2038" = no; then
+  baseargs="$baseargs --disable-year2038"
+  tbaseargs="$tbaseargs --disable-year2038"
+fi
+
 # Record and document user additions to sub configure arguments.
 AC_ARG_VAR([build_configargs],
   [additional configure arguments for build directories])
-- 
2.41.0



[PATCH 03/24] gcc-4.5 build fixes

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: Alan Modra 

Trying to build binutils with an older gcc currently fails.  Working
around these gcc bugs is not onerous so let's fix them.

include/ChangeLog:

* xtensa-dynconfig.h (xtensa_isa_internal): Delete unnecessary
forward declaration.
---
 include/xtensa-dynconfig.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/include/xtensa-dynconfig.h b/include/xtensa-dynconfig.h
index 48877ebb6b6..45d54dcd0e0 100644
--- a/include/xtensa-dynconfig.h
+++ b/include/xtensa-dynconfig.h
@@ -121,8 +121,6 @@ struct xtensa_config_v4
   int xchal_unaligned_store_hw;
 };
 
-typedef struct xtensa_isa_internal_struct xtensa_isa_internal;
-
 extern const void *xtensa_load_config (const char *name,
   const void *no_plugin_def,
   const void *no_name_def);
-- 
2.41.0



[PATCH 09/24] add --enable-default-compressed-debug-sections-algorithm configure option

2023-08-07 Thread Arsen Arsenović via Gcc-patches
From: Martin Liska 

ChangeLog:

* configure.ac: Add 
--enable-default-compressed-debug-sections-algorithm.
* configure: Regenerate.
---
 configure| 13 +
 configure.ac |  6 ++
 2 files changed, 19 insertions(+)

diff --git a/configure b/configure
index a5f6282bb0e..c5f6ae8e745 100755
--- a/configure
+++ b/configure
@@ -807,6 +807,7 @@ enable_offload_defaulted
 enable_gold
 enable_ld
 enable_compressed_debug_sections
+enable_default_compressed_debug_sections_algorithm
 enable_libquadmath
 enable_libquadmath_support
 enable_libada
@@ -1546,6 +1547,9 @@ Optional Features:
   --enable-compressed-debug-sections={all,gas,gold,ld,none}
   Enable compressed debug sections for gas, gold or ld
   by default
+  --enable-default-compressed-debug-sections-algorithm={zlib,zstd}
+  Default compression algorithm for
+  --enable-compressed-debug-sections.
   --disable-libquadmath   do not build libquadmath directory
   --disable-libquadmath-support
   disable libquadmath support for Fortran
@@ -3142,6 +3146,15 @@ else
 fi
 
 
+# Select default compression algorithm.
+# Check whether --enable-default_compressed_debug_sections_algorithm was given.
+if test "${enable_default_compressed_debug_sections_algorithm+set}" = set; 
then :
+  enableval=$enable_default_compressed_debug_sections_algorithm;
+else
+  default_compressed_debug_sections_algorithm=
+fi
+
+
 # Configure extra directories which are host specific
 
 case "${host}" in
diff --git a/configure.ac b/configure.ac
index e820940c81e..ef30300af28 100644
--- a/configure.ac
+++ b/configure.ac
@@ -418,6 +418,12 @@ AC_ARG_ENABLE(compressed_debug_sections,
   fi
 ], [enable_compressed_debug_sections=])
 
+# Select default compression algorithm.
+AC_ARG_ENABLE(default_compressed_debug_sections_algorithm,
+[AS_HELP_STRING([--enable-default-compressed-debug-sections-algorithm={zlib,zstd}],
+   [Default compression algorithm for 
--enable-compressed-debug-sections.])],
+[], [default_compressed_debug_sections_algorithm=])
+
 # Configure extra directories which are host specific
 
 case "${host}" in
-- 
2.41.0



[PATCH 01/24] toplevel: Substitute GDCFLAGS instead of using CFLAGS

2023-08-07 Thread Arsen Arsenović via Gcc-patches
r14-2875-g1ed21e23d6d4da ("Use substituted GDCFLAGS") already
implemented this change, but only on the generated file rather than in
the template it is generated from.

ChangeLog:

* Makefile.tpl: Substitute @GDCFLAGS@ instead of using
$(CFLAGS).
---
 Makefile.tpl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.tpl b/Makefile.tpl
index d0fe7e2fb77..4fdca604eb0 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -447,7 +447,7 @@ LIBCFLAGS = $(CFLAGS)
 CXXFLAGS = @CXXFLAGS@
 LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
 GOCFLAGS = $(CFLAGS)
-GDCFLAGS = $(CFLAGS)
+GDCFLAGS = @GDCFLAGS@
 GM2FLAGS = $(CFLAGS)
 
 # Pass additional PGO and LTO compiler options to the PGO build.
-- 
2.41.0



[PATCH 00/24] Sync shared build infrastructure with binutils-gdb

2023-08-07 Thread Arsen Arsenović via Gcc-patches
Hello,

This patch set, combined with a sibling patch set sent on the binutils
and GDB MLs, bring up the shared infrastructure between the two projects
in sync again.

It largely consists of cherry-picks from various people which have been
reviewed and accepted on the binutils-gdb side, as well as a couple of
patches for differences that seemed to get lost during the
pick-and-regenerate process, though I've had to reformat quite a few
commits so that they match what the changelog verifier expects.

Some of these commits were previously applied and then reverted, namely
"Check if AR works with --plugin and rc", but the reversion reason[1]
seems to be no longer valid as of requiring Binutils 2.35 for LTO
anyway.

In addition, I'm not entirely certain that the handling of the removed
targets I re-added is correct, nor what their status in binutils and gdb
is, so feedback is welcome there.

During this process, it appears that I overlooked passing -x to
cherry-pick, so the paper trail got lost.  If needed, I can hack
together some code to associate commits based on subjects with their
pair in the other repository, and amend the commits with these
references added.

These patches ignore the intl/ directory, as I plan to follow up this
patchset with one that can be cleanly applied to both trees which gets
rid of the intl/ directory in favor of out-of-tree gettext (ISL, GMP, et
al. style).

Bootstrapped and reg-tested on x86_64-pc-linux-gnu.

OK for master?

Thanks in advance, have a lovely day.

[1]: 
https://inbox.sourceware.org/gcc-patches/CAMe9rOqFSOSM5Sw5SBMiy20rdgRJkftUXdw=ykexhvdmuty...@mail.gmail.com/

Alan Modra (4):
  PR29961, plugin-api.h: "Could not detect architecture endianess"
  gcc-4.5 build fixes
  egrep in binutils
  PR27116, Spelling errors found by Debian style checker

Alexander von Gluck IV (1):
  Add support for the haiku operating system

Arsen Arsenović (3):
  toplevel: Substitute GDCFLAGS instead of using CFLAGS
  toplevel: Recover tilegx/tilepro targets
  configure: reinstate 32b PA-RISC HP-UX target in toplevel

Christophe Lyon (1):
  configure: require libzstd >= 1.4.0

Fangrui Song (1):
  binutils, gdb: support zstd compressed debug sections

H.J. Lu (4):
  Sync with binutils: GCC: Pass --plugin to AR and RANLIB
  GCC: Check if AR works with --plugin and rc
  PKG_CHECK_MODULES: Check if $pkg_cv_[]$1[]_LIBS works
  PKG_CHECK_MODULES: Properly check if $pkg_cv_[]$1[]_LIBS works

Indu Bhagat (2):
  bfd: linker: merge .sframe sections
  toplevel: Makefile.def: add install-strip dependency on libsframe

John Ericson (1):
  Deprecate a.out support for NetBSD targets.

Luis Machado (1):
  Disable year 2038 support on 32-bit hosts by default

Martin Liska (1):
  add --enable-default-compressed-debug-sections-algorithm configure
option

Nick Alcock (3):
  libtool.m4: fix nm BSD flag detection
  libtool.m4: fix the NM="/nm/over/here -B/option/with/path" case
  libtool.m4: augment symcode for Solaris 11

Simon Marchi (1):
  Pass PKG_CONFIG_PATH down from top-level Makefile

Vladimir Mezentsev (1):
  gprofng: a new GNU profiler

 Makefile.def   |  18 ++
 Makefile.in| 517 -
 Makefile.tpl   |  10 +-
 config/gcc-plugin.m4   |  40 +++
 config/lib-ld.m4   |   8 +-
 config/override.m4 |   2 +-
 config/picflag.m4  |   4 +-
 config/pkg.m4  |   8 +
 config/zstd.m4 |  23 ++
 configure  | 224 +++-
 configure.ac   |  74 +-
 fixincludes/configure  |   3 +-
 gcc/configure  | 140 ++
 include/collectorAPI.h |  73 ++
 include/libcollector.h |  89 +++
 include/libfcollector.h|  42 +++
 include/plugin-api.h   |  49 ++--
 include/xtensa-dynconfig.h |   2 -
 intl/configure |   4 +-
 libada/configure   |   4 +-
 libatomic/configure| 130 ++
 libbacktrace/configure | 130 ++
 libcc1/configure   | 132 ++
 libcpp/configure   |   4 +-
 libffi/configure   | 132 ++
 libgcc/configure   |   6 +-
 libgfortran/configure  | 132 ++
 libgm2/configure   | 132 ++
 libgomp/configure  | 132 ++
 libiberty/Makefile.in  |   5 +-
 libiberty/aclocal.m4   |   1 +
 libiberty/configure| 144 ++-
 libiberty/configure.ac |  12 +
 libitm/configure   | 132 ++
 libobjc/configure  | 130 ++
 libphobos/configure| 130 ++
 libquadmath/configure  | 130 ++
 libsanitizer/configure | 132 ++
 libssp/configure   | 130 ++
 libstdc++-v3/configure | 148 +++
 libtool.m4 | 130 ++
 libvtv/configure   | 132 ++
 lto-plugin/configure   | 130 ++
 zlib/configure | 130 ++
 44 files changed, 2924 insertions(+), 956 

[pushed] extend.texi: index __auto_type

2023-07-17 Thread Arsen Arsenović via Gcc-patches
gcc/ChangeLog:

* doc/extend.texi: Add @cindex on __auto_type.
---
Pushed as obvious.

 gcc/doc/extend.texi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 093bd97ba4d..ec9ffa3c86e 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -843,6 +843,7 @@ Thus, @code{array (pointer (char), 4)} is the type of 
arrays of 4
 pointers to @code{char}.
 @end itemize
 
+@cindex @code{__auto_type} in GNU C
 In GNU C, but not GNU C++, you may also declare the type of a variable
 as @code{__auto_type}.  In that case, the declaration must declare
 only one variable, whose declarator must just be an identifier, the
-- 
2.41.0



Re: [PATCH v2 0/5] A small Texinfo refinement

2023-05-29 Thread Arsen Arsenović via Gcc-patches
Hi,

NightStrike  writes:

> Can you include texinfo in a top-level directory and have it built with the
> build, like you can with dejagnu? That's generally a decent path for
> building new gcc on older systems.

Note that the Texinfo requirement wasn't bumped, so nothing changed in
this regard, however, I believe that this is already done, as I see the
following in Makefile.def:

  host_modules= { module= texinfo; no_install= true; };

(... and some relevant logic in configure.ac)


I'm not a fan of building dependencies in-tree, but I can see the
usefulness; I believe a superior solution would be one that adds .info
(et al.) files to all generated tarballs (including snapshots), hence
eliminating any extra deps anyway.  These files aren't system-specific,
after all, as they are neither code nor conditionally compiled.

This is also assumed practice in other packages.

Have a lovely day.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


[pushed] doc: Fix a pinch of typos in extend.texi

2023-05-17 Thread Arsen Arsenović via Gcc-patches
gcc/ChangeLog:

* doc/extend.texi (C++ Concepts) : Remove extraneous
parenthesis.  Fix misnamed index entry.
: Fix misnamed index entry.
---

Pushed as obvious.

 gcc/doc/extend.texi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 69b21a75e62..ed8b9c8a87b 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -25460,12 +25460,12 @@ assumption is valid. For example, @code{assume(n > 
0)}.
 @item axiom
 Introduces an axiom definition. Axioms introduce requirements on values.
 
-@kindex axiom
+@kindex forall
 @item forall
 Introduces a universally quantified object in an axiom. For example,
-@code{forall (int n) n + 0 == n}).
+@code{forall (int n) n + 0 == n}.
 
-@kindex axiom
+@kindex concept
 @item concept
 Introduces a concept definition. Concepts are sets of syntactic and semantic
 requirements on types and their values.
-- 
2.40.1



Ping: [PATCH 0/2] Unify and deduplicate FTM code

2023-05-08 Thread Arsen Arsenović via Gcc-patches
Ping.

This patch rebases cleanly as of right now.  No new changes to review.

Have a lovely day!
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


[PUSHED gcc-11] extend.texi: replace @itemx not preceded by @item.

2023-05-03 Thread Arsen Arsenović via Gcc-patches
gcc/ChangeLog:

* doc/extend.texi: Replace @itemx not being preceded by @item.
---
Fixes errors raised by newer Texinfo.

Pushed as obvious.

 gcc/doc/extend.texi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index d6093397a61..64bd4c1cb6c 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -2487,7 +2487,7 @@ The following attributes are supported on most targets.
 @table @code
 @c Keep this table alphabetized by attribute name.  Treat _ as space.
 
-@itemx access (@var{access-mode}, @var{ref-index})
+@item access (@var{access-mode}, @var{ref-index})
 @itemx access (@var{access-mode}, @var{ref-index}, @var{size-index})
 
 The @code{access} attribute enables the detection of invalid or unsafe
-- 
2.40.1



[PATCH 1/2] libstdc++: Implement more maintainable header

2023-04-29 Thread Arsen Arsenović via Gcc-patches
This commit replaces the ad-hoc logic in  with an AutoGen
database that (mostly) declaratively generates a version.h bit which
combines all of the FTM logic across all headers together.

This generated header defines macros of the form __glibcxx_foo,
equivalent to their __cpp_lib_foo variants, according to rules specified
in version.def and, optionally, if __glibcxx_want_foo or
__glibcxx_want_all are defined, also defines __cpp_lib_foo forms with
the same definition.

libstdc++-v3/ChangeLog:

* include/Makefile.am (bits_freestanding): Add version.h.
(allcreated): Add version.h.
(${bits_srcdir}/version.h): New rule.  Regenerates
version.h out of version.{def,tpl}.
* include/Makefile.in: Regenerate.
* include/bits/version.def: New file.  Declares a list of
all feature test macros, their values and their preconditions.
* include/bits/version.tpl: New file.  Turns version.def
into a sequence of #if blocks.
* include/bits/version.h: New file.  Generated from
version.def.
* include/std/version: Replace with a __glibcxx_want_all define
and bits/version.h include.
---
 libstdc++-v3/include/Makefile.am  |   10 +-
 libstdc++-v3/include/Makefile.in  |   10 +-
 libstdc++-v3/include/bits/version.def | 1591 
 libstdc++-v3/include/bits/version.h   | 1937 +
 libstdc++-v3/include/bits/version.tpl |  209 +++
 libstdc++-v3/include/std/version  |  350 +
 6 files changed, 3758 insertions(+), 349 deletions(-)
 create mode 100644 libstdc++-v3/include/bits/version.def
 create mode 100644 libstdc++-v3/include/bits/version.h
 create mode 100644 libstdc++-v3/include/bits/version.tpl

diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index a880e8ee227..a07b4c18585 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -154,6 +154,7 @@ bits_freestanding = \
${bits_srcdir}/stl_raw_storage_iter.h \
${bits_srcdir}/stl_relops.h \
${bits_srcdir}/stl_uninitialized.h \
+   ${bits_srcdir}/version.h \
${bits_srcdir}/string_view.tcc \
${bits_srcdir}/uniform_int_dist.h \
${bits_srcdir}/unique_ptr.h \
@@ -1113,7 +1114,8 @@ allcreated = \
${host_builddir}/c++config.h \
${host_builddir}/largefile-config.h \
${thread_host_headers} \
-   ${pch_build}
+   ${pch_build} \
+   ${bits_srcdir}/version.h
 
 # Here are the rules for building the headers
 all-local: ${allstamped} ${allcreated}
@@ -1463,6 +1465,12 @@ ${pch3_output}: ${pch3_source} ${pch2_output}
-mkdir -p ${pch3_output_builddir}
$(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pch3_source} -o $@
 
+# AutoGen .
+${bits_srcdir}/version.h: ${bits_srcdir}/version.def \
+   ${bits_srcdir}/version.tpl
+   cd $(@D) && \
+   autogen version.def
+
 # The real deal.
 install-data-local: install-headers
 install-headers:
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index 0ff875b280b..f5b04d3fe8a 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -509,6 +509,7 @@ bits_freestanding = \
${bits_srcdir}/stl_raw_storage_iter.h \
${bits_srcdir}/stl_relops.h \
${bits_srcdir}/stl_uninitialized.h \
+   ${bits_srcdir}/version.h \
${bits_srcdir}/string_view.tcc \
${bits_srcdir}/uniform_int_dist.h \
${bits_srcdir}/unique_ptr.h \
@@ -1441,7 +1442,8 @@ allcreated = \
${host_builddir}/c++config.h \
${host_builddir}/largefile-config.h \
${thread_host_headers} \
-   ${pch_build}
+   ${pch_build} \
+   ${bits_srcdir}/version.h
 
 
 # Host includes for threads
@@ -1937,6 +1939,12 @@ ${pch3_output}: ${pch3_source} ${pch2_output}
-mkdir -p ${pch3_output_builddir}
$(CXX) $(PCHFLAGS) $(AM_CPPFLAGS) -O2 -g ${pch3_source} -o $@
 
+# AutoGen .
+${bits_srcdir}/version.h: ${bits_srcdir}/version.def \
+   ${bits_srcdir}/version.tpl
+   cd $(@D) && \
+   autogen version.def
+
 # The real deal.
 install-data-local: install-headers
 install-headers:
diff --git a/libstdc++-v3/include/bits/version.def 
b/libstdc++-v3/include/bits/version.def
new file mode 100644
index 000..afdec9acfe3
--- /dev/null
+++ b/libstdc++-v3/include/bits/version.def
@@ -0,0 +1,1591 @@
+// Feature test macro definitions  -*- C++ -*-
+// Copyright (C) 2023 Free Software Foundation, Inc.
+
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT 

[PATCH 0/2] Unify and deduplicate FTM code

2023-04-29 Thread Arsen Arsenović via Gcc-patches
Greetings!

This patch set replaces all code that involves defining feature test
macros based on loosely put together conditionals in the standard
library with a unified helper for specifying and requiring feature test
macros, as well as updating most usage sites, many of which have been
migrated to following a pattern similar, in structure, to:

  ...
  #define __glibcxx_want_foo
  #include 
  ...
  namespace std {
  ...
  #ifdef __cpp_lib_foo
template
void foonicate(T&& t)
{ __builtin_foonicate_address(std::__addressof(t)); }
  #endif // __cpp_lib_foo
  ...
  } // namespace std

In the future this should aid in preventing  from being
dishonest about what the implementation provides, as well as reducing
the amount of finicky work it takes to update FTMs.

Note that this patchset is not perfect.  The usage sites of various
feature test macros still include "wide" condition blocks that shadow
over the blocks that check for FTMs, mostly in places where features
with FTMs are the exception, rather than the norm.

That said, using a pair of scripts[1][2], I've tested that the code
emitted in bits/stdc++.h remains unchanged (save for a misdeclared
__cpp_lib_constexpr_string in !HOSTED), as well as regression-tested
--enable-languages=c,c++,lto on x86_64-pc-linux-gnu, and ran the
libstdc++ testsuite with

  --target_board="unix{,-std=c++98,-std=gnu++11,-std=gnu++20,
  -D_GLIBCXX_USE_CXX11_ABI=0/-D_GLIBCXX_DEBUG,-D_GLIBCXX_DEBUG,
  -std=gnu++23}{-fno-freestanding,-ffreestanding}"

(without the line breaks) to find no relevant failures.

OK for trunk?

Thanks in advance, have a lovely day.

[1] https://git.sr.ht/~arsen/scripts/tree/master/item/difall.bash
[2] https://git.sr.ht/~arsen/scripts/tree/master/item/vercmp.bash

Arsen Arsenović (2):
  libstdc++: Implement more maintainable  header
  libstdc++: Replace all manual FTM definitions and use

 libstdc++-v3/include/Makefile.am  |   10 +-
 libstdc++-v3/include/Makefile.in  |   10 +-
 libstdc++-v3/include/bits/algorithmfwd.h  |7 +-
 libstdc++-v3/include/bits/align.h |8 +-
 libstdc++-v3/include/bits/alloc_traits.h  |   11 +-
 libstdc++-v3/include/bits/allocator.h |3 +-
 libstdc++-v3/include/bits/atomic_base.h   |   14 +-
 libstdc++-v3/include/bits/atomic_wait.h   |   10 +-
 libstdc++-v3/include/bits/basic_string.h  |   24 +-
 libstdc++-v3/include/bits/char_traits.h   |   11 +-
 libstdc++-v3/include/bits/chrono.h|   18 +-
 libstdc++-v3/include/bits/cow_string.h|9 +-
 libstdc++-v3/include/bits/erase_if.h  |   11 +-
 libstdc++-v3/include/bits/forward_list.h  |6 +-
 libstdc++-v3/include/bits/hashtable.h |9 +-
 libstdc++-v3/include/bits/ios_base.h  |6 +-
 libstdc++-v3/include/bits/move.h  |8 +-
 .../include/bits/move_only_function.h |9 +-
 libstdc++-v3/include/bits/node_handle.h   |8 +-
 libstdc++-v3/include/bits/ptr_traits.h|   15 +-
 libstdc++-v3/include/bits/range_access.h  |   16 +-
 libstdc++-v3/include/bits/ranges_algo.h   |   27 +-
 libstdc++-v3/include/bits/ranges_cmp.h|   14 +-
 libstdc++-v3/include/bits/shared_ptr.h|   10 +-
 libstdc++-v3/include/bits/shared_ptr_atomic.h |6 +-
 libstdc++-v3/include/bits/shared_ptr_base.h   |   17 +-
 libstdc++-v3/include/bits/specfun.h   |6 +-
 libstdc++-v3/include/bits/stl_algo.h  |   20 +-
 libstdc++-v3/include/bits/stl_algobase.h  |   13 +-
 libstdc++-v3/include/bits/stl_function.h  |   28 +-
 libstdc++-v3/include/bits/stl_iterator.h  |   21 +-
 libstdc++-v3/include/bits/stl_list.h  |6 +-
 libstdc++-v3/include/bits/stl_map.h   |6 +-
 libstdc++-v3/include/bits/stl_pair.h  |   12 +-
 libstdc++-v3/include/bits/stl_queue.h |9 +-
 libstdc++-v3/include/bits/stl_stack.h |7 +-
 libstdc++-v3/include/bits/stl_tree.h  |7 +-
 libstdc++-v3/include/bits/stl_uninitialized.h |9 +-
 libstdc++-v3/include/bits/stl_vector.h|4 +-
 libstdc++-v3/include/bits/unique_ptr.h|   13 +-
 libstdc++-v3/include/bits/unordered_map.h |8 +-
 .../include/bits/uses_allocator_args.h|   10 +-
 libstdc++-v3/include/bits/utility.h   |   21 +-
 libstdc++-v3/include/bits/version.def | 1591 ++
 libstdc++-v3/include/bits/version.h   | 1937 +
 libstdc++-v3/include/bits/version.tpl |  209 ++
 .../include/c_compatibility/stdatomic.h   |9 +-
 libstdc++-v3/include/c_global/cmath   |   18 +-
 libstdc++-v3/include/c_global/cstddef |9 +-
 libstdc++-v3/include/std/algorithm|   10 +-
 libstdc++-v3/include/std/any  |9 +-
 libstdc++-v3/include/std/array|9 +-
 libstdc++-v3/include/std/atomic   |   67 +-
 libstdc++-v3/include/std/barrier  |   11 +-
 

Re: [PATCH] gcc/m2: Drop references to $(P)

2023-04-25 Thread Arsen Arsenović via Gcc-patches

Richard Biener  writes:

> If it doesn't show any issues after a while on trunk it's OK for 13.2 I
> think.

Thanks, I'll re-propose it later then.

Have a lovely day!

-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH] gcc/m2: Drop references to $(P)

2023-04-21 Thread Arsen Arsenović via Gcc-patches

Jakub Jelinek  writes:

> Doesn't fix any regression, so not ok for 13.1 and I wouldn't bother
> for 13.2 either.

Okay, but it can affect --enable-languages=all in a slim edge case.

Why not 13.2?  It seems sufficiently simple.

Thanks, have a lovely night!
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH] gcc/m2: Drop references to $(P)

2023-04-21 Thread Arsen Arsenović via Gcc-patches
Hi Gaius,

Gaius Mulley  writes:

> yes certainly this is fine.  lgtm.  Thanks for spotting and the patch

Sure.  Will push to master and wait for a RM to weigh in on 13.

Thanks!
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


[PATCH] gcc/m2: Drop references to $(P)

2023-04-21 Thread Arsen Arsenović via Gcc-patches
$(P) seems to have been a workaround for some old, proprietary make
implementations that we no longer support.  It was removed in
r0-31149-gb8dad04b688e9c.

gcc/m2/ChangeLog:

* Make-lang.in: Remove references to $(P).
* Make-maintainer.in: Ditto.
---
Hi,

We spotted that the m2 makefile includes some long-gone compatibility
variable $(P), presumably left over from when m2 was not in the tree
yet.  This induced a build failure on our end:
https://bugs.gentoo.org/904714

Build-tested on x86_64-pc-linux-gnu.  I haven't finished running the
testsuite.  I believe this only ever expands to an empty string (if not
set by the env) in the current build system, so in theory, it should be
safe.

OK for gcc-13 and trunk (with a priority on the former)?

 gcc/m2/Make-lang.in   | 4 ++--
 gcc/m2/Make-maintainer.in | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/m2/Make-lang.in b/gcc/m2/Make-lang.in
index b34db0d9156..d0fa692e5b8 100644
--- a/gcc/m2/Make-lang.in
+++ b/gcc/m2/Make-lang.in
@@ -514,7 +514,7 @@ GM2_LIBS_BOOT = m2/gm2-compiler-boot/gm2.a \
 cc1gm2$(exeext): m2/stage1/cc1gm2$(exeext) $(m2.prev)
cp -p $< $@
 
-m2/stage2/cc1gm2$(exeext): m2/stage1/cc1gm2$(exeext) m2/gm2-compiler/m2flex.o 
$(P) \
+m2/stage2/cc1gm2$(exeext): m2/stage1/cc1gm2$(exeext) m2/gm2-compiler/m2flex.o \
 $(GM2_C_OBJS) $(BACKEND) $(LIBDEPS) $(GM2_LIBS) \
 m2/gm2-gcc/rtegraph.o plugin/m2rte$(soext)
-test -d $(@D) || $(mkinstalldirs) $(@D)
@@ -527,7 +527,7 @@ m2/stage2/cc1gm2$(exeext): m2/stage1/cc1gm2$(exeext) 
m2/gm2-compiler/m2flex.o $(
@$(call LINK_PROGRESS,$(INDEX.m2),end)
 
 m2/stage1/cc1gm2$(exeext): gm2$(exeext) m2/gm2-compiler-boot/m2flex.o \
-$(P) $(GM2_C_OBJS) $(BACKEND) $(LIBDEPS) \
+$(GM2_C_OBJS) $(BACKEND) $(LIBDEPS) \
 $(GM2_LIBS_BOOT) $(MC_LIBS) \
 m2/gm2-gcc/rtegraph.o plugin/m2rte$(soext) \
 $(m2.prev)
diff --git a/gcc/m2/Make-maintainer.in b/gcc/m2/Make-maintainer.in
index 17bd9a2d37e..a70682673cd 100644
--- a/gcc/m2/Make-maintainer.in
+++ b/gcc/m2/Make-maintainer.in
@@ -753,7 +753,7 @@ GM2_LIBS_PARANOID = m2/gm2-compiler-paranoid/gm2.a \
 gm2.paranoid: m2/m2obj3/cc1gm2$(exeext) gm2.verifyparanoid
 
 m2/m2obj3/cc1gm2$(exeext): m2/m2obj2/cc1gm2$(exeext) 
m2/gm2-compiler-paranoid/m2flex.o \
-$(P) $(GM2_C_OBJS) $(BACKEND) $(LIBDEPS) 
$(GM2_LIBS_PARANOID) \
+$(GM2_C_OBJS) $(BACKEND) $(LIBDEPS) 
$(GM2_LIBS_PARANOID) \
 m2/gm2-gcc/rtegraph.o plugin/m2rte$(exeext).so 
m2/gm2-libs-boot/M2LINK.o
-test -d m2/m2obj3 || $(mkinstalldirs) m2/m2obj3
@$(call LINK_PROGRESS,$(INDEX.m2),start)
-- 
2.40.0



Re: [PATCH] update_web_docs_git: Add updated Texinfo to PATH

2023-04-21 Thread Arsen Arsenović via Gcc-patches

Gerald Pfeifer  writes:

> On Thu, 20 Apr 2023, Arsen Arsenović wrote:
>>> I understand, just am wondering whether and why the : is required? I 
>>> don't think we are using this construct anywhere else?
>> Without them, this would happen:
>> 
>>   ~$ "${foo:=foo}"
>>   bash: foo: command not found
>>   ~ 127 $ unset foo
>>   ~$ echo "${foo:=foo}"
>>   foo
>>   ~$ 
>
> Ah, of course!
>
> That's why I tend to use FOO=${FOO-barbar} in such cases - which is a tad 
> more characters. :)
>
>> Thank you!  Hopefully we get this just in time for 13 :)
>
> The release is currently planned for the 26th and the udpated script is 
> now live.

Perfect \o/

> I just ran it and things seem to work just fine. Do you spot anything
> unexpected?

Seems perfect, thank you!

Have a lovely day!  :)

> Gerald


-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH] update_web_docs_git: Add updated Texinfo to PATH

2023-04-20 Thread Arsen Arsenović via Gcc-patches

Gerald Pfeifer  writes:

> Hi Arsen,
>
> On Fri, 14 Apr 2023, Arsen Arsenović wrote:
>>> Did you intentionally not implement the following part of my suggestion
>>>
>>>if [ x${MAKEINFO}x = xx ]; then
>>>:
>> > that is, allowing to override from the command-line (or crontab)?
>> (answering both the questions)
>> 
>> This := operator is a handy "default assign" operator.  It's a bit of an
>> oddity of the POSIX shell, but it works well.  The line:
>> 
>>   : "${foo:=bar}"
>> 
>> is a convenient way of spelling "if foo is unset or null, set it to
>> bar".  the initial ':' there serves to discard the result of this
>> evaluation (so that only its side effect of updating foo if necessary is
>> kept)
>
> I understand, just am wondering whether and why the : is required? I 
> don't think we are using this construct anywhere else?

Without them, this would happen:

  ~$ "${foo:=foo}"
  bash: foo: command not found
  ~ 127 $ unset foo
  ~$ echo "${foo:=foo}"
  foo
  ~$ 

> (I was aware of the ${foo:=bar} syntax, just caught up by you pushing
> that part of the logic to the lowest level whereas I had it at the top
> level. That's purely on me.)
>
> Please go ahead and push this (or a variant without the : commands) and
> I'll then pick it up from there.

Thank you!  Hopefully we get this just in time for 13 :)

Pushed.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH] doc: tfix

2023-04-20 Thread Arsen Arsenović via Gcc-patches

Alejandro Colomar via Gcc-patches  writes:

> Remove repeated word (typo).
>
> Signed-off-by: Alejandro Colomar 
> ---
>  gcc/doc/extend.texi | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
> index fd3745c5608..cdfb25ff272 100644
> --- a/gcc/doc/extend.texi
> +++ b/gcc/doc/extend.texi
> @@ -3756,7 +3756,7 @@ take function pointer arguments.
>  The @code{optimize} attribute is used to specify that a function is to
>  be compiled with different optimization options than specified on the
>  command line.  The optimize attribute arguments of a function behave
> -behave as if appended to the command-line.
> +as if appended to the command-line.
>  
>  Valid arguments are constant non-negative integers and
>  strings.  Each numeric argument specifies an optimization @var{level}.

Please include a ChangeLog like the following:

gcc/ChangeLog:

* doc/extend.texi (Common Function Attributes): Remove duplicate
word.

I can add that and push for you, if you agree.

Thanks, have a most lovely night!
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH] update_web_docs_git: Add updated Texinfo to PATH

2023-04-14 Thread Arsen Arsenović via Gcc-patches

Gerald Pfeifer  writes:

> On Tue, 11 Apr 2023, Arsen Arsenović wrote:
>> Ah!  Good idea.  What do you think of the following?
>
> Did you intentionally not implement the following part of my suggestion
>
>if [ x${MAKEINFO}x = xx ]; then
>:
>
> that is, allowing to override from the command-line (or crontab)?
>
>
> And why the colons in
>
>   +: "${MAKEINFO:=${makeinfo_git}/makeinfo}"
>   +: "${TEXI2DVI:=${makeinfo_git}/texi2dvi}"
>   +: "${TEXI2PDF:=${makeinfo_git}/texi2pdf}"
>
> ? I don't think we use these elsewhere. Do they serve a purpose or can we 
> omit them and keep things simpler?

(answering both the questions)

This := operator is a handy "default assign" operator.  It's a bit of an
oddity of the POSIX shell, but it works well.  The line:

  : "${foo:=bar}"

is a convenient way of spelling "if foo is unset or null, set it to
bar".  the initial ':' there serves to discard the result of this
evaluation (so that only its side effect of updating foo if necessary is
kept)

... so, the above block translates into "if makeinfo_git/makeinfo
exists, then default MAKEINFO, TEXI2DVI, TEXI2PDF to makeinfo_git/$tool,
otherwise, default them to $tool", where $tool is the respective tool
for those variables.

>
> Please let me know, and I'll see to get this (or probably an updated 
> patch) in place on gcc.gnu.org.
>
> Thanks,
> Gerald


-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH] update_web_docs_git: Add updated Texinfo to PATH

2023-04-10 Thread Arsen Arsenović via Gcc-patches

Gerald Pfeifer  writes:

> On Thu, 6 Apr 2023, Arsen Arsenović wrote:
>> maintainer-scripts/ChangeLog:
>> 
>>  * update_web_docs_git: Add updated Texinfo to PATH
>
> Do we really need to adjust PATH, or could we just introduce a MAKEINFO 
> variable, something like
>
>   if [ x${MAKEINFO}x = xx ]; then
> if [ -x /home/gccadmin/texinfo/install-git/bin/makeinfo ]; then
>   MAKEINFO=/home/gccadmin/texinfo/install-git/bin/makeinfo;
> else
>   MAKEINFO=makeinfo
> fi
>   fi
>
> ?
>
> (This also still allows overriding upon invocation.)
>
> Gerald

Ah!  Good idea.  What do you think of the following?

From ba00aa3882b7e0a5fa247f9fa824474e3ddc8102 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Arsen=20Arsenovi=C4=87?= 
Date: Thu, 6 Apr 2023 12:20:57 +0200
Subject: [PATCH] update_web_docs_git: Allow setting TEXI2*, add git build
 default

maintainer-scripts/ChangeLog:

	* update_web_docs_git: Add a mechanism to override makeinfo,
	texi2dvi and texi2pdf, and default them to
	/home/gccadmin/texinfo/install-git/bin/${tool}, if present.
---
 maintainer-scripts/update_web_docs_git | 17 ++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/maintainer-scripts/update_web_docs_git b/maintainer-scripts/update_web_docs_git
index d44ab27c1b7..c651e567424 100755
--- a/maintainer-scripts/update_web_docs_git
+++ b/maintainer-scripts/update_web_docs_git
@@ -14,6 +14,17 @@ export GITROOT
 
 PATH=/usr/local/bin:$PATH
 
+makeinfo_git=/home/gccadmin/texinfo/install-git/bin/
+if [ -x "${makeinfo_git}"/makeinfo ]; then
+: "${MAKEINFO:=${makeinfo_git}/makeinfo}"
+: "${TEXI2DVI:=${makeinfo_git}/texi2dvi}"
+: "${TEXI2PDF:=${makeinfo_git}/texi2pdf}"
+else
+: "${MAKEINFO:=makeinfo}"
+: "${TEXI2DVI:=texi2dvi}"
+: "${TEXI2PDF:=texi2pdf}"
+fi
+
 MANUALS="cpp
   cppinternals
   fastjar
@@ -174,10 +185,10 @@ for file in $MANUALS; do
 elif [ "$file" = "gnat_ugn" ]; then
   includes="$includes -I gcc/gcc/ada -I gcc/gcc/ada/doc/gnat_ugn"
 fi
-makeinfo --html -c CONTENTS_OUTPUT_LOCATION=inline --css-ref $CSS $includes -o ${file} ${filename}
+"${MAKEINFO}" --html -c CONTENTS_OUTPUT_LOCATION=inline --css-ref $CSS $includes -o ${file} ${filename}
 tar cf ${file}-html.tar ${file}/*.html
-texi2dvi $includes -o ${file}.dvi ${filename} /dev/null && dvips -o ${file}.ps ${file}.dvi
-texi2pdf $includes -o ${file}.pdf ${filename} /dev/null && dvips -o ${file}.ps ${file}.dvi
+"${TEXI2PDF}" $includes -o ${file}.pdf ${filename} 
... since the other tools are siblings.

Thanks for the smoke test!
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


[PATCH] update_web_docs_git: Add updated Texinfo to PATH

2023-04-06 Thread Arsen Arsenović via Gcc-patches
maintainer-scripts/ChangeLog:

* update_web_docs_git: Add updated Texinfo to PATH
---
Hi,

I'm posting this as a ping and a patch necessary to get the wwwdocs
building with the new Texinfo version that's installed on gcc.gnu.org.
It would be nice to do this ahead of the GCC 13 release.

I must ask that whoever decides to apply/update the script tests
texi2any with a simple example, like

  echo @node Top | ~/texinfo/install-git/bin/makeinfo --html -o -

... before updating; this should be a representative enough smoke test.
You should see some HTML output with little text in it.

It might also be wise to test the script directly by using a different
WWWBASE, just in case, even though it should be safe.

Thanks in advance, have a lovely day.

 maintainer-scripts/update_web_docs_git | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/maintainer-scripts/update_web_docs_git 
b/maintainer-scripts/update_web_docs_git
index d44ab27c1b7..f9006b1f45b 100755
--- a/maintainer-scripts/update_web_docs_git
+++ b/maintainer-scripts/update_web_docs_git
@@ -12,7 +12,7 @@ set -e
 GITROOT=${GITROOT:-"/git/gcc.git"}
 export GITROOT
 
-PATH=/usr/local/bin:$PATH
+PATH=/home/gccadmin/texinfo/install-git/bin:/usr/local/bin:$PATH
 
 MANUALS="cpp
   cppinternals
-- 
2.40.0



Re: [PATCH 2/4] libstdc++: Add a test for FTM redefinitions

2023-04-05 Thread Arsen Arsenović via Gcc-patches

Arsen Arsenović via Libstdc++  writes:

> Good idea.  Both the positive and negative cases work when implemented
> like this:
>
> From 98d302bab9a87d3f2daecf9d54d62f33ba216673 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Arsen=20Arsenovi=C4=87?= 
> Date: Wed, 8 Mar 2023 17:01:24 +0100
> Subject: [PATCH 2/4] libstdc++: Add a test for  FTM redefinitions
>
> This test detects redefinitions by compiling stdc++.h with
> -Wsystem-headers.  Thanks Patrick Palka for the suggestion.
>
> libstdc++-v3/ChangeLog:
>
>   * testsuite/17_intro/versionconflict.cc: New test.

I've forgotten to reword this after changing the logic.  New message:

commit dcd7bed33cc274e8f3565ad02fb1fbc04bc845fb
Author: Arsen Arsenović 
Date:   Wed Mar 8 17:01:24 2023 +0100

libstdc++: Add a test for  FTM redefinitions

This test detects redefinitions by compiling stdc++.h and ,
by disabling the system_header pragma on the latter, to allow
warnings in it.  Thanks Patrick Palka for the suggestion.

libstdc++-v3/ChangeLog:

* testsuite/17_intro/versionconflict.cc: New test.


-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH 1/4] libstdc++: Harmonize and other headers

2023-04-05 Thread Arsen Arsenović via Gcc-patches

Jonathan Wakely  writes:

>> [snip...]
>>+/* Duplicate definition with unique_ptr.h.  */
>>+#if __cplusplus > 202002L && defined(__cpp_constexpr_dynamic_alloc)
>>+# define __cpp_lib_constexpr_memory 202202L
>>+#elif __cplusplus > 201703L
>>+# include 
>
> Including  is unrelated to the FTM, and should always be
> done for >= C++17, but this change means it's not included for the
> first block.
>
> Please leave the #include with the _Safe_iterator_base declaration.

Fixed:

diff --git a/libstdc++-v3/include/bits/ptr_traits.h 
b/libstdc++-v3/include/bits/ptr_traits.h
index dc42a743c96..8a919ec1090 100644
--- a/libstdc++-v3/include/bits/ptr_traits.h
+++ b/libstdc++-v3/include/bits/ptr_traits.h
@@ -34,12 +34,15 @@
 
 #include 
 
+/* Duplicate definition with unique_ptr.h.  */
+#if __cplusplus > 202002L && defined(__cpp_constexpr_dynamic_alloc)
+# define __cpp_lib_constexpr_memory 202202L
+#elif __cplusplus > 201703L
+# define __cpp_lib_constexpr_memory 201811L
+#endif
+
 #if __cplusplus > 201703L
 #include 
-# ifndef __cpp_lib_constexpr_memory
-// Defined to a newer value in bits/unique_ptr.h for C++23
-#  define __cpp_lib_constexpr_memory 201811L
-# endif
 namespace __gnu_debug { struct _Safe_iterator_base; }
 #endif

>> [snip...]
>
> Pleae keep them in alphabetical order (within their relevant
> blocks/groups).

I didn't even notice the ordering - apologies.

Updated patch:

From 54cdd9aebfe485dc669f5893fe14d4cf7822ed9e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Arsen=20Arsenovi=C4=87?= 
Date: Wed, 8 Mar 2023 12:04:11 +0100
Subject: [PATCH 1/4] libstdc++: Harmonize  and other headers

Due to recent, large changes in libstdc++, the feature test macros
declared in  got out of sync with the other headers that
possibly declare them.

libstdc++-v3/ChangeLog:

* include/bits/unique_ptr.h (__cpp_lib_constexpr_memory):
Synchronize the definition block with...
* include/bits/ptr_traits.h (__cpp_lib_constexpr_memory):
... this one here.  Also define the 202202L value, rather than
leaving it up to purely unique_ptr.h, so that the value is
synchronized across all headers.
(__gnu_debug::_Safe_iterator_base): Move into new conditional
block.
* include/std/memory (__cpp_lib_atomic_value_initialization):
Define on freestanding under the same conditions as in
atomic_base.h.
* include/std/version (__cpp_lib_robust_nonmodifying_seq_ops):
Also define on freestanding.
(__cpp_lib_to_chars): Ditto.
(__cpp_lib_gcd): Ditto.
(__cpp_lib_gcd_lcm): Ditto.
(__cpp_lib_raw_memory_algorithms): Ditto.
(__cpp_lib_array_constexpr): Ditto.
(__cpp_lib_nonmember_container_access): Ditto.
(__cpp_lib_clamp): Ditto.
(__cpp_lib_constexpr_char_traits): Ditto.
(__cpp_lib_constexpr_string): Ditto.
(__cpp_lib_sample): Ditto.
(__cpp_lib_lcm): Ditto.
(__cpp_lib_constexpr_iterator): Ditto.
(__cpp_lib_constexpr_char_traits): Ditto.
(__cpp_lib_interpolate): Ditto.
(__cpp_lib_constexpr_utility): Ditto.
(__cpp_lib_shift): Ditto.
(__cpp_lib_ranges): Ditto.
(__cpp_lib_move_iterator_concept): Ditto.
(__cpp_lib_constexpr_numeric): Ditto.
(__cpp_lib_constexpr_functional): Ditto.
(__cpp_lib_constexpr_algorithms): Ditto.
(__cpp_lib_constexpr_tuple): Ditto.
(__cpp_lib_constexpr_memory): Ditto.
---
 libstdc++-v3/include/bits/ptr_traits.h | 11 ++--
 libstdc++-v3/include/bits/unique_ptr.h | 11 ++--
 libstdc++-v3/include/std/memory|  6 ++
 libstdc++-v3/include/std/version   | 87 ++
 4 files changed, 66 insertions(+), 49 deletions(-)

diff --git a/libstdc++-v3/include/bits/ptr_traits.h 
b/libstdc++-v3/include/bits/ptr_traits.h
index dc42a743c96..8a919ec1090 100644
--- a/libstdc++-v3/include/bits/ptr_traits.h
+++ b/libstdc++-v3/include/bits/ptr_traits.h
@@ -34,12 +34,15 @@
 
 #include 
 
+/* Duplicate definition with unique_ptr.h.  */
+#if __cplusplus > 202002L && defined(__cpp_constexpr_dynamic_alloc)
+# define __cpp_lib_constexpr_memory 202202L
+#elif __cplusplus > 201703L
+# define __cpp_lib_constexpr_memory 201811L
+#endif
+
 #if __cplusplus > 201703L
 #include 
-# ifndef __cpp_lib_constexpr_memory
-// Defined to a newer value in bits/unique_ptr.h for C++23
-#  define __cpp_lib_constexpr_memory 201811L
-# endif
 namespace __gnu_debug { struct _Safe_iterator_base; }
 #endif
 
diff --git a/libstdc++-v3/include/bits/unique_ptr.h 
b/libstdc++-v3/include/bits/unique_ptr.h
index c8daff41865..f0c6d2383b4 100644
--- a/libstdc++-v3/include/bits/unique_ptr.h
+++ b/libstdc++-v3/include/bits/unique_ptr.h
@@ -43,12 +43,11 @@
 # endif
 #endif
 
-#if __cplusplus > 202002L && __cpp_constexpr_dynamic_alloc
-# if __cpp_lib_constexpr_memory < 202202L
-// Defined with older value in bits/ptr_traits.h for C++20
-#  undef __cpp_lib_constexpr_memory
-#  define 

Re: [PATCH 2/4] libstdc++: Add a test for FTM redefinitions

2023-04-05 Thread Arsen Arsenović via Gcc-patches

Jonathan Wakely  writes:

> On 05/04/23 01:09 +0200, Arsen Arsenović wrote:
>>This test detects redefinitions by compiling stdc++.h with
>>-Wsystem-headers.  Thanks Patrick Palka for the suggestion.
>>
>>libstdc++-v3/ChangeLog:
>>
>>  * testsuite/17_intro/versionconflict.cc: New test.
>>---
>> libstdc++-v3/testsuite/17_intro/versionconflict.cc | 6 ++
>> 1 file changed, 6 insertions(+)
>> create mode 100644 libstdc++-v3/testsuite/17_intro/versionconflict.cc
>>
>>diff --git a/libstdc++-v3/testsuite/17_intro/versionconflict.cc 
>>b/libstdc++-v3/testsuite/17_intro/versionconflict.cc
>>new file mode 100644
>>index 000..4191c7a2b08
>>--- /dev/null
>>+++ b/libstdc++-v3/testsuite/17_intro/versionconflict.cc
>>@@ -0,0 +1,6 @@
>>+// { dg-do preprocess }
>>+// { dg-additional-options "-Wsystem-headers -Werror" }
>>+
>>+// Test for redefinitions of FTMs using bits/stdc++.h.
>>+#include 
>>+#include 
>
> I'm concerned that this will fail if libc headers have macro
> redefinition errors, or anything else that would usually be ignored.
>
> We could make it more robust by changing  like so:
>
> --- a/libstdc++-v3/include/std/version
> +++ b/libstdc++-v3/include/std/version
> @@ -30,7 +30,9 @@
>  #ifndef _GLIBCXX_VERSION_INCLUDED
>  #define _GLIBCXX_VERSION_INCLUDED
>  +#ifndef _GLIBCXX_TESTING_SYSHDR
>  #pragma GCC system_header
> +#endif
>#include 
>  Then the test could define that macro instead of using -Wsystem-headers.
>
> Could you see if that works?

Good idea.  Both the positive and negative cases work when implemented
like this:

From 98d302bab9a87d3f2daecf9d54d62f33ba216673 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Arsen=20Arsenovi=C4=87?= 
Date: Wed, 8 Mar 2023 17:01:24 +0100
Subject: [PATCH 2/4] libstdc++: Add a test for  FTM redefinitions

This test detects redefinitions by compiling stdc++.h with
-Wsystem-headers.  Thanks Patrick Palka for the suggestion.

libstdc++-v3/ChangeLog:

* testsuite/17_intro/versionconflict.cc: New test.
---
 libstdc++-v3/include/std/version   | 5 -
 libstdc++-v3/testsuite/17_intro/versionconflict.cc | 7 +++
 2 files changed, 11 insertions(+), 1 deletion(-)
 create mode 100644 libstdc++-v3/testsuite/17_intro/versionconflict.cc

diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/version
index cdd24248c57..1069bc6c9f6 100644
--- a/libstdc++-v3/include/std/version
+++ b/libstdc++-v3/include/std/version
@@ -30,7 +30,10 @@
 #ifndef _GLIBCXX_VERSION_INCLUDED
 #define _GLIBCXX_VERSION_INCLUDED
 
-#pragma GCC system_header
+// To facilitate testsuite/17_intro/versionconflict.cc
+#ifndef _GLIBCXX_TESTING_SYSHDR
+# pragma GCC system_header
+#endif
 
 #include 
 
diff --git a/libstdc++-v3/testsuite/17_intro/versionconflict.cc 
b/libstdc++-v3/testsuite/17_intro/versionconflict.cc
new file mode 100644
index 000..6c212980ab0
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/versionconflict.cc
@@ -0,0 +1,7 @@
+// { dg-do preprocess }
+// { dg-additional-options "-Werror" }
+
+// Test for redefinitions of FTMs using bits/stdc++.h.
+#define _GLIBCXX_TESTING_SYSHDR
+#include 
+#include 
-- 
2.40.0

-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH 4/4] libstdc++: Fix some freestanding test failures

2023-04-05 Thread Arsen Arsenović via Gcc-patches

Jonathan Wakely  writes:

> On Wed, 5 Apr 2023 at 00:13, Arsen Arsenović via Libstdc++
>  wrote:
>>
>> At some point,  was added to the non-hosted bit of the C++17
>> block, which induced failures in many tests.
>>
>> In addition, some tests also lacked a dg-require-effective-target hosted
>> tag.
>>
>> libstdc++-v3/ChangeLog:
>>
>> * include/precompiled/stdc++.h (C++17): Don't double-include
>> , once with wrong conditions.
>> * testsuite/18_support/96817.cc: Require hosted.
>> * testsuite/18_support/bad_exception/59392.cc: Ditto.
>> * testsuite/20_util/scoped_allocator/108952.cc: Ditto.
>> * testsuite/20_util/uses_allocator/lwg3527.cc: Ditto.
>
> Maybe this could be adjusted to not use std::allocator.
>
>> * testsuite/29_atomics/atomic/operators/pointer_partial_void.cc:
>
> This fails because std::abs s not freestanding (which is surprising,
> at least for the integral overloads).
> We could adjust the test to define its own abs but maybe it's not worth it.

I can take a look in stage 1.

> OK for trunk.
>
>> Ditto.
>> ---
>>  libstdc++-v3/include/precompiled/stdc++.h| 1 -
>>  libstdc++-v3/testsuite/18_support/96817.cc   | 1 +
>>  libstdc++-v3/testsuite/18_support/bad_exception/59392.cc | 1 +
>>  libstdc++-v3/testsuite/20_util/scoped_allocator/108952.cc| 1 +
>>  libstdc++-v3/testsuite/20_util/uses_allocator/lwg3527.cc | 1 +
>>  .../29_atomics/atomic/operators/pointer_partial_void.cc  | 1 +
>>  6 files changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/libstdc++-v3/include/precompiled/stdc++.h 
>> b/libstdc++-v3/include/precompiled/stdc++.h
>> index bc011986b53..176ad79ff3c 100644
>> --- a/libstdc++-v3/include/precompiled/stdc++.h
>> +++ b/libstdc++-v3/include/precompiled/stdc++.h
>> @@ -75,7 +75,6 @@
>>
>>  #if __cplusplus >= 201703L
>>  #include 
>> -#include 
>>  // #include 
>>  #include 
>>  #include 
>> diff --git a/libstdc++-v3/testsuite/18_support/96817.cc 
>> b/libstdc++-v3/testsuite/18_support/96817.cc
>> index 70938812bd8..073fc337e8f 100644
>> --- a/libstdc++-v3/testsuite/18_support/96817.cc
>> +++ b/libstdc++-v3/testsuite/18_support/96817.cc
>> @@ -17,6 +17,7 @@
>>
>>  // { dg-do run }
>>  // { dg-additional-options "-pthread" { target pthread } }
>> +// { dg-require-effective-target hosted }
>>
>>  // Static init cannot detect recursion for gthreads targets without futexes
>>  // (and the futex case can only detect it if __libc_single_threaded==true).
>> diff --git a/libstdc++-v3/testsuite/18_support/bad_exception/59392.cc 
>> b/libstdc++-v3/testsuite/18_support/bad_exception/59392.cc
>> index ac64e6eddb2..ae972d0535d 100644
>> --- a/libstdc++-v3/testsuite/18_support/bad_exception/59392.cc
>> +++ b/libstdc++-v3/testsuite/18_support/bad_exception/59392.cc
>> @@ -17,6 +17,7 @@
>>
>>  // { dg-options "-Wno-deprecated" }
>>  // { dg-do run { target c++14_down } }
>> +// { dg-require-effective-target hosted }
>>
>>  #include 
>>  #include 
>> diff --git a/libstdc++-v3/testsuite/20_util/scoped_allocator/108952.cc 
>> b/libstdc++-v3/testsuite/20_util/scoped_allocator/108952.cc
>> index a6b9c67498c..9342f453bf4 100644
>> --- a/libstdc++-v3/testsuite/20_util/scoped_allocator/108952.cc
>> +++ b/libstdc++-v3/testsuite/20_util/scoped_allocator/108952.cc
>> @@ -1,4 +1,5 @@
>>  // { dg-do compile { target c++11 } }
>> +// { dg-require-effective-target hosted }
>>
>>  #include 
>>
>> diff --git a/libstdc++-v3/testsuite/20_util/uses_allocator/lwg3527.cc 
>> b/libstdc++-v3/testsuite/20_util/uses_allocator/lwg3527.cc
>> index ae377f4b5a3..c5a7d513b31 100644
>> --- a/libstdc++-v3/testsuite/20_util/uses_allocator/lwg3527.cc
>> +++ b/libstdc++-v3/testsuite/20_util/uses_allocator/lwg3527.cc
>> @@ -1,5 +1,6 @@
>>  // { dg-options "-std=gnu++20" }
>>  // { dg-do compile { target c++20 } }
>> +// { dg-require-effective-target hosted }
>>
>>  #include 
>>
>> diff --git 
>> a/libstdc++-v3/testsuite/29_atomics/atomic/operators/pointer_partial_void.cc 
>> b/libstdc++-v3/testsuite/29_atomics/atomic/operators/pointer_partial_void.cc
>> index ddb63233a64..e5d221ed15a 100644
>> --- 
>> a/libstdc++-v3/testsuite/29_atomics/atomic/operators/pointer_partial_void.cc
>> +++ 
>> b/libstdc++-v3/testsuite/29_atomics/atomic/operators/pointer_partial_void.cc
>> @@ -1,5 +1,6 @@
>>  // { dg-do run { target { c++11_only || c++14_only } } }
>>  // { dg-require-atomic-builtins "" }
>> +// { dg-require-effective-target hosted }
>>
>>  // Copyright (C) 2012-2023 Free Software Foundation, Inc.
>>  //
>> --
>> 2.40.0
>>


-- 
Arsen Arsenović


signature.asc
Description: PGP signature


[PATCH 1/4] libstdc++: Harmonize and other headers

2023-04-04 Thread Arsen Arsenović via Gcc-patches
Due to recent, large changes in libstdc++, the feature test macros
declared in  got out of sync with the other headers that
possibly declare them.

libstdc++-v3/ChangeLog:

* include/bits/unique_ptr.h (__cpp_lib_constexpr_memory):
Synchronize the definition block with...
* include/bits/ptr_traits.h (__cpp_lib_constexpr_memory):
... this one here.  Also define the 202202L value, rather than
leaving it up to purely unique_ptr.h, so that the value is
synchronized across all headers.
(__gnu_debug::_Safe_iterator_base): Move into new conditional
block.
* include/std/memory (__cpp_lib_atomic_value_initialization):
Define on freestanding under the same conditions as in
atomic_base.h.
* include/std/version (__cpp_lib_robust_nonmodifying_seq_ops):
Also define on freestanding.
(__cpp_lib_to_chars): Ditto.
(__cpp_lib_gcd): Ditto.
(__cpp_lib_gcd_lcm): Ditto.
(__cpp_lib_raw_memory_algorithms): Ditto.
(__cpp_lib_array_constexpr): Ditto.
(__cpp_lib_nonmember_container_access): Ditto.
(__cpp_lib_clamp): Ditto.
(__cpp_lib_constexpr_char_traits): Ditto.
(__cpp_lib_constexpr_string): Ditto.
(__cpp_lib_sample): Ditto.
(__cpp_lib_lcm): Ditto.
(__cpp_lib_constexpr_iterator): Ditto.
(__cpp_lib_constexpr_char_traits): Ditto.
(__cpp_lib_interpolate): Ditto.
(__cpp_lib_constexpr_utility): Ditto.
(__cpp_lib_shift): Ditto.
(__cpp_lib_ranges): Ditto.
(__cpp_lib_move_iterator_concept): Ditto.
(__cpp_lib_constexpr_numeric): Ditto.
(__cpp_lib_constexpr_functional): Ditto.
(__cpp_lib_constexpr_algorithms): Ditto.
(__cpp_lib_constexpr_tuple): Ditto.
(__cpp_lib_constexpr_memory): Ditto.
---
Evening,

This patchset is a replacement to and extension of the one presented at
https://inbox.sourceware.org/libstdc++/20230309222626.4008373-1-ar...@aarsen.me/
... that has been rebased as to include newer additions, and extended to
cover some regressions that seem to have occurred recently in
freestanding mode.

Tested on x86_64-pc-linux-gnu.

OK for trunk?

Thanks in advance, have a lovely night.

 libstdc++-v3/include/bits/ptr_traits.h | 13 ++--
 libstdc++-v3/include/bits/unique_ptr.h | 11 ++--
 libstdc++-v3/include/std/memory|  6 ++
 libstdc++-v3/include/std/version   | 85 ++
 4 files changed, 66 insertions(+), 49 deletions(-)

diff --git a/libstdc++-v3/include/bits/ptr_traits.h 
b/libstdc++-v3/include/bits/ptr_traits.h
index dc42a743c96..f6cc6b65f93 100644
--- a/libstdc++-v3/include/bits/ptr_traits.h
+++ b/libstdc++-v3/include/bits/ptr_traits.h
@@ -34,12 +34,15 @@
 
 #include 
 
+/* Duplicate definition with unique_ptr.h.  */
+#if __cplusplus > 202002L && defined(__cpp_constexpr_dynamic_alloc)
+# define __cpp_lib_constexpr_memory 202202L
+#elif __cplusplus > 201703L
+# include 
+# define __cpp_lib_constexpr_memory 201811L
+#endif
+
 #if __cplusplus > 201703L
-#include 
-# ifndef __cpp_lib_constexpr_memory
-// Defined to a newer value in bits/unique_ptr.h for C++23
-#  define __cpp_lib_constexpr_memory 201811L
-# endif
 namespace __gnu_debug { struct _Safe_iterator_base; }
 #endif
 
diff --git a/libstdc++-v3/include/bits/unique_ptr.h 
b/libstdc++-v3/include/bits/unique_ptr.h
index c8daff41865..f0c6d2383b4 100644
--- a/libstdc++-v3/include/bits/unique_ptr.h
+++ b/libstdc++-v3/include/bits/unique_ptr.h
@@ -43,12 +43,11 @@
 # endif
 #endif
 
-#if __cplusplus > 202002L && __cpp_constexpr_dynamic_alloc
-# if __cpp_lib_constexpr_memory < 202202L
-// Defined with older value in bits/ptr_traits.h for C++20
-#  undef __cpp_lib_constexpr_memory
-#  define __cpp_lib_constexpr_memory 202202L
-# endif
+/* Duplicate definition with ptr_traits.h.  */
+#if __cplusplus > 202002L && defined(__cpp_constexpr_dynamic_alloc)
+# define __cpp_lib_constexpr_memory 202202L
+#elif __cplusplus > 201703L
+# define __cpp_lib_constexpr_memory 201811L
 #endif
 
 namespace std _GLIBCXX_VISIBILITY(default)
diff --git a/libstdc++-v3/include/std/memory b/libstdc++-v3/include/std/memory
index 341f9857730..85c36d67ee1 100644
--- a/libstdc++-v3/include/std/memory
+++ b/libstdc++-v3/include/std/memory
@@ -91,6 +91,12 @@
 #  include 
 #endif
 
+/* As a hack, we declare __cpp_lib_atomic_value_initialization here even though
+   we don't include the bit that actually declares it, for consistency.  */
+#if !defined(__cpp_lib_atomic_value_initialization) && __cplusplus >= 202002L
+# define __cpp_lib_atomic_value_initialization 201911L
+#endif
+
 #if __cplusplus >= 201103L && __cplusplus <= 202002L && _GLIBCXX_HOSTED
 namespace std _GLIBCXX_VISIBILITY(default)
 {
diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/version
index a19c39c6cdd..0239fcea813 100644
--- a/libstdc++-v3/include/std/version
+++ b/libstdc++-v3/include/std/version
@@ -85,6 +85,12 

[PATCH 3/4] libstdc++: Downgrade DEBUG to ASSERTIONS when !HOSTED

2023-04-04 Thread Arsen Arsenović via Gcc-patches
Supporting the debug mode in freestanding is a non-trivial job, so
instead, as a best-effort, enable assertions, which are light and easy.

libstdc++-v3/ChangeLog:

* include/bits/c++config: When __STDC_HOSTED__ is zero,
disable _GLIBCXX_DEBUG and, if it was set, enable
_GLIBCXX_ASSERTIONS.
* testsuite/lib/libstdc++.exp (check_v3_target_debug_mode):
Include  when determining whether debug is
set, in order to inherit the logic from above
---
 libstdc++-v3/include/bits/c++config  | 7 +++
 libstdc++-v3/testsuite/lib/libstdc++.exp | 1 +
 2 files changed, 8 insertions(+)

diff --git a/libstdc++-v3/include/bits/c++config 
b/libstdc++-v3/include/bits/c++config
index 71f2401402f..13892787e09 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -397,6 +397,13 @@ _GLIBCXX_END_NAMESPACE_VERSION
 # define _GLIBCXX_END_INLINE_ABI_NAMESPACE(X)   } // inline namespace X
 #endif
 
+// In the case that we don't have a hosted environment, we can't provide the
+// debugging mode.  Instead, we do our best and downgrade to assertions.
+#if defined(_GLIBCXX_DEBUG) && !__STDC_HOSTED__
+#undef _GLIBCXX_DEBUG
+#define _GLIBCXX_ASSERTIONS 1
+#endif
+
 // Inline namespaces for special modes: debug, parallel.
 #if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL)
 namespace std
diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp 
b/libstdc++-v3/testsuite/lib/libstdc++.exp
index 98512c973fb..490abd108fa 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -1007,6 +1007,7 @@ proc check_v3_target_debug_mode { } {
 global cxxflags
 return [check_v3_target_prop_cached et_debug_mode {
set code "
+   #include 
#if ! defined _GLIBCXX_DEBUG
# error no debug mode
#endif
-- 
2.40.0



[PATCH 4/4] libstdc++: Fix some freestanding test failures

2023-04-04 Thread Arsen Arsenović via Gcc-patches
At some point,  was added to the non-hosted bit of the C++17
block, which induced failures in many tests.

In addition, some tests also lacked a dg-require-effective-target hosted
tag.

libstdc++-v3/ChangeLog:

* include/precompiled/stdc++.h (C++17): Don't double-include
, once with wrong conditions.
* testsuite/18_support/96817.cc: Require hosted.
* testsuite/18_support/bad_exception/59392.cc: Ditto.
* testsuite/20_util/scoped_allocator/108952.cc: Ditto.
* testsuite/20_util/uses_allocator/lwg3527.cc: Ditto.
* testsuite/29_atomics/atomic/operators/pointer_partial_void.cc:
Ditto.
---
 libstdc++-v3/include/precompiled/stdc++.h| 1 -
 libstdc++-v3/testsuite/18_support/96817.cc   | 1 +
 libstdc++-v3/testsuite/18_support/bad_exception/59392.cc | 1 +
 libstdc++-v3/testsuite/20_util/scoped_allocator/108952.cc| 1 +
 libstdc++-v3/testsuite/20_util/uses_allocator/lwg3527.cc | 1 +
 .../29_atomics/atomic/operators/pointer_partial_void.cc  | 1 +
 6 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/precompiled/stdc++.h 
b/libstdc++-v3/include/precompiled/stdc++.h
index bc011986b53..176ad79ff3c 100644
--- a/libstdc++-v3/include/precompiled/stdc++.h
+++ b/libstdc++-v3/include/precompiled/stdc++.h
@@ -75,7 +75,6 @@
 
 #if __cplusplus >= 201703L
 #include 
-#include 
 // #include 
 #include 
 #include 
diff --git a/libstdc++-v3/testsuite/18_support/96817.cc 
b/libstdc++-v3/testsuite/18_support/96817.cc
index 70938812bd8..073fc337e8f 100644
--- a/libstdc++-v3/testsuite/18_support/96817.cc
+++ b/libstdc++-v3/testsuite/18_support/96817.cc
@@ -17,6 +17,7 @@
 
 // { dg-do run }
 // { dg-additional-options "-pthread" { target pthread } }
+// { dg-require-effective-target hosted }
 
 // Static init cannot detect recursion for gthreads targets without futexes
 // (and the futex case can only detect it if __libc_single_threaded==true).
diff --git a/libstdc++-v3/testsuite/18_support/bad_exception/59392.cc 
b/libstdc++-v3/testsuite/18_support/bad_exception/59392.cc
index ac64e6eddb2..ae972d0535d 100644
--- a/libstdc++-v3/testsuite/18_support/bad_exception/59392.cc
+++ b/libstdc++-v3/testsuite/18_support/bad_exception/59392.cc
@@ -17,6 +17,7 @@
 
 // { dg-options "-Wno-deprecated" }
 // { dg-do run { target c++14_down } }
+// { dg-require-effective-target hosted }
 
 #include 
 #include 
diff --git a/libstdc++-v3/testsuite/20_util/scoped_allocator/108952.cc 
b/libstdc++-v3/testsuite/20_util/scoped_allocator/108952.cc
index a6b9c67498c..9342f453bf4 100644
--- a/libstdc++-v3/testsuite/20_util/scoped_allocator/108952.cc
+++ b/libstdc++-v3/testsuite/20_util/scoped_allocator/108952.cc
@@ -1,4 +1,5 @@
 // { dg-do compile { target c++11 } }
+// { dg-require-effective-target hosted }
 
 #include 
 
diff --git a/libstdc++-v3/testsuite/20_util/uses_allocator/lwg3527.cc 
b/libstdc++-v3/testsuite/20_util/uses_allocator/lwg3527.cc
index ae377f4b5a3..c5a7d513b31 100644
--- a/libstdc++-v3/testsuite/20_util/uses_allocator/lwg3527.cc
+++ b/libstdc++-v3/testsuite/20_util/uses_allocator/lwg3527.cc
@@ -1,5 +1,6 @@
 // { dg-options "-std=gnu++20" }
 // { dg-do compile { target c++20 } }
+// { dg-require-effective-target hosted }
 
 #include 
 
diff --git 
a/libstdc++-v3/testsuite/29_atomics/atomic/operators/pointer_partial_void.cc 
b/libstdc++-v3/testsuite/29_atomics/atomic/operators/pointer_partial_void.cc
index ddb63233a64..e5d221ed15a 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic/operators/pointer_partial_void.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/operators/pointer_partial_void.cc
@@ -1,5 +1,6 @@
 // { dg-do run { target { c++11_only || c++14_only } } }
 // { dg-require-atomic-builtins "" }
+// { dg-require-effective-target hosted }
 
 // Copyright (C) 2012-2023 Free Software Foundation, Inc.
 //
-- 
2.40.0



[PATCH 2/4] libstdc++: Add a test for FTM redefinitions

2023-04-04 Thread Arsen Arsenović via Gcc-patches
This test detects redefinitions by compiling stdc++.h with
-Wsystem-headers.  Thanks Patrick Palka for the suggestion.

libstdc++-v3/ChangeLog:

* testsuite/17_intro/versionconflict.cc: New test.
---
 libstdc++-v3/testsuite/17_intro/versionconflict.cc | 6 ++
 1 file changed, 6 insertions(+)
 create mode 100644 libstdc++-v3/testsuite/17_intro/versionconflict.cc

diff --git a/libstdc++-v3/testsuite/17_intro/versionconflict.cc 
b/libstdc++-v3/testsuite/17_intro/versionconflict.cc
new file mode 100644
index 000..4191c7a2b08
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/versionconflict.cc
@@ -0,0 +1,6 @@
+// { dg-do preprocess }
+// { dg-additional-options "-Wsystem-headers -Werror" }
+
+// Test for redefinitions of FTMs using bits/stdc++.h.
+#include 
+#include 
-- 
2.40.0



Re: [PATCH] Introduce -nolibstdc++ option

2023-03-30 Thread Arsen Arsenović via Gcc-patches
Hi Alexandre,

Alexandre Oliva via Gcc-patches  writes:

> Hello, Gerald,
>
> On Feb 11, 2023, Gerald Pfeifer  wrote:
>
>> On Thu, 23 Jun 2022, Alexandre Oliva via Gcc-patches wrote:
>>> Introduce -nostdlib++ option
>>> 
>>> Using g++ to link without libstdc++, as in g++.dg/abi/pure-virtual1.C,
>>> is error prone, because there's no way to tell g++ to drop libstdc++
>>> without also dropping libc and any other libraries that the target
>>> implicitly links in.
>
>> % grep -r nostdlib $WWWDOCS
>> %
>
>> Should this be documented in gcc-13/changes.html? Would you mind proposing 
>> a snippet (or going ahead and pushing it)?
>
> I can't make my mind up about this.
>
> At first, the goal of adding the option was just to aid this specific
> test.  But then, it transpired that other compilers offered a similar
> option, with the spelling that we ended up using, so perhaps it would
> make sense to document it, after all.

IMO, yes - in fact, the libstdc++ manual even has a use-case for this
(freestanding when the compiler is *not* built with libstdc++ in
freestanding mode) and documents using the gcc driver rather than the
g++ one.  See libstdc++-v3/doc/xml/manual/using.xml:

  If you're using a libstdc++ configured for hosted environments, and
  would like to not involve the libraries libstdc++ would depend on in
  your programs, you will need to use gcc to link your
  application with only libsupc++.a,
  like so:

If you think the flag you added fits here, would you mind also including
this file in your patch?

Note that this flag is only applicable here if MATH_LIBRARY is omitted
but libsupc++.a is kept on the linker command line (apologies for
not checking ahead of writing this email - I'm not currently in a
convenient spot to do so).

Thanks in advance, have a lovely day.

> How about this, does this seem useful?
>
> diff --git a/htdocs/gcc-13/changes.html b/htdocs/gcc-13/changes.html
> index ff70d2eefecec..c1bbbfa28e18e 100644
> --- a/htdocs/gcc-13/changes.html
> +++ b/htdocs/gcc-13/changes.html
> @@ -333,6 +333,9 @@ a work-in-progress.
>The  href="https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html#index-Wpessimizing-move;>-Wpessimizing-move
>  and  href="https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html#index-Wredundant-move;>-Wredundant-move
>  warnings have been extended to warn in more contexts.
> +  The  href="https://gcc.gnu.org/onlinedocs/gcc/Link_Options.html#index-nostdlib_002b_002b;>-nostdlib++
> +option has been added, to enable linking with g++
> +without implicitly linking in the C++ standard library.
>  
>  
>  Runtime Library (libstdc++)


-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: Ping (gcc/configure.ac, docs): [PATCH v2 4/5] Update texinfo.tex, remove the @gol macro/alias

2023-03-21 Thread Arsen Arsenović via Gcc-patches

Arsen Arsenović via Gcc-patches  writes:

> Thank you!  I'll do a final rebase and push in the morning.

Done!

Gerald, please update the scripts when you get a chance (but back the
old ones up just in case!)

If makeinfo is updated as I've asked in one of the other emails, will
the script eventually automatically regenerate docs with the newer
makeinfo?

Thanks, have a lovely day.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: Ping (gcc/configure.ac, docs): [PATCH v2 4/5] Update texinfo.tex, remove the @gol macro/alias

2023-03-20 Thread Arsen Arsenović via Gcc-patches

Sandra Loosemore  writes:

> On 3/18/23 14:14, Arsen Arsenović via Gcc-patches wrote:
>> Evening,
>> Ping on this patch series.
>> I believe we're close to being able to apply it, with contents of the
>> documentation changes being approved, and only a small build system
>> change and a revised patch series "shape" left to review.
>
> Yup.  I think you can go ahead and commit everything but the part with the
> configure/makefile hackery, which still needs somebody other than me to 
> approve
> it.
>
>> The former change of these two is in:
>> https://inbox.sourceware.org/gcc-patches/20230311203234.2257423-1-ar...@aarsen.me/
>> The patch adds a test for the presence of CONTENTS_OUTPUT_LOCATION into
>> the build system in order to avoid shortcontents coming after contents
>> in HTML output.  We've also updated Texinfo to output shortcontents
>> before contents by default as a result of the discussion here, though
>> that will only happen in newer versions.
>> The latter "shape" is a git log documented at:
>> https://inbox.sourceware.org/gcc-patches/87ttysppsc@aarsen.me/
>> As always, I've freshly rebased the patch series at
>>https://git.sr.ht/~arsen/gcc texinfo_improvements
>> ... or, in (git)web form, at:
>>https://git.sr.ht/~arsen/gcc/log/texinfo_improvements
>> ... with the render at:
>>https://www.aarsen.me/~arsen/final/
>> Thank you all in advance, have a lovely day.
>
> Joseph, could you maybe review the last piece?  A direct pointer to it in
> Arsen's git is
>
> https://git.sr.ht/~arsen/gcc/commit/bc734311cbca1085a1728f79b7eebef8cc7aeac3
>
> -Sandra

Thank you!  I'll do a final rebase and push in the morning.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: Ping (gcc/configure.ac, docs): [PATCH v2 4/5] Update texinfo.tex, remove the @gol macro/alias

2023-03-20 Thread Arsen Arsenović via Gcc-patches

Joseph Myers  writes:

> On Mon, 20 Mar 2023, Sandra Loosemore wrote:
>
>> Joseph, could you maybe review the last piece?  A direct pointer to it in
>> Arsen's git is
>> 
>> https://git.sr.ht/~arsen/gcc/commit/bc734311cbca1085a1728f79b7eebef8cc7aeac3
>
> That's OK, assuming I understand correctly that makeinfo will still 
> succeed with a warning when it's an older version (gcc.gnu.org, where 
> update_web_docs_git runs, has version 6.5).

It should, yes, but I'd like to ask for that server to be updated to
Texinfo straight from the press (the press is currently at commit
e2d30b1270deacf5a1eab1d383733a5a088827d6).  Mark told me that this needs
approval from the GCC admins to do.

The reason for this is that the in-dev versions of Texinfo produce more
accessible HTML documentation due to a few changes that I've
incorporated into them, as well as a few made by the Texinfo
maintainers.

Do you think that would be OK?

Thanks, have a lovely night.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Ping (gcc/configure.ac, docs): [PATCH v2 4/5] Update texinfo.tex, remove the @gol macro/alias

2023-03-18 Thread Arsen Arsenović via Gcc-patches
Evening,

Ping on this patch series.

I believe we're close to being able to apply it, with contents of the
documentation changes being approved, and only a small build system
change and a revised patch series "shape" left to review.

The former change of these two is in:
https://inbox.sourceware.org/gcc-patches/20230311203234.2257423-1-ar...@aarsen.me/
The patch adds a test for the presence of CONTENTS_OUTPUT_LOCATION into
the build system in order to avoid shortcontents coming after contents
in HTML output.  We've also updated Texinfo to output shortcontents
before contents by default as a result of the discussion here, though
that will only happen in newer versions.

The latter "shape" is a git log documented at:
https://inbox.sourceware.org/gcc-patches/87ttysppsc@aarsen.me/

As always, I've freshly rebased the patch series at

  https://git.sr.ht/~arsen/gcc texinfo_improvements

... or, in (git)web form, at:

  https://git.sr.ht/~arsen/gcc/log/texinfo_improvements

... with the render at:

  https://www.aarsen.me/~arsen/final/

Thank you all in advance, have a lovely day.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH v2 0/5] A small Texinfo refinement

2023-03-13 Thread Arsen Arsenović via Gcc-patches

Richard Biener  writes:

> On Fri, Mar 10, 2023 at 8:00 PM Gerald Pfeifer  wrote:
>>
>> On Fri, 10 Mar 2023, Sandra Loosemore wrote:
>> > AFAIK we have not knowingly changed any specific requirements beyond the
>> > stated 4.7 and 4.9 for PDF output, but it concerns me that nobody is
>> > likely to be using versions that old on a regular basis to make sure
>> > they continue to work and we haven't unknowingly introduced dependencies
>> > on newer Texinfo features.
>>
>> I'm generally very interested in ensuring we do not hurt users who do not
>> have the latest and greatest of the day. On the other hand, if there's a
>> few people using (more or less deliberately abandonware) we should not
>> feel too bad if something breaks.
>>
>> > Anyway, I think I will leave the existing requirement alone for now, and
>> > just add a note that newer versions produce better output.
>>
>> With Richi mentioning that SLE 12 (which was first released 9 years ago)
>> uses texinfo 4.13a and Andrew mentioning that RHEL 7 uses texinfo 5.1 I
>> would feel very comfortable making either 4.13 or even 5.1 the new minimum.
>>
>> (Not because we need to cater to those two Enterprise Linux distros,
>> rather since they tend to fall on the conversative side.)
>
> We could also opt to ship generated pdf documentation with the
> release tarballs - the pre-built info format plus manual pages is
> probably of less use these days?

They're still widely installed and I suspect many open the manpages as a
quick reference.  I guess that fewer open the info pages, but it's not
nobody (I certainly do, but I also have texinfo installed so I can
generate them anyway, as I do for the weekly snapshots that I have
installed).

> Richard.
>
>> Gerald


-- 
Arsen Arsenović


signature.asc
Description: PGP signature


[PATCH gcc-{11, 12}] c++: top level bind when rewriting coroutines [PR106188]

2023-03-13 Thread Arsen Arsenović via Gcc-patches
In the edge case of a coroutine not containing any locals, the ifcd/switch
temporaries would get added to the coroutine frame, corrupting its
layout. To prevent this, we can make sure there is always a BIND_EXPR at
the top of the function body, and thus, always a place for our new
temporaries to go without interfering with the coroutine frame.

PR c++/106188 - Incorrect frame layout after transforming conditional statement 
without top-level bind expression
PR c++/106713 - if (co_await ...) crashes with a jump to ud2

PR c++/106188
PR c++/106713

gcc/cp/ChangeLog:

* coroutines.cc (coro_rewrite_function_body): Ensure we have a
BIND_EXPR wrapping the function body.

gcc/testsuite/ChangeLog:

* g++.dg/coroutines/pr106188.C: New test.
---
Morning,

A while back, we merged this patch into GCC 13 to fix PR106188, but
never backported it into GCC 11 and 12, which both still suffer from
this bug.

I've tested the same patch against releases/gcc-{11,12} and they apply
and fix the testcase (and the testcase fails without them, as expected)
on x86_64-pc-linux-gnu.

OK for backporting?

Thanks in advance.

 gcc/cp/coroutines.cc   |  9 ++
 gcc/testsuite/g++.dg/coroutines/pr106188.C | 34 ++
 2 files changed, 43 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/coroutines/pr106188.C

diff --git a/gcc/cp/coroutines.cc b/gcc/cp/coroutines.cc
index e982cdb89a7..ea3850082cf 100644
--- a/gcc/cp/coroutines.cc
+++ b/gcc/cp/coroutines.cc
@@ -4067,6 +4067,15 @@ coro_rewrite_function_body (location_t fn_start, tree 
fnbody, tree orig,
   BLOCK_SUPERCONTEXT (replace_blk) = top_block;
   BLOCK_SUBBLOCKS (top_block) = replace_blk;
 }
+  else
+{
+  /* We are missing a top level BIND_EXPR. We need one to ensure that we
+don't shuffle around the coroutine frame and corrupt it.  */
+  tree bind_wrap = build3_loc (fn_start, BIND_EXPR, void_type_node,
+  NULL, NULL, NULL);
+  BIND_EXPR_BODY (bind_wrap) = fnbody;
+  fnbody = bind_wrap;
+}
 
   /* Wrap the function body in a try {} catch (...) {} block, if exceptions
  are enabled.  */
diff --git a/gcc/testsuite/g++.dg/coroutines/pr106188.C 
b/gcc/testsuite/g++.dg/coroutines/pr106188.C
new file mode 100644
index 000..9db3778d079
--- /dev/null
+++ b/gcc/testsuite/g++.dg/coroutines/pr106188.C
@@ -0,0 +1,34 @@
+// { dg-do run { target c++20 } }
+// test case from pr106188, w/o workaround
+#include 
+
+struct task {
+  struct promise_type {
+task get_return_object() { return task{}; }
+void return_void() {}
+void unhandled_exception() {}
+auto initial_suspend() noexcept { return std::suspend_never{}; }
+auto final_suspend() noexcept { return std::suspend_never{}; }
+  };
+};
+
+struct suspend_and_resume {
+  bool await_ready() const { return false; }
+  void await_suspend(std::coroutine_handle<> h) { h.resume(); }
+  void await_resume() {}
+};
+
+task f() {
+  if (co_await suspend_and_resume{}, false) {}
+}
+
+task g() {
+  switch (co_await suspend_and_resume{}, 0) {
+default: break;
+  }
+}
+
+int main() {
+  f();
+  g();
+}
-- 
2.39.2



Re: [PATCH v2 1/5] docs: Create Indices appendix

2023-03-12 Thread Arsen Arsenović via Gcc-patches

Gerald Pfeifer  writes:

> On Sat, 11 Mar 2023, Arsen Arsenović wrote:
>> Sandra Loosemore  writes:
>>> Hmmm, first off, I think somebody other than me needs to approve the 
>>> configure and makefile pieces, as well as the maintainer-scripts part. 
>>> It looks conceptually right to me
>
> Per gcc/MAINTAINERS that'd be
>
>   build machinery (*.in)  Paolo Bonzini   
>   build machinery (*.in)  Nathanael Nerode
>   build machinery (*.in)  Alexandre Oliva 
>   build machinery (*.in)  Ralf Wildenhues 
>
> though I don't recall seeing much (if anything) from others than Alexandre 
> for quite a while.
>
> So more likely one of the Global Reviewers in that same file.

Okay, thanks.  I'll let some time pass before pinging people for the
v2 I sent yesterday.

With that, we should be left with just a review of the updated Git log
before this series is ready for trunk, IIRC.

Have a great day!

> Gerald


-- 
Arsen Arsenović


signature.asc
Description: PGP signature


[PATCH v2] html: Set CONTENTS_OUTPUT_LOCATION=inline if makeinfo supports it

2023-03-11 Thread Arsen Arsenović via Gcc-patches
This flag allows us to restore old (pre-6.8) behavior of the
@{summary,}content commands, so that texi2any continues to emit
summarycontents first.

maintainer-scripts/ChangeLog:

* update_web_docs_git: Set CONTENTS_OUTPUT_LOCATION=inline in
order to put @shortcontents above contents.

gcc/ChangeLog:

* configure.ac: Add check for the Texinfo 6.8
CONTENTS_OUTPUT_LOCATION customization variable and set it if
supported.
* configure: Regenerate.
* Makefile.in (MAKEINFO_TOC_INLINE_FLAG): New variable.  Set by
configure.ac to -c CONTENTS_OUTPUT_LOCATION=inline if
CONTENTS_OUTPUT_LOCATION support is detected, empty otherwise.
($(build_htmldir)/%/index.html): Pass MAKEINFO_TOC_INLINE_FLAG.
---
Here's an updated version of that patch, for review.  I'm sending it
separately and properly to not accidentally alienate potential
reviewers.

 gcc/Makefile.in|  6 -
 gcc/configure  | 35 --
 gcc/configure.ac   | 21 
 maintainer-scripts/update_web_docs_git |  2 +-
 4 files changed, 60 insertions(+), 4 deletions(-)

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 6001c9e3b55..d8b76d83d68 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -787,6 +787,9 @@ INSTALL_HEADERS=install-headers install-mkheaders
 # Control whether Info documentation is built and installed.
 BUILD_INFO = @BUILD_INFO@
 
+# Control flags for @contents placement in HTML output
+MAKEINFO_TOC_INLINE_FLAG = @MAKEINFO_TOC_INLINE_FLAG@
+
 # Control whether manpages generated by texi2pod.pl can be rebuilt.
 GENERATED_MANPAGES = @GENERATED_MANPAGES@
 
@@ -3461,7 +3464,8 @@ html:: $(HTMLS_BUILD)
 $(build_htmldir)/%/index.html: %.texi
$(mkinstalldirs) $(@D)
rm -f $(@D)/*
-   $(TEXI2HTML) -I $(abs_docdir) -I $(abs_docdir)/include -o $(@D) $<
+   $(TEXI2HTML) $(MAKEINFO_TOC_INLINE_FLAG) \
+   -I $(abs_docdir) -I $(abs_docdir)/include -o $(@D) $<
 
 # Duplicate entry to handle renaming of gccinstall
 $(build_htmldir)/gccinstall/index.html: $(TEXI_GCCINSTALL_FILES)
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 62bc908b991..120151c474a 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1242,6 +1242,27 @@ else
 fi
 AC_SUBST(BUILD_INFO)
 
+# Determine whether makeinfo supports the CONTENTS_OUTPUT_LOCATION variable.
+# If it does, we want to pass it to makeinfo in order to restore the old
+# behavior of @{summary,}contents placement.
+MAKEINFO_TOC_INLINE_FLAG=
+AS_IF([test x"$MAKEINFO" != x], [
+  AC_CACHE_CHECK([for CONTENTS_OUTPUT_LOCATION support in $MAKEINFO],
+[gcc_cv_texi_add_toc_inline_flags], [
+# Detect the unknown variable CONTENTS_OUTPUT_LOCATION warning
+if "$MAKEINFO" -c CONTENTS_OUTPUT_LOCATION=inline &1 \
+   | grep CONTENTS_OUTPUT_LOCATION >/dev/null; then
+  gcc_cv_texi_add_toc_inline_flags=no
+else
+  gcc_cv_texi_add_toc_inline_flags=yes
+fi
+  ])
+  if test x"$gcc_cv_texi_add_toc_inline_flags" = xyes; then
+MAKEINFO_TOC_INLINE_FLAG='-c CONTENTS_OUTPUT_LOCATION=inline'
+  fi
+])
+AC_SUBST([MAKEINFO_TOC_INLINE_FLAG])
+
 # Is pod2man recent enough to regenerate manpages?
 AC_MSG_CHECKING([for recent Pod::Man])
 if (perl -e 'use 1.10 Pod::Man') >/dev/null 2>&1; then
diff --git a/maintainer-scripts/update_web_docs_git 
b/maintainer-scripts/update_web_docs_git
index 9ded1744df4..c9f14d1a4d1 100755
--- a/maintainer-scripts/update_web_docs_git
+++ b/maintainer-scripts/update_web_docs_git
@@ -169,7 +169,7 @@ for file in $MANUALS; do
 if [ "$file" = "gnat_ugn" ]; then
   includes="$includes -I gcc/gcc/ada -I gcc/gcc/ada/doc/gnat_ugn"
 fi
-makeinfo --html --css-ref $CSS $includes -o ${file} ${filename}
+makeinfo --html -c CONTENTS_OUTPUT_LOCATION=inline --css-ref $CSS 
$includes -o ${file} ${filename}
 tar cf ${file}-html.tar ${file}/*.html
 texi2dvi $includes -o ${file}.dvi ${filename} /dev/null && 
dvips -o ${file}.ps ${file}.dvi
 texi2pdf $includes -o ${file}.pdf ${filename} 

Re: [PATCH v2 1/5] docs: Create Indices appendix

2023-03-11 Thread Arsen Arsenović via Gcc-patches

Gerald Pfeifer  writes:

> On Sat, 11 Mar 2023, Arsen Arsenović wrote:
>> OK, changed up a bit, what do you think of this:
>
>> maintainer-scripts/ChangeLog:
>>
>>  * update_web_docs_git: Set CONTENTS_OUTPUT_LOCATION=inline in
>>  order to put @shortcontents above contents. See
>>  9dd976a4-4e09-d901-b949-6d5037567...@codesourcery.com on
>>  gcc-patches.
>
> In the ChangeLog we only describe *what* has change, so the first half of 
> the first sentence.
>
> The rest then goes in between the first line of the Git commit message
> (= the subject of your mail) and the ChangeLog entries.

Ah, OK.  I decided to put it there, too (and repeat it twice), since the
ChangeLog crafting script doesn't include the commit message for
context.  I've dropped that now.

>
>> --- a/gcc/configure
>> +++ b/gcc/configure
>
> We usually don't post diffs for generated files. Not a biggie, I figured I 
> mention it since it makes reviewing easier and patches shorter, and thus 
> tends to increase the chance reviewers short on time jump in. :-)

Ah, d'oh.  I forgot to filter that out.  Apologies.

>
>> --- a/maintainer-scripts/update_web_docs_git
>> +++ b/maintainer-scripts/update_web_docs_git
>> @@ -169,7 +169,7 @@ for file in $MANUALS; do
>> if [ "$file" = "gnat_ugn" ]; then
>>   includes="$includes -I gcc/gcc/ada -I gcc/gcc/ada/doc/gnat_ugn"
>> fi
>> -makeinfo --html --css-ref $CSS $includes -o ${file} ${filename}
>> +makeinfo --html -c CONTENTS_OUTPUT_LOCATION=inline --css-ref $CSS 
>> $includes -o ${file} ${filename}
>
> Sandra deferred to me on this one, so explicitly: Ack, thank you. :-)
>
> Note, update_web_docs_git runs once a day, at 0:50 GMT, see 
> gcc/maintainer-scripts/crontab, and needs to be updated on the gcc.gnu.org 
> system. I am happy to do that for you, just drop me a note when the commit
> is in.

Sure thing, thanks!

> Gerald


-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH v2 1/5] docs: Create Indices appendix

2023-03-11 Thread Arsen Arsenović via Gcc-patches

Sandra Loosemore  writes:

> On 3/11/23 05:22, Arsen Arsenović wrote:
>> OK, changed up a bit, what do you think of this:
>> maintainer-scripts/ChangeLog:
>>  * update_web_docs_git: Set CONTENTS_OUTPUT_LOCATION=inline in
>>  order to put @shortcontents above contents. See
>>  9dd976a4-4e09-d901-b949-6d5037567...@codesourcery.com on
>>  gcc-patches.
>> gcc/ChangeLog:
>>  * configure.ac: Add check for the Texinfo 6.8
>>  CONTENTS_OUTPUT_LOCATION customization variable and set it if
>>  supported.
>>  * configure: Regenerate.
>>  * Makefile.in (MAKEINFO_TOC_INLINE_FLAG): New variable.  Set by
>>  configure.ac to -c CONTENTS_OUTPUT_LOCATION=inline if
>>  CONTENTS_OUTPUT_LOCATION support is detected, empty otherwise.
>>  ($(build_htmldir)/%/index.html): Pass MAKEINFO_TOC_INLINE_FLAG.
>>  See 9dd976a4-4e09-d901-b949-6d5037567...@codesourcery.com on
>>  gcc-patches.
>
> Hmmm, first off, I think somebody other than me needs to approve the configure
> and makefile pieces, as well as the maintainer-scripts part. It looks
> conceptually right to me, although I would add a comment to new configure.ac
> piece like
>
> "Newer versions of Texinfo put the table of contents in the wrong place by
> default in HTML output, but provide a command-line option to restore the
> desired behavior.  Check whether we need to do that."

This sounds good, will drop in.  Who can review these?

> I don't know whether the maintainer-scripts change needs to be made 
> conditional
> too.  :-S

I don't think so, I was thinking of omitting it for the usual build too
since it's a nonfatal error to pass non-existent customization
variables, but I decided that this would introduce too much noise to the
normal path.  This shouldn't emit a warning on the server that runs the
update anyway since, hopefully, we'd be updating it 7.0dev for the other
goodies.

> BTW, this change probably needs to be backported to all active GCC branches
> (10, 11, and 12) too after it's committed to mainline.

I'm not opposed to doing that.

> -Sandra


-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH v2 1/5] docs: Create Indices appendix

2023-03-11 Thread Arsen Arsenović via Gcc-patches

Sandra Loosemore  writes:

> On 3/9/23 13:38, Arsen Arsenović wrote:
>> Found the change.  HTML got support for CONTENTS_OUTPUT_LOCATION,
>> which defaults to after_top, which ignores the inline location of
>> these elements.  Here's a patch:
>> maintainer-scripts/ChangeLog:
>>  * update_web_docs_git: Set CONTENTS_OUTPUT_LOCATION=inline in
>>  order to put @shortcontents above contents. See
>>  9dd976a4-4e09-d901-b949-6d5037567...@codesourcery.com on
>>  gcc-patches.
>
> I don't think this is an adequate fix.  We mere mortals build the manuals with
> "make html" etc instead of the maintainer scripts for the web site, so we need
> a solution that we can put either in the Makefile or directly in the .texi
> files, that won't blow up for older versions of Texinfo that don't support 
> this
> thing.
>
> -Sandra

OK, changed up a bit, what do you think of this:

From 5f9084fa0db49cb550bc147e7a563c31a311be1d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Arsen=20Arsenovi=C4=87?= 
Date: Thu, 9 Mar 2023 21:44:29 +0100
Subject: [PATCH] html: Set CONTENTS_OUTPUT_LOCATION=inline if makeinfo
 supports it

maintainer-scripts/ChangeLog:

	* update_web_docs_git: Set CONTENTS_OUTPUT_LOCATION=inline in
	order to put @shortcontents above contents. See
	9dd976a4-4e09-d901-b949-6d5037567...@codesourcery.com on
	gcc-patches.

gcc/ChangeLog:

	* configure.ac: Add check for the Texinfo 6.8
	CONTENTS_OUTPUT_LOCATION customization variable and set it if
	supported.
	* configure: Regenerate.
	* Makefile.in (MAKEINFO_TOC_INLINE_FLAG): New variable.  Set by
	configure.ac to -c CONTENTS_OUTPUT_LOCATION=inline if
	CONTENTS_OUTPUT_LOCATION support is detected, empty otherwise.
	($(build_htmldir)/%/index.html): Pass MAKEINFO_TOC_INLINE_FLAG.
	See 9dd976a4-4e09-d901-b949-6d5037567...@codesourcery.com on
	gcc-patches.
---
 gcc/Makefile.in|  6 -
 gcc/configure  | 32 --
 gcc/configure.ac   | 18 +++
 maintainer-scripts/update_web_docs_git |  2 +-
 4 files changed, 54 insertions(+), 4 deletions(-)

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 6001c9e3b55..d8b76d83d68 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -787,6 +787,9 @@ INSTALL_HEADERS=install-headers install-mkheaders
 # Control whether Info documentation is built and installed.
 BUILD_INFO = @BUILD_INFO@
 
+# Control flags for @contents placement in HTML output
+MAKEINFO_TOC_INLINE_FLAG = @MAKEINFO_TOC_INLINE_FLAG@
+
 # Control whether manpages generated by texi2pod.pl can be rebuilt.
 GENERATED_MANPAGES = @GENERATED_MANPAGES@
 
@@ -3461,7 +3464,8 @@ html:: $(HTMLS_BUILD)
 $(build_htmldir)/%/index.html: %.texi
 	$(mkinstalldirs) $(@D)
 	rm -f $(@D)/*
-	$(TEXI2HTML) -I $(abs_docdir) -I $(abs_docdir)/include -o $(@D) $<
+	$(TEXI2HTML) $(MAKEINFO_TOC_INLINE_FLAG) \
+		-I $(abs_docdir) -I $(abs_docdir)/include -o $(@D) $<
 
 # Duplicate entry to handle renaming of gccinstall
 $(build_htmldir)/gccinstall/index.html: $(TEXI_GCCINSTALL_FILES)
diff --git a/gcc/configure b/gcc/configure
index 254f9b6c943..98356fdf92d 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -810,6 +810,7 @@ PYTHON
 BISON
 FLEX
 GENERATED_MANPAGES
+MAKEINFO_TOC_INLINE_FLAG
 BUILD_INFO
 MAKEINFO
 have_mktemp_command
@@ -8795,6 +8796,33 @@ else
 fi
 
 
+MAKEINFO_TOC_INLINE_FLAG=
+if test x"$MAKEINFO" != x; then :
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CONTENTS_OUTPUT_LOCATION support in $MAKEINFO" >&5
+$as_echo_n "checking for CONTENTS_OUTPUT_LOCATION support in $MAKEINFO... " >&6; }
+if ${gcc_cv_texi_add_toc_inline_flags+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+# Detect the unknown variable CONTENTS_OUTPUT_LOCATION warning
+if "$MAKEINFO" -c CONTENTS_OUTPUT_LOCATION=inline &1 \
+   | grep CONTENTS_OUTPUT_LOCATION >/dev/null; then
+  gcc_cv_texi_add_toc_inline_flags=no
+else
+  gcc_cv_texi_add_toc_inline_flags=yes
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_texi_add_toc_inline_flags" >&5
+$as_echo "$gcc_cv_texi_add_toc_inline_flags" >&6; }
+  if test x"$gcc_cv_texi_add_toc_inline_flags" = xyes; then
+MAKEINFO_TOC_INLINE_FLAG='-c CONTENTS_OUTPUT_LOCATION=inline'
+  fi
+
+fi
+
+
 # Is pod2man recent enough to regenerate manpages?
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for recent Pod::Man" >&5
 $as_echo_n "checking for recent Pod::Man... " >&6; }
@@ -19792,7 +19820,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 19795 "configure"
+#line 19823 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -19898,7 +19926,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 19901 "configure"
+#line 19929 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 

Re: [PATCH v2 1/5] docs: Create Indices appendix

2023-03-10 Thread Arsen Arsenović via Gcc-patches

Sandra Loosemore  writes:

> On 3/9/23 13:38, Arsen Arsenović wrote:
>> Found the change.  HTML got support for CONTENTS_OUTPUT_LOCATION,
>> which defaults to after_top, which ignores the inline location of
>> these elements.  Here's a patch:
>> maintainer-scripts/ChangeLog:
>>  * update_web_docs_git: Set CONTENTS_OUTPUT_LOCATION=inline in
>>  order to put @shortcontents above contents. See
>>  9dd976a4-4e09-d901-b949-6d5037567...@codesourcery.com on
>>  gcc-patches.
>
> I don't think this is an adequate fix.  We mere mortals build the manuals with
> "make html" etc instead of the maintainer scripts for the web site, so we need
> a solution that we can put either in the Makefile or directly in the .texi
> files, that won't blow up for older versions of Texinfo that don't support 
> this
> thing.

Hm, I've forgotten about that.  AFAICT, the only way to specify this
customization variable is through makeinfo flags.  It'd seem that
unrecognized variables produce a warning, though, so at least building
with older versions won't fail.

We could probably test for whether -c CONTENTS_OUTPUT_LOCATION produces
no warning, and if so, pass an extra flag in the makefile, or just
accept the warning on older versions (before 6.8).

Those, IIUC, should behave as if CONTENTS_OUTPUT_LOCATION is set to
inline, but I haven't tested that (it's getting quite late).

Also worth noting is that the contents come before the top node when set
up like this.  It might be nice to gate that behind @ifhtml or such.

Maybe we should also consider suggesting that texi2any places
@shortcontents first in after_top mode.  I can handle that if you think
that's reasonable.

I'll send the updated patch in the morning.

> -Sandra

Thanks, have a lovely night.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


[pushed] MAINTAINERS: add myself to write after approval

2023-03-10 Thread Arsen Arsenović via Gcc-patches
ChangeLog:

* MAINTAINERS (Write After Approval): Add myself.
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index a61d3ae06df..3c533cb651d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -318,6 +318,7 @@ from other maintainers or reviewers.
 Mark G. Adams  
 Pedro Alves
 Paul-Antoine Arras 
+Arsen Arsenović
 Raksit Ashok   
 Matt Austern   
 David Ayers
-- 
2.39.2



Re: [PATCH v2 4/5] Update texinfo.tex, remove the @gol macro/alias

2023-03-10 Thread Arsen Arsenović via Gcc-patches
Hi Gerald,

Gerald Pfeifer  writes:

> On Fri, 10 Mar 2023, Arsen Arsenović wrote:
>> Thanks, Thomas.  I'd be happy to undergo this process later today.  If I
>> understood right, I should fill out
>> https://sourceware.org/cgi-bin/pdw/ps_form.cgi and name you, right?
>
> Yes. 

Thanks, done.  Exciting :-)

> (Thomas, you, and me actually could have met a FOSDEM. Next year we should
> send a note to the gcc@ list and arrange for something?)
>
 Arsen, if that is indeed the case, I offer to push these two commits for
 you if you send them by e-mail (as two attachments).
>> Thanks!  Either approach works for me :)
>
> Happy to go the route Thomas suggested (though available to help, too).

Thank you!  I'll keep you posted.  For now, let's get a final review of
the remaining bits and I'll try pushing myself should that become
possible.

> Gerald

Have a great day :-)
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH v2 4/5] Update texinfo.tex, remove the @gol macro/alias

2023-03-10 Thread Arsen Arsenović via Gcc-patches
Afternoon,

Sandra Loosemore  writes:

> On 2/23/23 03:27, Arsen Arsenović via Gcc-patches wrote:
>> The @gol macro appears to have existed as a workaround for a bug in old
>> versions of makeinfo and/or texinfo.tex, where they would, in some types
>> of output, fail to emit line breaks in @gccoptlists.  After updating
>> texinfo.tex, I noticed that this behavior appears to no longer be
>> exhibited, instead, both acted correctly and inserted newlines.  The
>> (groff) manual output also appears unaffected.
>> gcc/ChangeLog:
>>  * doc/include/texinfo.tex: Update to 2023-01-17.19.
>>  * doc/implement-c.texi: Remove usage of @gol.
>>  * doc/invoke.texi: Ditto.
>>  * doc/sourcebuild.texi: Ditto.
>>  * doc/include/gcc-common.texi: Remove @gol.  In new Makeinfo and
>>  texinfo.tex versions, the bug it was working around appears to
>>  be gone.
>> gcc/fortran/ChangeLog:
>>  * invoke.texi: Remove usages of @gol.
>>  * intrinsic.texi: Ditto.
>
> This is OK, but I'd like to see this patch split into two separate commits as
> well -- one for the texinfo.tex import, and one for the @gol changes.

The full log is below.  This branch is also, as usual, visible on my
fork at:

  https://git.sr.ht/~arsen/gcc texinfo_improvements

... and is visible in web form at:

  https://git.sr.ht/~arsen/gcc/log/texinfo_improvements

I rebased the patchset to today's revision again.

The log:

commit 63fcce9b7d7af55fd73024fa42cb44fde9063c3a
Author: Arsen Arsenović 
Date:   Thu Mar 9 21:44:29 2023 +0100

update_web_docs_git: Set CONTENTS_OUTPUT_LOCATION=inline

maintainer-scripts/ChangeLog:

* update_web_docs_git: Set CONTENTS_OUTPUT_LOCATION=inline in
order to put @shortcontents above contents. See
9dd976a4-4e09-d901-b949-6d5037567...@codesourcery.com on
gcc-patches.

commit 04c696ed31e623d003a0472f83d6a93c53541790
Author: Arsen Arsenović 
Date:   Tue Feb 28 11:40:56 2023 +0100

docs: Fix up new instances of index reordering

This commit fixes up an instance of the index entry mis-ordering that
occurred between the formulation and application of commit
r13-6310-gf33d7a88d069d1.

gcc/ChangeLog:

* doc/extend.texi: Associate use_hazard_barrier_return index
entry with its attribute.
* doc/invoke.texi: Associate -fcanon-prefix-map index entry with
its attribute

commit cfc401f06bf46fd98ee1272e0204155d635b3c42
Author: Arsen Arsenović 
Date:   Thu Jan 26 18:50:38 2023 +0100

update_web_docs_git: Update CSS reference to new manual CSS

maintainer-scripts/ChangeLog:

* update_web_docs_git (CSS): Update CSS reference to point to
/texinfo-manuals.css.

commit d3c953045f99523a726d1d2b2d25bc9e9352fdfd
Author: Arsen Arsenović 
Date:   Wed Jan 25 23:33:03 2023 +0100

doc: Remove the @gol macro/alias

The @gol macro appears to have existed as a workaround for a bug in old
versions of makeinfo and/or texinfo.tex, where they would, in some types
of output, fail to emit line breaks in @gccoptlists.  After updating
texinfo.tex, I noticed that this behavior appears to no longer be
exhibited, instead, both acted correctly and inserted newlines.  The
(groff) manual output also appears unaffected.

gcc/ChangeLog:

* doc/implement-c.texi: Remove usage of @gol.
* doc/invoke.texi: Ditto.
* doc/sourcebuild.texi: Ditto.
* doc/include/gcc-common.texi: Remove @gol.  In new Makeinfo and
texinfo.tex versions, the bug it was working around appears to
be gone.

gcc/fortran/ChangeLog:

* invoke.texi: Remove usages of @gol.
* intrinsic.texi: Ditto.

commit e543f4acda2573331d02a99a779f8710abfb14c6
Author: Arsen Arsenović 
Date:   Fri Mar 10 16:21:33 2023 +0100

doc: Update texinfo.tex

gcc/ChangeLog:

* doc/include/texinfo.tex: Update to 2023-01-17.19.

commit 5f093996a453656755a0209271d01392d05b849e
Author: Arsen Arsenović 
Date:   Fri Mar 10 16:13:28 2023 +0100

docs: Add @defbuiltin family of helpers

The @defbuiltin{,x} macros are convenience macros for the often-repeated
task of defining a built-in function in extend.texi.  Usage of this
macro should lead to a higher degree of consistency across pieces of
text written by different people, and provide a better reading
experience, as they prevent easy-to-make errors, like forgetting index
entries for these functions.

gcc/ChangeLog:

* doc/include/gcc-common.texi: Add @defbuiltin{,x} and
@enddefbuiltin for defining built-in functions.
* doc/extend.texi: Apply @defbuiltin{,x} to many, but not all,
places where it should b

Re: [PATCH v2 5/5] update_web_docs_git: Update CSS reference to new manual CSS

2023-03-10 Thread Arsen Arsenović via Gcc-patches

Sandra Loosemore  writes:

> On 2/23/23 03:27, Arsen Arsenović via Gcc-patches wrote:
>> maintainer-scripts/ChangeLog:
>>  * update_web_docs_git (CSS): Update CSS reference to point to
>>  /texinfo-manuals.css.
>
> I'm going to defer to Gerald on this one, since I am ignorant of how documents
> are produced for the GCC web site.  IIUC the online docs are built on a system
> with Texinfo 6.5; I don't know if it's reasonable to update that, otherwise I
> think somebody ought to give it a dry run to make sure that the style sheet
> does reasonable things with Texinfo 6.5 output.

ISTR asking Mark about updating that system for the purposes of this
change and releaseq, and him saying that it is possible to do so, should
the GCC admins agree, so I think we should be okay.

Gerald, there's one more patch for update_web_docs_git that you'll be
interested in, see:
https://inbox.sourceware.org/gcc-patches/86sfed63l6@aarsen.me/

This addresses the @shortcontents coming after the @contents even with
the Texinfo sources specifying otherwise.

Thanks in advance.

> -Sandra


-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH v2 4/5] Update texinfo.tex, remove the @gol macro/alias

2023-03-10 Thread Arsen Arsenović via Gcc-patches
Hi Gerald, Thomas,

Thomas Schwinge  writes:

> Hi!
>
> On 2023-03-10T01:17:04+0100, Gerald Pfeifer  wrote:
>> On Thu, 9 Mar 2023, Sandra Loosemore wrote:
>>> This is OK, but I'd like to see this patch split into two separate
>>> commits as well -- one for the texinfo.tex import, and one for the @gol
>>> changes.
>>
>> I believe Arsen does not have git write access.
>
> Well, I guess we should fix that?  :-) I've met Arsen in person at
> FOSDEM 2023, and I'm happy to vouch for his reasonable behavior.
> He does have a FSF Copyright Assignment for GCC.
> ; I'm happy to act
> as sponsor.

Thanks, Thomas.  I'd be happy to undergo this process later today.  If I
understood right, I should fill out
https://sourceware.org/cgi-bin/pdw/ps_form.cgi and name you, right?

Thanks again.

>
> Grüße
>  Thomas
>
>
>> Arsen, if that is indeed the case, I offer to push these two commits for
>> you if you send them by e-mail (as two attachments).

Thanks!  Either approach works for me :)

>> Gerald
> -
> Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 
> München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas 
> Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht 
> München, HRB 106955

Have a lovely day!
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH v2 4/5] Update texinfo.tex, remove the @gol macro/alias

2023-03-10 Thread Arsen Arsenović via Gcc-patches
Morning,

Sandra Loosemore  writes:

> On 2/23/23 03:27, Arsen Arsenović via Gcc-patches wrote:
>> The @gol macro appears to have existed as a workaround for a bug in old
>> versions of makeinfo and/or texinfo.tex, where they would, in some types
>> of output, fail to emit line breaks in @gccoptlists.  After updating
>> texinfo.tex, I noticed that this behavior appears to no longer be
>> exhibited, instead, both acted correctly and inserted newlines.  The
>> (groff) manual output also appears unaffected.
>> gcc/ChangeLog:
>>  * doc/include/texinfo.tex: Update to 2023-01-17.19.
>>  * doc/implement-c.texi: Remove usage of @gol.
>>  * doc/invoke.texi: Ditto.
>>  * doc/sourcebuild.texi: Ditto.
>>  * doc/include/gcc-common.texi: Remove @gol.  In new Makeinfo and
>>  texinfo.tex versions, the bug it was working around appears to
>>  be gone.
>> gcc/fortran/ChangeLog:
>>  * invoke.texi: Remove usages of @gol.
>>  * intrinsic.texi: Ditto.
>
> This is OK, but I'd like to see this patch split into two separate commits as
> well -- one for the texinfo.tex import, and one for the @gol changes.

Sure thing.  I'll send the updated git log in a few hours, when I split
the commits, for your review (for both of the commits).

Thanks, have a great day.

> -Sandra


-- 
Arsen Arsenović


signature.asc
Description: PGP signature


[PATCH 2/2] libstdc++: Add a test for FTM redefinitions

2023-03-09 Thread Arsen Arsenović via Gcc-patches
This test detects redefinitions by compiling stdc++.h with
-Wsystem-headers.  Thanks Patrick Palka for the suggestion.

libstdc++-v3/ChangeLog:

* testsuite/17_intro/versionconflict.cc: New test.
---
 libstdc++-v3/testsuite/17_intro/versionconflict.cc | 6 ++
 1 file changed, 6 insertions(+)
 create mode 100644 libstdc++-v3/testsuite/17_intro/versionconflict.cc

diff --git a/libstdc++-v3/testsuite/17_intro/versionconflict.cc 
b/libstdc++-v3/testsuite/17_intro/versionconflict.cc
new file mode 100644
index 000..4191c7a2b08
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/versionconflict.cc
@@ -0,0 +1,6 @@
+// { dg-do preprocess }
+// { dg-additional-options "-Wsystem-headers -Werror" }
+
+// Test for redefinitions of FTMs using bits/stdc++.h.
+#include 
+#include 
-- 
2.39.2



[PATCH 1/2] libstdc++: Harmonize and other headers

2023-03-09 Thread Arsen Arsenović via Gcc-patches
Due to recent, large changes in libstdc++, the feature test macros
declared in  got out of sync with the other headers that
possibly declare them.  This patch resolves that.

libstdc++-v3/ChangeLog:

* include/bits/unique_ptr.h (__cpp_lib_constexpr_memory):
Synchronize the definition block with...
* include/bits/ptr_traits.h (__cpp_lib_constexpr_memory):
... this one here.  Also define the 202202L value, rather than
leaving it up to purely unique_ptr.h, so that the value is
synchronized across all headers.
(__gnu_debug::_Safe_iterator_base): Move into new conditional
block.
* include/std/memory (__cpp_lib_atomic_value_initialization):
Define on freestanding under the same conditions as in
atomic_base.h.
* include/std/version (__cpp_lib_robust_nonmodifying_seq_ops):
Also define on freestanding.
(__cpp_lib_to_chars): Ditto.
(__cpp_lib_gcd): Ditto.
(__cpp_lib_gcd_lcm): Ditto.
(__cpp_lib_raw_memory_algorithms): Ditto.
(__cpp_lib_array_constexpr): Ditto.
(__cpp_lib_nonmember_container_access): Ditto.
(__cpp_lib_clamp): Ditto.
(__cpp_lib_constexpr_char_traits): Ditto.
(__cpp_lib_constexpr_string): Ditto.
(__cpp_lib_sample): Ditto.
(__cpp_lib_lcm): Ditto.
(__cpp_lib_constexpr_iterator): Ditto.
(__cpp_lib_constexpr_char_traits): Ditto.
(__cpp_lib_interpolate): Ditto.
(__cpp_lib_constexpr_utility): Ditto.
(__cpp_lib_shift): Ditto.
(__cpp_lib_ranges): Ditto.
(__cpp_lib_constexpr_numeric): Ditto.
(__cpp_lib_constexpr_functional): Ditto.
(__cpp_lib_constexpr_algorithms): Ditto.
(__cpp_lib_constexpr_tuple): Ditto.
(__cpp_lib_constexpr_memory): Ditto.
(__cpp_lib_format): Define to 202106L, matching std/format.
---
Hi,

This patchset harmonizes the FTM inconsistencies that were discovered a
while back, and adds a test that crudely tries to detect them.

In the future, we should replace this with a common definition
mechanism, and selective exposure, as we discussed.

Tested on x86_64-pc-linux-gnu.

 libstdc++-v3/include/bits/ptr_traits.h | 13 ++--
 libstdc++-v3/include/bits/unique_ptr.h | 11 ++--
 libstdc++-v3/include/std/memory|  6 ++
 libstdc++-v3/include/std/version   | 84 ++
 4 files changed, 66 insertions(+), 48 deletions(-)

diff --git a/libstdc++-v3/include/bits/ptr_traits.h 
b/libstdc++-v3/include/bits/ptr_traits.h
index dc42a743c96..f6cc6b65f93 100644
--- a/libstdc++-v3/include/bits/ptr_traits.h
+++ b/libstdc++-v3/include/bits/ptr_traits.h
@@ -34,12 +34,15 @@
 
 #include 
 
+/* Duplicate definition with unique_ptr.h.  */
+#if __cplusplus > 202002L && defined(__cpp_constexpr_dynamic_alloc)
+# define __cpp_lib_constexpr_memory 202202L
+#elif __cplusplus > 201703L
+# include 
+# define __cpp_lib_constexpr_memory 201811L
+#endif
+
 #if __cplusplus > 201703L
-#include 
-# ifndef __cpp_lib_constexpr_memory
-// Defined to a newer value in bits/unique_ptr.h for C++23
-#  define __cpp_lib_constexpr_memory 201811L
-# endif
 namespace __gnu_debug { struct _Safe_iterator_base; }
 #endif
 
diff --git a/libstdc++-v3/include/bits/unique_ptr.h 
b/libstdc++-v3/include/bits/unique_ptr.h
index c8daff41865..f0c6d2383b4 100644
--- a/libstdc++-v3/include/bits/unique_ptr.h
+++ b/libstdc++-v3/include/bits/unique_ptr.h
@@ -43,12 +43,11 @@
 # endif
 #endif
 
-#if __cplusplus > 202002L && __cpp_constexpr_dynamic_alloc
-# if __cpp_lib_constexpr_memory < 202202L
-// Defined with older value in bits/ptr_traits.h for C++20
-#  undef __cpp_lib_constexpr_memory
-#  define __cpp_lib_constexpr_memory 202202L
-# endif
+/* Duplicate definition with ptr_traits.h.  */
+#if __cplusplus > 202002L && defined(__cpp_constexpr_dynamic_alloc)
+# define __cpp_lib_constexpr_memory 202202L
+#elif __cplusplus > 201703L
+# define __cpp_lib_constexpr_memory 201811L
 #endif
 
 namespace std _GLIBCXX_VISIBILITY(default)
diff --git a/libstdc++-v3/include/std/memory b/libstdc++-v3/include/std/memory
index 341f9857730..85c36d67ee1 100644
--- a/libstdc++-v3/include/std/memory
+++ b/libstdc++-v3/include/std/memory
@@ -91,6 +91,12 @@
 #  include 
 #endif
 
+/* As a hack, we declare __cpp_lib_atomic_value_initialization here even though
+   we don't include the bit that actually declares it, for consistency.  */
+#if !defined(__cpp_lib_atomic_value_initialization) && __cplusplus >= 202002L
+# define __cpp_lib_atomic_value_initialization 201911L
+#endif
+
 #if __cplusplus >= 201103L && __cplusplus <= 202002L && _GLIBCXX_HOSTED
 namespace std _GLIBCXX_VISIBILITY(default)
 {
diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/version
index 871d30db5b3..abc49d12e54 100644
--- a/libstdc++-v3/include/std/version
+++ b/libstdc++-v3/include/std/version
@@ -85,6 +85,12 @@
 #define __cpp_lib_transparent_operators 201510L
 #define 

Re: [PATCH v2 1/5] docs: Create Indices appendix

2023-03-09 Thread Arsen Arsenović via Gcc-patches

Sandra Loosemore  writes:

> On 2/23/23 03:27, Arsen Arsenović via Gcc-patches wrote:
>> The GCC manual has multiple indices.  By creating an appendix which
>> lists them, we help makeinfo present a more accessible way for the
>> reader to see all the indices.
>> gcc/ChangeLog:
>>  * doc/gcc.texi: Add the Indices appendix, to make texinfo
>>  generate nice indices overview page.
>>  (@copying): Move "This file documents the use of the GNU
>>  compilers" into @copying.  Add quotations around cover texts.
>
>
> I guess this patch is OK and is necessary to smooth over some misfeatures
> in newer versions of Texinfo.  In particular, comparing your sample output
> https://www.aarsen.me/~arsen/final/gcc.html/index.html
>
> to my own fresh Texinfo 6.7-generated version with your patches applied, and
> the existing online documention like
>
> https://gcc.gnu.org/onlinedocs/gcc-12.2.0/gcc/index.html
>
> the order of the "Short Table of Contents" and longer "Table of Contents" have
> been switched, so that in the new version you have to scroll all the way down
> to the bottom of the page (ugh) to click on "Option Index".  (Frankly, this
> seems like a misfeature; the point of having a "Short Table of Contents" is
> *not* to have to page through the long one to find a particular chapter.)
>
> I guess that is a Texinfo change?  gcc.texi still has:
>
> @summarycontents
> @contents
>
> in that order.

Found the change.  HTML got support for CONTENTS_OUTPUT_LOCATION, which
defaults to after_top, which ignores the inline location of these
elements.  Here's a patch:

From 0a0c9469301fb25c4b420a1ed4e381f5ea921d07 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Arsen=20Arsenovi=C4=87?= 
Date: Thu, 9 Mar 2023 21:44:29 +0100
Subject: [PATCH] update_web_docs_git: Set CONTENTS_OUTPUT_LOCATION=inline

maintainer-scripts/ChangeLog:

	* update_web_docs_git: Set CONTENTS_OUTPUT_LOCATION=inline in
	order to put @shortcontents above contents. See
	9dd976a4-4e09-d901-b949-6d5037567...@codesourcery.com on
	gcc-patches.
---
 maintainer-scripts/update_web_docs_git | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/maintainer-scripts/update_web_docs_git b/maintainer-scripts/update_web_docs_git
index 9ded1744df4..c9f14d1a4d1 100755
--- a/maintainer-scripts/update_web_docs_git
+++ b/maintainer-scripts/update_web_docs_git
@@ -169,7 +169,7 @@ for file in $MANUALS; do
 if [ "$file" = "gnat_ugn" ]; then
   includes="$includes -I gcc/gcc/ada -I gcc/gcc/ada/doc/gnat_ugn"
 fi
-makeinfo --html --css-ref $CSS $includes -o ${file} ${filename}
+makeinfo --html -c CONTENTS_OUTPUT_LOCATION=inline --css-ref $CSS $includes -o ${file} ${filename}
 tar cf ${file}-html.tar ${file}/*.html
 texi2dvi $includes -o ${file}.dvi ${filename} /dev/null && dvips -o ${file}.ps ${file}.dvi
 texi2pdf $includes -o ${file}.pdf ${filename} 
I pushed the updated docs, and added that commit to my branch (as well
as rebasing it, as always).

> OTOH, I see that in your new version there is now a line with links
> [Contents][Index] before the Introduction.  If adding this new appendix makes
> the [Index] link point at the indices, I think it is OK, although I'm still
> worried that the overall effect (even without the new version of Texinfo) is
> making the indices harder to find.
>
> I wonder, could we add something to the Introduction text like
>
> Tip: This manual is very long.  If you're looking for something in particular,
> try searching the @ref{Option Index} or @ref{Concept and Symbol Index}.
>
> ???

Even with the above fixed, I think it'd be nice to add this text.

> -Sandra


-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH v2 0/5] A small Texinfo refinement

2023-03-09 Thread Arsen Arsenović via Gcc-patches

Sandra Loosemore  writes:

>> As an example, let's take this link:
>> https://gcc.gnu.org/onlinedocs/gcc-12.2.0/gcc/Warning-Options.html#index-Wpedantic
>> This should place you below the item line this index entry refers to,
>> and there aren't any copiable anchors (see equivalent in my render for
>> an example of those), both of which were often named as annoyances with
>> the onlinedocs while the Sphinx experiment was taking place.
>> A similar thing happens in the standalone and Emacs info viewers (but
>> that's less noticeable there since the cursor is placed in the middle of
>> the screen when jumping to an index entry there).  Try, for instance,
>> 'info gcc Wpedantic' (your cursor will be placed just below the item
>> line).
>> The fix for the first of these issues should already be applied by
>> Gerald (in the reordering commits, IIRC at least, save for one that I
>> created later because someone snuck in new "misplaced" indices), and
>> that fix should also fix up previous versions of Texinfo.
>> Even with this change, the copiable anchors will remain missing since
>> released Texinfo versions lack some AST transformations that enable
>> those.
>
> OK, I can see the difference there between the current online docs, the set 
> you
> produced with the unreleased Texinfo support, and what I got building with
> Texinfo 6.7.
>
>> Otherwise, manuals should work fine with older releases, unless I missed
>> something when refactoring @defbuiltin and removing @gols (which I do
>> believe are superfluous with current versions of texinfo.tex, which is
>> why I bumped that too).
>
> I did a few spot-checks here and there of those changes.  I saw a couple of
> line break problems but they turn out to be due to existing errors in the 
> .texi
> files that were not introduced by your (mostly mechanical) changes.

Thanks.  I tried to check all usage sites of @gol in PDF output too, to
make sure its removal didn't have a negative impact, but I only tested
new makeinfo and the texinfo.tex I pushed to my branch (2023-01-17.19).

I expect the version of makeinfo to have no impact for that output,
since it should just offload to texi2dvi.

>> FWIW, I (briefly) tested with Texinfo 6.0, and output seems okay.  On
>> 5.0, I got a few warnings, but I think even 6.0 is apt considering its
>> age.  I haven't given it a proper scrutiny, though (workdays are busy
>> this time of year..).
>
> Texinfo 6.0 was released in 2015, 5.0 in 2013.  FWIW, Trusty Tahr (the current
> oldest Ubuntu LTS release) has 5.2.  4.7 was released in 2004, I don't know 
> why
> anyone would still be trying to use that unless it's needed for building 
> legacy
> code from the same era.

Heh, I hadn't realized how far back LTS releases go..  I don't think
there's any new language constructs that the GCC manual could make use
of currently, so it shouldn't be too difficult to retain at least a
"builds with diagnostics" level of support for those versions.

> I think we could do away with the requirement for a specific minimum version,
> and make install.texi say something similar to what it says for e.g. awk --
> just use a "recent" version, and note that new versions produce better output
> and very old ones may produce diagnostics.  I'll add that do my own todo list.

That seems reasonable, thanks.

> -Sandra

-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH v2 1/5] docs: Create Indices appendix

2023-03-09 Thread Arsen Arsenović via Gcc-patches

Sandra Loosemore  writes:

> On 2/23/23 03:27, Arsen Arsenović via Gcc-patches wrote:
>> The GCC manual has multiple indices.  By creating an appendix which
>> lists them, we help makeinfo present a more accessible way for the
>> reader to see all the indices.
>> gcc/ChangeLog:
>>  * doc/gcc.texi: Add the Indices appendix, to make texinfo
>>  generate nice indices overview page.
>>  (@copying): Move "This file documents the use of the GNU
>>  compilers" into @copying.  Add quotations around cover texts.
>
>
> I guess this patch is OK and is necessary to smooth over some misfeatures
> in newer versions of Texinfo.  In particular, comparing your sample output
> https://www.aarsen.me/~arsen/final/gcc.html/index.html
>
> to my own fresh Texinfo 6.7-generated version with your patches applied, and
> the existing online documention like
>
> https://gcc.gnu.org/onlinedocs/gcc-12.2.0/gcc/index.html
>
> the order of the "Short Table of Contents" and longer "Table of Contents" have
> been switched, so that in the new version you have to scroll all the way down
> to the bottom of the page (ugh) to click on "Option Index".  (Frankly, this
> seems like a misfeature; the point of having a "Short Table of Contents" is
> *not* to have to page through the long one to find a particular chapter.)
>
> I guess that is a Texinfo change?  gcc.texi still has:
>
> @summarycontents
> @contents
>
> in that order.

Hm, I hadn't noticed that..  That is odd.  I'll figure out why this
happens later today.  Thanks for raising this to my attention.

> OTOH, I see that in your new version there is now a line with links
> [Contents][Index] before the Introduction.  If adding this new appendix makes
> the [Index] link point at the indices, I think it is OK, although I'm still
> worried that the overall effect (even without the new version of Texinfo) is
> making the indices harder to find.
>
> I wonder, could we add something to the Introduction text like
>
> Tip: This manual is very long.  If you're looking for something in particular,
> try searching the @ref{Option Index} or @ref{Concept and Symbol Index}.
>
> ???

I think this is a good idea in either case.  It should certainly help
users unaccustomed to Texinfo in locating things quickly.

> -Sandra


-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH v2 0/5] A small Texinfo refinement

2023-03-08 Thread Arsen Arsenović via Gcc-patches

Sandra Loosemore  writes:

> On 3/8/23 02:11, Arsen Arsenović wrote:
>> Sandra Loosemore  writes:
>> 
>>> On 2/23/23 03:27, Arsen Arsenović via Gcc-patches wrote:
>>>> I've rerendered the updated documentation with latest development
>>>> Texinfo (as some of the changes I made for the purposes of the GCC
>>>> manual still aren't in releases) at:
>>>> https://www.aarsen.me/~arsen/final/
>>>
>>> Ummm.  I don't think GCC's documentation should depend on an unreleased 
>>> version
>>> of Texinfo.  Currently install.texi documents that version 4.7 or later is
>>> required, 4.8 for "make pdf"; did I miss something in your patch set that 
>>> bumps
>>> this requirement?  Exactly what features do you depend on that are not yet
>>> supported by an official Texinfo release?
>> This patch should still build with older Texinfo versions (albeit, I
>> hadn't tested 4.7, I missed that requirement).  The unreleased version
>> should be installed on the server building HTML documentation as it
>> produces better results w.r.t clickable anchors and index-in-table
>> handling.  It should not be a hard dependency, and should only degrade
>> to its current state should in-dev Texinfo be missing.
>
> Hmmm, OK.  We presently have Texinfo version 6.7 installed here, so I'll give
> that a try.  I'm not sure I'd be able to detect problems with incorrect HTML
> anchors or whatever, though.

As an example, let's take this link:
https://gcc.gnu.org/onlinedocs/gcc-12.2.0/gcc/Warning-Options.html#index-Wpedantic

This should place you below the item line this index entry refers to,
and there aren't any copiable anchors (see equivalent in my render for
an example of those), both of which were often named as annoyances with
the onlinedocs while the Sphinx experiment was taking place.

A similar thing happens in the standalone and Emacs info viewers (but
that's less noticeable there since the cursor is placed in the middle of
the screen when jumping to an index entry there).  Try, for instance,
'info gcc Wpedantic' (your cursor will be placed just below the item
line).

The fix for the first of these issues should already be applied by
Gerald (in the reordering commits, IIRC at least, save for one that I
created later because someone snuck in new "misplaced" indices), and
that fix should also fix up previous versions of Texinfo.

Even with this change, the copiable anchors will remain missing since
released Texinfo versions lack some AST transformations that enable
those.

Otherwise, manuals should work fine with older releases, unless I missed
something when refactoring @defbuiltin and removing @gols (which I do
believe are superfluous with current versions of texinfo.tex, which is
why I bumped that too).

To be clear, the anchor-related stuff is entirely specific to HTML
output.

> Most people building GCC from source probably use whatever versions of build
> dependencies are provided by their OS distribution.  In our group we need
> reproducible builds for long-term support so we maintain our own list of
> dependencies and normally update to the latest stable versions only once every
> few years unless there is a hard requirement to upgrade some particular tool
> meanwhile.  I personally do not know how the manuals for the GCC web site are
> built, but it seems kind of important to make sure that works as intended 
> since
> it's the main online resource for ordinary GCC users.

Yes, I can get behind this sentiment too.  I don't mean to impose a hard
dependency on the bleeding edge of Texinfo.  My target was indeed the
GCC website and ordinary users.

>> It might be worth bumping the minimum, 4.7 is a version from 2004; in
>> the meanwhile, I'll try a few older versions too.
>
> I agree that it's unlikely anyone is building current GCC with a Texinfo
> version as old as 4.7 any more, and it may be that the manual doesn't even
> build properly with such an old release due to existing unintentional
> dependencies on newer features, independently of your patch.  If we do update
> the version, there's a version check in configure.ac and some hack for
> "makeinfo 4.7 brokenness" in doc/install.texi2html that need to be changed, as
> well as install.texi.

FWIW, I (briefly) tested with Texinfo 6.0, and output seems okay.  On
5.0, I got a few warnings, but I think even 6.0 is apt considering its
age.  I haven't given it a proper scrutiny, though (workdays are busy
this time of year..).

> -Sandra

Thanks, have a lovely evening.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH v2 0/5] A small Texinfo refinement

2023-03-08 Thread Arsen Arsenović via Gcc-patches

Sandra Loosemore  writes:

> On 2/23/23 03:27, Arsen Arsenović via Gcc-patches wrote:
>> I've rerendered the updated documentation with latest development
>> Texinfo (as some of the changes I made for the purposes of the GCC
>> manual still aren't in releases) at:
>>https://www.aarsen.me/~arsen/final/
>
> Ummm.  I don't think GCC's documentation should depend on an unreleased 
> version
> of Texinfo.  Currently install.texi documents that version 4.7 or later is
> required, 4.8 for "make pdf"; did I miss something in your patch set that 
> bumps
> this requirement?  Exactly what features do you depend on that are not yet
> supported by an official Texinfo release?

This patch should still build with older Texinfo versions (albeit, I
hadn't tested 4.7, I missed that requirement).  The unreleased version
should be installed on the server building HTML documentation as it
produces better results w.r.t clickable anchors and index-in-table
handling.  It should not be a hard dependency, and should only degrade
to its current state should in-dev Texinfo be missing.

It might be worth bumping the minimum, 4.7 is a version from 2004; in
the meanwhile, I'll try a few older versions too.

Thanks, have a lovely day.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH v2 0/5] A small Texinfo refinement

2023-02-26 Thread Arsen Arsenović via Gcc-patches
Hi Thomas,

Thomas Schwinge  writes:

> Hi Arsen!
>
> Thanks for caring about the documentation infrastructure!
>
> On 2023-02-23T11:27:09+0100, Arsen Arsenović via Gcc-patches 
>  wrote:
>> The commit "docs: Reorder @opindex to be before corresponding options"
>
>> https://gcc.gnu.org/pipermail/gcc-patches/2023-February/612616.html
>> His idea of automatically checking for this error pattern will be
>> implemented separately, after I figure out how best to do that.  The
>> code that was involved in making this patchset is too primitive to
>> apply globally.
>
> But please don't spend too much time on that idea, if that turns out to
> require non-trivial Texinfo parsing.

My intention was to do it in texi2any, since there's already a nice and
convenient parse tree that can be used there.  Alternatively, texi2any
can export the parse tree for external tools consumption, if some
heuristic ends up not being general enough for all Texinfo manuals.  I'd
like to figure out something general, though, as time permits.

> Given that you've now fixed up the existing disordered instances, I
> suppose not many new ones are going be introduced, assuming that people
> extend the documentation by looking at the existing, now-good context.

Yes, I think so too.  In either case, I'll try to catch errors before
they get merged, at least for now.

>
> Grüße
>  Thomas
> -
> Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 
> München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas 
> Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht 
> München, HRB 106955

Have a lovely day.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [wwwdocs] Add revised Texinfo manual CSS

2023-02-23 Thread Arsen Arsenović via Gcc-patches
Morning,

Gerald Pfeifer  writes:

> On Fri, 27 Jan 2023, Arsen Arsenović via Gcc-patches wrote:
>>  htdocs/texinfo-manuals.css | 129 +
>
> Thank you - I pushed this.
>
> +/* Texinfo documentation stylesheet.
> +   Inspired by the Gnulib manual, 2023-01-26.
> +
> +   Arsen Arsenović 
>
> Can we rephrase this a bit? Something like "Contributed by" maybe, or 
> omitting the name (as we usually do - since I made sure it's in Git)?

Ah, sure.  Feel free to omit the name.  I was following the convention
established with me in GCC code.

Feel free to rephrase as you see fit.

Thanks in advance.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


[PATCH v2 3/5] doc: Add @defbuiltin family of helpers, set documentlanguage

2023-02-23 Thread Arsen Arsenović via Gcc-patches
The @defbuiltin{,x} macros are convenience macros for the often-repeated
task of defining a built-in function in extend.texi.  Usage of this
macro should lead to a higher degree of consistency across pieces of
text written by different people, and provide a better reading
experience, as they prevent easy-to-make errors, like forgetting index
entries for these functions.

The documentlanguage omission was spotted by one of the people I asked
to "test drive" the updated manual, and so, it was added accordingly.

gcc/ChangeLog:

* doc/gcc.texi: Set document language to en_US.
(@copying): Wrap cover tests @quotation, move description of
manual in.
* doc/include/gcc-common.texi: Add @defbuiltin(x), @enddefbuiltin
for defining built-in functions.
* doc/extend.texi: Fix copyright notice comment, switch to using
@defbuiltin for built-in function definitions.
(Object Size Checking): Add subsubsection for formatted output
function (printf et al.) checking.
---
 gcc/doc/extend.texi | 1560 +++
 gcc/doc/gcc.texi|5 +-
 gcc/doc/include/gcc-common.texi |   16 +
 3 files changed, 798 insertions(+), 783 deletions(-)

diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 0e11e43536c..e8bacefb69e 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -1,4 +1,4 @@
-c Copyright (C) 1988-2023 Free Software Foundation, Inc.
+@c Copyright (C) 1988-2023 Free Software Foundation, Inc.
 
 @c This is part of the GCC manual.
 @c For copying conditions, see the file gcc.texi.
@@ -585,14 +585,14 @@ built-in functions as:
 intptr_t @var{buf}[5];
 @end smallexample
 
-@deftypefn {Built-in Function} {int} __builtin_setjmp (intptr_t *@var{buf})
+@defbuiltin{{int} __builtin_setjmp (intptr_t *@var{buf})}
 This function saves the current stack context in @var{buf}.  
 @code{__builtin_setjmp} returns 0 when returning directly,
 and 1 when returning from @code{__builtin_longjmp} using the same
 @var{buf}.
-@end deftypefn
+@enddefbuiltin
 
-@deftypefn {Built-in Function} {void} __builtin_longjmp (intptr_t *@var{buf}, 
int @var{val})
+@defbuiltin{{void} __builtin_longjmp (intptr_t *@var{buf}, int @var{val})}
 This function restores the stack context in @var{buf}, 
 saved by a previous call to @code{__builtin_setjmp}.  After
 @code{__builtin_longjmp} is finished, the program resumes execution as
@@ -604,7 +604,7 @@ mechanism to restore the stack context, it cannot be called
 from the same function calling @code{__builtin_setjmp} to
 initialize @var{buf}.  It can only be called from a function called
 (directly or indirectly) from the function calling @code{__builtin_setjmp}.
-@end deftypefn
+@enddefbuiltin
 
 @node Constructing Calls
 @section Constructing Function Calls
@@ -626,7 +626,7 @@ sophisticated features or other extensions of the language. 
 It
 is, therefore, not recommended to use them outside very simple
 functions acting as mere forwarders for their arguments.
 
-@deftypefn {Built-in Function} {void *} __builtin_apply_args ()
+@defbuiltin{{void *} __builtin_apply_args ()}
 This built-in function returns a pointer to data
 describing how to perform a call with the same arguments as are passed
 to the current function.
@@ -635,9 +635,9 @@ The function saves the arg pointer register, structure 
value address,
 and all registers that might be used to pass arguments to a function
 into a block of memory allocated on the stack.  Then it returns the
 address of that block.
-@end deftypefn
+@enddefbuiltin
 
-@deftypefn {Built-in Function} {void *} __builtin_apply (void 
(*@var{function})(), void *@var{arguments}, size_t @var{size})
+@defbuiltin{{void *} __builtin_apply (void (*@var{function})(), void 
*@var{arguments}, size_t @var{size})}
 This built-in function invokes @var{function}
 with a copy of the parameters described by @var{arguments}
 and @var{size}.
@@ -654,15 +654,15 @@ It is not always simple to compute the proper value for 
@var{size}.  The
 value is used by @code{__builtin_apply} to compute the amount of data
 that should be pushed on the stack and copied from the incoming argument
 area.
-@end deftypefn
+@enddefbuiltin
 
-@deftypefn {Built-in Function} {void} __builtin_return (void *@var{result})
+@defbuiltin{{void} __builtin_return (void *@var{result})}
 This built-in function returns the value described by @var{result} from
 the containing function.  You should specify, for @var{result}, a value
 returned by @code{__builtin_apply}.
-@end deftypefn
+@enddefbuiltin
 
-@deftypefn {Built-in Function} {} __builtin_va_arg_pack ()
+@defbuiltin{{} __builtin_va_arg_pack ()}
 This built-in function represents all anonymous arguments of an inline
 function.  It can be used only in inline functions that are always
 inlined, never compiled as a separate function, such as those using
@@ -686,9 +686,9 @@ myprintf (FILE *f, const char *format, ...)
   return r + s;
 @}
 @end smallexample
-@end 

[PATCH v2 5/5] update_web_docs_git: Update CSS reference to new manual CSS

2023-02-23 Thread Arsen Arsenović via Gcc-patches
maintainer-scripts/ChangeLog:

* update_web_docs_git (CSS): Update CSS reference to point to
/texinfo-manuals.css.
---
 maintainer-scripts/update_web_docs_git | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/maintainer-scripts/update_web_docs_git 
b/maintainer-scripts/update_web_docs_git
index dee9b1d3b5e..9ded1744df4 100755
--- a/maintainer-scripts/update_web_docs_git
+++ b/maintainer-scripts/update_web_docs_git
@@ -33,7 +33,7 @@ MANUALS="cpp
   libiberty
   porting"
 
-CSS=/gcc.css
+CSS=/texinfo-manuals.css
 
 WWWBASE=${WWWBASE:-"/www/gcc/htdocs"}
 WWWBASE_PREFORMATTED=/www/gcc/htdocs-preformatted
-- 
2.39.2



[PATCH v2 1/5] docs: Create Indices appendix

2023-02-23 Thread Arsen Arsenović via Gcc-patches
The GCC manual has multiple indices.  By creating an appendix which
lists them, we help makeinfo present a more accessible way for the
reader to see all the indices.

gcc/ChangeLog:

* doc/gcc.texi: Add the Indices appendix, to make texinfo
generate nice indices overview page.
(@copying): Move "This file documents the use of the GNU
compilers" into @copying.  Add quotations around cover texts.
---
 gcc/doc/gcc.texi | 33 ++---
 1 file changed, 22 insertions(+), 11 deletions(-)

diff --git a/gcc/doc/gcc.texi b/gcc/doc/gcc.texi
index 7019365429d..bc7cc6e6743 100644
--- a/gcc/doc/gcc.texi
+++ b/gcc/doc/gcc.texi
@@ -40,6 +40,9 @@
 @c %**end of header
 
 @copying
+This file documents the use of the GNU compilers.
+
+@quotation
 Copyright @copyright{} 1988-2023 Free Software Foundation, Inc.
 
 Permission is granted to copy, distribute and/or modify this document
@@ -59,6 +62,7 @@ Texts being (a) (see below), and with the Back-Cover Texts 
being (b)
  You have freedom to copy and modify this GNU Manual, like GNU
  software.  Copies published by the Free Software Foundation raise
  funds for GNU development.
+@end quotation
 @end copying
 @ifnottex
 @dircategory Software development
@@ -71,7 +75,6 @@ Texts being (a) (see below), and with the Back-Cover Texts 
being (b)
 * lto-dump: (gcc) lto-dump.@command{lto-dump}---Tool for
 dumping LTO object files.
 @end direntry
-This file documents the use of the GNU compilers.
 @sp 1
 @insertcopying
 @sp 1
@@ -159,8 +162,7 @@ object files.
 * GNU Free Documentation License:: How you can copy and share this manual.
 * Contributors::People who have contributed to GCC.
 
-* Option Index::Index to command line options.
-* Keyword Index::   Index of concepts and symbol names.
+* Indices:: List of indices in this manual.
 @end menu
 
 @include frontends.texi
@@ -196,19 +198,28 @@ object files.
 @c Indexes
 @c -
 
+@node Indices
+@appendix Indices
+
+@menu
+* Option Index::Index to command line options.
+* Concept and Symbol Index::Index of concepts and symbols names.
+@end menu
+
 @node Option Index
-@unnumbered Option Index
+@appendixsec Option Index
 
-GCC's command line options are indexed here without any initial @samp{-}
-or @samp{--}.  Where an option has both positive and negative forms
-(such as @option{-f@var{option}} and @option{-fno-@var{option}}),
-relevant entries in the manual are indexed under the most appropriate
-form; it may sometimes be useful to look up both forms.
+GCC's command line options are indexed here without any initial
+@samp{-} or @samp{--}.  Where an option has both positive and negative
+forms (such as @option{-f@var{option}} and
+@option{-fno-@var{option}}), relevant entries in the manual are
+indexed under the most appropriate form; it may sometimes be useful to
+look up both forms.
 
 @printindex op
 
-@node Keyword Index
-@unnumbered Keyword Index
+@node Concept and Symbol Index
+@appendixsec Concept and Symbol Index
 
 @printindex cp
 
-- 
2.39.2



[PATCH v2 0/5] A small Texinfo refinement

2023-02-23 Thread Arsen Arsenović via Gcc-patches
Morning,

(as said in
)

This is a rebase + slight amendment of the previous patch series visible
at:

https://inbox.sourceware.org/gcc-patches/cover.1674777149.git.ar...@aarsen.me/

The commit "docs: Reorder @opindex to be before corresponding options"
was already applied, and so, is dropped.

To reiterate and address comments from v1:

  - OK from Iain Buclaw for the D changes:
https://gcc.gnu.org/pipermail/gcc-patches/2023-January/610724.html
  - Thomas Schwinge noted that the commit message for 2/5 lacks context.
This should be addressed in this revision.
https://gcc.gnu.org/pipermail/gcc-patches/2023-February/612616.html
His idea of automatically checking for this error pattern will be
implemented separately, after I figure out how best to do that.  The
code that was involved in making this patchset is too primitive to
apply globally.

Some of the commits have been squashed into 2/5 also, as they were split
arbitrarily to avoid hitting email size constraints, but, turns out the
commits that were split weren't the problem in the first place :-).

This patchset still needs the wwwdocs change at:
https://inbox.sourceware.org/gcc-patches/20230127003224.717347-1-ar...@aarsen.me/
to add the stylesheet referenced in 5/5.

I've rerendered the updated documentation with latest development
Texinfo (as some of the changes I made for the purposes of the GCC
manual still aren't in releases) at:

  https://www.aarsen.me/~arsen/final/

... and the entire patchset can also be fetched from:

  https://git.sr.ht/~arsen/gcc texinfo_improvements

Arsen Arsenović (5):
  docs: Create Indices appendix
  **/*.texi: Reorder index entries
  doc: Add @defbuiltin family of helpers, set documentlanguage
  Update texinfo.tex, remove the @gol macro/alias
  update_web_docs_git: Update CSS reference to new manual CSS

 gcc/d/implement-d.texi |   66 +-
 gcc/doc/cfg.texi   |   12 +-
 gcc/doc/cpp.texi   |   12 +-
 gcc/doc/cppenv.texi|4 +-
 gcc/doc/cppopts.texi   |8 +-
 gcc/doc/extend.texi| 2564 
 gcc/doc/gcc.texi   |   36 +-
 gcc/doc/generic.texi   |2 +-
 gcc/doc/implement-c.texi   |2 +-
 gcc/doc/include/gcc-common.texi|   26 +-
 gcc/doc/include/texinfo.tex| 7599 +++-
 gcc/doc/install.texi   |6 +-
 gcc/doc/invoke.texi| 2854 -
 gcc/doc/md.texi|   25 +-
 gcc/doc/rtl.texi   |8 +-
 gcc/doc/sourcebuild.texi   |4 -
 gcc/doc/tm.texi|4 +-
 gcc/doc/tm.texi.in |4 +-
 gcc/doc/trouble.texi   |8 +-
 gcc/fortran/intrinsic.texi |  722 +--
 gcc/fortran/invoke.texi|  284 +-
 gcc/go/gccgo.texi  |   34 +-
 maintainer-scripts/update_web_docs_git |2 +-
 23 files changed, 8030 insertions(+), 6256 deletions(-)

Thanks in advance, have a lovely day.
-- 
2.39.2



Re: (rebased patchset) [PATCH 3/7] **/*.texi: Reorder index entries

2023-02-23 Thread Arsen Arsenović via Gcc-patches
Hi Gerald,

Thanks for the review.

Gerald Pfeifer  writes:

> I was going to push this, alas there are now rejects for
> fortran/invoke.texi, gcc/doc/invoke.texi and gcc/doc/cppopts.texi.
>
> If you can get me a rebased version I'll give it a try again. (Or
> are there some earlier dependencies? I tried to push what I feel
> comfortable at this point.)

Yeah, many of these reorder commits are mostly separate work to prevent
hitting the email size limit (and that still failed!), and so, they
are probably interdependent.

There have been changes to the documentation in-tree that should fall
within this patchset, though, and so, I've updated my repository again.
These might be the failures that you've seen, too.

I've also updated commit messages per Thomas' suggestion, so that they
are useful to those that lack the history of what went on to lead to
this change, and squashed some of the commits, so that they aren't as
arbitrarily split anymore.


HEAD 5f3c6b59f2d27a2caeaecabebb0e509006654c70 of

  https://git.sr.ht/~arsen/gcc texinfo_improvements

should be more appropriate, specifically, patch 3 now has 4 squashed
into it (commit 63dc28797802e4681872a0c0d127466f83fc2def), and so, we're
left with (from newest to oldest):

  5f3c6b59f2d update_web_docs_git: Update CSS reference to new manual CSS
  d9306db884d Update texinfo.tex, remove the @gol macro/alias
  435f4d1dbea doc: Add @defbuiltin family of helpers, set documentlanguage
  63dc2879780 **/*.texi: Reorder index entries
  c2327818bd7 docs: Create Indices appendix

I will send a v2, as this version has more manual changes than the
few rebases that have been done between pings.

> Gerald

Thanks again, have a lovely day.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: [PATCH 3/7] **/*.texi: Reorder index entries

2023-02-23 Thread Arsen Arsenović via Gcc-patches
Hi Thomas,

Thomas Schwinge  writes:

> Hi!
>
> On 2023-01-27T01:18:31+0100, Arsen Arsenović via Gcc-patches 
>  wrote:
>> Much like the previous commit, this change is mostly mechanical
>
> I find it helpful to see in the Git commit log some kind of rationale,
> instead of just the almost-useless GNU ChangeLog snippets.  ;-)

Yes, fair enough.  I forget that many will lack the lots of out-of-band
context that went into this change.  I'll push relevant amendments to my
repository.

>> with a
>> simple script.  I have, however, gone over the patch myself also, to see
>> if there's anything that ought to be kept as-is.
>
> Assuming that the script is safe to run automatically (no manual
> intervention necessary), I wonder: should that go into the GCC test suite
> (say, like 'gcc.src/maintainers.exp') or GCC build process (say, like
> 'gcc/Makefile.in:s-tm-texi'), to make sure that we're not regressing this
> again?

The script I wrote is a bit too dumb (there are, for instance, a few
hunks which I manually revert after running the script, because they
relate to comments, for instance), which is also why I skipped the Ada
manuals (the script would reformat a lot of code that is semantically
correct in terms of the problem this patchset is meant to be
addressing).  I was considering adding a warning to makeinfo to detect
when indices are placed in "odd" positions, such as on the ends of
paragraphs, in order to detect these errors; I haven't had the
opportunity to do that yet, though.

I do agree that it'd be nice to automatically detect this.

>> Formatter:
>>
>>   # GPL3+
>>   use v5.35;
>>   use strict;
>>   use warnings;
>>
>>   my @lineq = ();
>>   my @itemq = ();
>>   my @indxq = ();
>>   my $lstin = 0;
>>
>>   while (<>)
>> {
>>   push (@lineq, $_);
>>   if (/^\@[a-zA-Z0-9]{1,2}index\W/)
>> {
>>   $lstin = @lineq;
>>   push (@indxq, $_);
>>   next;
>> }
>>   if (/^\@itemx?\W/)
>> {
>>   $lstin = @lineq;
>>   push (@itemq, $_);
>>   next;
>> }
>>   next if $lstin && /^\s*(\@c(omment)?\W.*)?$/;
>>
>>   if (@indxq and @itemq)
>> {
>>   print @indxq;
>>   print @itemq;
>>   print @lineq[$lstin..@lineq-1];
>> }
>>   else
>> {
>>   print @lineq;
>> }
>>   @lineq = ();
>>   @itemq = ();
>>   @indxq = ();
>>   $lstin = 0;
>> }
>>
>>   if (@indxq and @itemq)
>> {
>>   print @indxq;
>>   print @itemq;
>>   print @lineq[$lstin..@lineq-1];
>> }
>>   else
>> {
>>   print @lineq;
>> }
>>
>>   # Local Variables:
>>   # indent-tabs-mode: nil
>>   # End:
>
>
> Grüße
>  Thomas
>
>
>> gcc/d/ChangeLog:
>>
>>   * implement-d.texi: Reorder index entries around @items.
>> [...]
>
>> --- a/gcc/d/implement-d.texi
>> +++ b/gcc/d/implement-d.texi
>> @@ -126,11 +126,11 @@ The following attributes are supported on most targets.
>>
>>  @table @code
>>
>> +@cindex @code{alloc_size} function attribute
>> +@cindex @code{alloc_size} variable attribute
>>  @item @@(gcc.attributes.alloc_size (@var{sizeArgIdx}))
>>  @itemx @@(gcc.attributes.alloc_size (@var{sizeArgIdx}, @var{numArgIdx}))
>>  @itemx @@(gcc.attributes.alloc_size (@var{sizeArgIdx}, @var{numArgIdx}, 
>> @var{zeroBasedNumbering}))
>> -@cindex @code{alloc_size} function attribute
>> -@cindex @code{alloc_size} variable attribute
>>
>>[...]
> -
> Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634
> München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas
> Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht
> München, HRB 106955

Thanks, have a lovely day.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Ping^2: [PATCH+wwwdocs 0/8] A small Texinfo refinement

2023-02-21 Thread Arsen Arsenović via Gcc-patches
Ping.  Like last time, I rebased the series.

The first two times around, I did not notice there's dedicated
maintainers for the documentation component, and so, I am adding Gerald,
Joseph and Sandra to CC this time.  Apologies for the omission.

Range-diff since last ping:

1:  6eba1548dfe = 1:  b61d9e238b7 docs: Create Indices appendix
2:  3f54e2c451f = 2:  c94a8f13471 docs: Reorder @opindex to be before 
corresponding options
3:  7821fcc2717 = 3:  99e2767db54 **/*.texi: Reorder index entries
4:  af9be5e8ae7 = 4:  de6e0e7de47 docs: Mechanically reorder item/index combos 
in extend.texi
5:  19e506d79a4 = 5:  9e5d534e373 doc: Add @defbuiltin family of helpers, set 
documentlanguage
6:  72e4c79fc60 ! 6:  ea16d17d4f5 Update texinfo.tex, remove the @gol 
macro/alias
@@ gcc/doc/invoke.texi: Options} and @ref{Objective-C and Objective-C++ 
Dialect Opt
 --Wunused-label @gol
 --Wunused-value @gol
 --Wunused-variable  @gol
---Wuse-after-free=3  @gol
+--Wuse-after-free=2  @gol
 --Wvla-parameter @r{(C and Objective-C only)} @gol
 --Wvolatile-register-var  @gol
 +@gccoptlist{-Waddress
@@ gcc/doc/invoke.texi: Options} and @ref{Objective-C and Objective-C++ 
Dialect Opt
 +-Wunused-label
 +-Wunused-value
 +-Wunused-variable
-+-Wuse-after-free=3
++-Wuse-after-free=2
 +-Wvla-parameter @r{(C and Objective-C only)}
 +-Wvolatile-register-var
  -Wzero-length-bounds}
7:  711d4564fc2 = 7:  e8e6669ba95 update_web_docs_git: Update CSS reference to 
new manual CSS

The following changes since commit f99303eb4aafef70075951731b3ad99266fe6225:

  d: Merge upstream dmd, druntime 09faa4eacd, phobos 13ef27a56. (2023-02-21 
15:33:38 +0100)

are available in the Git repository at:

  https://git.sr.ht/~arsen/gcc texinfo_improvements

for you to fetch changes up to e8e6669ba95ed6991e651fa5c238a3778b0ea745:

  update_web_docs_git: Update CSS reference to new manual CSS (2023-02-21 
15:55:56 +0100)


Arsen Arsenović (7):
  docs: Create Indices appendix
  docs: Reorder @opindex to be before corresponding options
  **/*.texi: Reorder index entries
  docs: Mechanically reorder item/index combos in extend.texi
  doc: Add @defbuiltin family of helpers, set documentlanguage
  Update texinfo.tex, remove the @gol macro/alias
  update_web_docs_git: Update CSS reference to new manual CSS

 gcc/d/gdc.texi |  144 +-
 gcc/d/implement-d.texi |   66 +-
 gcc/doc/cfg.texi   |   12 +-
 gcc/doc/cpp.texi   |   12 +-
 gcc/doc/cppdiropts.texi|   24 +-
 gcc/doc/cppenv.texi|4 +-
 gcc/doc/cppopts.texi   |   94 +-
 gcc/doc/cppwarnopts.texi   |   14 +-
 gcc/doc/extend.texi| 2564 +-
 gcc/doc/gcc.texi   |   36 +-
 gcc/doc/generic.texi   |2 +-
 gcc/doc/implement-c.texi   |2 +-
 gcc/doc/include/gcc-common.texi|   26 +-
 gcc/doc/include/texinfo.tex| 7599 +---
 gcc/doc/install.texi   |6 +-
 gcc/doc/invoke.texi| 8421 
 gcc/doc/lto.texi   |8 +-
 gcc/doc/md.texi|   25 +-
 gcc/doc/rtl.texi   |8 +-
 gcc/doc/sourcebuild.texi   |4 -
 gcc/doc/tm.texi|4 +-
 gcc/doc/tm.texi.in |4 +-
 gcc/doc/trouble.texi   |8 +-
 gcc/fortran/intrinsic.texi |  722 +--
 gcc/fortran/invoke.texi|  394 +-
 gcc/go/gccgo.texi  |   34 +-
 maintainer-scripts/update_web_docs_git |2 +-
 27 files changed, 11007 insertions(+), 9232 deletions(-)

Have a lovely day :)
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Ping: [wwwdocs] lists: Add documentation about the Sourceware public-inbox

2023-02-13 Thread Arsen Arsenović via Gcc-patches
Ping:
https://inbox.sourceware.org/gcc-patches/20230123012100.4021860-1-ar...@aarsen.me/

No further changes happened to the file between the post and today.

Have a lovely night :-)
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Ping: [PATCH+wwwdocs 0/8] A small Texinfo refinement

2023-02-13 Thread Arsen Arsenović via Gcc-patches
Ping on this patch.  I took the liberty to rebase it.  The changes are
minimal, so I didn't want to resend the entire patchset.  I included a
range diff and a pull request for your convenience.

The render is also updated, and ``make all && make html'' passes (which
is something I forgot to check last time, so tm.texi had some
complaints, apologies).

-:  --- > 1:  6eba1548dfe docs: Create Indices appendix
1:  3ac13e06ad7 ! 2:  3f54e2c451f docs: Reorder @opindex to be before 
corresponding options
@@ gcc/doc/invoke.texi: union U @{
  
  @end itemize
  
++@opindex -Wno-changes-meaning
+ @item -Wno-changes-meaning @r{(C++ and Objective-C++ only)}
+ C++ requires that unqualified uses of a name within a class have the
+ same meaning in the complete scope of the class, so declaring the name
+@@ gcc/doc/invoke.texi: error case can be reduced to a warning with
+ 
+ Both diagnostics are also suppressed by @option{-fms-extensions}.
+ 
 -@item -Wchar-subscripts
  @opindex Wchar-subscripts
  @opindex Wno-char-subscripts
@@ gcc/doc/invoke.texi: program may yield backtraces with different 
addresses due t
  @opindex fsanitize=kernel-address
 +@item -fsanitize=kernel-address
  Enable AddressSanitizer for Linux kernel.
- See @uref{https://github.com/google/kasan} for more details.
+ See @uref{https://github.com/google/kernel-sanitizers} for more details.
  
 -@item -fsanitize=hwaddress
  @opindex fsanitize=hwaddress
@@ gcc/doc/invoke.texi: For predictable results, you must also specify the 
same set
  Produce a shared object which can then be linked with other objects to
  form an executable.  Not all systems support this option.  For predictable
  results, you must also specify the same set of options used for 
compilation
-@@ gcc/doc/invoke.texi: to subtle defects.  Supplying them in cases where 
they are not necessary
- is innocuous. For x86, crtfastmath.o will not be added when
- @option{-shared} is specified. }
+@@ gcc/doc/invoke.texi: is innocuous.  @option{-shared} suppresses the 
addition of startup code
+ to alter the floating-point environment as done with @option{-ffast-math},
+ @option{-Ofast} or @option{-funsafe-math-optimizations} on some targets.}
  
 -@item -shared-libgcc
 -@itemx -static-libgcc
2:  7ff7376a83c ! 3:  7821fcc2717 **/*.texi: Reorder index entries
@@ Commit message
 * doc/invoke.texi: Ditto.
 * doc/md.texi: Ditto.
 * doc/rtl.texi: Ditto.
-* doc/tm.texi: Ditto.
+* doc/tm.texi.in: Ditto.
 * doc/trouble.texi: Ditto.
+* doc/tm.texi: Regenerate.
 
 gcc/fortran/ChangeLog:
 
@@ gcc/doc/tm.texi: boundary, to contain the local variables of the 
function.  On s
  this region and the save area may occur in the opposite order, with the
  save area closer to the top of the stack.
  
+-@item
+ @cindex @code{ACCUMULATE_OUTGOING_ARGS} and stack frames
++@item
+ Optionally, when @code{ACCUMULATE_OUTGOING_ARGS} is defined, a region of
+ @code{crtl->outgoing_args_size} bytes to be used for outgoing
+ argument lists of the function.  @xref{Stack Arguments}.
+
+ ## gcc/doc/tm.texi.in ##
+@@ gcc/doc/tm.texi.in: This section describes the macros that output 
function entry
+ @hook TARGET_ASM_FUNCTION_EPILOGUE
+ 
+ @itemize @bullet
+-@item
+ @findex pretend_args_size
+ @findex crtl->args.pretend_args_size
++@item
+ A region of @code{crtl->args.pretend_args_size} bytes of
+ uninitialized space just underneath the first argument arriving on the
+ stack.  (This may not be at the very start of the allocated stack region
+@@ gcc/doc/tm.texi.in: boundary, to contain the local variables of the 
function.  On some machines,
+ this region and the save area may occur in the opposite order, with the
+ save area closer to the top of the stack.
+ 
 -@item
  @cindex @code{ACCUMULATE_OUTGOING_ARGS} and stack frames
 +@item
3:  00cb8c6ad52 = 4:  af9be5e8ae7 docs: Mechanically reorder item/index combos 
in extend.texi
4:  af15b1b84cb ! 5:  19e506d79a4 doc: Add @defbuiltin family of helpers, set 
documentlanguage
@@ gcc/doc/extend.texi: myprintf (FILE *f, const char *format, ...)
 -@end deftypefn
 +@enddefbuiltin
  
--@deftypefn {Built-in Function} {size_t} __builtin_va_arg_pack_len ()
-+@defbuiltin{{size_t} __builtin_va_arg_pack_len ()}
+-@deftypefn {Built-in Function} {int} __builtin_va_arg_pack_len ()
++@defbuiltin{int __builtin_va_arg_pack_len ()}
  This built-in function returns the number of anonymous arguments of
  an inline function.  It can be used only in inline functions that
  are always inlined, never compiled as a separate function, such
@@ gcc/doc/extend.texi: forced to 

  1   2   >