Commit Graph

212558 Commits

Author SHA1 Message Date
Arthur Cohen
6a7d0e5dc6 gccrs: libformat_parser: Start experimenting with cbindgen
libgrust/ChangeLog:

	* libformat_parser/cbindgen.toml: New file.
	* libformat_parser/libformat-parser.h: New file.

gcc/rust/ChangeLog:

	* ast/rust-fmt.h: Add remaining FFI types.
2024-08-01 13:11:28 +02:00
Arthur Cohen
8647682e5a gccrs: libformat_parser: Add FFI safe interface
libgrust/ChangeLog:

	* libformat_parser/generic_format_parser/src/lib.rs: Add generic
	library.
	* libformat_parser/src/lib.rs: Add base for FFI interface.
2024-08-01 13:11:28 +02:00
Thomas Schwinge
8e284d026e Rust: Move 'libformat_parser' build into libgrust
Addresses #2883.

	contrib/
	* gcc_update (files_and_dependencies): Update for
	'libformat_parser' in libgrust.
	gcc/rust/
	* Make-lang.in (LIBFORMAT_PARSER): Point to 'libformat_parser'
	build in libgrust.
	(%.toml:, $(LIBFORMAT_PARSER):): Remove.
	libgrust/
	* libformat_parser/Makefile.am: New.
	* Makefile.am [!TARGET_LIBRARY] (SUBDIRS): Add 'libformat_parser'.
	* configure.ac: Handle it.
	(TARGET_LIBRARY): New 'AM_CONDITIONAL'.
	* libformat_parser/Makefile.in: Generate.
	* Makefile.in: Regenerate.
	* configure: Likewise.
2024-08-01 13:11:28 +02:00
Thomas Schwinge
acf10f83ab Rust: Move 'libformat_parser' build into the GCC build directory
Fixes #2883.

gcc/rust/ChangeLog:
	* Make-lang.in (LIBFORMAT_PARSER): Point to the GCC build
	directory.
	* ($(LIBFORMAT_PARSER)): Build in the GCC build directory.
2024-08-01 13:11:03 +02:00
Thomas Schwinge
96a5c5bd28 Rust: Don't cache 'libformat_parser.a'
gcc/rust/
	* Make-lang.in (LIBFORMAT_PARSER): Point to the actual build artifact.
	($(LIBFORMAT_PARSER)): Don't cache it.
2024-08-01 12:48:55 +02:00
Arthur Cohen
7e1d64a5dc gccrs: libgrust: Vendor Rust dependencies
This commits vendors and locks our dependencies so that our Rust components
do not need internet access to be built anymore. Tested in a docker container
with no network access.

We can think about merging the vendor directory once we have more than one
Rust component, e.g. when we add polonius to the mix.

