Commit Graph

612 Commits

Author SHA1 Message Date
Jonathan Wakely 3acb929cc0 libstdc++: Define <stacktrace> header for C++23
Add the <stacktrace> header and a new libstdc++_libbacktrace.a library
that provides the implementation. For now, the new library is only built
if --enable-libstdcxx-backtrace=yes is used. As with the Filesystem TS,
the new library is only provided as a static archive.

libstdc++-v3/ChangeLog:

	* acinclude.m4 (GLIBCXX_ENABLE_BACKTRACE): New macro.
	* configure.ac: Use GLIBCXX_ENABLE_BACKTRACE.
	* include/Makefile.am: Add new header.
	* include/Makefile.in: Regenerate.
	* include/std/stacktrace: New header.
	* include/std/version (__cpp_lib_stacktrace): Define.
	* Makefile.in: Regenerate.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* doc/Makefile.in: Regenerate.
	* libsupc++/Makefile.in: Regenerate.
	* po/Makefile.in: Regenerate.
	* python/Makefile.in: Regenerate.
	* src/Makefile.am: Regenerate.
	* src/Makefile.in: Regenerate.
	* src/c++11/Makefile.in: Regenerate.
	* src/c++17/Makefile.in: Regenerate.
	* src/c++20/Makefile.in: Regenerate.
	* src/c++98/Makefile.in: Regenerate.
	* src/filesystem/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.
	* src/libbacktrace/Makefile.am: New file.
	* src/libbacktrace/Makefile.in: New file.
	* src/libbacktrace/backtrace-rename.h: New file.
	* src/libbacktrace/backtrace-supported.h.in: New file.
	* src/libbacktrace/config.h.in: New file.
	* testsuite/lib/libstdc++.exp (check_effective_target_stacktrace):
	New proc.
	* testsuite/20_util/stacktrace/entry.cc: New test.
	* testsuite/20_util/stacktrace/synopsis.cc: New test.
	* testsuite/20_util/stacktrace/version.cc: New test.
2022-01-17 12:13:02 +00:00
Jonathan Wakely 68c2e9e923 libstdc++: Fix and simplify freestanding configuration [PR103866]
This fixes the --disable-hosted-libstdcxx build so that it works with
--without-headers. Currently you need to also use --with-newlib, which
is confusing for users who aren't actually using newlib.

The AM_PROG_LIBTOOL checks are currently skipped for --with-newlib and
--with-avrlibc builds, with this change they are also skipped when using
--without-headers.  It would be nice if using --disable-hosted-libstdcxx
automatically skipped those checks, but GLIBCXX_ENABLE_HOSTED comes too
late to make the AM_PROG_LIBTOOL checks depend on $is_hosted.

The checks for EOF, SEEK_CUR etc. cause the build to fail if there is no
<stdio.h> available.  Unlike most headers, which get a HAVE_FOO_H macro,
<stdio.h> is in autoconf's default includes, so every check tries to
include it unconditionally. This change skips those checks for
freestanding builds.

Similarly, the checks for <stdint.h> types done by GCC_HEADER_STDINT try
to include <stdio.h> and fail for --without-headers builds. This change
skips the use of GCC_HEADER_STDINT for freestanding. We can probably
stop using GCC_HEADER_STDINT entirely, since only one file uses the
gstdint.h header that is generated, and that could easily be changed to
use <stdint.h> instead. That can wait for stage 1.

We also need to skip the GLIBCXX_CROSSCONFIG stage if --without-headers
was used, since we don't have any of the functions it deals with.

The end result of the changes above is that it should not be necessary
for a --disable-hosted-libstdcxx --without-headers build to also use
--with-newlib.

Finally, compile libsupc++ with -ffreestanding when --without-headers is
used, so that <stdint.h> will use <gcc-stdint.h> instead of expecting it
to come from libc.

libstdc++-v3/ChangeLog:

	PR libstdc++/103866
	* acinclude.m4 (GLIBCXX_COMPUTE_STDIO_INTEGER_CONSTANTS): Do
	nothing for freestanding builds.
	(GLIBCXX_ENABLE_HOSTED): Define FREESTANDING_FLAGS.
	* configure.ac: Do not use AC_LIBTOOL_DLOPEN when configured
	with --without-headers.  Do not use GCC_HEADER_STDINT for
	freestanding builds.
	* libsupc++/Makefile.am (HOSTED_CXXFLAGS): Use -ffreestanding
	for freestanding builds.
	* configure: Regenerate.
	* Makefile.in: Regenerate.
	* doc/Makefile.in: Regenerate.
	* include/Makefile.in: Regenerate.
	* libsupc++/Makefile.in: Regenerate.
	* po/Makefile.in: Regenerate.
	* python/Makefile.in: Regenerate.
	* src/Makefile.in: Regenerate.
	* src/c++11/Makefile.in: Regenerate.
	* src/c++17/Makefile.in: Regenerate.
	* src/c++20/Makefile.in: Regenerate.
	* src/c++98/Makefile.in: Regenerate.
	* src/filesystem/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.
2022-01-10 12:18:14 +00:00
Jonathan Wakely ca1c7065e9 libstdc++: Fix definition of _GLIBCXX_NO_SLEEP config macro
If no OS function to sleep (e.g. nanosleep, usleep, Win32 Sleep etc.) is
available then configure defines the macro NO_SLEEP. But this will not
get prefixed with "_GLIBCXX_" because include/Makefile.am only does that
for macros beginning with "HAVE_". The configure script should define
_GLIBCXX_NO_SLEEP instead (which is what the code actually checks for).

libstdc++-v3/ChangeLog:

	* acinclude.m4 (GLIBCXX_ENABLE_LIBSTDCXX_TIME): Add _GLIBCXX_
	prefix to NO_SLEEP macro.
	* config.h.in: Regenerate.
	* configure: Regenerate.
2021-12-10 14:05:46 +00:00
Jonathan Wakely e2e98f524f libstdc++: Remove broken std::allocator base classes [PR103340]
The bitmap_allocator, __mt_alloc and __pool_alloc extensions are no
longer suitable for use as the base class of std::allocator, because
they have not been updated to meet the C++20 requirements.  There is a
patch attached to PR 103340 which addresses that, but more work would be
needed to solve the linking errors that occur when the library is
configured to use them.

Using --enable-libstdcxx-allocator=bitmap wouldn't even bootstrap for
the past few years, and I can't find any gcc-testresults reports using
any of these allocators. This patch removes the configure option to use
these as the std::allocator base class. The allocators are still in the
tree and can be used directly, you just can't configure the library to
use one of them as the base class of std::allocator.