libgrust/ChangeLog:

	* libformat_parser/.cargo/config: New file.
	* libformat_parser/vendor.NOTES: New file.
	* libformat_parser/vendor/libc/.cargo-checksum.json: New file.
	* libformat_parser/vendor/libc/CONTRIBUTING.md: New file.
	* libformat_parser/vendor/libc/Cargo.toml: New file.
	* libformat_parser/vendor/libc/LICENSE-APACHE: New file.
	* libformat_parser/vendor/libc/LICENSE-MIT: New file.
	* libformat_parser/vendor/libc/README.md: New file.
	* libformat_parser/vendor/libc/build.rs: New file.
	* libformat_parser/vendor/libc/rustfmt.toml: New file.
	* libformat_parser/vendor/libc/src/fixed_width_ints.rs: New file.
	* libformat_parser/vendor/libc/src/fuchsia/aarch64.rs: New file.
	* libformat_parser/vendor/libc/src/fuchsia/align.rs: New file.
	* libformat_parser/vendor/libc/src/fuchsia/mod.rs: New file.
	* libformat_parser/vendor/libc/src/fuchsia/no_align.rs: New file.
	* libformat_parser/vendor/libc/src/fuchsia/riscv64.rs: New file.
	* libformat_parser/vendor/libc/src/fuchsia/x86_64.rs: New file.
	* libformat_parser/vendor/libc/src/hermit/aarch64.rs: New file.
	* libformat_parser/vendor/libc/src/hermit/mod.rs: New file.
	* libformat_parser/vendor/libc/src/hermit/x86_64.rs: New file.
	* libformat_parser/vendor/libc/src/lib.rs: New file.
	* libformat_parser/vendor/libc/src/macros.rs: New file.
	* libformat_parser/vendor/libc/src/psp.rs: New file.
	* libformat_parser/vendor/libc/src/sgx.rs: New file.
	* libformat_parser/vendor/libc/src/solid/aarch64.rs: New file.
	* libformat_parser/vendor/libc/src/solid/arm.rs: New file.
	* libformat_parser/vendor/libc/src/solid/mod.rs: New file.
	* libformat_parser/vendor/libc/src/switch.rs: New file.
	* libformat_parser/vendor/libc/src/teeos/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/aix/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/aix/powerpc64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/apple/b32/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/apple/b32/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/aarch64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/aarch64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/x86_64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/x86_64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/apple/long_array.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/apple/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/dragonfly/errno.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/arm.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/b64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/b64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd13/b64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd13/x86_64.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd14/b64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd14/x86_64.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd15/b64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd15/x86_64.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/powerpc.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/riscv64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/x86.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/x86_64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/aarch64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/arm.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/mips.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/powerpc.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/riscv64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/sparc64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/x86.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/x86_64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/aarch64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/arm.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/mips64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/powerpc.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/powerpc64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/riscv64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/sparc64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/x86.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/x86_64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/haiku/b32.rs: New file.
	* libformat_parser/vendor/libc/src/unix/haiku/b64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/haiku/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/haiku/native.rs: New file.
	* libformat_parser/vendor/libc/src/unix/haiku/x86_64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/hurd/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/hurd/b32.rs: New file.
	* libformat_parser/vendor/libc/src/unix/hurd/b64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/hurd/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/hurd/no_align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b32/arm.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b32/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b32/x86/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b32/x86/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/aarch64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/aarch64/int128.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/aarch64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/riscv64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/riscv64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/x86_64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/x86_64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/emscripten/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/emscripten/lfs64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/emscripten/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/emscripten/no_align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/arch/generic/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/arch/mips/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/arch/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/arch/powerpc/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/arch/sparc/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/arm/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/arm/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/csky/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/csky/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/m68k/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/mips/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/mips/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/powerpc.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/riscv32/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/sparc/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/x86/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/x86/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/fallback.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/ilp32.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/int128.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/lp64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/loongarch64/align.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/mips64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/powerpc64/align.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/riscv64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/s390x.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/sparc64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/no_align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/arm/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/arm/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/hexagon.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/mips/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/mips/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/powerpc.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/riscv32/align.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/x86/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/x86/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/aarch64/align.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/aarch64/int128.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/mips64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/powerpc64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/riscv64/align.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/s390x.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/x86_64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/lfs64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/no_align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/non_exhaustive.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/arm/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/arm/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/arm/no_align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips32/align.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips32/no_align.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips64/align.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips64/mod.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips64/no_align.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/no_align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/x86_64/l4re.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/x86_64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/x86_64/other.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/newlib/aarch64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/newlib/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/newlib/arm/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/newlib/espidf/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/newlib/generic.rs: New file.
	* libformat_parser/vendor/libc/src/unix/newlib/horizon/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/newlib/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/newlib/no_align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/newlib/powerpc/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/newlib/vita/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/no_align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/nto/aarch64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/nto/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/nto/neutrino.rs: New file.
	* libformat_parser/vendor/libc/src/unix/nto/x86_64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/redox/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/solarish/compat.rs: New file.
	* libformat_parser/vendor/libc/src/unix/solarish/illumos.rs: New file.
	* libformat_parser/vendor/libc/src/unix/solarish/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/solarish/solaris.rs: New file.
	* libformat_parser/vendor/libc/src/unix/solarish/x86.rs: New file.
	* libformat_parser/vendor/libc/src/unix/solarish/x86_64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/solarish/x86_common.rs: New file.
	* libformat_parser/vendor/libc/src/vxworks/aarch64.rs: New file.
	* libformat_parser/vendor/libc/src/vxworks/arm.rs: New file.
	* libformat_parser/vendor/libc/src/vxworks/mod.rs: New file.
	* libformat_parser/vendor/libc/src/vxworks/powerpc.rs: New file.
	* libformat_parser/vendor/libc/src/vxworks/powerpc64.rs: New file.
	* libformat_parser/vendor/libc/src/vxworks/x86.rs: New file.
	* libformat_parser/vendor/libc/src/vxworks/x86_64.rs: New file.
	* libformat_parser/vendor/libc/src/wasi.rs: New file.
	* libformat_parser/vendor/libc/src/windows/gnu/align.rs: New file.
	* libformat_parser/vendor/libc/src/windows/gnu/mod.rs: New file.
	* libformat_parser/vendor/libc/src/windows/mod.rs: New file.
	* libformat_parser/vendor/libc/src/windows/msvc/mod.rs: New file.
	* libformat_parser/vendor/libc/src/xous.rs: New file.
	* libformat_parser/vendor/libc/tests/const_fn.rs: New file.
	* libformat_parser/vendor/unicode-xid/.cargo-checksum.json: New file.
	* libformat_parser/vendor/unicode-xid/COPYRIGHT: New file.
	* libformat_parser/vendor/unicode-xid/Cargo.toml: New file.
	* libformat_parser/vendor/unicode-xid/LICENSE-APACHE: New file.
	* libformat_parser/vendor/unicode-xid/LICENSE-MIT: New file.
	* libformat_parser/vendor/unicode-xid/README.md: New file.
	* libformat_parser/vendor/unicode-xid/benches/xid.rs: New file.
	* libformat_parser/vendor/unicode-xid/src/lib.rs: New file.
	* libformat_parser/vendor/unicode-xid/src/tables.rs: New file.
	* libformat_parser/vendor/unicode-xid/src/tests.rs: New file.
	* libformat_parser/vendor/unicode-xid/tests/exhaustive_tests.rs: New file.
2024-08-01 12:47:19 +02:00
Thomas Schwinge
2340894554 gccrs: Add 'gcc/rust/Make-lang.in:LIBFORMAT_PARSER'
... to avoid verbatim repetition.

	gcc/rust/
	* Make-lang.in (LIBPROC_MACRO_INTERNAL): New.
	(RUST_LIBDEPS, crab1$(exeext), rust/libformat_parser.a): Use it.
2024-08-01 12:47:19 +02:00
Arthur Cohen
6fef4d6ffc gccrs: libgrust: Add format_parser library
Compile libformat_parser and link to it.

gcc/rust/ChangeLog:

	* Make-lang.in: Compile libformat_parser.
	* ast/rust-fmt.cc: New FFI definitions.
	* ast/rust-fmt.h: Likewise.
	* expand/rust-macro-builtins.cc (MacroBuiltin::format_args_handler): Call
	into libformat_parser.
	* expand/rust-macro-builtins.h: Define format_args!() handler proper.

libgrust/ChangeLog:

	* libformat_parser/Cargo.lock: New file.
	* libformat_parser/Cargo.toml: New file.
	* libformat_parser/generic_format_parser/Cargo.toml: New file.
	* libformat_parser/generic_format_parser/src/lib.rs: New file.
	* libformat_parser/src/bin.rs: New file.
	* libformat_parser/src/lib.rs: New file.
2024-08-01 12:47:19 +02:00
Arthur Cohen
473feb033d gccrs: fmt: Start working on format_args!() parser
This commit adds a base class for parsing the various constructs of a
Rust format string, according to the grammar in the reference:

https://doc.rust-lang.org/std/fmt/index.html#syntax

gcc/rust/ChangeLog:

	* Make-lang.in: Compile rust-fmt object
	* ast/rust-fmt.cc: New file.
	* ast/rust-fmt.h: New file.
2024-08-01 12:47:18 +02:00
Marc Poulhiès
a58f7df147 gccrs: minor cleanup in langhook.type_for_mode
gcc/rust/ChangeLog:

	* rust-lang.cc (grs_langhook_type_for_mode): simplify code for
	xImode. Add missing long_double_type_node.

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
2024-08-01 12:47:18 +02:00
Owen Avery
8319fa7847 gccrs: Fix false positive for top-level AltPattern
gcc/rust/ChangeLog:

	* hir/rust-ast-lower-pattern.cc
	(ASTLoweringPattern::visit):
	Reset is_let_top_level while visiting GroupedPattern.

gcc/testsuite/ChangeLog:

	* rust/compile/let_alt.rs: Check for false positive.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-08-01 12:47:18 +02:00
Thomas Schwinge
5f9e88211c Rust: Make 'tree'-level 'MAIN_NAME_P' work
'gcc/tree.h':

    #define main_identifier_node		global_trees[TI_MAIN_IDENTIFIER]
    #define MAIN_NAME_P(NODE) \
      (IDENTIFIER_NODE_CHECK (NODE) == main_identifier_node)

..., which is not initialized by default, but has to be set up by every front
end individually.  'MAIN_NAME_P' enables certain code optimizations, but is
especially also relevant for back ends that emit additional program entry setup
code for 'main'.

	gcc/rust/
	* backend/rust-compile-base.cc (HIRCompileBase::compile_function):
	For 'main', initialize 'main_identifier_node'.
2024-08-01 12:47:18 +02:00
Richard Biener
ed03af4ef3 tree-optimization/114659 - VN and FP to int punning
The following addresses another case where x87 FP loads mangle the
bit representation and thus are not suitable for a representative
in other types.  VN was value-numbering a later integer load of 'x'
as the same as a former float load of 'x'.

We can use the new TARGET_MODE_CAN_TRANSFER_BITS hook to identify
problematic modes and enforce strict compatibility for those in
the reference comparison, improving the handling of modes with
padding in visit_reference_op_load.

	PR tree-optimization/114659
	* tree-ssa-sccvn.cc (visit_reference_op_load): Do not
	prevent punning from modes with padding here, but ...
	(vn_reference_eq): ... ensure this here, also honoring
	types with modes that cannot act as bit container.

	* gcc.target/i386/pr114659.c: New testcase.
2024-08-01 12:27:53 +02:00
Richard Biener
c71646436a [x86] implement TARGET_MODE_CAN_TRANSFER_BITS
The following implements the hook, excluding x87 modes for scalar
and complex float modes.

	* config/i386/i386.cc (TARGET_MODE_CAN_TRANSFER_BITS): Define.
	(ix86_mode_can_transfer_bits): New function.
2024-08-01 12:27:47 +02:00
Richard Biener
b3974356b0 Add TARGET_MODE_CAN_TRANSFER_BITS
The following adds a target hook to specify whether regs of MODE can be
used to transfer bits.  The hook is supposed to be used for value-numbering
to decide whether a value loaded in such mode can be punned to another
mode instead of re-loading the value in the other mode and for SRA to
decide whether MODE is suitable as container holding a value to be
used in different modes.

	* target.def (mode_can_transfer_bits): New target hook.
	* target.h (mode_can_transfer_bits): New function wrapping the
	hook and providing default behavior.
	* doc/tm.texi.in: Update.
	* doc/tm.texi: Re-generate.
2024-08-01 12:27:04 +02:00
Georg-Johann Lay
3e4c47d108 AVR: Tweak unsigned comparisons against 256 resp. 65536.
u16 >= 256 can be performed by testing the hi8 part against 0.
u32 >= 65536 can be performed by testing the high word against 0.
The optimization is performed in split2 after register allocation
because the register allocator likely spills for subregs.

gcc/
	* config/avr/avr.md (cbranch<mode>4_insn): Split to a test of the
	high part against 0 if possible.
2024-08-01 10:42:36 +02:00
Georg-Johann Lay
d050484797 AVR: Tweak register pressure for const_fixed compares against "M".
When comparing a 16-bit or 32-bit integer against a constant in
the range 0...0xff, constraint M is used because no scratch reg
is needed in that case.  Same can be done for fixed-point compares.