libstdc++-v3/ChangeLog:

	PR libstdc++/103340
	PR libstdc++/103400
	PR libstdc++/103381
	* acinclude.m4 (GLIBCXX_ENABLE_ALLOCATOR): Remove mt, bitmap
	and pool options.
	* configure: Regenerate.
	* config/allocator/bitmap_allocator_base.h: Removed.
	* config/allocator/mt_allocator_base.h: Removed.
	* config/allocator/pool_allocator_base.h: Removed.
	* doc/xml/manual/allocator.xml: Update.
	* doc/xml/manual/configure.xml: Update.
	* doc/xml/manual/evolution.xml: Document removal.
	* doc/xml/manual/mt_allocator.xml: Editorial tweaks.
	* doc/html/manual/*: Regenerate.
2021-12-02 16:46:28 +00:00
Jonathan Wakely 9646a3229b libstdc++: Replace AC_CACHE_VAL with AC_CACHE_CHECK
This replaces most uses of AC_CACHE_VAL with AC_CACHE_CHECK, which means
we don't need separate AC_MSG_CHECKING and AC_MSG_RESULT macros.

There are a few trivial bugs fixed as a side effect, where an
AC_MSG_RESULT was printed out even if the actual checks hadn't been
done. That didn't affect the results, only the content of config.log.

libstdc++-v3/ChangeLog:

	* acinclude.m4: Replace AC_CACHE_VAL with AC_CACHE_CHECK.
	* configure: Regenerate.
2021-11-18 13:56:33 +00:00
Hans-Peter Nilsson 60f761c7e5 libstdc++: Use GCC_TRY_COMPILE_OR_LINK for getentropy, arc4random
Since r12-5056-g3439657b0286, there has been a regression in
test results; an additional 100 FAILs running the g++ and
libstdc++ testsuite on cris-elf, a newlib target.  The
failures are linker errors, not finding a definition for
getentropy.  It appears newlib has since 2017-12-03
declarations of getentropy and arc4random, and provides an
implementation of arc4random using getentropy, but provides no
definition of getentropy, not even a stub yielding ENOSYS.
This is similar to what it does for many other functions too.

While fixing newlib (like adding said stub) would likely help,
it still leaves older newlib releases hanging.  Thankfully,
the libstdc++ configury test can be improved to try linking
where possible; using the bespoke GCC_TRY_COMPILE_OR_LINK
instead of AC_TRY_COMPILE.  BTW, I see a lack of consistency;
some tests use AC_TRY_COMPILE and some GCC_TRY_COMPILE_OR_LINK
for no apparent reason, but this commit just amends
r12-5056-g3439657b0286.

libstdc++-v3:
	PR libstdc++/103166
	* acinclude.m4 (GLIBCXX_CHECK_GETENTROPY, GLIBCXX_CHECK_ARC4RANDOM):
	Use GCC_TRY_COMPILE_OR_LINK instead of AC_TRY_COMPILE.
	* configure: Regenerate.
2021-11-13 01:45:06 +01:00
Jonathan Wakely a54ce8865a libstdc++: Print assertion messages to stderr [PR59675]
This replaces the printf used by failed debug assertions with fprintf,
so we can write to stderr.

To avoid including <stdio.h> the assert function is moved into the
library. To avoid programs using a vague linkage definition of the old
inline function, the function is renamed. Code compiled with old
versions of GCC might still call the old function, but code compiled
with the newer GCC will call the new function and write to stderr.

libstdc++-v3/ChangeLog:

	PR libstdc++/59675
	* acinclude.m4 (libtool_VERSION): Bump version.
	* config/abi/pre/gnu.ver (GLIBCXX_3.4.30): Add version and
	export new symbol.
	* configure: Regenerate.
	* include/bits/c++config (__replacement_assert): Remove, declare
	__glibcxx_assert_fail instead.
	* src/c++11/debug.cc (__glibcxx_assert_fail): New function to
	replace __replacement_assert, writing to stderr instead of
	stdout.
	* testsuite/util/testsuite_abi.cc: Update latest version.
2021-11-12 12:23:10 +00:00
Jonathan Wakely 3439657b02 libstdc++: Support getentropy and arc4random in std::random_device
This adds additional "getentropy" and "arc4random" tokens to
std::random_device. The former is supported on Glibc and OpenBSD (and
apparently wasm), and the latter is supported on various BSDs.

libstdc++-v3/ChangeLog:

	* acinclude.m4 (GLIBCXX_CHECK_GETENTROPY, GLIBCXX_CHECK_ARC4RANDOM):
	Define.
	* configure.ac (GLIBCXX_CHECK_GETENTROPY, GLIBCXX_CHECK_ARC4RANDOM):
	Use them.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* src/c++11/random.cc (random_device): Add getentropy and
	arc4random as sources.
	* testsuite/26_numerics/random/random_device/cons/token.cc:
	Check new tokens.
	* testsuite/26_numerics/random/random_device/entropy.cc:
	Likewise.
2021-11-09 14:40:33 +00:00
Corentin Gay 523ca6403c ctype support for libstdc++ on VxWorks
for  libstdc++-v3/ChangeLog

	* acinclude.m4: Add VxWorks-specific case for the
	configuration of ctypes.
	* configure: Regenerate.
	* config/locale/vxworks/ctype_members.cc: Add VxWorks-specific
	version.
	* config/os/vxworks/ctype_base.h: Adjust for VxWorks7+.
	* config/os/vxworks/ctype_configure_char.cc: Likewise.
	* config/os/vxworks/ctype_inline.h: Likewise.
	* testsuite/28_regex/traits/char/isctype.cc: Defines
	NEWLINE_IN_CLASS_BLANK if the target is VxWorks.
	* testsuite/28_regex/traits/wchar_t/isctype.cc: Likewise.
2021-05-04 21:49:43 -03:00
Jonathan Wakely ad0a3be4df libstdc++: Remove _GLIBCXX_USE_INT128 autoconf macro
We don't need to decide whether to use __int128 when running configure,
we can do so at compilation time by seeing if __SIZEOF_INT128__ is
defined and if it's greater than __SIZEOF_LONG_LONG__.

This removes another unnecessary architecture-specific config macro in
<bits/c++config.h>, so the same header can work for 32-bit or 64-bit
compilation on AIX.

libstdc++-v3/ChangeLog:

	* acinclude.m4 (GLIBCXX_ENABLE_INT128_FLOAT128): Remove
	checks for __int128 and rename to GLIBCXX_ENABLE_FLOAT128.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Adjust to use GLIBCXX_ENABLE_FLOAT128.
	* include/bits/random.h (_Select_uint_least_t<s, 1>):
	Use __SIZEOF_INT128__ to decide whether to use __int128.
	* include/std/charconv (__to_chars_unsigned_type): Likewise.
2021-05-04 12:07:09 +01:00
Jonathan Wakely 7ddcd26ebb libstdc++: Remove GLIBCXX_CHECK_INT64_T checks
This simplifies the definition of std::streamoff by using the predefined
__INT64_TYPE__ macro, instead of the _GLIBCXX_HAVE_INT64_T_LONG,
_GLIBCXX_HAVE_INT64_T_LONG_LONG and _GLIBCXX_HAVE_INT64_T macros defined
by configure.

By using the __INT64_TYPE__ macro (which all of GCC, Clang and Intel
define) we do not need to determine the type of int64_t in configure, we
can just use that type directly.

The background for the change was explained by David Edelsohn:

  Currently the type of streamoff is determined at libstdc++ configure
  time, chosen by the definitions of _GLIBCXX_HAVE_INT64_T_LONG and
  _GLIBCXX_HAVE_INT64_T_LONG_LONG.  For a multilib configuration, the
  difference is encoded in the different multilib header file paths.
  For "FAT" library targets that package 32 bit and 64 bit libraries
  together, G++ also expects a single header file directory hierarchy,
  causing an incorrect value for streamoff in some situations.

And in a subsequent mail:

  Most of the libstdc++ headers are architecture-neutral, OS neutral and
  ABI neutral.  The differences are localized in bits/c++config.h.  And
  most of c++config.h is identical for 32 bit AIX and 64 bit AIX.  The
  only differences that matter are __int128 and __int64_t.

This change removes some of those differences. With the only uses of the
INT64_T configure macros removed, the configure checks themselves can
also be removed.

Co-authored-by: David Edelsohn <dje.gcc@gmail.com>

libstdc++-v3/ChangeLog:

	* acinclude.m4 (GLIBCXX_CHECK_INT64_T): Delete.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Do not use GLIBCXX_CHECK_INT64_T.
	* include/bits/postypes.h: Remove include of <stdint.h> and
	definition/undefinition of the __STDC_LIMIT_MACROS and
	__STDC_CONSTANT_MACROS macros.
	(streamoff): Use __INT64_TYPE__ if defined.
2021-04-30 20:30:46 +01:00
Jakub Jelinek 2d4c3af94f Fix AIX libstdc++ semaphore support [PR100164]
> > The #error would not be hit if _GLIBCXX_HAVE_POSIX_SEMAPHORE were defined,
> > but it shows up in your error report.

> You now have pinpointed the problem.

> It's not that AIX doesn't have semaphore, but that the code previously
> had a fallback that hid a bug in the macros:

  // Use futex if available and didn't force use of POSIX
  using __fast_semaphore = __atomic_semaphore<__detail::__platform_wait_t>;
  using __fast_semaphore = __platform_semaphore;
  using __fast_semaphore = __atomic_semaphore<ptrdiff_t>;

> The problem is that libstdc++ configure defines
> _GLIBCXX_HAVE_POSIX_SEMAPHORE in config.h.  libstdc++ uses sed to
> rewrite config.h to c++config.h and prepends _GLIBCXX_, so c++config.h
> contains

> And bits/semaphore_base.h is not testing that corrupted macro.  Either
> semaphore_base.h needs to test for the corrupted macro, or libtsdc++
> configure needs to define HAVE_POSIX_SEMAPHORE without itself
> prepending _GLIBCXX_  so that the c++config.h rewriting works
> correctly and defines the correct macro for semaphore_base.h.

The include/Makefile.am sed is:
        sed -e 's/HAVE_/_GLIBCXX_HAVE_/g' \
            -e 's/PACKAGE/_GLIBCXX_PACKAGE/g' \
            -e 's/VERSION/_GLIBCXX_VERSION/g' \
            -e 's/WORDS_/_GLIBCXX_WORDS_/g' \
            -e 's/_DARWIN_USE_64_BIT_INODE/_GLIBCXX_DARWIN_USE_64_BIT_INODE/g' \
            -e 's/_FILE_OFFSET_BITS/_GLIBCXX_FILE_OFFSET_BITS/g' \
            -e 's/_LARGE_FILES/_GLIBCXX_LARGE_FILES/g' \
            -e 's/ICONV_CONST/_GLIBCXX_ICONV_CONST/g' \
            -e '/[       ]_GLIBCXX_LONG_DOUBLE_COMPAT[   ]/d' \
            -e '/[       ]_GLIBCXX_LONG_DOUBLE_ALT128_COMPAT[    ]/d' \
            < ${CONFIG_HEADER} >> $@ ;\
so for many macros one needs _GLIBCXX_ prefixes already in configure,
as can be seen in grep AC_DEFINE.*_GLIBCXX configure.ac acinclude.m4
But _GLIBCXX_HAVE_POSIX_SEMAPHORE is the only one that shouldn't have
that prefix because the sed is adding that.
E.g. on i686-linux, I see
grep _GLIBCXX__GLIBCXX c++config.h
that proves it is the only broken one.

So this change fixes the acinclude.m4 side.

2021-04-21  Jakub Jelinek  <jakub@redhat.com>

	PR libstdc++/100164
	* acinclude.m4: For POSIX semaphores AC_DEFINE HAVE_POSIX_SEMAPHORE
	rather than _GLIBCXX_HAVE_POSIX_SEMAPHORE.
	* configure: Regenerated.
	* config.h.in: Regenerated.
2021-04-21 11:13:54 +02:00
Jonathan Wakely a2c2eec183 libstdc++: Test errno macros directly, not via autoconf [PR 93151]
This fixes a bug caused by a mismatch between the macros defined by
<errno.h> when GCC is built and the macros defined by <errno.h> when
users include <system_error>. If the user code is compiled with
_XOPEN_SOURCE defined to 500 or 600, Darwin suppresses the
ENOTRECOVERABLE and EOWNERDEAD macros, which are not defined by SUSv3
(aka POSIX.1-2001).

Since POSIX requires the errno macros to be macros (and not variables or
enumerators) we can just test for them directly using the preprocessor.
That means that <system_error> will match what is actuallydefined when
it's included, not what was defined when GCC was built. With that change
there is no need for the GLIBCXX_CHECK_SYSTEM_ERROR configure checks and
they can be removed.

libstdc++-v3/ChangeLog:

	PR libstdc++/93151
	* acinclude.m4 (GLIBCXX_CHECK_SYSTEM_ERROR): Remove.
	* configure.ac: Regenerate.
	* config/os/generic/error_constants.h: Test POSIX errno macros
	directly, instead of corresponding _GLIBCXX_HAVE_EXXX macros.
	* testsuite/19_diagnostics/headers/system_error/errc_std_c++0x.cc:
	Likewise.
	* testsuite/19_diagnostics/headers/system_error/93151.cc: New
	test.
2020-12-16 13:36:02 +00:00
Keith Packard 75aee07269 libstdc++: Support libc with stdio-only I/O in libstdc++
The current libstdc++ basic_file_stdio.cc code assumes a POSIX API
underneath the stdio implementation provided by the host libc. This
means that the host must provide a fairly broad POSIX file API,
including read, write, open, close, lseek and ioctl.

This patch changes basic_file_stdio.cc to only use basic ANSI-C stdio
functions, allowing it to be used with libc implementations like
picolibc which may not have a POSIX operating system underneath.

This is enabled by a new --enable-cstdio=stdio_pure configure option.

Aided-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>

libstdc++-v3/ChangeLog:

	* acinclude.m4 (GLIBCXX_ENABLE_CSTDIO): Allow "stdio_pure"
	option and define _GLIBCXX_USE_PURE_STDIO when it is used. Also
	add "stdio_posix" option as an alias for "stdio".
	* config/io/basic_file_stdio.cc [_GLIBCXX_USE_PURE_STDIO]: Only
	use defined stdio entry points for all I/O operations, without
	direct calls to underlying POSIX functions.
	* config.h.in: Regenerate.
	* configure: Regenerate.
2020-12-15 17:39:24 +00:00
Jonathan Wakely 0aa1786d34 libstdc++: Fix build failure for target with no way to sleep
In previous releases the std::this_thread::sleep_for function was only
declared if the target supports multiple threads. I changed that
recently in r11-2649-g5bbb1f3000c57fd4d95969b30fa0e35be6d54ffb so that
sleep_for could be used single-threaded. But that means that targets
using --disable-threads are now required to provide some way to sleep.
This breaks the build for (at least) AVR when trying to build a hosted
library.

This patch adds a new autoconf macro that is defined when no way to
sleep is available, and uses that to suppress the sleeping functions in
std::this_thread.

The #error in src/c++11/thread.cc is retained for the case where there
is no sleep function available but multiple threads are supported. This
is consistent with previous releases, but that #error could probably be
removed without any consequences.

libstdc++-v3/ChangeLog:

	* acinclude.m4 (GLIBCXX_ENABLE_LIBSTDCXX_TIME): Define NO_SLEEP
	if none of nanosleep, sleep and Sleep is available.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* include/std/thread [_GLIBCXX_NO_SLEEP] (__sleep_for): Do
	not declare.
	[_GLIBCXX_NO_SLEEP] (sleep_for, sleep_until): Do not
	define.
	* src/c++11/thread.cc [_GLIBCXX_NO_SLEEP] (__sleep_for): Do
	not define.
2020-12-09 16:56:54 +00:00
Rainer Orth 55ebb0d6fb ada: c++: Get rid of libposix4, librt on Solaris
I recently noticed that neither libposix4 nor librt are needed on
Solaris 11 any longer:

* libposix4 was renamed to librt in Solaris 7 back in 1998.

* librt was folded into libc in the OpenSolaris timeframe, leaving librt
  only as a filter on libc.  Thus, it's no longer needed on either
  Solaris 11 or Illumos.

The following patch removes both uses.  At the same time, Ada's use of
libthread has gone: it was folded into libc in Solaris 10 already.
TIME_LIBRARY and friends in g++ are likewise removed: Solaris was the
only user.

Bootstrapped without regressions on i386-pc-solaris2.11,
sparc-sun-solaris2.11, and x86_64-pc-linux-gnu.


2020-11-16  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	gcc/cp:
	* g++spec.c (TIMELIB, TIME_LIBRARY): Remove.
	(lang_specific_driver): Remove TIME_LIBRARY handling.

	gcc:
	* config/sol2.h (TIME_LIBRARY): Remove.

	libstdc++-v3:
	* acinclude.m4 (GLIBCXX_ENABLE_LIBSTDCXX_TIME): Remove libposix4
	references.
	<solaris*>: Don't use -lrt any longer.
	* configure: Regenerate.

	* doc/xml/manual/configure.xml (--enable-libstdcxx-time=OPTION):
	Remove libposix4 reference.

	gcc/ada:
	* Makefile.rtl <sparc*-sun-solaris*> (THREADSLIB): Remove.
	(MISCLIB): Remove -lposix4.
	<*86-*-solaris2*>: Likewise.
	* libgnarl/s-osinte__solaris.ads (System.OS_Interface): Remove
	-lposix4 -lthread.
2020-11-26 13:01:30 +01:00
Jonathan Wakely 92b47a321e libstdc++: Add configure checks for semaphores
This moves the checks for POSIX semaphores to configure time. As well as
requiring <semaphore.h> and SEM_VALUE_MAX, we also require the
sem_timedwait function. That was only optional in POSIX 2001 (and is
absent on Darwin).

libstdc++-v3/ChangeLog:

	* acinclude.m4 (GLIBCXX_CHECK_GTHREADS): Check for
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* include/bits/semaphore_base.h (_GLIBCXX_HAVE_POSIX_SEMAPHORE):
	Check autoconf macro instead of defining it here.
2020-11-23 18:12:39 +00:00
Jonathan Wakely 1e3e6c700f libstdc++: Revert changes for SYS_clock_gettime64 [PR 93421]
As discussed in the PR, it's incredibly unlikely that a system that
needs to use the SYS_clock_gettime syscall (e.g. glibc 2.16 or older) is
going to define the SYS_clock_gettime64 macro. Ancient systems that need
to use the syscall aren't going to have time64 support.

This reverts the recent changes to try and make clock_gettime syscalls
be compatible with systems that have been updated for time64 (those
changes were wrong anyway as they misspelled the SYS_clock_gettime64
macro). The changes for futex syscalls are retained, because we still
use them on modern systems that might be using time64.

To ensure that the clock_gettime syscalls are safe, configure will fail
if SYS_clock_gettime is needed, and SYS_clock_gettime64 is also defined
(but to a distinct value from SYS_clock_gettime), and the tv_sec member
of timespec is larger than long. This means we will be unable to build
on a hypothetical system where we need the time32 version of
SYS_clock_gettime but where userspace is using a time64 struct timespec.
In the unlikely event that this failure is triggered on any real
systems, we can fix it later. But we probably won't need to.

libstdc++-v3/ChangeLog:

	PR libstdc++/93421
	* acinclude.m4 (GLIBCXX_ENABLE_LIBSTDCXX_TIME): Fail if struct
	timespec isn't compatible with SYS_clock_gettime.
	* configure: Regenerate.
	* src/c++11/chrono.cc: Revert changes for time64 compatibility.
	Add static_assert instead.
	* src/c++11/futex.cc (_M_futex_wait_until_steady): Assume
	SYS_clock_gettime can use struct timespec.
2020-11-17 22:38:49 +00:00
Jonathan Yong 505ea90904 libstdc++: Exclude cygwin and mingw from linker relro support
PE format does not have ELF style relro linker support, exclude
from checking. If the host linker supports ELF format, configure
may get confused.

libstdc++-v3/ChangeLog:

	* acinclude.m4 (GLIBCXX_CHECK_LINKER_FEATURES): Exclude
	cygwin and mingw from relro linker test.
	* configure: Regenerate.
2020-11-11 15:36:05 +00:00
Thomas Rodgers a0e4d7b44c libstdc++: Implement C++20 features for <sstream>
New ctors and ::view() accessor for -
  * basic_stingbuf
  * basic_istringstream
  * basic_ostringstream
  * basic_stringstreamm

New ::get_allocator() accessor for basic_stringbuf.

libstdc++-v3/ChangeLog:
	* acinclude.m4 (glibcxx_SUBDIRS): Add src/c++20.
	* config/abi/pre/gnu.ver (GLIBCXX_3.4.29): New symbols.
	* configure: Regenerate.
	* include/std/sstream:
	(basic_stringbuf::basic_stringbuf(allocator const&)): New constructor.
	(basic_stringbuf::basic_stringbuf(openmode, allocator const&)): Likewise.
	(basic_stringbuf::basic_stringbuf(basic_string&&, openmode)): Likewise.
	(basic_stringbuf::basic_stringbuf(basic_stringbuf&&, allocator const&)):
	Likewise.
	(basic_stringbuf::get_allocator()): New method.
	(basic_stringbuf::view()): Likewise.
	(basic_istringstream::basic_istringstream(basic_string&&, openmode)):
	New constructor.
	(basic_istringstream::basic_istringstream(openmode, allocator const&)):
	Likewise
	(basic_istringstream::view()): New method.
	(basic_ostringstream::basic_ostringstream(basic_string&&, openmode)):
	New constructor.
	(basic_ostringstream::basic_ostringstream(openmode, allocator const&)):
	Likewise
	(basic_ostringstream::view()): New method.
	(basic_stringstream::basic_stringstream(basic_string&&, openmode)):
	New constructor.
	(basic_stringstream::basic_stringstream(openmode, allocator const&)):
	Likewise
	(basic_stringstream::view()): New method.
	* src/Makefile.in: Add c++20 directory.
	* src/Makefile.am: Regenerate.
	* src/c++20/Makefile.am: Add makefile for new sub-directory.
	* src/c++20/Makefile.in: Generate.
	* src/c++20/sstream-inst.cc: New file defining explicit
	instantiations for basic_stringbuf, basic_istringstream,
	basic_ostringstream, and basic_stringstream member functions
	added in C++20.
	* testsuite/27_io/basic_stringbuf/cons/char/2.cc: New test.
	* testsuite/27_io/basic_stringbuf/cons/wchar_t/2.cc: Likewise.
	* testsuite/27_io/basic_stringbuf/view/char/1.cc: Likewise.
	* testsuite/27_io/basic_stringbuf/view/wchar_t/1.cc: Likewise.
	* testsuite/27_io/basic_istringstream/cons/char/1.cc: Likewise.
	* testsuite/27_io/basic_istringstream/cons/wchar_t/1.cc: Likewise.
	* testsuite/27_io/basic_istringstream/view/char/1.cc: Likewise.
	* testsuite/27_io/basic_istringstream/view/wchar_t/1.cc: Likewise.
	* testsuite/27_io/basic_ostringstream/cons/char/1.cc: Likewise.
	* testsuite/27_io/basic_ostringstream/cons/wchar_t/1.cc: Likewise.
	* testsuite/27_io/basic_ostringstream/view/char/1.cc: Likewise.
	* testsuite/27_io/basic_ostringstream/view/wchar_t/1.cc: Likewise.
	* testsuite/27_io/basic_stringstream/cons/char/1.cc: Likewise.
	* testsuite/27_io/basic_stringstream/cons/wchar_t/1.cc: Likewise.
	* testsuite/27_io/basic_stringstream/view/char/1.cc: Likewise.
	* testsuite/27_io/basic_stringstream/view/wchar_t/1.cc: Likewise.
2020-10-28 11:56:06 -07:00
Jonathan Wakely 55484a0f81 libstdc++: Deprecate the --enable-cheaders=c_std configuration
These headers do not offer any tangible benefit compared to the default
c_global version. They are not actively maintained meaning that they
have bugs which have already been fixed for the c_global headers.

This change adds a warning if they are used, and requires a new
--enable-cheaders-obsolete option to allow their use. Unless we receive
reports from users who rely on the c_std headers they should be removed
at some point in future.

libstdc++-v3/ChangeLog:

	* acinclude.m4 (GLIBCXX_ENABLE_CHEADERS): Warn if the c_std
	option is used and fail unless --enable-cheaders-obsolete is
	also used.
	* configure: Regenerate.
2020-08-13 16:33:28 +01:00
Jonathan Wakely 90f7636bf8 libstdc++: Make C++17 ignore --disable-libstdcxx-filesystem-ts [PR 94681]
The configure switch should only affect the optional Filesystem TS, not
the std::filesystem features of C++17.

libstdc++-v3/ChangeLog:

	PR libstdc++/94681
	* acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Do not depend on
	$enable_libstdcxx_filesystem_ts.
	* configure: Regenerate.
2020-08-10 13:21:59 +01:00
Jonathan Wakely 932fbc868a libstdc++: Add std::from_chars for floating-point types
This adds the missing std::from_chars overloads for floating-point
types, as required for C++17 conformance.

The implementation is a hack and not intended to be used in the long
term. Rather than parsing the string directly, this determines the
initial portion of the string that matches the pattern determined by the
chars_format parameter, then creates a NTBS to be parsed by strtod (or
strtold or strtof).

Because creating a NTBS requires allocating memory, but std::from_chars
is noexcept, we need to be careful to minimise allocation. Even after
being careful, allocation failure is still possible, and so a
non-conforming std::no_more_memory error code might be returned.

Because strtod et al depend on the current locale, but std::from_chars
does not, we change the current thread's locale to "C" using newlocale
and uselocale before calling strtod, and restore it afterwards.

Because strtod doesn't have the equivalent of a std::chars_format
parameter, it has to examine the input to determine the format in use,
even though the std::from_chars code has already parsed it once (or
twice for large input strings!)

By replacing the use of strtod we could avoid allocation, avoid changing
locale, and use optimised code paths specific to each std::chars_format
case. We would also get more portable behaviour, rather than depending
on the presence of uselocale, and on any bugs or quirks of the target
libc's strtod. Replacing strtod is a project for a later date.

libstdc++-v3/ChangeLog:

	* acinclude.m4 (libtool_VERSION): Bump version.
	* config.h.in: Regenerate.
	* config/abi/pre/gnu.ver: Add GLIBCXX_3.4.29 version and new
	exports.
	* config/os/gnu-linux/ldbl-extra.ver: Add _GLIBCXX_LDBL_3.4.29
	version and new export.
	* configure: Regenerate.
	* configure.ac: Check for <xlocale.h> and uselocale.
	* crossconfig.m4: Add macro or checks for uselocale.
	* include/std/charconv (from_chars): Declare overloads for
	float, double, and long double.
	* src/c++17/Makefile.am: Add new file.
	* src/c++17/Makefile.in: Regenerate.
	* src/c++17/floating_from_chars.cc: New file.
	(from_chars): Define for float, double, and long double.
	* testsuite/20_util/from_chars/1_c++20_neg.cc: Prune extra
	diagnostics caused by new overloads.
	* testsuite/20_util/from_chars/1_neg.cc: Likewise.
	* testsuite/20_util/from_chars/2.cc: Check leading '+'.
	* testsuite/20_util/from_chars/4.cc: New test.
	* testsuite/20_util/from_chars/5.cc: New test.
	* testsuite/util/testsuite_abi.cc: Add new symbol versions.
2020-07-20 23:49:27 +01:00
Jonathan Wakely 759812fddc libstdc++: Replace glibc-specific check for clock_gettime (PR 93325)
It's wrong to assume that clock_gettime is unavailable on any *-*-linux*
target that doesn't have glibc 2.17 or later. Use a generic test instead
of using __GLIBC_PREREQ. Only do that test when is_hosted=yes so that we
don't get an error for cross targets without a working linker.

This ensures that C library's clock_gettime will be used on non-glibc
targets, instead of an incorrect syscall to SYS_clock_gettime.

	PR libstdc++/93325
	* acinclude.m4 (GLIBCXX_ENABLE_LIBSTDCXX_TIME): Use AC_SEARCH_LIBS for
	clock_gettime instead of explicit glibc version check.
	* configure: Regenerate.
2020-01-28 13:24:09 +00:00
Maciej W. Rozycki e8e66971cd Add `--with-toolexeclibdir=' configuration option
Provide means, in the form of a `--with-toolexeclibdir=' configuration
option, to override the default installation directory for target
libraries, otherwise known as $toolexeclibdir.  This is so that it is
possible to get newly-built libraries, particularly the shared ones,
installed in a common place, so that they can be readily used by the
target system as their host libraries, possibly over NFS, without a need
to manually copy them over from the currently hardcoded location they
would otherwise be installed in.

In the presence of the `--enable-version-specific-runtime-libs' option
and for configurations building native GCC the option is ignored.

	config/
	* toolexeclibdir.m4: New file.

	gcc/
	* doc/install.texi (Cross-Compiler-Specific Options): Document
	`--with-toolexeclibdir' option.

	libada/
	* Makefile.in (configure_deps): Add `toolexeclibdir.m4'.
	* configure.ac: Handle `--with-toolexeclibdir='.
	* configure: Regenerate.

	libatomic/
	* configure.ac: Handle `--with-toolexeclibdir='.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* testsuite/Makefile.in: Regenerate.

	libffi/
	* configure.ac: Handle `--with-toolexeclibdir='.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* include/Makefile.in: Regenerate.
	* man/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.

	libgcc/
	* Makefile.in (configure_deps): Add `toolexeclibdir.m4'.
	* configure.ac: Handle `--with-toolexeclibdir='.
	* configure: Regenerate.

	libgfortran/
	* configure.ac: Handle `--with-toolexeclibdir='.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

	libgomp/
	* configure.ac: Handle `--with-toolexeclibdir='.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* testsuite/Makefile.in: Regenerate.

	libhsail-rt/
	* configure.ac: Handle `--with-toolexeclibdir='.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

	libitm/
	* configure.ac: Handle `--with-toolexeclibdir='.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* testsuite/Makefile.in: Regenerate.

	libobjc/
	* Makefile.in (aclocal_deps): Add `toolexeclibdir.m4'.
	* aclocal.m4: Include `toolexeclibdir.m4'.
	* configure.ac: Handle `--with-toolexeclibdir='.
	* configure: Regenerate.

	liboffloadmic/
	* plugin/configure.ac: Handle `--with-toolexeclibdir='.
	* plugin/Makefile.in: Regenerate.
	* plugin/aclocal.m4: Regenerate.
	* plugin/configure: Regenerate.
	* configure.ac: Handle `--with-toolexeclibdir='.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

	libphobos/
	* m4/druntime.m4: Handle `--with-toolexeclibdir='.
	* m4/Makefile.in: Regenerate.
	* libdruntime/Makefile.in: Regenerate.
	* src/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

	libquadmath/
	* configure.ac: Handle `--with-toolexeclibdir='.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

	libsanitizer/
	* configure.ac: Handle `--with-toolexeclibdir='.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* asan/Makefile.in: Regenerate.
	* interception/Makefile.in: Regenerate.
	* libbacktrace/Makefile.in: Regenerate.
	* lsan/Makefile.in: Regenerate.
	* sanitizer_common/Makefile.in: Regenerate.
	* tsan/Makefile.in: Regenerate.
	* ubsan/Makefile.in: Regenerate.

	libssp/
	* configure.ac: Handle `--with-toolexeclibdir='.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

	libstdc++-v3/
	* acinclude.m4: Handle `--with-toolexeclibdir='.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* doc/Makefile.in: Regenerate.
	* include/Makefile.in: Regenerate.
	* libsupc++/Makefile.in: Regenerate.
	* po/Makefile.in: Regenerate.
	* python/Makefile.in: Regenerate.
	* src/Makefile.in: Regenerate.
	* src/c++11/Makefile.in: Regenerate.
	* src/c++17/Makefile.in: Regenerate.
	* src/c++98/Makefile.in: Regenerate.
	* src/filesystem/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.

	libvtv/
	* configure.ac: Handle `--with-toolexeclibdir='.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* testsuite/Makefile.in: Regenerate.

	zlib/
	* configure.ac: Handle `--with-toolexeclibdir='.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
2020-01-24 11:24:25 +00:00
Corentin Gay 784daa979b VxWorks has_nanosleep for libstdc++ enable-libstdcxx-time auto
2019-12-30  Corentin Gay  <gay@adacore.com>

	* acinclude.m4 (vxworks*): New entry. Set ac_has_nanosleep=yes.
	* configure: Regenerate.

From-SVN: r279796
2019-12-30 22:36:14 +00:00
Jerome Lambourg 84de780d46 libstdc++: Test setrlimit with c++ in configure
* acinclude.m4 (GLIBCXX_CHECK_SETRLIMIT): Test with AC_LANG_CPLUSPLUS.
	* configure: Regenerate.

From-SVN: r279644
2019-12-20 15:30:41 +00:00
Jerome Lambourg 7607ff49af libstdc++: Strengthen the check for availability of pthread_rwlock_t
* acinclude.m4 (_GLIBCXX_USE_PTHREAD_RWLOCK_T): Checks that
        _PTHREADS is defined after including gthr.h.
        * configure: Regenerate.

From-SVN: r279635
2019-12-20 09:30:48 +00:00
Mike Crowe ab40695a46 libstdc++: Add full steady_clock support to shared_timed_mutex
The pthread_rwlock_clockrdlock and pthread_rwlock_clockwrlock functions
were added to glibc in v2.30. They have also been added to Android
Bionic. If these functions are available in the C library then they can
be used to implement shared_timed_mutex::try_lock_until,
shared_timed_mutex::try_lock_for,
shared_timed_mutex::try_lock_shared_until and
shared_timed_mutex::try_lock_shared_for so that they are no longer
unaffected by the system clock being warped. (This is the shared_mutex
equivalent of PR libstdc++/78237 for mutex.)

If the new functions are available then steady_clock is deemed to be the
"best" clock available which means that it is used for the relative
try_lock_for calls and absolute try_lock_until calls using steady_clock
and user-defined clocks. It's not possible to have
_GLIBCXX_USE_PTHREAD_RWLOCK_CLOCKLOCK defined without
_GLIBCXX_USE_PTHREAD_RWLOCK_T, so the requirement that the clock be the
same as condition_variable is maintained. Calls explicitly using
system_clock (aka high_resolution_clock) continue to use CLOCK_REALTIME
via the old pthread_rwlock_timedrdlock and pthread_rwlock_timedwrlock
functions.

If the new functions are not available then system_clock is deemed to be
the "best" clock available which means that the previous suboptimal
behaviour remains.

Additionally, the user-defined clock used with
shared_timed_mutex::try_lock_for and shared_mutex::try_lock_shared_for
may have higher precision than __clock_t. We may need to round the
duration up to ensure that the timeout is long enough. (See
__timed_mutex_impl::_M_try_lock_for)

2019-12-02  Mike Crowe  <mac@mcrowe.com>

	Add full steady_clock support to shared_timed_mutex
	* acinclude.m4 (GLIBCXX_CHECK_PTHREAD_RWLOCK_CLOCKLOCK): Define
	to check for the presence of both pthread_rwlock_clockrdlock and
	pthread_rwlock_clockwrlock.
	* config.h.in: Regenerate.
	* configure.ac: Call GLIBCXX_USE_PTHREAD_RWLOCK_CLOCKLOCK.
	* configure: Regenerate.
	* include/std/shared_mutex (shared_timed_mutex): Define __clock_t as
	the best clock to use for relative waits.
	(shared_timed_mutex::try_lock_for) Round up wait duration if necessary.
	(shared_timed_mutex::try_lock_shared_for): Likewise.
	(shared_timed_mutex::try_lock_until): Use existing try_lock_until
	implementation for system_clock (which matches __clock_t when
	_GLIBCCXX_USE_PTHREAD_RWLOCK_CLOCKLOCK is not defined). Add new
	overload for steady_clock that uses pthread_rwlock_clockwrlock if it
	is available. Simplify overload for non-standard clock to just call
	try_lock_for with a relative timeout.
	(shared_timed_mutex::try_lock_shared_until): Likewise.

From-SVN: r278903
2019-12-02 16:23:10 +00:00
Mike Crowe 3b2fb54353 libstdc++: PR 78237 Add full steady_clock support to timed_mutex
The pthread_mutex_clocklock function is available in glibc since the
2.30 release. If this function is available in the C library it can be
used to fix PR libstdc++/78237 by supporting steady_clock properly with
timed_mutex.

This means that code using timed_mutex::try_lock_for or
timed_mutex::wait_until with steady_clock is no longer subject to timing
out early or potentially waiting for much longer if the system clock is
warped at an inopportune moment.

If pthread_mutex_clocklock is available then steady_clock is deemed to
be the "best" clock available which means that it is used for the
relative try_lock_for calls and absolute try_lock_until calls using
steady_clock and user-defined clocks. Calls explicitly using
system_clock (aka high_resolution_clock) continue to use CLOCK_REALTIME
via __gthread_cond_timedwait.

If pthread_mutex_clocklock is not available then system_clock is deemed
to be the "best" clock available which means that the previous
suboptimal behaviour remains.

2019-12-02  Mike Crowe  <mac@mcrowe.com>

	PR libstdc++/78237 Add full steady_clock support to timed_mutex
	* acinclude.m4 (GLIBCXX_CHECK_PTHREAD_MUTEX_CLOCKLOCK): Define to
	detect presence of pthread_mutex_clocklock function.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Call GLIBCXX_CHECK_PTHREAD_MUTEX_CLOCKLOCK.
	* include/std/mutex (__timed_mutex_impl): Remove unnecessary __clock_t.
	(__timed_mutex_impl::_M_try_lock_for): Use best clock to turn relative
	timeout into absolute timeout.
	(__timed_mutex_impl::_M_try_lock_until): Keep existing implementation
	for system_clock. Add new implementation for steady_clock that calls
	_M_clocklock. Modify overload for user-defined clock to use a relative
	wait so that it automatically uses the best clock.
	[_GLIBCXX_USE_PTHREAD_MUTEX_CLOCKLOCK] (timed_mutex::_M_clocklock):
	New member function.
	(recursive_timed_mutex::_M_clocklock): Likewise.

From-SVN: r278901
2019-12-02 16:23:01 +00:00
Jonathan Wakely f0cfae9f4e libstdc++: Default to --enable-libstdcxx-filesystem-ts for *-*-mingw*
* acinclude.m4 (GLIBCXX_ENABLE_FILESYSTEM_TS): Enable by default for
	mingw targets.
	* configure: Regenerate.

From-SVN: r278870
2019-11-30 01:03:40 +00:00
Christophe Lyon 6508fa9c06 [ARM/FDPIC v6 24/24] [ARM] FDPIC: Handle arm*-*-uclinuxfdpiceabi in libstdc++ configure scripts
2019-09-10  Christophe Lyon  <christophe.lyon@st.com>

        libstdc++-v3/
    	* acinclude.m4: Handle uclinux*.
    	* configure: Regenerate.
    	* configure.host: Handle uclinux*

From-SVN: r275586
2019-09-10 10:13:20 +02:00
Mike Crowe ad4d1d21ad PR libstdc++/41861 Add full steady_clock support to condition_variable
The pthread_cond_clockwait function is available in glibc since the 2.30
release. If this function is available in the C library it can be used
to fix PR libstdc++/41861 by supporting std::chrono::steady_clock
properly with std::condition_variable.

This means that code using std::condition_variable::wait_for or
std::condition_variable::wait_until with std::chrono::steady_clock is no
longer subject to timing out early or potentially waiting for much
longer if the system clock is warped at an inopportune moment.

If pthread_cond_clockwait is available then std::chrono::steady_clock is
deemed to be the "best" clock available which means that it is used for
the relative wait_for calls and absolute wait_until calls using
user-defined clocks. Calls explicitly using std::chrono::system_clock
continue to use CLOCK_REALTIME via __gthread_cond_timedwait.

If pthread_cond_clockwait is not available then
std::chrono::system_clock is deemed to be the "best" clock available
which means that the previous suboptimal behaviour remains.

2019-09-04  Mike Crowe  <mac@mcrowe.com>

	PR libstdc++/41861
	* acinclude.m4 (GLIBCXX_CHECK_PTHREAD_COND_CLOCKWAIT): Check for new
	pthread_cond_clockwait function.
	* configure.ac: Use GLIBCXX_CHECK_PTHREAD_COND_CLOCKWAIT.
	* configure: Regenerate.
	* config.h.in: Regenerate.
	* include/std/condition_variable: (condition_variable): Rename
	__steady_clock_t typedef and add system_clock. Change __clock_t to be
	a typedef for the preferred clock to convert arbitrary other clocks to.
	[_GLIBCXX_USE_PTHREAD_COND_CLOCKWAIT] (wait_until): Add a steady_clock
	overload.
	(wait_until): Change __clock_t overload to use system_clock.
	[_GLIBCXX_USE_PTHREAD_COND_CLOCKWAIT] (__wait_until_impl): Add
	steady_clock overload that calls pthread_cond_clockwait.
	(__wait_until_impl): Change __clock_t overload to use system_clock.
	(condition_variable_any) [_GLIBCXX_USE_PTHREAD_COND_CLOCKWAIT]: Use
	steady_clock for __clock_t if pthread_cond_clockwait is available.

From-SVN: r275390
2019-09-04 23:43:29 +01:00
Chung-Lin Tang c6c2d1bc9b re PR other/79543 (Inappropriate "ld --version" checking)
2019-09-03  Chung-Lin Tang <cltang@codesourcery.com>

	libatomic/
	PR other/79543
	* acinclude.m4 (LIBAT_CHECK_LINKER_FEATURES): Fix GNU ld --version
	scanning to conform to the GNU Coding Standards.
	* configure: Regenerate.

	libffi/
	PR other/79543
	* acinclude.m4 (LIBAT_CHECK_LINKER_FEATURES): Fix GNU ld --version
	scanning to conform to the GNU Coding Standards.
	* configure: Regenerate.

	libgomp/
	PR other/79543
	* acinclude.m4 (LIBGOMP_CHECK_LINKER_FEATURES): Fix GNU ld --version
	scanning to conform to the GNU Coding Standards.
	* configure: Regenerate.

	libitm/
	PR other/79543
	* acinclude.m4 (LIBITM_CHECK_LINKER_FEATURES): Fix GNU ld --version
	scanning to conform to the GNU Coding Standards.
	* configure: Regenerate.

	libstdc++-v3/
	PR other/79543
	* acinclude.m4 (GLIBCXX_CHECK_LINKER_FEATURES): Fix GNU ld --version
	scanning to conform to the GNU Coding Standards.
	* configure: Regenerate.

From-SVN: r275341
2019-09-03 14:10:26 +00:00
Jonathan Wakely d02a041242 PR libstdc++/91067 add more missing exports for directory iterators
PR libstdc++/91067
	* acinclude.m4 (libtool_VERSION): Bump to 6:28:0.
	* configure: Regenerate.
	* config/abi/pre/gnu.ver (GLIBCXX_3.4.28): Add new version. Export
	missing symbols.
	* testsuite/27_io/filesystem/iterators/91067.cc: Test move
	constructors.
	* testsuite/util/testsuite_abi.cc: Add new symbol version.

From-SVN: r275032
2019-08-29 13:16:27 +01:00
Jonathan Wakely 67699bf667 PR libstdc++/91067 fix missing exports for filesystem iterators
The copy assignment operator for recursive_directory_iterator was not
exported despite being needed. The __shared_ptr default constructors are
not needed when compiling with GCC but Clang requires them for -O1.

	PR libstdc++/91067
	* acinclude.m4 (libtool_VERSION): Bump to 6:27:0.
	* configure: Regenerate.
	* config/abi/pre/gnu.ver (GLIBCXX_3.4.27): Add new version. Export
	missing symbols.
	* testsuite/27_io/filesystem/iterators/91067.cc: New test.
	* testsuite/util/testsuite_abi.cc: Add new symbol version.

From-SVN: r273023
2019-07-03 22:06:25 +01:00
Jonathan Wakely 86f73527aa Skip libstdc++ debug build in early bootstrap stages
As mentioned in PR 90770, this is a patch that Debian have been carrying
for some time. The additional unoptimized copies of libstdc++ libs that
get built during each stage are never going to be used, so don't bother
building them.

For a profiled bootstrap this means we won't train the compiler on the
unoptimized library code with assertions enabled, but that doesn't seem
like a big problem, as the same code has already been compiled once for
the main libstdc++ library.

	* acinclude.m4 (GLIBCXX_ENABLE_DEBUG): Only do debug build for final
	stage of bootstrap.
	* configure: Regenerate.

From-SVN: r272509
2019-06-20 15:17:57 +01:00
Jonathan Wakely b0c0d878a8 PR libstdc++/85494 use rdseed and rand_s in std::random_device
Add support for additional sources of randomness to std::random_device,
to allow using RDSEED for Intel CPUs and rand_s for Windows. When
supported these can be selected using the tokens "rdseed" and "rand_s".
For *-w64-mingw32 targets the "default" token will now use rand_s, and
for other i?86-*-* and x86_64-*-* targets it will try to use "rdseed"
first, then "rdrand", and finally "/dev/urandom".

To simplify the declaration of std::random_device in <bits/random.h> the
constructors now unconditionally call _M_init instead of _M_init_pretr1,
and the function call operator now unconditionally calls _M_getval. The
library code now decides whether _M_init and _M_getval should use a real
source of randomness or the mt19937 engine.

Existing code compiled against old libstdc++ headers will still call
_M_init_pretr1 and _M_getval_pretr1, but those functions now forward to
_M_init and _M_getval if a real source of randomness is available. This
means existing code compiled for mingw-w64 will start to use rand_s just
by linking to a new libstdc++.dll.

	* acinclude.m4 (GLIBCXX_CHECK_X86_RDSEED): Define macro to check if
	the assembler supports rdseed.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Use GLIBCXX_CHECK_X86_RDSEED.
	* config/os/mingw32-w64/os_defines.h (_GLIBCXX_USE_CRT_RAND_S): Define.
	* doc/html/*: Regenerate.
	* doc/xml/manual/status_cxx2011.xml: Document new tokens.
	* include/bits/random.h (random_device::random_device()): Always call
	_M_init rather than _M_init_pretr1.
	(random_device::random_device(const string&)): Likewise.
	(random_device::operator()()): Always call _M_getval().
	(random_device::_M_file): Replace first member of union with an
	anonymous struct, with _M_file as its first member.
	* src/c++11/random.cc [_GLIBCXX_X86_RDRAND] (USE_RDRAND): Define.
	[_GLIBCXX_X86_RDSEED] (USE_RDSEED): Define.
	(USE_MT19937): Define if none of the above are defined.
	(USE_POSIX_FILE_IO): Define.
	(_M_strtoul): Remove.
	[USE_RDSEED] (__x86_rdseed): Define new function.
	[_GLIBCXX_USE_CRT_RAND_S] (__winxp_rand_s): Define new function.
	(random_device::_M_init(const string&)): Initialize new union members.
	Add support for "rdseed" and "rand_s" tokens. Decide what the
	"default" token does according to which USE_* macros are defined.
	[USE_POSIX_FILE_IO]: Store a file descriptor.
	[USE_MT19937]: Forward to _M_init_pretr1 instead.
	(random_device::_M_init_pretr1(const string&)) [USE_MT19937]: Inline
	code from _M_strtoul.
	[!USE_MT19937]: Call _M_init, transforming the old default token or
	numeric tokens to "default".
	(random_device::_M_fini()) [USE_POSIX_FILE_IO]: Use close not fclose.
	(random_device::_M_getval()): Use new union members to obtain a
	random number from the stored function pointer or file descriptor.
	[USE_MT19937]: Obtain a value from the mt19937 engine.
	(random_device::_M_getval_pretr1()): Call _M_getval().
	(random_device::_M_getentropy()) [USE_POSIX_FILE_IO]: Use _M_fd
	instead of fileno.
	[!USE_MT19937] (mersenne_twister): Do not instantiate when not needed.
	* testsuite/26_numerics/random/random_device/85494.cc: New test.

From-SVN: r271740
2019-05-29 15:45:35 +01:00
Jonathan Wakely a4395a846a PR libstdc++/89466 avoid slow xsltproc command in configure
Certain broken versions of xsltproc ignore the --nonet option and will
attempt to fetch the docbook stylesheet from the WWW when it isn't in
the local XML catalog.

This patch checks for the local stylesheet directory first, and doesn't
use xsltproc if no local stylesheets are found. Checking for the local
directory is done using xmlcatalog if available, only checking the
hardcoded list of directories if xmlcatalog fails. The right directory
for Suse is added to the hardcoded list.

This should avoid doing an xsltproc check that would need to download
the stylesheet, so no network connection is made even if a broken
xsltproc is present.

	PR libstdc++/89466
	* acinclude.m4 (GLIBCXX_CONFIGURE_DOCBOOK): Reorder check for local
	stylesheet directories before check for xsltproc. Try to use
	xmlcatalog to find local stylesheet directory before trying hardcoded
	paths. Add path used by suse to hardcoded paths. Adjust xsltproc
	check to look for the same stylesheet as doc/Makefile.am uses. Don't
	use xsltproc if xmlcatalog fails to find a local stylesheet.
	* configure.ac: Check for xmlcatalog.
	* Makefile.in: Regenerate.
	* configure: Likewise.
	* doc/Makefile.in: Likewise.
	* include/Makefile.in: Likewise.
	* libsupc++/Makefile.in: Likewise.
	* po/Makefile.in: Likewise.
	* python/Makefile.in: Likewise.
	* src/Makefile.in: Likewise.
	* src/c++11/Makefile.in: Likewise.
	* src/c++17/Makefile.in: Likewise.
	* src/c++98/Makefile.in: Likewise.
	* src/filesystem/Makefile.in: Likewise.
	* testsuite/Makefile.in: Likewise.

From-SVN: r269249
2019-02-27 11:25:44 +00:00
Jonathan Wakely cf4b581f2e Fix build for systems without POSIX truncate
Older versions of newlib do not provide truncate so add a configure
check for it, and provide a fallback definition.

There were also some missing exports in the linker script, which went
unnoticed because there are no tests for some functions. A new link-only
test checks that every filesystem operation function is defined by the
library.

	* acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Check for truncate.
	* config.h.in: Regenerate.
	* config/abi/pre/gnu.ver: Order patterns for filesystem operations
	alphabetically and add missing entries for copy_symlink,
	hard_link_count, rename, and resize_file.
	* configure: Regenerate.
	* src/c++17/fs_ops.cc (resize_file): Remove #if so posix::truncate is
	used unconditionally.
	* src/filesystem/ops-common.h (__gnu_posix::truncate)
	[!_GLIBCXX_HAVE_TRUNCATE]: Provide fallback definition that only
	supports truncating to zero length.
	* testsuite/27_io/filesystem/operations/all.cc: New test.
	* testsuite/27_io/filesystem/operations/resize_file.cc: New test.

From-SVN: r267647
2019-01-07 12:38:51 +00:00
Jonathan Wakely de4db54fd9 PR libstdc++/86756 Move rest of std::filesystem to libstdc++.so
Move std::filesystem directory iterators and operations from
libstdc++fs.a to main libstdc++ library. These components have many
dependencies on OS support, which is not available on all targets. Some
additional autoconf checks and conditional compilation is needed to
ensure the files will build for all targets. Previously this code was
not compiled without --enable-libstdcxx-filesystem-ts but the C++17
components should be available for all hosted builds.

The tests for these components no longer need to link to libstdc++fs.a,
but are not expected to pass on all targets. To avoid numerous failures
on targets which are not expected to pass the tests (due to missing OS
functionality) leave the dg-require-filesystem-ts directives in place
for now. This will ensure the tests only run for builds where the
filesystem-ts library is built, which presumably means some level of OS
support is present.

	PR libstdc++/86756
	* acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Check for utime and
	lstat and define _GLIBCXX_USE_UTIME and _GLIBCXX_USE_LSTAT.
	* config.h.in: Regenerate.
	* config/abi/pre/gnu.ver (GLIBCXX_3.4.26): Export symbols for
	remaining std::filesystem types and functions.
	* configure: Regenerate.
	* src/c++17/Makefile.am: Add C++17 filesystem sources.
	* src/c++17/Makefile.in: Regenerate.
	* src/c++17/cow-fs_dir.cc: Move src/filesystem/cow-std-dir.cc to
	here, and change name of included file.
	* src/c++17/cow-fs_ops.cc: Move src/filesystem/cow-std-ops.cc to
	here, and change name of included file.
	* src/c++17/fs_dir.cc: Move src/filesystem/std-dir.cc to here. Change
	path to dir-common.h.
	* src/c++17/fs_ops.cc: Move src/filesystem/std-ops.cc to here. Change
	path to ops-common.h. Disable -Wunused-parameter warnings.
	(internal_file_clock): Define unconditionally.
	[!_GLIBCXX_HAVE_SYS_STAT_H] (internal_file_clock::from_stat): Do not
	define.
	(do_copy_file, do_space): Move definitions to ops.common.h.
	(copy, file_size, hard_link_count, last_write_time, space): Only
	perform operation when _GLIBCXX_HAVE_SYS_STAT_H is defined, otherwise
	report an error.
	(last_write_time, read_symlink): Remove unused attributes from
	parameters.
	* src/filesystem/Makefile.am: Remove C++17 filesystem sources.
	* src/filesystem/Makefile.in: Regenerate.
	* src/filesystem/cow-std-dir.cc: Move to src/c++17/cow-fs_dir.cc.
	* src/filesystem/cow-std-ops.cc: Move to src/c++17/cow-fs_ops.cc.
	* src/filesystem/std-dir.cc: Move to src/c++17/fs_dir.cc.
	* src/filesystem/std-ops.cc: Move to src/c++17/fs_ops.cc.
	* src/filesystem/dir-common.h [!_GLIBCXX_HAVE_DIRENT_H]: Define
	dummy types and functions instead of using #error.
	* src/filesystem/dir.cc [!_GLIBCXX_HAVE_DIRENT_H]: Use #error.
	* src/filesystem/ops-common.h [!_GLIBCXX_USE_LSTAT] (lstat): Define
	in terms of stat.
	[!_GLIBCXX_HAVE_UNISTD_H]: Define dummy types and functions.
	(do_copy_file, do_space): Move definitions here from std-ops.cc.
	* src/filesystem/ops.cc: Adjust calls to do_copy_file and do_space
	to account for new namespace.
	* testsuite/27_io/filesystem/directory_entry/86597.cc: Remove
	-lstdc++fs from dg-options.
	* testsuite/27_io/filesystem/directory_entry/lwg3171.cc: Likewise.
	* testsuite/27_io/filesystem/file_status/1.cc: Likewise.
	* testsuite/27_io/filesystem/filesystem_error/cons.cc: Likewise.
	* testsuite/27_io/filesystem/filesystem_error/copy.cc: Likewise.
	* testsuite/27_io/filesystem/iterators/directory_iterator.cc:
	Likewise.
	* testsuite/27_io/filesystem/iterators/pop.cc: Likewise.
	* testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc:
	Likewise.
	* testsuite/27_io/filesystem/operations/absolute.cc: Likewise.
	* testsuite/27_io/filesystem/operations/canonical.cc: Likewise.
	* testsuite/27_io/filesystem/operations/copy.cc: Likewise.
	* testsuite/27_io/filesystem/operations/copy_file.cc: Likewise.
	* testsuite/27_io/filesystem/operations/create_directories.cc:
	Likewise.
	* testsuite/27_io/filesystem/operations/create_directory.cc: Likewise.
	* testsuite/27_io/filesystem/operations/create_symlink.cc: Likewise.
	* testsuite/27_io/filesystem/operations/current_path.cc: Likewise.
	* testsuite/27_io/filesystem/operations/equivalent.cc: Likewise.
	* testsuite/27_io/filesystem/operations/exists.cc: Likewise.
	* testsuite/27_io/filesystem/operations/file_size.cc: Likewise.
	* testsuite/27_io/filesystem/operations/is_empty.cc: Likewise.
	* testsuite/27_io/filesystem/operations/last_write_time.cc: Likewise.
	* testsuite/27_io/filesystem/operations/permissions.cc: Likewise.
	* testsuite/27_io/filesystem/operations/proximate.cc: Likewise.
	* testsuite/27_io/filesystem/operations/read_symlink.cc: Likewise.
	* testsuite/27_io/filesystem/operations/relative.cc: Likewise.
	* testsuite/27_io/filesystem/operations/remove.cc: Likewise.
	* testsuite/27_io/filesystem/operations/remove_all.cc: Likewise.
	* testsuite/27_io/filesystem/operations/space.cc: Likewise.
	* testsuite/27_io/filesystem/operations/status.cc: Likewise.
	* testsuite/27_io/filesystem/operations/symlink_status.cc: Likewise.
	* testsuite/27_io/filesystem/operations/temp_directory_path.cc:
	Likewise.
	* testsuite/27_io/filesystem/operations/weakly_canonical.cc: Likewise.

From-SVN: r267616
2019-01-06 22:34:37 +00:00
Jonathan Wakely da29d2a36e PR libstdc++/67843 set shared_ptr lock policy at build-time
This resolves a longstanding issue where the lock policy for shared_ptr
reference counting depends on compilation options when the header is
included, so that different -march options can cause ABI changes. For
example, objects compiled with -march=armv7 will use atomics to
synchronize reference counts, and objects compiled with -march=armv5t
will use a mutex. That means the shared_ptr control block will have a
different layout in different objects, causing ODR violations and
undefined behaviour. This was the root cause of PR libstdc++/42734 as
well as PR libstdc++/67843.

The solution is to decide on the lock policy at build time, when
libstdc++ is configured. The configure script checks for the
availability of the necessary atomic built-ins for the target and fixes
that choice permanently. Different -march flags used to compile user
code will not cause changes to the lock policy. This results in an ABI
change for certain compilations, but only where there was already an ABI
incompatibility between the libstdc++.so library and objects built with
an incompatible -march option. In general, this means a more stable ABI
that isn't silently altered when -march flags make addition atomic ops
available.

To force a target to use "atomic" or "mutex" the new configure option
--with-libstdcxx-lock-policy can be used.

In order to turn ODR violations into linker errors, the uses of
shared_ptr in filesystem directory iterators have been replaced
with __shared_ptr, and explicit instantiations are declared. This
ensures that object files using those types cannot link to libstdc++
libs unless they use the same lock policy.

	PR libstdc++/67843
	* acinclude.m4 (GLIBCXX_ENABLE_LOCK_POLICY): Add new macro
	that defines _GLIBCXX_HAVE_ATOMIC_LOCK_POLICY.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Use GLIBCXX_ENABLE_LOCK_POLICY.
	* doc/xml/manual/configure.xml: Document new configure option.
	* include/bits/fs_dir.h (directory_iterator): Use __shared_ptr
	instead of shared_ptr.
	(recursive_directory_iterator): Likewise.
	(__shared_ptr<_Dir>): Add explicit instantiation declaration.
	(__shared_ptr<recursive_directory_iterator::_Dir_stack>): Likewise.
	* include/bits/shared_ptr_base.h (__allocate_shared, __make_shared):
	Add default template argument for _Lock_policy template parameter.
	* include/ext/concurrence.h (__default_lock_policy): Check macro
	_GLIBCXX_HAVE_ATOMIC_LOCK_POLICY instead of checking if the current
	target supports the builtins for compare-and-swap.
	* src/filesystem/std-dir.cc (__shared_ptr<_Dir>): Add explicit
	instantiation definition.
	(__shared_ptr<recursive_directory_iterator::_Dir_stack>): Likewise.
	(directory_iterator, recursive_directory_iterator): Use __make_shared
	instead of make_shared.

From-SVN: r266533
2018-11-27 23:25:56 +00:00
Jonathan Wakely 5ae2c32a8a Define _GLIBCXX_USE_DEV_RANDOM as replacement for _GLIBCXX_USE_RANDOM_TR1
Define and use a new macro with a more descriptive name. Only use the
old macro in <tr1/random.h>.

	* acinclude.m4 (GLIBCXX_CHECK_RANDOM_TR1): Replace with ...
	(GLIBCXX_CHECK_DEV_RANDOM): New macro with more descriptive name.
	Define _GLIBCXX_USE_DEV_RANDOM as well as _GLIBCXX_USE_RANDOM_TR1.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Use GLIBCXX_CHECK_DEV_RANDOM instead of
	GLIBCXX_CHECK_RANDOM_TR1.
	crossconfig.m4: Likewise.
	* include/bits/random.h (random_device): Use _GLIBCXX_USE_DEV_RANDOM
	instead of _GLIBCXX_USE_RANDOM_TR1.
	* testsuite/26_numerics/random/random_device/cons/token.cc: Likewise.

From-SVN: r265197
2018-10-16 15:49:29 +01:00
Jonathan Wakely a9d49e9681 Add new src/c++17 directory to list in acinclude.m4
* acinclude.m4 (glibcxx_SUBDIRS): Add src/c++17.
	* src/Makefile.am: Add comment.
	* src/c++17/Makefile.in: Regenerate.

From-SVN: r262964
2018-07-25 12:01:39 +01:00
Jonathan Wakely c3be340eb6 PR libstdc++/86450 use -Wabi=2 and simplify -Werror use
Use -Wabi=2 to fix warnings about -Wabi having no effect on its own.
This requires suppressing two warnings in src/c++11/debug.cc which do
not affect the library ABI.

Previously libstdc++ defaulted to --enable-werror but the -Werror flag
was not actually added unless --enable-maintainer-mode was used. This is
not documented and not the expected behaviour. This removes any special
treatment for maintainer-mode, makes -Werror depend directly on
--enable-werror, and changes the default to --enable-werror=no.

	PR libstdc++/86450
	* acinclude.m4 (GLIBCXX_CHECK_COMPILER_FEATURES): Don't define WERROR.
	(GLIBCXX_EXPORT_FLAGS): Use -Wabi=2 instead of -Wabi.
	* configure: Regenerate.
	* configure.ac: Change GLIBCXX_ENABLE_WERROR default to "no".
	* doc/Makefile.in: Regenerate.
	* fragment.am: Set WERROR_FLAG to -Werror instead of $(WERROR).
	* include/Makefile.in: Regenerate.
	* libsupc++/Makefile.in: Regenerate.
	* po/Makefile.in: Regenerate.
	* python/Makefile.in: Regenerate.
	* src/Makefile.in: Regenerate.
	* src/c++11/Makefile.in: Regenerate.
	* src/c++11/debug.cc: Use diagnostic pragmas to suppress warnings
	from -Wabi=2 that don't affect exported symbols.
	* src/c++98/Makefile.in: Regenerate.
	* src/filesystem/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.

From-SVN: r262824
2018-07-17 14:18:47 +01:00
Jonathan Wakely cda121ac7a PR libstdc++/83328 add correct basic_string::insert for initializer_list
The SSO basic_string has a non-standard insert(iterator, initializer_list)
overload, from a C++0x draft. This adds the correct overload, while also
preserving the old one so that the old symbol is still exported from the
library.

The COW basic_string doesn't have any of the C++11 changes to the insert
overloads (they all still have non-const iterator parameters and the
ones that should return an iterator still return void). This doesn't
make any change to the COW string.

	PR libstdc++/83328
	* acinclude.m4 (libtool_VERSION): Bump to 6:26:0.
	* config/abi/pre/gnu.ver: Add GLIBCXX_3.4.26 and export new symbol.
	* configure: Regenerate.
	* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
	(basic_string::insert(const_iterator, initializer_list<C>)): Add.
	[_GLIBCXX_USE_CXX11_ABI && !_GLIBCXX_DEFINING_STRING_INSTANTIATIONS]
	(basic_string::insert(iterator, initializer_list<C>)): Suppress
	definition.
	* include/debug/string (basic_string::insert(iterator, C)): Change
	first parameter to const_iterator.
	(basic_string::insert(iterator, size_type, C)): Likewise. Change
	return type to iterator.
	(basic_string::insert(iterator, InputIterator, InputIterator)):
	Likewise.
	(basic_string::insert(iterator, initializer_list<C>)): Change first
	parameter to const_iterator and return type to iterator.
	* src/c++11/string-inst.cc: Extend comment.
	* testsuite/21_strings/basic_string/modifiers/insert/char/83328.cc:
	New.
	* testsuite/21_strings/basic_string/modifiers/insert/wchar_t/83328.cc:
	New.
	* testsuite/util/testsuite_abi.cc: Add new symbol version.

From-SVN: r261866
2018-06-21 23:01:25 +01:00
Jonathan Wakely 7314856c61 Fix bootstrap failure for bare metal due to autoconf link tests
The AC_CHECK_FUNCS tests cause the build to fail for bare metal cross
compilers, where link tests are not allowed. Replace them with
GCC_TRY_COMPILE_OR_LINK tests instead. Skip all the Filesystem
dependency checks if not building the filesystem library.

	* acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Only check when
	enable_libstdcxx_filesystem_ts = yes. Check for link, readlink and
	symlink.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Remove AC_CHECK_FUNCS for link, readlink and symlink.

From-SVN: r261704
2018-06-18 17:01:24 +01:00
Tulio Magno Quites Machado Filho f421e442c6 PR libstdc++/84654 Disable __float128 specializations for -mno-float128
2018-05-01  Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>

	PR libstdc++/84654
	* acinclude.m4: Set ENABLE_FLOAT128 instead of _GLIBCXX_USE_FLOAT128.
	* config.h.in: Remove references to _GLIBCXX_USE_FLOAT128.
	* configure: Regenerate.
	* include/Makefile.am: Replace the value of _GLIBCXX_USE_FLOAT128
	based on ENABLE_FLOAT128.
	* include/Makefile.in: Regenerate.
	* include/bits/c++config: Define _GLIBCXX_USE_FLOAT128.
	[!defined(__FLOAT128__) && !defined(__SIZEOF_FLOAT128__)]: Undefine
	_GLIBCXX_USE_FLOAT128.

From-SVN: r259813
2018-05-01 23:47:33 +01:00
Sebastian Huber b76602dcf2 RTEMS: Enable some libstdc++ features
libstdc++/

	* acinclude.m4 (GLIBCXX_ENABLE_LIBSTDCXX_TIME): Add rtems*.
	(GLIBCXX_ENABLE_FILESYSTEM_TS): Likewise.
	* configure: Regenerate.

From-SVN: r254985
2017-11-21 06:22:13 +00:00
Igor Tsimbalist 36101de964 Enable building libstdc++-v3 with Intel CET
libstdc++-v3/
	* acinclude.m4: Add cet.m4.
	* configure.ac: Set CET_FLAGS. Update EXTRA_CFLAGS,
	EXTRA_CXX_FLAGS.
	* libsupc++/Makefile.am: Use Add EXTRA_CFLAGS.
	* Makefile.in: Regenerate.
	* configure: Likewise.
	* doc/Makefile.in: Likewise.
	* include/Makefile.in: Likewise.
	* libsupc++/Makefile.in: Likewise.
	* po/Makefile.in: Likewise.
	* python/Makefile.in: Likewise.
	* src/Makefile.in: Likewise.
	* src/c++11/Makefile.in: Likewise.
	* src/c++98/Makefile.in: Likewise.
	* src/filesystem/Makefile.in: Likewise.
	* testsuite/Makefile.in: Likewise.

From-SVN: r254895
2017-11-17 22:28:10 +01:00