gcc/
	* config/avr/constraints.md (YMM): New constraint.
	* config/avr/avr.md (cmp<mode>3, *cmp<mode>3)
	(cbranch<mode>4_insn): Allow YMM where M is allowed.
2024-08-01 10:42:35 +02:00
Jakub Jelinek
df2b444a23 i386: Fix up *<extract_type>_vinsert<shuffletype><extract_suf>_0 [PR115981]
The r14-537 change started canonicalizing VEC_MERGE operands based on
swap_commutative_operands_p or if they have the same precedence least
significant bit of the third operand.
The *<extract_type>_vinsert<shuffletype><extract_suf>_0 pattern was
added for combine matching and no longer triggers after that change,
as it used the reg_or_0_operand as the first operand and VEC_DUPLICATE
as the second.
Now, reg_or_0_operand could be a REG, SUBREG of object or CONST_VECTOR.
REG has commutative_operand_precedence -1 or -2, SUBREG of object -3,
CONST_VECTOR -4, while VEC_DUPLICATE has 0, so VEC_DUPLICATE will always
go first and REG, SUBREG or CONST_VECTOR second.

This patch swaps the operands so that it matches again.

2024-08-01  Jakub Jelinek  <jakub@redhat.com>

	PR target/115981
	* config/i386/sse.md
	(*<extract_type>_vinsert<shuffletype><extract_suf>_0): Swap the
	first two VEC_MERGE operands, renumber match_operands and test
	for 0xF or 0x3 rather than 0xFFF0 or 0xFC immediate.

	* gcc.target/i386/avx512dq-pr90991-1.c: Add tests for no separate
	zero extension instructions.
	* gcc.target/i386/avx512dq-pr90991-2.c: Likewise.
2024-08-01 10:32:54 +02:00
Tobias Burnus
c99cdcab4f omp-offload.cc: Fix value-expr handling of 'declare target link' vars [PR115637]
As the PR and included testcase shows, replacing 'arr2' by its value expression
'*arr2$13$linkptr' failed for
  MEM <uint128_t> [(c_char * {ref-all})&arr2]
which left 'arr2' in the code as unknown symbol. Now expand the value expression
already in pass_omp_target_link::execute's process_link_var_op walk_gimple_stmt
walk - and don't rely on gimple_regimplify_operands.

	PR middle-end/115637

gcc/ChangeLog:

	* gimplify.cc (gimplify_body): Fix macro name in the comment.
	* omp-offload.cc (find_link_var_op): Rename to ...
	(process_link_var_op): ... this. Replace value expr.
	(pass_omp_target_link::execute): Update walk_gimple_stmt call.

libgomp/ChangeLog:

	* testsuite/libgomp.fortran/declare-target-link.f90: Uncomment
	now working code.

Co-authored-by: Richard Biener <rguenther@suse.de
2024-08-01 09:06:32 +02:00
Lingling Kong
25dba615e3 i386: Remove ndd support for *add<mode>_4 [PR113744]
*add<mode>_4 and *adddi_4 are for shorter opcode from cmp to
inc/dec or add $128. But NDD code is longer than the cmp code,
so there is no need to support ndd.

gcc/ChangeLog:

	PR target/113744
	* config/i386/i386.md (*add<mode>_4): Remove ndd support.
	(*adddi_4): Ditto.

Co-Authored-By: Hu, Lin1 <lin1.hu@intel.com>
2024-08-01 11:09:19 +08:00
Xiao Zeng
edad1b0501 RISC-V: NFC: Do not use zicond for pr105314 testcases
gcc/testsuite/ChangeLog:

	* gcc.target/riscv/pr105314-rtl.c: Skip zicond.
	* gcc.target/riscv/pr105314-rtl32.c: Ditto.
	* gcc.target/riscv/pr105314.c: Ditto.

Signed-off-by: Xiao Zeng <zengxiao@eswincomputing.com>
2024-08-01 11:01:02 +08:00
Mark Harmstone
4c88b4e635 Fix ICE when using -gcodeview with empty struct
Empty structs result in empty LF_FIELDLIST types, which are valid, but
we weren't accounting for this and assuming they had to contain
subtypes.

gcc/
	* dwarf2codeview.cc (get_type_num_struct): Fix NULL pointer dereference.
2024-08-01 02:36:54 +01:00
David Malcolm
64fbaf36a3 testsuite: split out parts of jit.dg/jit.exp into a new lib/valgrind.exp
I want to reuse some of the support for valgrind in jit.exp
in my upcoming testsuite for https://gcc.gnu.org/wiki/libdiagnostics
so this patch splits that out into a valgrind.exp.

No functional change intended.

gcc/testsuite/ChangeLog:
	* jit.dg/jit.exp: Add load_lib valgrind.exp.
	(proc report_leak): Move to valgrind.exp, and add argument
	leak_report_function rather than hardcoding xfail.
	(parse_valgrind_logfile): Likewise.
	(fixed_host_execute): Pass xfail to parse_valgrind_logfile.
	* lib/valgrind.exp: New file, based on the above.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-07-31 20:38:41 -04:00
David Malcolm
55982d1682 diagnostics: handle logical locations with NULL name
gcc/ChangeLog:
	* diagnostic-path.cc
	(thread_event_printer::print_swimlane_for_event_range): Gracefully
	handle logical_location::get_name_for_path_output returning null.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-07-31 20:38:41 -04:00
David Malcolm
5cb7adeaf5 testsuite: drop unused import within sarif.py
No functional change intended.

gcc/testsuite/ChangeLog:
	* gcc.dg/sarif-output/sarif.py: Drop unused import of gzip.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-07-31 20:38:41 -04:00
David Malcolm
a874b8301d diagnostics: SARIF output: capture unlabelled secondary locations
This patch extends
* the work done in r15-2291-gd7a688fc960f78 to capture labels
  on location ranges in rich_locations in SARIF form as
  "annotations" (§3.28.6)
* the work done in r15-2354-g4d1f71d49e396c to support
  related locations (§3.27.22 and §3.34)

so that all location ranges in a rich_location now get captured in
the SARIF output:
- those with a label are handled as before as "annotations" (§3.28.6),
  per r15-2291-gd7a688fc960f78
- those without a label now get captured, in the result's
  "relatedLocations" (§3.27.22)

For example, given:

  int missing_semicolon (void)
  {
    return 42
  }

for which the textual output looks like this:

  PATH/missing-semicolon.c: In function 'missing_semicolon':
  PATH/missing-semicolon.c:9:12: error: expected ';' before '}' token
      9 |   return 42
        |            ^
        |            ;
     10 | }
        | ~

with this patch the SARIF output now has this for the result's location:

   "relationships": [{"target": 0,
                      "kinds": ["relevant"]}]}],

where the result gains a related location :

  "relatedLocations": [{"physicalLocation": {"artifactLocation": { [...snip...] },
                                             "region": {"startLine": 10,
                                                        "startColumn": 1,
                                                        "endColumn": 2},
                                             "contextRegion": {"startLine": 10,
                                                               "snippet": {"text": "}\n"}}},
                        "id": 0}]}]}]}

i.e. that the error also has the secondary location at the trailing
close brace which has the relationship "relevant" to the primary
location (at the suggested insertion point).

The patch also adds test coverage for the SARIF encoding of the fix-it hint.

gcc/ChangeLog:
	* diagnostic-format-sarif.cc
	(sarif_location_manager::worklist_item::unlabelled_secondary_location):
	New enum value.
	(sarif_location_manager::m_unlabelled_secondary_locations): New
	field.
	(sarif_location_manager::process_worklist_item): Handle unlabelled
	secondary locations.
	(sarif_builder::make_location_object): Generalize code to handle
	ranges within a rich_location so as well as using annotations for
	those with labels, we now add related locations for those without
	labels.

gcc/testsuite/ChangeLog:
	* gcc.dg/sarif-output/missing-semicolon.c: New test.
	* gcc.dg/sarif-output/sarif.py (get_location_physical_region): New.
	(get_location_snippet_text): New.
	* gcc.dg/sarif-output/test-missing-semicolon.py: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-07-31 20:38:41 -04:00
David Malcolm
c990667996 diagnostics: SARIF output: eliminate some uses of "line_table" global
No functional change intended.

gcc/ChangeLog:
	* diagnostic-format-sarif.cc (sarif_builder::sarif_builder): Assert
	that m_line_maps is nonnull.
	(diagnostic_output_format_init_sarif_stderr): Add "line_maps"
	param and pass to format ctor.
	(diagnostic_output_format_init_sarif_file): Likewise.
	(diagnostic_output_format_init_sarif_stream): Likewise.
	* diagnostic.cc (diagnostic_output_format_init): Pass "line_table"
	as line_maps param to the above.
	* diagnostic.h (diagnostic_output_format_init_sarif_stderr): Add
	"line_maps" param.
	(diagnostic_output_format_init_sarif_file): Likewise.
	(diagnostic_output_format_init_sarif_stream): Likewise.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-07-31 20:38:40 -04:00
David Malcolm
f829e627f4 diagnostics: SARIF output: tweak ASCII art in comment
gcc/ChangeLog:
	* diagnostic-format-sarif.cc: Tweak ASCII art in comment
	to show edges for both directions in the digraph.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2024-07-31 20:38:40 -04:00
GCC Administrator
22c62d33ec Daily bump. 2024-08-01 00:19:03 +00:00
François Dumont
787f2d52d5 libstdc++: Fix unexpected compilation error in neg tests
Fix a compilation error that is not expected by the tests preserving
the expected ones.

The 'test' variable declaration is missing since commit
a9260b7eb6 that removed the test global
variable in testsuite files.

libstdc++-v3/ChangeLog:

	* testsuite/23_containers/map/operators/1_neg.cc (test01): Add test variable
	declaration.
	* testsuite/23_containers/set/operators/1_neg.cc (test01): Likewise.
2024-07-31 22:39:15 +02:00
Jonathan Wakely
e7d88ff8aa libstdc++: Fix src/c++20/format.cc for non-gthreads targets
libstdc++-v3/ChangeLog:

	* src/c++20/format.cc [!_GLIBCXX_HAS_GTHREADS] (mutex): Define
	dummy mutex type.
	* testsuite/std/time/format_localized.cc: Use loop variable
	instead of creating the same locale on every iteration.
2024-07-31 21:25:29 +01:00
Jerry DeLisle
6886f1c164 Fortran: Add newline character to test input.
gcc/testsuite/ChangeLog:

	PR libfortran/105361

	* gfortran.dg/pr105361.f90: Add newline character to test
	input to provide more compliant test.
2024-07-31 12:56:50 -07:00
Andrew Pinski
c65653f568 match: Fix types matching for (?:) !=/== (?:) [PR116134]
The problem here is that in generic types of comparisons don't need
to be boolean types (or vector boolean types). And fixes that by making
sure the types of the conditions match before doing the optimization.

Bootstrapped and tested on x86_64-linux-gnu with no regressions.

	PR middle-end/116134

gcc/ChangeLog:

	* match.pd (`(a ? x : y) eq/ne (b ? x : y)`): Check that
	a and b types match.
	(`(a ? x : y) eq/ne (b ? y : x)`): Likewise.

gcc/testsuite/ChangeLog:

	* gcc.dg/torture/pr116134-1.c: New test.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2024-07-31 12:26:14 -07:00
Arsen Arsenović
ebf4f09556 dir-locals: apply our C settings in C++ also
This also works with Emacs 30 Tree-Sitter C and C++ modes, as they are
submodes.

ChangeLog:

	* .dir-locals.el: Change c-mode to a list of C, C++ and ObjC
	modes that Emacs currently provides.
2024-07-31 20:38:27 +02:00
Jeff Law
69a9ee05c6 [target/116104] Fix more rtl-checking failures in ext-dce
More enable-rtl-checking fixes for ext-dce.  Very similar to the one recently
posted, this time covering more of the shift ops.

I checked all instances of CONSTANT_P guarding [U]INTVAL and fixed all that
looked wrong.  I also created a dummy assembler/linker so that I could run the
GCC testsuite on gcn and verified that wasn't tripping any rtl-checking bugs in
ext-dce anymore.

Obviously this has also gone through x86 bootstrap and regression tested.

Pushing to the trunk.

	pr target/116104
gcc/
	* ext-dce.cc (carry_backpropagate): Change more guards of [U]INTVAL to
	test CONST_INT_P rather than CONSTANT_P, fixing rtl-checking failures.
2024-07-31 11:32:30 -06:00
Dimitar Dimitrov
dcdefe47e1 pru: Enable section anchoring by default
Loading an arbitrary constant address in a register is expensive for
PRU.  So enable section anchoring by default to utilize the unsigned
byte constant offset operand of load/store instructions.

gcc/ChangeLog:

	* common/config/pru/pru-common.cc
	(TARGET_OPTION_OPTIMIZATION_TABLE): New definition.
	* config/pru/pru.cc (TARGET_MIN_ANCHOR_OFFSET): Set minimal
	anchor offset.
	(TARGET_MAX_ANCHOR_OFFSET): Set maximum anchor offset.

gcc/testsuite/ChangeLog:

	* gcc.target/pru/section-anchors-1.c: New test.
	* gcc.target/pru/section-anchors-2.c: New test.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2024-07-31 19:45:05 +03:00
Dimitar Dimitrov
f2fac50209 testsuite: Fix for targets not passing argc/argv [PR116154]
PRU and other simulator targets do not pass any argv arguments
to main.  Instead of erroneously relying on argc==0, use a volatile
variable instead.

I reverted the fix for PR67947 in r6-3891-g8a18fcf4aa1d5c, and made sure
that the updated test case still fails for x86_64:

  $ make check-gcc-c RUNTESTFLAGS="dg-torture.exp=pr67947.c"
  ...
  FAIL: gcc.dg/torture/pr67947.c   -O1  execution test
  ...
  # of expected passes            8
  # of unexpected failures        8

Fix was suggested by Andrew Pinski in PR116154.  Committed as obvious.

	PR testsuite/116154

gcc/testsuite/ChangeLog:

	* gcc.dg/torture/pr67947.c: Use volatile variable instead of
	argc.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2024-07-31 19:38:03 +03:00
Sam James
f722126723 libstdc++: drop bogus 'dg_do run' directive
We already have a valid 'dg-do run' (- vs _) directive, so drop the bogus
one.

libstdc++-v3/ChangeLog:
	* testsuite/28_regex/traits/char/translate.cc: Drop bogus 'dg_do run'.
2024-07-31 17:22:42 +01:00
Jeff Law
89ed5ab210 [PR rtl-optimization/116136] Fix previously latent SUBREG simplification bug
This fixes a testsuite regression seen on m68k after some of the recent ext-dce
changes.  Ultimately Richard S and I have concluded the bug was a latent issue
in subreg simplification.

Essentially when simplifying something like

(set (target:M1) (subreg:M1 (subreg:M2 (reg:M1) 0) 0))

Where M1 > M2.  We'd simplify to:

(set (target:M1) (reg:M1))

The problem is on a big endian target that's wrong.   Consider if M1 is DI and
M2 is SI.    The original should extract bits 32..63 from the source register
and store them into bits 0..31 of the target register. In the simplified form
it's just a copy, so bits 0..63 of the source end up bits 0..63 of the target.

This shows up as the following regressions on the m68k:

> Tests that now fail, but worked before (3 tests):
>
> gcc: gcc.c-torture/execute/960416-1.c   -O2  execution test
> gcc: gcc.c-torture/execute/960416-1.c   -O2 -flto -fno-use-linker-plugin -flto-partition=none  execution test
> gcc: gcc.c-torture/execute/960416-1.c   -Os  execution test

The fix is pretty trivial, instead of hardcoding "0" as the byte offset in the
test for the simplification, instead we need to use the subreg_lowpart_offset.

Anyway, bootstrapped and regression tested on m68k and x86_64 and tested on the
other embedded targets as well without regressions.  Naturally it fixes the
regression noted above.  I haven't see other testsuite improvements when I spot
checked some of the big endian crosses.

	PR rtl-optimization/116136
gcc/
	* simplify-rtx.cc (simplify_context::simplify_subreg): Check
	that we're working with the lowpart offset rather than byte 0.
2024-07-31 10:16:59 -06:00
Jonathan Wakely
ee4cc961ce libstdc++: Handle strerror returning null
The linux man page for strerror says that some systems return NULL for
an unknown error number. That violates the C and POSIX standards, but we
can esily handle it to avoid a segfault.

libstdc++-v3/ChangeLog:

	* src/c++11/system_error.cc (strerror_string): Handle
	non-conforming NULL return from strerror.
2024-07-31 17:07:11 +01:00
Jonathan Wakely
5dd1f0d69f libstdc++: Only append "@euro" to locale names for Glibc testing
The testsuite automatically appends "@euro" to "xx.ISO8859-15" locale
names on all targets except FreeBSD, DragonflyBSD, and NetBSD. It should
only be for Glibc, not all non-BSD targets.

libstdc++-v3/ChangeLog:

	* testsuite/lib/libstdc++.exp (check_v3_target_namedlocale):
	Only append "@euro" to ".ISO8859-15" locales for Glibc.
2024-07-31 17:07:11 +01:00
Jonathan Wakely
96f789d25f libstdc++: Bump __cpp_lib_format value for std::runtime_format
We already supported this feature, but couldn't set the feature test
macro accordingly because we were missing support for older features.
Now that we support all the older <format> changes, we can set this to
the correct value.

libstdc++-v3/ChangeLog:

	* include/bits/version.def (format): Update value for C++26.
	* include/bits/version.h: Regenerate.
	* include/std/format (runtime_format, wruntime_format): Check
	__cpp_lib_format instead of __cplusplus.
	* testsuite/std/format/functions/format.cc: Update expected
	value of macro for C++26 mode.
2024-07-31 17:07:11 +01:00
Jonathan Wakely
08782a5d92 libstdc++: Define C++26 member visit for std::basic_format_arg [PR110356]
Implement the std::format changes from P2637R3. This adds visit member
functions to std::basic_format_arg and deprecates the non-member
function std::visit_format_arg.

libstdc++-v3/ChangeLog:

	PR libstdc++/110356
	* include/bits/c++config (_GLIBCXX26_DEPRECATED): Define.
	(_GLIBCXX26_DEPRECATED_SUGGEST): Define.
	* include/bits/version.def (format): Update for C++26.
	* include/bits/version.h: Regenerate.
	* include/std/format (basic_format_arg::visit): New member
	functions.
	(visit_format_arg): Add deprecated attribute.
	* testsuite/std/format/arguments/args.cc: Expect deprecated
	warnings. Check member visit.
	* testsuite/std/format/functions/format.cc: Update expected
	value for __cpp_lib_format macro.
	* testsuite/std/format/parse_ctx.cc: Add dg-warning for
	deprecation.
2024-07-31 17:07:11 +01:00
Jonathan Wakely
f6f2c78d9d libstdc++: Define C++26 member visit for std::variant [PR110356]
Implement the std::variant changes from P2637R3.

libstdc++-v3/ChangeLog:

	PR libstdc++/110356
	* include/bits/version.def (variant): Update for C++26.
	* include/bits/version.h: Regenerate.
	* include/std/variant (variant::visit): New member functions.
	* testsuite/20_util/variant/visit.cc: Check second alternative.
	* testsuite/20_util/variant/visit_member.cc: New test.
2024-07-31 17:07:10 +01:00
Jonathan Wakely
3836df7e89 libstdc++: Implement C++26 type checking for std::format args [PR115776]
Implement the changes from P2757R3, which enhance the parse context to
be able to do type checking on format arguments, and to use that to
ensure that args used for width and precisions are integral types.

libstdc++-v3/ChangeLog:

	PR libstdc++/115776
	* include/bits/version.def (format): Update for C++26.
	* include/bits/version.h: Regenerate.
	* include/std/format (basic_format_parse_context): Remove
	default argument from constructor and split into two
	constructors. Make the constructor taking size_t private for
	C++26 and later.
	(basic_format_parse_context::check_dynamic_spec): New member
	function template.
	(basic_format_parse_context::check_dynamic_spec_integral): New
	member function.
	(basic_format_parse_context::check_dynamic_spec_string):
	Likewise.
	(__format::_Spec::_S_parse_width_or_precision): Use
	check_dynamic_spec_integral.
	(__format::__to_arg_t_enum): New helper function.
	(basic_format_arg):  Declare __to_arg_t_enum as friend.
	(__format::_Scanner): Define and use a derived parse context
	type.
	(__format::_Checking_scanner): Make arg types available to parse
	context.
	* testsuite/std/format/functions/format.cc: Check for new values
	of __cpp_lib_format macro.
	* testsuite/std/format/parse_ctx.cc: Check all members of
	basic_format_parse_context.
	* testsuite/std/format/parse_ctx_neg.cc: New test.
	* testsuite/std/format/string.cc: Add more checks for dynamic
	width and precision args.
2024-07-31 17:07:10 +01:00
Jonathan Wakely
72cd15b20a libstdc++: Support P2510R3 "Formatting pointers" as a DR for C++20
We already enable this for -std=gnu++20 but we can do it for -std=c++20
too. Both libc++ and MSVC also treat this change as a DR for C++20.

Now that the previous change to the value of __cpp_lib_format is
supported, we can finally update it to 202304 to indicate support for
this feature too.

libstdc++-v3/ChangeLog:

	* include/bits/version.def (format): Update value for P2510R3.
	* include/bits/version.h: Regenerate.
	* include/std/format (_GLIBCXX_P2518R3): Remove misspelled macro
	and check __glibcxx_format instead.
	* testsuite/std/format/functions/format.cc: Check value of the
	__cpp_lib_format macro for formatting pointers support.
	* testsuite/std/format/parse_ctx.cc: Likewise.
2024-07-31 17:07:10 +01:00
Jonathan Wakely
74b5101cc9 libstdc++: Handle encodings in localized chrono formatting [PR109162]
This implements the C++23 paper P2419R2 (Clarify handling of encodings
in localized formatting of chrono types). The requirement is that when
the literal encoding is "a Unicode encoding form" and the formatting
locale uses a different encoding, any locale-specific strings such as
"août" for std::chrono::August should be converted to the literal
encoding.

Using the recently-added std::locale::encoding() function we can check
the locale's encoding and then use iconv if a conversion is needed.
Because nl_langinfo_l and iconv_open both allocate memory, a naive
implementation would perform multiple allocations and deallocations for
every snippet of locale-specific text that needs to be converted to
UTF-8. To avoid that, a new internal locale::facet is defined to store
the text_encoding and an iconv_t descriptor, which are then cached in
the formatting locale. This requires access to the internals of a
std::locale object in src/c++20/format.cc, so that new file needs to be
compiled with -fno-access-control, as well as -std=gnu++26 in order to
use std::text_encoding.

Because the new std::text_encoding and std::locale::encoding() symbols
are only in the libstdc++exp.a archive, we need to include
src/c++26/text_encoding.cc in the main library, but not export its
symbols yet. This means they can be used by the two new functions which
are exported from the main library.

The encoding conversions are done for C++20, treating it as a DR that
resolves LWG 3656.

With this change we can increase the value of the __cpp_lib_format macro
for C++23. The value should be 202207 for P2419R2, but we already
implement P2510R3 (Formatting pointers) so can use the value 202304.

libstdc++-v3/ChangeLog:

	PR libstdc++/109162
	* acinclude.m4 (libtool_VERSION): Update to 6:34:0.
	* config/abi/pre/gnu.ver: Disambiguate old patters. Add new
	GLIBCXX_3.4.34 symbol version and new exports.
	* configure: Regenerate.
	* include/bits/chrono_io.h (_ChronoSpec::_M_locale_specific):
	Add new accessor functions to use a reserved bit in _Spec.
	(__formatter_chrono::_M_parse): Use _M_locale_specific(true)
	when chrono-specs contains locale-dependent conversion
	specifiers.
	(__formatter_chrono::_M_format): Open iconv descriptor if
	conversion to UTF-8 will be needed.
	(__formatter_chrono::_M_write): New function to write a
	localized string with possible character conversion.
	(__formatter_chrono::_M_a_A, __formatter_chrono::_M_b_B)
	(__formatter_chrono::_M_p, __formatter_chrono::_M_r)
	(__formatter_chrono::_M_x, __formatter_chrono::_M_X)
	(__formatter_chrono::_M_locale_fmt): Use _M_write.
	* include/bits/version.def (format): Update value.
	* include/bits/version.h: Regenerate.
	* include/std/format (_GLIBCXX_P2518R3): Check feature test
	macro instead of __cplusplus.
	(basic_format_context): Declare __formatter_chrono as friend.
	* src/c++20/Makefile.am: Add new file.
	* src/c++20/Makefile.in: Regenerate.
	* src/c++20/format.cc: New file.
	* testsuite/std/time/format_localized.cc: New test.
	* testsuite/util/testsuite_abi.cc: Add new symbol version.
2024-07-31 17:07:10 +01:00
Sam James
d498e79ebe testsuite: fix dg-require-* order vs dg-additional-sources
Per gccint, 'dg-require-*' must come before any
'dg-additional-sources' directives. Fix a handful of deviant cases.

	* gcc.dg/tree-prof/crossmodule-indir-call-topn-1.c: Fix dg-require-profiling
	directive order.
	* gcc.dg/tree-prof/crossmodule-indir-call-topn-2.c: Likewise.
2024-07-31 16:09:55 +01:00
Sam James
9ad3d1c581 testsuite: fix dg-require-effective-target order vs dg-additional-sources
Per gccint, 'dg-require-effective-target' must come before any
'dg-additional-sources' directives. Fix a handful of deviant cases.

gcc/testsuite/ChangeLog:
	* gcc.target/aarch64/aapcs64/func-ret-3.c: Fix dg-require-effective-target directive order.
	* gcc.target/aarch64/aapcs64/func-ret-4.c: Likewise.
	* gfortran.dg/PR100914.f90: Likewise.

libgomp/ChangeLog:
	* testsuite/libgomp.c++/pr24455.C: Fix dg-require-effective-target directive order.
	* testsuite/libgomp.c/pr24455.c: Likewise.
2024-07-31 16:09:54 +01:00
Sam James
d398581485 testsuite: fix 'dg-do-preprocess' typo
We want 'dg-do preprocess', not 'dg-do-preprocess'. Fix that.

	PR target/106828
	* g++.target/loongarch/pr106828.C: Fix 'dg-do compile' typo.
2024-07-31 16:09:54 +01:00