Skip to content
Snippets Groups Projects
  1. Jan 02, 2025
  2. Nov 08, 2024
    • Jakub Jelinek's avatar
      ibstdc++: Add some further attributes to ::operator new in <new> · 80e5be0c
      Jakub Jelinek authored
      I've noticed alloc_align attribute is missing on the non-vector
      ::operator new with std::align_val_t and const std::nothrow_t&
      arguments, this patch adds it.  The last hunk is just
      an attempt to make the line shorter.
      The first hunk originally added also __alloc_size__ (1) attribute,
      but seems that regresses
      FAIL: g++.dg/tm/pr46270.C  -std=gnu++98 (test for excess errors)
      with
      Excess errors:
      .../libstdc++-v3/libsupc++/new:137:26: warning: new declaration 'void* operator new(std::size_t)' ambiguates built-in declaration 'void* operator new(long unsigned int)
      +transaction_safe' [-Wbuiltin-declaration-mismatch]
      .../libstdc++-v3/libsupc++/new:140:26: warning: new declaration 'void* operator new [](std::size_t)' ambiguates built-in declaration 'void* operator new [](long unsigned int)
      +transaction_safe' [-Wbuiltin-declaration-mismatch]
      I must say I have no clue why that happens only in C++98 (C++11 and
      above are quiet) and why only with -fgnu-tm, tried to debug that but
      am lost.  It is some conflict with the predeclared ::operator new, but
      those clearly do have the externally_visible attribute, and alloc_size (1)
      attributes:
           extvisattr = build_tree_list (get_identifier ("externally_visible"),
                                         NULL_TREE);
           newattrs = tree_cons (get_identifier ("alloc_size"),
                                 build_tree_list (NULL_TREE, integer_one_node),
                                 extvisattr);
           newtype = cp_build_type_attribute_variant (ptr_ftype_sizetype, newattrs);
           newtype = build_exception_variant (newtype, new_eh_spec);
      ...
          tree opnew = push_cp_library_fn (NEW_EXPR, newtype, 0);
          DECL_IS_MALLOC (opnew) = 1;
          DECL_SET_IS_OPERATOR_NEW (opnew, true);
          DECL_IS_REPLACEABLE_OPERATOR (opnew) = 1;
      and at C++98 I think libstdc++ doesn't add transaction_safe attribute:
       // Conditionally enable annotations for the Transactional Memory TS on C++11.
       // Most of the following conditions are due to limitations in the current
       // implementation.
       #if __cplusplus >= 201103L && _GLIBCXX_USE_CXX11_ABI                    \
         && _GLIBCXX_USE_DUAL_ABI && __cpp_transactional_memory >= 201500L     \
         &&  !_GLIBCXX_FULLY_DYNAMIC_STRING && _GLIBCXX_USE_WEAK_REF           \
         && _GLIBCXX_USE_ALLOCATOR_NEW
       #define _GLIBCXX_TXN_SAFE transaction_safe
       #define _GLIBCXX_TXN_SAFE_DYN transaction_safe_dynamic
       #else
       #define _GLIBCXX_TXN_SAFE
       #define _GLIBCXX_TXN_SAFE_DYN
       #endif
      push_cp_library_fn adds transaction_safe attribute whenever -fgnu-tm
      is used, regardless of the other conditionals:
         if (flag_tm)
           apply_tm_attr (fn, get_identifier ("transaction_safe"));
      
      Anyway, omitting alloc_size (1) fixes that test and given that the
      predeclared operator new already has alloc_size (1) attribute, I think it
      can be safely left out.
      
      2024-11-08  Jakub Jelinek  <jakub@redhat.com>
      
      	* libsupc++/new (::operator new, ::operator new[]): Add malloc
      	attribute where missing.  Add alloc_align attribute when
      	std::align_val_t is present and where it was missing.  Formatting fix.
      80e5be0c
  3. Nov 01, 2024
  4. Oct 31, 2024
    • Jonathan Wakely's avatar
      libstdc++: Add align_alloc attribute to aligned operator new · 646b24ef
      Jonathan Wakely authored
      
      The aligned versions of operator new should use the align_alloc
      attribute to help the compiler.
      
      PR c++/86878 requests that the compiler would use the attribute to warn
      about invalid attributes, so an XFAILed test is added for that.
      
      libstdc++-v3/ChangeLog:
      
      	* libsupc++/new (operator new): Add attribute align_alloc(2) to
      	overloads taking a std::align_val_t argument.
      	* testsuite/18_support/new_aligned_warn.cc: New test.
      
      Reviewed-by: default avatarJakub Jelinek <jakub@redhat.com>
      646b24ef
  5. Oct 25, 2024
    • Jakub Jelinek's avatar
      non-gcc: Remove trailing whitespace · 45ab93d9
      Jakub Jelinek authored
      I've tried to build stage3 with
      -Wleading-whitespace=blanks -Wtrailing-whitespace=blank -Wno-error=leading-whitespace=blanks -Wno-error=trailing-whitespace=blank
      added to STRICT_WARN and that expectably resulted in about
      2744 unique trailing whitespace warnings and 124837 leading whitespace
      warnings when excluding *.md files (which obviously is in big part a
      generator issue).  Others from that are generator related, I think those
      need to be solved later.
      
      The following patch just fixes up the easy case (trailing whitespace),
      which could be easily automated:
      for i in `find . -name \*.h -o -name \*.cc -o -name \*.c | xargs grep -l '[ 	]$' | grep -v testsuite/`; do sed -i -e 's/[ 	]*$//' $i; done
      I've excluded files which I knew are obviously generated or go FE.
      
      Is there anything else we'd want to avoid the changes?
      
      Due to patch size, I've split it between gcc/ part
      and rest (include/, libiberty/, libgcc/, libcpp/, libstdc++-v3/;
      this part).
      
      2024-10-24  Jakub Jelinek  <jakub@redhat.com>
      
      include/
      	* dyn-string.h: Remove trailing whitespace.
      	* libiberty.h: Likewise.
      	* xregex.h: Likewise.
      	* splay-tree.h: Likewise.
      	* partition.h: Likewise.
      	* plugin-api.h: Likewise.
      	* demangle.h: Likewise.
      	* vtv-change-permission.h: Likewise.
      	* fibheap.h: Likewise.
      	* hsa_ext_image.h: Likewise.
      	* hashtab.h: Likewise.
      	* libcollector.h: Likewise.
      	* sort.h: Likewise.
      	* symcat.h: Likewise.
      	* hsa_ext_amd.h: Likewise.
      libcpp/
      	* directives.cc: Remove trailing whitespace.
      	* mkdeps.cc: Likewise.
      	* line-map.cc: Likewise.
      	* internal.h: Likewise.
      	* files.cc: Likewise.
      	* init.cc: Likewise.
      	* makeucnid.cc: Likewise.
      	* system.h: Likewise.
      	* include/line-map.h: Likewise.
      	* include/symtab.h: Likewise.
      	* include/cpplib.h: Likewise.
      	* expr.cc: Likewise.
      	* charset.cc: Likewise.
      	* macro.cc: Likewise.
      	* errors.cc: Likewise.
      	* lex.cc: Likewise.
      	* traditional.cc: Likewise.
      libgcc/
      	* crtstuff.c: Remove trailing whitespace.
      	* libgcov.h: Likewise.
      	* config/alpha/crtfastmath.c: Likewise.
      	* config/alpha/vms-gcc_shell_handler.c: Likewise.
      	* config/alpha/vms-unwind.h: Likewise.
      	* config/pa/linux-atomic.c: Likewise.
      	* config/pa/linux-unwind.h: Likewise.
      	* config/pa/quadlib.c: Likewise.
      	* config/pa/fptr.c: Likewise.
      	* config/s390/32/_fixsfdi.c: Likewise.
      	* config/s390/32/_fixunssfdi.c: Likewise.
      	* config/s390/32/_fixunsdfdi.c: Likewise.
      	* config/c6x/pr-support.c: Likewise.
      	* config/lm32/_udivsi3.c: Likewise.
      	* config/lm32/libgcc_lm32.h: Likewise.
      	* config/lm32/_udivmodsi4.c: Likewise.
      	* config/lm32/_mulsi3.c: Likewise.
      	* config/lm32/_modsi3.c: Likewise.
      	* config/lm32/_umodsi3.c: Likewise.
      	* config/lm32/_divsi3.c: Likewise.
      	* config/darwin-crt3.c: Likewise.
      	* config/msp430/mpy.c: Likewise.
      	* config/ia64/tf-signs.c: Likewise.
      	* config/ia64/fde-vms.c: Likewise.
      	* config/ia64/unwind-ia64.c: Likewise.
      	* config/ia64/vms-unwind.h: Likewise.
      	* config/ia64/sfp-exceptions.c: Likewise.
      	* config/ia64/quadlib.c: Likewise.
      	* config/ia64/unwind-ia64.h: Likewise.
      	* config/rl78/vregs.h: Likewise.
      	* config/arm/bpabi.c: Likewise.
      	* config/arm/unwind-arm.c: Likewise.
      	* config/arm/pr-support.c: Likewise.
      	* config/arm/linux-atomic.c: Likewise.
      	* config/arm/bpabi-lib.h: Likewise.
      	* config/frv/frvend.c: Likewise.
      	* config/frv/cmovw.c: Likewise.
      	* config/frv/frvbegin.c: Likewise.
      	* config/frv/cmovd.c: Likewise.
      	* config/frv/cmovh.c: Likewise.
      	* config/aarch64/cpuinfo.c: Likewise.
      	* config/i386/crtfastmath.c: Likewise.
      	* config/i386/cygming-crtend.c: Likewise.
      	* config/i386/32/tf-signs.c: Likewise.
      	* config/i386/crtprec.c: Likewise.
      	* config/i386/sfp-exceptions.c: Likewise.
      	* config/i386/w32-unwind.h: Likewise.
      	* config/m32r/initfini.c: Likewise.
      	* config/sparc/crtfastmath.c: Likewise.
      	* config/gcn/amdgcn_veclib.h: Likewise.
      	* config/nios2/linux-atomic.c: Likewise.
      	* config/nios2/linux-unwind.h: Likewise.
      	* config/nios2/lib2-mul.c: Likewise.
      	* config/nios2/lib2-nios2.h: Likewise.
      	* config/xtensa/unwind-dw2-xtensa.c: Likewise.
      	* config/rs6000/darwin-fallback.c: Likewise.
      	* config/rs6000/ibm-ldouble.c: Likewise.
      	* config/rs6000/sfp-machine.h: Likewise.
      	* config/rs6000/darwin-asm.h: Likewise.
      	* config/rs6000/darwin-crt2.c: Likewise.
      	* config/rs6000/aix-unwind.h: Likewise.
      	* config/rs6000/sfp-exceptions.c: Likewise.
      	* config/gthr-vxworks.c: Likewise.
      	* config/riscv/atomic.c: Likewise.
      	* config/visium/memcpy.c: Likewise.
      	* config/darwin-crt-tm.c: Likewise.
      	* config/stormy16/lib2funcs.c: Likewise.
      	* config/arc/ieee-754/divtab-arc-sf.c: Likewise.
      	* config/arc/ieee-754/divtab-arc-df.c: Likewise.
      	* config/arc/initfini.c: Likewise.
      	* config/sol2/gmon.c: Likewise.
      	* config/microblaze/divsi3_table.c: Likewise.
      	* config/m68k/fpgnulib.c: Likewise.
      	* libgcov-driver.c: Likewise.
      	* unwind-dw2.c: Likewise.
      	* fp-bit.c: Likewise.
      	* dfp-bit.h: Likewise.
      	* dfp-bit.c: Likewise.
      	* libgcov-driver-system.c: Likewise.
      libgcc/config/libbid/
      	* _le_td.c: Remove trailing whitespace.
      	* bid128_compare.c: Likewise.
      	* bid_div_macros.h: Likewise.
      	* bid64_to_bid128.c: Likewise.
      	* bid64_to_uint32.c: Likewise.
      	* bid128_to_uint64.c: Likewise.
      	* bid64_div.c: Likewise.
      	* bid128_round_integral.c: Likewise.
      	* bid_binarydecimal.c: Likewise.
      	* bid128_string.c: Likewise.
      	* bid_flag_operations.c: Likewise.
      	* bid128_to_int64.c: Likewise.
      	* _mul_sd.c: Likewise.
      	* bid64_mul.c: Likewise.
      	* bid128_noncomp.c: Likewise.
      	* _gt_dd.c: Likewise.
      	* bid64_add.c: Likewise.
      	* bid64_string.c: Likewise.
      	* bid_from_int.c: Likewise.
      	* bid128.c: Likewise.
      	* _ge_dd.c: Likewise.
      	* _ne_sd.c: Likewise.
      	* _dd_to_td.c: Likewise.
      	* _unord_sd.c: Likewise.
      	* bid64_to_uint64.c: Likewise.
      	* _gt_sd.c: Likewise.
      	* _sd_to_td.c: Likewise.
      	* _addsub_td.c: Likewise.
      	* _ne_td.c: Likewise.
      	* bid_dpd.c: Likewise.
      	* bid128_add.c: Likewise.
      	* bid128_next.c: Likewise.
      	* _lt_sd.c: Likewise.
      	* bid64_next.c: Likewise.
      	* bid128_mul.c: Likewise.
      	* _lt_dd.c: Likewise.
      	* _ge_td.c: Likewise.
      	* _unord_dd.c: Likewise.
      	* bid64_sqrt.c: Likewise.
      	* bid_sqrt_macros.h: Likewise.
      	* bid64_fma.c: Likewise.
      	* _sd_to_dd.c: Likewise.
      	* bid_conf.h: Likewise.
      	* bid64_noncomp.c: Likewise.
      	* bid_gcc_intrinsics.h: Likewise.
      	* _gt_td.c: Likewise.
      	* _ge_sd.c: Likewise.
      	* bid128_minmax.c: Likewise.
      	* bid128_quantize.c: Likewise.
      	* bid32_to_bid64.c: Likewise.
      	* bid_round.c: Likewise.
      	* _td_to_sd.c: Likewise.
      	* bid_inline_add.h: Likewise.
      	* bid128_fma.c: Likewise.
      	* _eq_td.c: Likewise.
      	* bid32_to_bid128.c: Likewise.
      	* bid64_rem.c: Likewise.
      	* bid128_2_str_tables.c: Likewise.
      	* _mul_dd.c: Likewise.
      	* _dd_to_sd.c: Likewise.
      	* bid128_div.c: Likewise.
      	* _lt_td.c: Likewise.
      	* bid64_compare.c: Likewise.
      	* bid64_to_int32.c: Likewise.
      	* _unord_td.c: Likewise.
      	* bid128_rem.c: Likewise.
      	* bid_internal.h: Likewise.
      	* bid64_to_int64.c: Likewise.
      	* _eq_dd.c: Likewise.
      	* _td_to_dd.c: Likewise.
      	* bid128_to_int32.c: Likewise.
      	* bid128_to_uint32.c: Likewise.
      	* _ne_dd.c: Likewise.
      	* bid64_quantize.c: Likewise.
      	* _le_dd.c: Likewise.
      	* bid64_round_integral.c: Likewise.
      	* _le_sd.c: Likewise.
      	* bid64_minmax.c: Likewise.
      libgcc/config/avr/libf7/
      	* f7-renames.h: Remove trailing whitespace.
      libstdc++-v3/
      	* include/debug/debug.h: Remove trailing whitespace.
      	* include/parallel/base.h: Likewise.
      	* include/parallel/types.h: Likewise.
      	* include/parallel/settings.h: Likewise.
      	* include/parallel/multiseq_selection.h: Likewise.
      	* include/parallel/partition.h: Likewise.
      	* include/parallel/random_number.h: Likewise.
      	* include/parallel/find_selectors.h: Likewise.
      	* include/parallel/partial_sum.h: Likewise.
      	* include/parallel/list_partition.h: Likewise.
      	* include/parallel/search.h: Likewise.
      	* include/parallel/algorithmfwd.h: Likewise.
      	* include/parallel/random_shuffle.h: Likewise.
      	* include/parallel/multiway_mergesort.h: Likewise.
      	* include/parallel/sort.h: Likewise.
      	* include/parallel/algobase.h: Likewise.
      	* include/parallel/numericfwd.h: Likewise.
      	* include/parallel/multiway_merge.h: Likewise.
      	* include/parallel/losertree.h: Likewise.
      	* include/bits/basic_ios.h: Likewise.
      	* include/bits/stringfwd.h: Likewise.
      	* include/bits/ostream_insert.h: Likewise.
      	* include/bits/stl_heap.h: Likewise.
      	* include/bits/unordered_map.h: Likewise.
      	* include/bits/hashtable_policy.h: Likewise.
      	* include/bits/stl_iterator_base_funcs.h: Likewise.
      	* include/bits/valarray_before.h: Likewise.
      	* include/bits/regex.h: Likewise.
      	* include/bits/postypes.h: Likewise.
      	* include/bits/stl_iterator.h: Likewise.
      	* include/bits/localefwd.h: Likewise.
      	* include/bits/stl_algo.h: Likewise.
      	* include/bits/ios_base.h: Likewise.
      	* include/bits/stl_function.h: Likewise.
      	* include/bits/basic_string.h: Likewise.
      	* include/bits/hashtable.h: Likewise.
      	* include/bits/valarray_after.h: Likewise.
      	* include/bits/char_traits.h: Likewise.
      	* include/bits/gslice.h: Likewise.
      	* include/bits/locale_facets_nonio.h: Likewise.
      	* include/bits/mask_array.h: Likewise.
      	* include/bits/specfun.h: Likewise.
      	* include/bits/random.h: Likewise.
      	* include/bits/slice_array.h: Likewise.
      	* include/bits/valarray_array.h: Likewise.
      	* include/tr1/float.h: Likewise.
      	* include/tr1/functional_hash.h: Likewise.
      	* include/tr1/math.h: Likewise.
      	* include/tr1/hashtable_policy.h: Likewise.
      	* include/tr1/stdio.h: Likewise.
      	* include/tr1/complex.h: Likewise.
      	* include/tr1/stdbool.h: Likewise.
      	* include/tr1/stdarg.h: Likewise.
      	* include/tr1/inttypes.h: Likewise.
      	* include/tr1/fenv.h: Likewise.
      	* include/tr1/stdlib.h: Likewise.
      	* include/tr1/wchar.h: Likewise.
      	* include/tr1/tgmath.h: Likewise.
      	* include/tr1/limits.h: Likewise.
      	* include/tr1/wctype.h: Likewise.
      	* include/tr1/stdint.h: Likewise.
      	* include/tr1/ctype.h: Likewise.
      	* include/tr1/random.h: Likewise.
      	* include/tr1/shared_ptr.h: Likewise.
      	* include/ext/mt_allocator.h: Likewise.
      	* include/ext/sso_string_base.h: Likewise.
      	* include/ext/debug_allocator.h: Likewise.
      	* include/ext/vstring_fwd.h: Likewise.
      	* include/ext/pointer.h: Likewise.
      	* include/ext/pod_char_traits.h: Likewise.
      	* include/ext/malloc_allocator.h: Likewise.
      	* include/ext/vstring.h: Likewise.
      	* include/ext/bitmap_allocator.h: Likewise.
      	* include/ext/pool_allocator.h: Likewise.
      	* include/ext/type_traits.h: Likewise.
      	* include/ext/ropeimpl.h: Likewise.
      	* include/ext/codecvt_specializations.h: Likewise.
      	* include/ext/throw_allocator.h: Likewise.
      	* include/ext/extptr_allocator.h: Likewise.
      	* include/ext/atomicity.h: Likewise.
      	* include/ext/concurrence.h: Likewise.
      	* include/c_compatibility/wchar.h: Likewise.
      	* include/c_compatibility/stdint.h: Likewise.
      	* include/backward/hash_fun.h: Likewise.
      	* include/backward/binders.h: Likewise.
      	* include/backward/hashtable.h: Likewise.
      	* include/backward/auto_ptr.h: Likewise.
      	* libsupc++/eh_arm.cc: Likewise.
      	* libsupc++/unwind-cxx.h: Likewise.
      	* libsupc++/si_class_type_info.cc: Likewise.
      	* libsupc++/vec.cc: Likewise.
      	* libsupc++/class_type_info.cc: Likewise.
      	* libsupc++/vmi_class_type_info.cc: Likewise.
      	* libsupc++/guard_error.cc: Likewise.
      	* libsupc++/bad_typeid.cc: Likewise.
      	* libsupc++/eh_personality.cc: Likewise.
      	* libsupc++/atexit_arm.cc: Likewise.
      	* libsupc++/pmem_type_info.cc: Likewise.
      	* libsupc++/vterminate.cc: Likewise.
      	* libsupc++/eh_terminate.cc: Likewise.
      	* libsupc++/bad_cast.cc: Likewise.
      	* libsupc++/exception_ptr.h: Likewise.
      	* libsupc++/eh_throw.cc: Likewise.
      	* libsupc++/bad_alloc.cc: Likewise.
      	* libsupc++/nested_exception.cc: Likewise.
      	* libsupc++/pointer_type_info.cc: Likewise.
      	* libsupc++/pbase_type_info.cc: Likewise.
      	* libsupc++/bad_array_new.cc: Likewise.
      	* libsupc++/pure.cc: Likewise.
      	* libsupc++/eh_exception.cc: Likewise.
      	* libsupc++/bad_array_length.cc: Likewise.
      	* libsupc++/cxxabi.h: Likewise.
      	* libsupc++/guard.cc: Likewise.
      	* libsupc++/eh_catch.cc: Likewise.
      	* libsupc++/cxxabi_forced.h: Likewise.
      	* libsupc++/tinfo.h: Likewise.
      45ab93d9
  6. Sep 26, 2024
  7. Sep 25, 2024
    • Jason Merrill's avatar
      libstdc++: #ifdef out #pragma GCC system_header · 63a598de
      Jason Merrill authored
      In r15-3714-gd3a7302ec5985a I added -Wsystem-headers to the libstdc++ build
      flags to help catch problems in the library.  This patch takes a different
      approach, of disabling the #pragma system_header unless _GLIBCXX_SYSHDR is
      defined.  As a result, the testsuites will treat them as non-system-headers
      to get better warning coverage during regression testing of both gcc and
      libstdc++, not just when building the library.
      
      My rationale for the #ifdef instead of just removing the #pragma is the
      three G++ tests that want to test libstdc++ system header behavior, so we
      need a way to select it.
      
      This doesn't affect installed libraries, as they get their
      system-header status from the lookup path.  But testsuite_flags
      --build-includes gives -I directives rather than -isystem.
      
      This patch doesn't change the headers in config/ because I'm not compiling
      with most of them, so won't see any warnings that need fixing.  Adjusting
      them could happen later, or we can not bother.
      
      libstdc++-v3/ChangeLog:
      
      	* acinclude.m4 (WARN_FLAGS): Remove -Wsystem-headers.
      	* configure: Regenerate.
      	* include/bits/algorithmfwd.h: #ifdef out #pragma GCC system_header.
      	* include/bits/atomic_base.h
      	* include/bits/atomic_futex.h
      	* include/bits/atomic_timed_wait.h
      	* include/bits/atomic_wait.h
      	* include/bits/basic_ios.h
      	* include/bits/basic_string.h
      	* include/bits/boost_concept_check.h
      	* include/bits/char_traits.h
      	* include/bits/charconv.h
      	* include/bits/chrono.h
      	* include/bits/chrono_io.h
      	* include/bits/codecvt.h
      	* include/bits/concept_check.h
      	* include/bits/cpp_type_traits.h
      	* include/bits/elements_of.h
      	* include/bits/enable_special_members.h
      	* include/bits/erase_if.h
      	* include/bits/forward_list.h
      	* include/bits/functional_hash.h
      	* include/bits/gslice.h
      	* include/bits/gslice_array.h
      	* include/bits/hashtable.h
      	* include/bits/indirect_array.h
      	* include/bits/invoke.h
      	* include/bits/ios_base.h
      	* include/bits/iterator_concepts.h
      	* include/bits/locale_classes.h
      	* include/bits/locale_facets.h
      	* include/bits/locale_facets_nonio.h
      	* include/bits/localefwd.h
      	* include/bits/mask_array.h
      	* include/bits/max_size_type.h
      	* include/bits/memory_resource.h
      	* include/bits/memoryfwd.h
      	* include/bits/move_only_function.h
      	* include/bits/node_handle.h
      	* include/bits/ostream_insert.h
      	* include/bits/out_ptr.h
      	* include/bits/parse_numbers.h
      	* include/bits/postypes.h
      	* include/bits/quoted_string.h
      	* include/bits/range_access.h
      	* include/bits/ranges_base.h
      	* include/bits/refwrap.h
      	* include/bits/sat_arith.h
      	* include/bits/semaphore_base.h
      	* include/bits/slice_array.h
      	* include/bits/std_abs.h
      	* include/bits/std_function.h
      	* include/bits/std_mutex.h
      	* include/bits/std_thread.h
      	* include/bits/stl_iterator_base_funcs.h
      	* include/bits/stl_iterator_base_types.h
      	* include/bits/stl_tree.h
      	* include/bits/stream_iterator.h
      	* include/bits/streambuf_iterator.h
      	* include/bits/stringfwd.h
      	* include/bits/this_thread_sleep.h
      	* include/bits/unique_lock.h
      	* include/bits/uses_allocator_args.h
      	* include/bits/utility.h
      	* include/bits/valarray_after.h
      	* include/bits/valarray_array.h
      	* include/bits/valarray_before.h
      	* include/bits/version.h
      	* include/c_compatibility/fenv.h
      	* include/c_compatibility/inttypes.h
      	* include/c_compatibility/stdint.h
      	* include/decimal/decimal.h
      	* include/experimental/bits/net.h
      	* include/experimental/bits/shared_ptr.h
      	* include/ext/aligned_buffer.h
      	* include/ext/alloc_traits.h
      	* include/ext/atomicity.h
      	* include/ext/concurrence.h
      	* include/ext/numeric_traits.h
      	* include/ext/pod_char_traits.h
      	* include/ext/pointer.h
      	* include/ext/stdio_filebuf.h
      	* include/ext/stdio_sync_filebuf.h
      	* include/ext/string_conversions.h
      	* include/ext/type_traits.h
      	* include/ext/vstring.h
      	* include/ext/vstring_fwd.h
      	* include/ext/vstring_util.h
      	* include/parallel/algorithmfwd.h
      	* include/parallel/numericfwd.h
      	* include/tr1/functional_hash.h
      	* include/tr1/hashtable.h
      	* include/tr1/random.h
      	* libsupc++/exception.h
      	* libsupc++/hash_bytes.h
      	* include/bits/basic_ios.tcc
      	* include/bits/basic_string.tcc
      	* include/bits/fstream.tcc
      	* include/bits/istream.tcc
      	* include/bits/locale_classes.tcc
      	* include/bits/locale_facets.tcc
      	* include/bits/locale_facets_nonio.tcc
      	* include/bits/ostream.tcc
      	* include/bits/sstream.tcc
      	* include/bits/streambuf.tcc
      	* include/bits/string_view.tcc
      	* include/bits/version.tpl
      	* include/experimental/bits/string_view.tcc
      	* include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp
      	* include/ext/random.tcc
      	* include/ext/vstring.tcc
      	* include/tr2/bool_set.tcc
      	* include/tr2/dynamic_bitset.tcc
      	* include/bits/c++config
      	* include/c/cassert
      	* include/c/cctype
      	* include/c/cerrno
      	* include/c/cfloat
      	* include/c/ciso646
      	* include/c/climits
      	* include/c/clocale
      	* include/c/cmath
      	* include/c/csetjmp
      	* include/c/csignal
      	* include/c/cstdarg
      	* include/c/cstddef
      	* include/c/cstdio
      	* include/c/cstdlib
      	* include/c/cstring
      	* include/c/ctime
      	* include/c/cuchar
      	* include/c/cwchar
      	* include/c/cwctype
      	* include/c_global/cassert
      	* include/c_global/ccomplex
      	* include/c_global/cctype
      	* include/c_global/cerrno
      	* include/c_global/cfenv
      	* include/c_global/cfloat
      	* include/c_global/cinttypes
      	* include/c_global/ciso646
      	* include/c_global/climits
      	* include/c_global/clocale
      	* include/c_global/cmath
      	* include/c_global/csetjmp
      	* include/c_global/csignal
      	* include/c_global/cstdalign
      	* include/c_global/cstdarg
      	* include/c_global/cstdbool
      	* include/c_global/cstddef
      	* include/c_global/cstdint
      	* include/c_global/cstdio
      	* include/c_global/cstdlib
      	* include/c_global/cstring
      	* include/c_global/ctgmath
      	* include/c_global/ctime
      	* include/c_global/cuchar
      	* include/c_global/cwchar
      	* include/c_global/cwctype
      	* include/c_std/cassert
      	* include/c_std/cctype
      	* include/c_std/cerrno
      	* include/c_std/cfloat
      	* include/c_std/ciso646
      	* include/c_std/climits
      	* include/c_std/clocale
      	* include/c_std/cmath
      	* include/c_std/csetjmp
      	* include/c_std/csignal
      	* include/c_std/cstdarg
      	* include/c_std/cstddef
      	* include/c_std/cstdio
      	* include/c_std/cstdlib
      	* include/c_std/cstring
      	* include/c_std/ctime
      	* include/c_std/cuchar
      	* include/c_std/cwchar
      	* include/c_std/cwctype
      	* include/debug/array
      	* include/debug/bitset
      	* include/debug/deque
      	* include/debug/forward_list
      	* include/debug/list
      	* include/debug/map
      	* include/debug/set
      	* include/debug/string
      	* include/debug/unordered_map
      	* include/debug/unordered_set
      	* include/debug/vector
      	* include/decimal/decimal
      	* include/experimental/algorithm
      	* include/experimental/any
      	* include/experimental/array
      	* include/experimental/buffer
      	* include/experimental/chrono
      	* include/experimental/contract
      	* include/experimental/deque
      	* include/experimental/executor
      	* include/experimental/filesystem
      	* include/experimental/forward_list
      	* include/experimental/functional
      	* include/experimental/internet
      	* include/experimental/io_context
      	* include/experimental/iterator
      	* include/experimental/list
      	* include/experimental/map
      	* include/experimental/memory
      	* include/experimental/memory_resource
      	* include/experimental/net
      	* include/experimental/netfwd
      	* include/experimental/numeric
      	* include/experimental/propagate_const
      	* include/experimental/ratio
      	* include/experimental/regex
      	* include/experimental/scope
      	* include/experimental/set
      	* include/experimental/socket
      	* include/experimental/string
      	* include/experimental/string_view
      	* include/experimental/synchronized_value
      	* include/experimental/system_error
      	* include/experimental/timer
      	* include/experimental/tuple
      	* include/experimental/type_traits
      	* include/experimental/unordered_map
      	* include/experimental/unordered_set
      	* include/experimental/vector
      	* include/ext/algorithm
      	* include/ext/cmath
      	* include/ext/functional
      	* include/ext/iterator
      	* include/ext/memory
      	* include/ext/numeric
      	* include/ext/random
      	* include/ext/rb_tree
      	* include/ext/rope
      	* include/parallel/algorithm
      	* include/std/algorithm
      	* include/std/any
      	* include/std/array
      	* include/std/atomic
      	* include/std/barrier
      	* include/std/bit
      	* include/std/bitset
      	* include/std/charconv
      	* include/std/chrono
      	* include/std/codecvt
      	* include/std/complex
      	* include/std/concepts
      	* include/std/condition_variable
      	* include/std/coroutine
      	* include/std/deque
      	* include/std/execution
      	* include/std/expected
      	* include/std/filesystem
      	* include/std/format
      	* include/std/forward_list
      	* include/std/fstream
      	* include/std/functional
      	* include/std/future
      	* include/std/generator
      	* include/std/iomanip
      	* include/std/ios
      	* include/std/iosfwd
      	* include/std/iostream
      	* include/std/istream
      	* include/std/iterator
      	* include/std/latch
      	* include/std/limits
      	* include/std/list
      	* include/std/locale
      	* include/std/map
      	* include/std/memory
      	* include/std/memory_resource
      	* include/std/mutex
      	* include/std/numbers
      	* include/std/numeric
      	* include/std/optional
      	* include/std/ostream
      	* include/std/print
      	* include/std/queue
      	* include/std/random
      	* include/std/ranges
      	* include/std/ratio
      	* include/std/regex
      	* include/std/scoped_allocator
      	* include/std/semaphore
      	* include/std/set
      	* include/std/shared_mutex
      	* include/std/span
      	* include/std/spanstream
      	* include/std/sstream
      	* include/std/stack
      	* include/std/stacktrace
      	* include/std/stdexcept
      	* include/std/streambuf
      	* include/std/string
      	* include/std/string_view
      	* include/std/syncstream
      	* include/std/system_error
      	* include/std/text_encoding
      	* include/std/thread
      	* include/std/tuple
      	* include/std/type_traits
      	* include/std/typeindex
      	* include/std/unordered_map
      	* include/std/unordered_set
      	* include/std/utility
      	* include/std/valarray
      	* include/std/variant
      	* include/std/vector
      	* include/std/version
      	* include/tr1/array
      	* include/tr1/cfenv
      	* include/tr1/cinttypes
      	* include/tr1/cmath
      	* include/tr1/complex
      	* include/tr1/cstdbool
      	* include/tr1/cstdint
      	* include/tr1/cstdio
      	* include/tr1/cstdlib
      	* include/tr1/cwchar
      	* include/tr1/cwctype
      	* include/tr1/functional
      	* include/tr1/memory
      	* include/tr1/random
      	* include/tr1/regex
      	* include/tr1/tuple
      	* include/tr1/type_traits
      	* include/tr1/unordered_map
      	* include/tr1/unordered_set
      	* include/tr1/utility
      	* include/tr2/bool_set
      	* include/tr2/dynamic_bitset
      	* include/tr2/type_traits
      	* libsupc++/atomic_lockfree_defines.h
      	* libsupc++/compare
      	* libsupc++/cxxabi.h
      	* libsupc++/cxxabi_forced.h
      	* libsupc++/cxxabi_init_exception.h
      	* libsupc++/exception
      	* libsupc++/initializer_list
      	* libsupc++/new
      	* libsupc++/typeinfo: Likewise.
      	* testsuite/20_util/ratio/operations/ops_overflow_neg.cc
      	* testsuite/23_containers/array/tuple_interface/get_neg.cc
      	* testsuite/23_containers/vector/cons/destructible_debug_neg.cc
      	* testsuite/24_iterators/operations/prev_neg.cc
      	* testsuite/ext/type_traits/add_unsigned_floating_neg.cc
      	* testsuite/ext/type_traits/add_unsigned_integer_neg.cc
      	* testsuite/ext/type_traits/remove_unsigned_floating_neg.cc
      	* testsuite/ext/type_traits/remove_unsigned_integer_neg.cc: Adjust
      	line numbers.
      
      gcc/testsuite/ChangeLog
      
      	* g++.dg/analyzer/fanalyzer-show-events-in-system-headers-default.C
      	* g++.dg/analyzer/fanalyzer-show-events-in-system-headers-no.C
      	* g++.dg/diagnostic/disable.C: #define _GLIBCXX_SYSHDR.
      63a598de
  8. Sep 23, 2024
    • Jason Merrill's avatar
      libstdc++: operator new/delete are transaction_safe · 2620e372
      Jason Merrill authored
      With the changes to #pragma system_header, g++.dg/tm/pr46270.C was
      failing because <new> didn't implement the N4514 change to [new.delete] that
      says "The library versions of the global allocation and deallocation
      functions are declared transaction_safe (8.3.5 dcl.fct)."  We already have
      the _GLIBCXX_TXN_SAFE macro, just need to add it.
      
      libstdc++-v3/ChangeLog:
      
      	* libsupc++/new: Add _GLIBCXX_TXN_SAFE.
      2620e372
  9. Sep 22, 2024
  10. Sep 19, 2024
    • Jason Merrill's avatar
      libstdc++: add #pragma diagnostic · d3a7302e
      Jason Merrill authored
      The use of #pragma GCC system_header in libstdc++ has led to bugs going
      undetected for a while due to the silencing of compiler warnings that would
      have revealed them promptly, and also interferes with warnings about
      problematic template instantiations induced by user code.
      
      But removing it, or even compiling with -Wsystem-header, is also problematic
      due to warnings about deliberate uses of extensions.
      
      So this patch adds #pragma GCC diagnostic as needed to suppress these
      warnings.
      
      The change to acinclude.m4 changes -Wabi to warn only in comparison to ABI
      19, to avoid lots of warnings that we now mangle concept requirements, which
      are in any case still experimental.  I checked for any other changes against
      ABI v15, and found only the <format> lambda mangling, which we can ignore.
      
      This also enables -Wsystem-headers while building the library, so we see any
      warnings not silenced by these #pragmas.
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/algorithmfwd.h:
      	* include/bits/allocator.h:
      	* include/bits/codecvt.h:
      	* include/bits/concept_check.h:
      	* include/bits/cpp_type_traits.h:
      	* include/bits/hashtable.h:
      	* include/bits/iterator_concepts.h:
      	* include/bits/ostream_insert.h:
      	* include/bits/ranges_base.h:
      	* include/bits/regex_automaton.h:
      	* include/bits/std_abs.h:
      	* include/bits/stl_algo.h:
      	* include/c_compatibility/fenv.h:
      	* include/c_compatibility/inttypes.h:
      	* include/c_compatibility/stdint.h:
      	* include/ext/concurrence.h:
      	* include/ext/type_traits.h:
      	* testsuite/ext/type_traits/add_unsigned_floating_neg.cc:
      	* testsuite/ext/type_traits/add_unsigned_integer_neg.cc:
      	* testsuite/ext/type_traits/remove_unsigned_floating_neg.cc:
      	* testsuite/ext/type_traits/remove_unsigned_integer_neg.cc:
      	* include/bits/basic_ios.tcc:
      	* include/bits/basic_string.tcc:
      	* include/bits/fstream.tcc:
      	* include/bits/istream.tcc:
      	* include/bits/locale_classes.tcc:
      	* include/bits/locale_facets.tcc:
      	* include/bits/ostream.tcc:
      	* include/bits/regex_compiler.tcc:
      	* include/bits/sstream.tcc:
      	* include/bits/streambuf.tcc:
      	* configure: Regenerate.
      	* include/bits/c++config:
      	* include/c/cassert:
      	* include/c/cctype:
      	* include/c/cerrno:
      	* include/c/cfloat:
      	* include/c/climits:
      	* include/c/clocale:
      	* include/c/cmath:
      	* include/c/csetjmp:
      	* include/c/csignal:
      	* include/c/cstdarg:
      	* include/c/cstddef:
      	* include/c/cstdio:
      	* include/c/cstdlib:
      	* include/c/cstring:
      	* include/c/ctime:
      	* include/c/cwchar:
      	* include/c/cwctype:
      	* include/c_global/climits:
      	* include/c_global/cmath:
      	* include/c_global/cstddef:
      	* include/c_global/cstdlib:
      	* include/decimal/decimal:
      	* include/ext/rope:
      	* include/std/any:
      	* include/std/charconv:
      	* include/std/complex:
      	* include/std/coroutine:
      	* include/std/format:
      	* include/std/iomanip:
      	* include/std/limits:
      	* include/std/numbers:
      	* include/tr1/functional:
      	* include/tr1/tuple:
      	* include/tr1/type_traits:
      	* libsupc++/compare:
      	* libsupc++/new: Add #pragma GCC diagnostic to suppress
      	undesired warnings.
      	* acinclude.m4: Change -Wabi version from 2 to 19.
      
      gcc/ChangeLog:
      
      	* ginclude/stdint-wrap.h: Add #pragma GCC diagnostic to suppress
      	undesired warnings.
      	* gsyslimits.h: Likewise.
      d3a7302e
  11. Sep 12, 2024
    • Jonathan Wakely's avatar
      libstdc++: Simplify std::launder definition · 27c985b7
      Jonathan Wakely authored
      A single static assert is a much simpler way to implement the
      compile-time preconditions on std::launder than an overload set of
      deleted functions and function templates. The only difficulty is that
      <new> doesn't include <type_traits> so we can't use std::is_function and
      std::is_void for the checks. That can be worked around though, by using
      the __is_same and __is_function built-ins. If the __is_function built-in
      isn't supported then the __builtin_launder built-in will give an error
      anyway, since the commit preceding this one.
      
      We can also remove the redundant __cplusplus >= 201703L check around the
      definitions of std::launder and the interference constants, which are
      already guarded by the appropriate feature test macros.
      
      libstdc++-v3/ChangeLog:
      
      	* libsupc++/new (launder): Add static_assert and remove deleted
      	overloads.
      	* testsuite/18_support/launder/requirements_neg.cc: Adjust
      	expected diagnostics.
      27c985b7
  12. Sep 02, 2024
  13. Aug 08, 2024
    • Jakub Jelinek's avatar
      c++, libstdc++: Implement C++26 P2747R2 - constexpr placement new [PR115744] · afa3a4a5
      Jakub Jelinek authored
      With the PR115754 fix in, constexpr placement new mostly just works,
      so this patch just adds constexpr keyword to the placement new operators
      in <new>, adds FTMs and testsuite coverage.
      
      There is one accepts-invalid though, the
      new (p + 1) int[]{2, 3};      // error (in this paper)
      case from the paper.  Can we handle that incrementally?
      The problem with that is I think calling operator new now that it is
      constexpr should be fine even in that case in constant expressions, so
      int *p = std::allocator<int>{}.allocate(3);
      int *q = operator new[] (sizeof (int) * 2, p + 1);
      should be ok, so it can't be easily the placement new operator call
      itself on whose constexpr evaluation we try something special, it should
      be on the new expression, but constexpr.cc actually sees only
      <<< Unknown tree: expr_stmt
        (void) (TARGET_EXPR <D.2640, (void *) TARGET_EXPR <D.2641, VIEW_CONVERT_EXPR<int *>(b) + 4>>, TARGET_EXPR <D.2642, operator new [] (8, NON_LVALUE_EXPR <D.2640>)>,   int * D.2643;
        <<< Unknown tree: expr_stmt
          (void) (D.2643 = (int *) D.2642) >>>;
      and that is just fine by the preexisting constexpr evaluation rules.
      
      Should build_new_1 emit some extra cast for the array cases with placement
      new in maybe_constexpr_fn (current_function_decl) that the existing P2738
      code would catch?
      
      2024-08-08  Jakub Jelinek  <jakub@redhat.com>
      
      	PR c++/115744
      gcc/c-family/
      	* c-cppbuiltin.cc (c_cpp_builtins): Change __cpp_constexpr
      	from 202306L to 202406L for C++26.
      gcc/testsuite/
      	* g++.dg/cpp2a/construct_at.h (operator new, operator new[]):
      	Use constexpr instead of inline if __cpp_constexpr >= 202406L.
      	* g++.dg/cpp26/constexpr-new1.C: New test.
      	* g++.dg/cpp26/constexpr-new2.C: New test.
      	* g++.dg/cpp26/constexpr-new3.C: New test.
      	* g++.dg/cpp26/feat-cxx26.C (__cpp_constexpr): Adjust expected
      	value.
      libstdc++-v3/
      	* libsupc++/new (__glibcxx_want_constexpr_new): Define before
      	including bits/version.h.
      	(_GLIBCXX_PLACEMENT_CONSTEXPR): Define.
      	(operator new, operator new[]): Use it for placement new instead
      	of inline.
      	* include/bits/version.def (constexpr_new): New FTM.
      	* include/bits/version.h: Regenerate.
      afa3a4a5
  14. Jun 14, 2024
    • Jonathan Wakely's avatar
      libstdc++: Make std::type_info::operator== always_inline for C++23 [PR110572] · 6af8d8e6
      Jonathan Wakely authored
      Commit r12-6266-g3633cc54284450 implemented P1328 for C++23, making
      std::type_info::operator== usable in constant expressions. For targets
      such as mingw-w64 where that function was not previously inline, making
      it constexpr required making it inline for C++23 and later. For
      statically linked programs this can result in multiple definition
      errors, because there's a non-inline definition in libstdc++.a as well.
      
      For those targets make it always_inline for C++23, so that there is no
      symbol generated for the inline definition, and the non-inline
      definition in libstdc++.a will be the only definition.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/110572
      	* libsupc++/typeinfo (type_info::operator==): Add always_inline
      	attribute for targets where the ABI requries equality to be
      	non-inline.
      	* testsuite/18_support/type_info/110572.cc: New test.
      6af8d8e6
    • Jonathan Wakely's avatar
      libstdc++: Fix declaration of posix_memalign for freestanding · 161efd67
      Jonathan Wakely authored
      Thanks to Jérôme Duval for noticing this.
      
      libstdc++-v3/ChangeLog:
      
      	* libsupc++/new_opa.cc [!_GLIBCXX_HOSTED]: Fix declaration of
      	posix_memalign.
      161efd67
  15. Feb 19, 2024
    • Iain Sandoe's avatar
      libstdc++, Darwin: Handle a linker warning [PR112397]. · 1609fdff
      Iain Sandoe authored
      
      Darwin's linker warns when we make a direct branch to code that is
      in a weak definition (citing that if a different implementation of
      the weak function is chosen by the dynamic linker this would be an
      error).
      
      As the analysis in the PR shows, this can happen when we have hot/
      cold partitioning and there is an error path that is primarily cold
      but makes use of epilogue code in the hot section.  In this simple
      case, we can easily deduce that the code is in fact safe; however
      that is not something we can realistically implement in the linker.
      
      Since the user-replaceable allocators are implemented using weak
      definitions, this is a warning that is frequently flagged up in both
      the testsuite and end-user code.
      
      The chosen solution here is to suppress the hot/cold partitioning for
      these cases (it is unlikely to impact performance much c.f. the
      actual allocation).
      
      	PR target/112397
      
      libstdc++-v3/ChangeLog:
      
      	* configure: Regenerate.
      	* configure.ac: Detect if we are building for Darwin.
      	* libsupc++/Makefile.am: If we are building for Darwin, then
      	suppress hot/cold partitioning for the array allocators.
      	* libsupc++/Makefile.in: Regenerated.
      
      Signed-off-by: default avatarIain Sandoe <iain@sandoe.co.uk>
      Co-authored-by: default avatarJonathan Wakely <jwakely@redhat.com>
      1609fdff
  16. Jan 11, 2024
    • Marcus Haehnel's avatar
      libstdc++: use updated type for __unexpected_handler · a7dea405
      Marcus Haehnel authored
      
      Commit f4130a3e changed the type of
      __expected_handler in libsupc++/unwind-cxx.h to be a
      std::terminate_handler to avoid a deprecated warning. However, the
      definition in eh_unex_handler.cc still used the old type
      (std::unexpected_handler) and thus causes a warning when compiling
      libstdc++ with -Wdeprecated-declarations (which is the default, for
      example, for clang).
      
      Adapt the definition to match the declaration.
      
      libstdc++-v3/ChangeLog:
      
      	* libsupc++/eh_unex_handler.cc: Adjust definition type to
      	declaration.
      
      Reviewed-by: default avatarJonathan Wakely <jwakely@redhat.com>
      a7dea405
    • Jonathan Wakely's avatar
      libstdc++: Prefer posix_memalign for aligned-new [PR113258] · f50f2efa
      Jonathan Wakely authored
      As described in PR libstdc++/113258 there are old versions of tcmalloc
      which replace malloc and related APIs, but do not repalce aligned_alloc
      because it didn't exist at the time they were released. This means that
      when operator new(size_t, align_val_t) uses aligned_alloc to obtain
      memory, it comes from libc's aligned_alloc not from tcmalloc. But when
      operator delete(void*, size_t, align_val_t) uses free to deallocate the
      memory, that goes to tcmalloc's replacement version of free, which
      doesn't know how to free it.
      
      If we give preference to the older posix_memalign instead of
      aligned_alloc then we're more likely to use a function that will be
      compatible with the replacement version of free. Because posix_memalign
      has been around for longer, it's more likely that old third-party malloc
      replacements will also replace posix_memalign alongside malloc and free.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/113258
      	* libsupc++/new_opa.cc: Prefer to use posix_memalign if
      	available.
      f50f2efa
  17. Jan 07, 2024
    • Jonathan Wakely's avatar
      libstdc++: Avoid conflicting declaration in eh_call.cc [PR112997] · 8c5d00f8
      Jonathan Wakely authored
      r14-1527-g2415024e0f81f8 changed the parameter of the
      __cxa_call_terminate definition, but there's also a declaration in
      unwind-cxx.h which should have been changed too.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/112997
      	* libsupc++/unwind-cxx.h (__cxa_call_terminate): Change first
      	parameter to void*.
      8c5d00f8
  18. Jan 03, 2024
  19. Dec 07, 2023
    • Alexandre Oliva's avatar
      libsupc++: try cxa_thread_atexit_impl at runtime · 3d0f3382
      Alexandre Oliva authored
      g++.dg/tls/thread_local-order2.C fails when the toolchain is built for
      a platform that lacks __cxa_thread_atexit_impl, even if the program is
      built and run using that toolchain on a (later) platform that offers
      __cxa_thread_atexit_impl.
      
      This patch adds runtime testing for __cxa_thread_atexit_impl on select
      platforms (GNU variants, for starters) that support weak symbols.
      
      
      for  libstdc++-v3/ChangeLog
      
      	PR libstdc++/112858
      	* config/os/gnu-linux/os_defines.h
      	(_GLIBCXX_MAY_HAVE___CXA_THREAD_ATEXIT_IMPL): Define.
      	* libsupc++/atexit_thread.cc [__GXX_WEAK__ &&
      	_GLIBCXX_MAY_HAVE___CXA_THREAD_ATEXIT_IMPL]
      	(__cxa_thread_atexit): Add dynamic detection of
      	__cxa_thread_atexit_impl.
      3d0f3382
  20. Dec 06, 2023
  21. Dec 02, 2023
    • Alexandre Oliva's avatar
      libsupc++: try cxa_thread_atexit_impl at runtime · f4dd9416
      Alexandre Oliva authored
      g++.dg/tls/thread_local-order2.C fails when the toolchain is built for
      a platform that lacks __cxa_thread_atexit_impl, even if the program is
      built and run using that toolchain on a (later) platform that offers
      __cxa_thread_atexit_impl.
      
      This patch adds runtime testing for __cxa_thread_atexit_impl on
      platforms that support weak symbols.
      
      
      for  libstdc++-v3/ChangeLog
      
      	* libsupc++/atexit_thread.cc [__GXX_WEAK__]: Add dynamic
      	detection of __cxa_thread_atexit_impl.
      f4dd9416
  22. Sep 07, 2023
    • Jonathan Wakely's avatar
      libstdc++: Simplify C++20 poison pill overloads (P2602R2) · 6854e3ac
      Jonathan Wakely authored
      This implements the C++23 change "Poison Pills are Too Toxic". This
      makes sense to do unconditionally for C++20, as the corner cases that it
      fixes are considered to be defects in the C++20 design (e.g. LWG3480 was
      needed to fix directory iterators because of these pills being too
      toxic).
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/iterator_concepts.h (__imove::iter_move): Define
      	poison pill as deleted for consistency.
      	(__access::begin): Replace with a single declaration.
      	* include/bits/ranges_base.h (__access::end, __access::rbegin)
      	(__access::rend, __access::size): Likewise.
      	* include/bits/version.def (ranges): Update value for C++23.
      	* include/bits/version.h: Regenerate.
      	* libsupc++/compare (__compare): Add missing poison pill
      	overloads.
      	* testsuite/std/ranges/version_c++23.cc: Adjust expected value
      	of __cpp_lib_ranges.
      	* testsuite/std/ranges/access/p2602.cc: New test.
      6854e3ac
    • Jonathan Wakely's avatar
      libstdc++: Rename C++20 Customization Point Objects · faea9d92
      Jonathan Wakely authored
      This makes the naming of the CPO types and namespaces simpler and more
      consistent. With this change the string "cust" won't appear in
      diagnostics related to these CPOs, which avoids confusion about what it
      means (customization? customer?). Users don't really need to care that
      these are called "customization point objects", so don't show them the
      string "cust". Names like "__imove::_IterMove" are preferable to names
      like "__cust_imove::_IMove" as the former is more obviously related to
      the public API "ranges::iter_move".
      
      Instead of a plethora of inline namespaces for all the different CPO
      objects, define them all in an inline namespace called _Cpo (which isn't
      shown to users anyway, unlike the types of those objects).
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/iterator_concepts.h (ranges::__cust_imove):
      	Rename to ranges::__imove.
      	(_IMove): Rename to _IterMove.
      	(ranges::__cust_iswap): Rename to ranges::__iswap.
      	(ranges::__cust): Rename to ranges::_Cpo.
      	(ranges::__cust_access): Rename to ranges::__access.
      	* include/bits/ranges_base.h (ranges::__cust_access): Rename to
      	ranges::__access.
      	(ranges::__cust): Rename to ranges::_Cpo.
      	* include/std/concepts (ranges::__cust_swap):  Rename to
      	ranges::__swap.
      	(ranges::__cust): Rename to ranges::_Cpo.
      	* libsupc++/compare (__cmp_cust): Rename to __compare.
      	(__cmp_algo): Rename to _Cpo.
      faea9d92
  23. Aug 17, 2023
    • Jonathan Wakely's avatar
      libstdc++: Make __cmp_cat::__unseq constructor consteval · 84cff28f
      Jonathan Wakely authored
      This constructor should only ever be used with a literal 0 as the
      argument, so we can make it consteval. This has the nice advantage that
      it is expanded immediately in the front end, and so GDB will never step
      into the __cmp_cat::__unseq::__unseq(__unseq*) constructor that is
      uninteresting and probably confusing to users.
      
      libstdc++-v3/ChangeLog:
      
      	* libsupc++/compare (__cmp_cat::__unseq): Make ctor consteval.
      	* testsuite/18_support/comparisons/categories/zero_neg.cc: Prune
      	excess errors caused by invalid consteval calls.
      84cff28f
  24. Aug 16, 2023
    • Arsen Arsenović's avatar
      libstdc++: Replace all manual FTM definitions and use · 083b7f28
      Arsen Arsenović authored
      libstdc++-v3/ChangeLog:
      
      	* libsupc++/typeinfo: Switch to bits/version.h for
      	__cpp_lib_constexpr_typeinfo.
      	* libsupc++/new: Switch to bits/version.h for
      	__cpp_lib_{launder,hardware_interference_size,destroying_delete}.
      	(launder): Guard behind __cpp_lib_launder.
      	(hardware_destructive_interference_size)
      	(hardware_constructive_interference_size): Guard behind
      	__cpp_lib_hardware_interference_size.
      	* libsupc++/exception: Switch to bits/version.h for
      	__cpp_lib_uncaught_exceptions.
      	(uncaught_exceptions): Guard behind __cpp_lib_uncaught_exceptions.
      	* libsupc++/compare: Switch to bits/version.h for
      	__cpp_lib_three_way_comparison.
      	(three_way_comparable, three_way_comparable_with)
      	(compare_three_way, weak_order, strong_order, partial_order):
      	Guard behind __cpp_lib_three_way_comparison >= 201907L.
      	* include/std/chrono: Drop __cpp_lib_chrono definition.
      	* include/std/vector: Switch to bits/version.h for
      	__cpp_lib_erase_if.
      	(erase, erase_if): Guard behind __cpp_lib_erase_if.
      	* include/std/variant: Switch to bits/version.h for
      	__cpp_lib_variant.  Guard whole header behind that FTM.
      	* include/std/utility: Switch to bits/version.h for
      	__cpp_lib_{exchange_function,constexpr_algorithms,as_const},
      	__cpp_lib_{integer_comparison_functions,to_underlying}, and
      	__cpp_lib_unreachable.
      	(exchange): Guard behind __cpp_lib_exchange_function.
      	(cmp_equal, cmp_not_equal, cmp_less, cmp_greater, cmp_less_equal)
      	(cmp_greater_equal, in_range): Guard behind
      	__cpp_lib_integer_comparison_functions.
      	(to_underlying): Guard behind __cpp_lib_to_underlying.
      	(unreachable): Guard behind __cpp_lib_unreachable.
      	* include/std/type_traits: Switch to bits/version.h for
      	__cpp_lib_is_{null_pointer,final,nothrow_convertible,aggregate},
      	__cpp_lib_is_{constant_evaluated,invocable,layout_compatible},
      	__cpp_lib_is_{pointer_interconvertible,scoped_enum,swappable},
      	__cpp_lib_{logical_traits,reference_from_temporary,remove_cvref},
      	__cpp_lib_{result_of_sfinae,transformation_trait_aliases},
      	__cpp_lib_{type_identity,type_trait_variable_templates},
      	__cpp_lib_{unwrap_ref,void_t,integral_constant_callable},
      	__cpp_lib_{bool_constant,bounded_array_traits}, and
      	__cpp_lib_has_unique_object_representations.
      	(integral_constant::operator()): Guard behind
      	__cpp_lib_integral_constant_callable.
      	(bool_constant): Guard behind __cpp_lib_bool_constant.
      	(conjunction, disjunction, negation, conjunction_v, disjunction_v)
      	(negation_v): Guard behind __cpp_lib_logical_traits.
      	(is_null_pointer): Guard behind __cpp_lib_is_null_pointer.
      	(is_final): Guard behind __cpp_lib_is_final.
      	(is_nothrow_convertible, is_nothrow_convertible_v): Guard behind
      	__cpp_lib_is_nothrow_convertible.
      	(remove_const_t, remove_volatile_t, remove_cv_t)
      	(add_const_t, add_volatile_t, add_cv_t): Guard behind
      	__cpp_lib_transformation_trait_aliases.
      	(void_t): Guard behind __cpp_lib_void_t.
      	(is_swappable_with_v, is_nothrow_swappable_with_v)
      	(is_swappable_with, is_nothrow_swappable_with): Guard behind
      	__cpp_lib_is_swappable.
      	(is_nothrow_invocable_r, is_invocable_r, invoke_result)
      	(is_invocable, invoke_result_t): Guard behind
      	__cpp_lib_is_invocable.
      	(alignment_of_v, extent_v, has_virtual_destructor_v)
      	(is_abstract_v, is_arithmetic_v, is_array_v)
      	(is_assignable_v, is_base_of_v, is_class_v, is_compound_v)
      	(is_constructible_v, is_const_v, is_convertible_v)
      	(is_copy_assignable_v, is_copy_constructible_v)
      	(is_default_constructible_v, is_destructible_v)
      	(is_empty_v, is_enum_v, is_final_v, is_floating_point_v)
      	(is_function_v, is_fundamental_v, is_integral_v)
      	(is_invocable_r_v, is_invocable_v, is_literal_type_v)
      	(is_lvalue_reference_v, is_member_function_pointer_v)
      	(is_member_object_pointer_v, is_member_pointer_v)
      	(is_move_assignable_v, is_move_constructible_v)
      	(is_nothrow_assignable_v, is_nothrow_constructible_v)
      	(is_nothrow_copy_assignable_v, is_nothrow_copy_constructible_v)
      	(is_nothrow_default_constructible_v, is_nothrow_destructible_v)
      	(is_nothrow_invocable_r_v, is_nothrow_invocable_v)
      	(is_nothrow_move_assignable_v, is_nothrow_move_constructible_v)
      	(is_null_pointer_v, is_object_v, is_pod_v, is_pointer_v)
      	(is_polymorphic_v, is_reference_v, is_rvalue_reference_v)
      	(is_same_v, is_scalar_v, is_signed_v, is_standard_layout_v)
      	(is_trivially_assignable_v, is_trivially_constructible_v)
      	(is_trivially_copyable_v, is_trivially_copy_assignable_v)
      	(is_trivially_copy_constructible_v)
      	(is_trivially_default_constructible_v)
      	(is_trivially_destructible_v, is_trivially_move_assignable_v)
      	(is_trivially_move_constructible_v, is_trivial_v, is_union_v)
      	(is_unsigned_v, is_void_v, is_volatile_v, rank_v, as variadic):
      	Guard behind __cpp_lib_type_trait_variable_templates.
      	(has_unique_object_representations)
      	(has_unique_object_representations_v): Guard behind
      	__cpp_lib_has_unique_object_representation.
      	(is_aggregate): Guard behind __cpp_lib_is_aggregate.
      	(remove_cvref, remove_cvref_t): Guard behind
      	__cpp_lib_remove_cvref.
      	(type_identity, type_identity_t): Guard behind
      	__cpp_lib_type_identity.
      	(unwrap_reference, unwrap_reference_t, unwrap_ref_decay)
      	(unwrap_ref_decay_t): Guard behind __cpp_lib_unwrap_ref.
      	(is_bounded_array_v, is_unbounded_array_v, is_bounded_array)
      	(is_unbounded_array): Guard behind __cpp_lib_bounded_array_traits.
      	(is_scoped_enum, is_scoped_enum_v): Guard behind
      	__cpp_lib_is_scoped_enum.
      	(reference_constructs_from_temporary)
      	(reference_constructs_from_temporary_v): Guard behind
      	__cpp_lib_reference_from_temporary.
      	* include/std/tuple: Switch to bits/version.h for
      	__cpp_lib_{constexpr_tuple,tuple_by_type,apply_make_from_tuple}.
      	(get<T>): Guard behind __cpp_lib_tuple_by_type.
      	(apply): Guard behind __cpp_lib_apply.
      	(make_from_tuple): Guard behind __cpp_lib_make_from_tuple.
      	* include/std/syncstream: Switch to bits/version.h for
      	__cpp_lib_syncbuf.  Guard header behind that FTM.
      	* include/std/string_view: Switch to bits/version.h for
      	__cpp_lib_{string_{view,contains},constexpr_string_view} and
      	__cpp_lib_starts_ends_with.
      	(basic_string_view::starts_with, basic_string_view::ends_with):
      	Guard behind __cpp_lib_starts_ends_with.
      	[C++23 && _GLIBCXX_HOSTED && !defined(__cpp_lib_string_contains)]:
      	Assert as impossible ithout a bug in C++23.
      	* include/std/string: Switch to bits/version.h for
      	__cpp_lib_erase_if.
      	(erase, erase_if): Guard behind __cpp_lib_erase_if.
      	* include/std/thread: Switch to bits/version.h for
      	__cpp_lib_jthread.
      	* include/std/stop_token: Switch to bits/version.h for
      	__cpp_lib_jthread.
      	* include/std/spanstream: Switch to bits/version.h for
      	__cpp_lib_spanstream.  Guard header behind that FTM.
      	* include/std/span: Switch to bits/version.h for __cpp_lib_span.
      	Guard header behind that FTM.
      	* include/std/source_location: Switch to bits/version.h for
      	__cpp_lib_source_location.  Guard header with that FTM.
      	* include/std/shared_mutex: Switch to bits/version.h for
      	__cpp_lib_shared{,_timed}_mutex.
      	(shared_mutex): Guard behind __cpp_lib_shared_mutex.
      	* include/std/semaphore: Switch to bits/version.h for
      	__cpp_lib_semaphore.  Guard header behind that FTM.
      	* include/std/ranges: Switch to bits/version.h for
      	__cpp_lib_ranges_{zip,chunk{,_by},slide,join_with},
      	__cpp_lib_ranges_{repeat_stride,cartesian_product,as_rvalue},
      	and __cpp_lib_ranges_{as_const,enumerate,iota}.
      	(ranges::zip et al, ranges::chunk et al, ranges::slide et al)
      	(ranges::chunk_by et al, ranges::join_with et al)
      	(ranges::stride et al, ranges::cartesian_product et al)
      	(ranges::as_rvalue et al, ranges::as_const et al)
      	(ranges::enumerate et al): Guard behind appropriate FTM.
      	* include/std/optional: Switch to bits/version.h for
      	__cpp_lib_optional.  Guard header behind that FTM.
      	* include/std/numeric: Switch to bits/version.h for
      	__cpp_lib_{gcd{,_lcm},lcm,constexpr_numeric,interpolate}
      	and __cpp_lib_parallel_algorithm.
      	(gcd, lcm): Guard behind __cpp_lib_gcd_lcm.
      	(midpoint): Guard behind __cpp_lib_interpolate.
      	* include/std/numbers: Switch to bits/version.h for
      	__cpp_lib_math_constants.  Guard header behind that FTM.
      	* include/std/mutex: Switch to bits/version.h for
      	__cpp_lib_scoped_lock.
      	(scoped_Lock): Guard behind __cpp_lib_scoped_lock.
      	* include/std/memory_resource: Switch to bits/version.h for
      	__cpp_lib_{polymorphic_allocator,memory_resource}.
      	(synchronized_pool_resource): Guard behind
      	__cpp_lib_memory_resource >= 201603L.
      	(polymorphic_allocator): Guard behind
      	__cpp_lib_polymorphic_allocator.
      	* include/std/memory: Switch to bits/version.h for
      	__cpp_lib_{parallel_algorithm,atomic_value_initialization}.
      	* include/std/list: Switch to bits/version.h for
      	__cpp_lib_erase_if.
      	(erase, erase_if): Guard behind __cpp_lib_erase_if.
      	* include/std/latch: Switch to bits/version.h for __cpp_lib_latch.
      	Guard header behind that FTM.
      	* include/std/iterator: Switch to bits/version.h for
      	__cpp_lib_null_iterators.
      	* include/std/iomanip: Switch to bits/version.h for
      	__cpp_lib_quoted_string_io.
      	(quoted): Guard behind __cpp_lib_quoted_string_io.
      	* include/std/functional: Switch to bits/version.h for
      	__cpp_lib_{invoke{,_r},constexpr_functional,bind_front} and
      	__cpp_lib_{not_fn,booyer_moore_searcher}.
      	(invoke): Guard behind __cpp_lib_invoke.
      	(invoke_r): Guard behind __cpp_lib_invoke_r.
      	(bind_front): Guard behind __cpp_lib_bind_front.
      	(not_fn): Guard behind __cpp_lib_not_fn.
      	(boyer_moore_searcher, boyer_moore_horspool_searcher): Guard
      	definition behind __cpp_lib_boyer_moore_searcher.
      	* include/std/forward_list: Switch to bits/version.h for
      	__cpp_lib_erase_if.
      	(erase, erase_if): Guard behind __cpp_lib_erase_if.
      	* include/std/format: Switch to bits/version.h for
      	__cpp_lib_format.  Guard header behind that FTM.
      	* include/std/filesystem: Switch to bits/version.h for
      	__cpp_lib_filesystem.  Guard header behind that FTM.
      	* include/std/expected: Switch to bits/version.h for
      	__cpp_lib_expected.  Guard header behind it.
      	* include/std/execution: Switch to bits/version.h for
      	__cpp_lib_{execution,parallel_algorithm}.  Guard header behind
      	either.
      	* include/std/deque: Switch to bits/version.h for
      	__cpp_lib_erase_if.
      	(erase, erase_if): Guard behind __cpp_lib_erase_if.
      	* include/std/coroutine: Switch to bits/version.h for
      	__cpp_lib_coroutine.  Guard header behind that FTM.
      	* include/std/concepts: Switch to bits/version.h for
      	__cpp_lib_concepts.  Guard header behind that FTM.
      	* include/std/complex: Switch to bits/version.h for
      	__cpp_lib_{complex_udls,constexpr_complex}.
      	(operator""if, operator""i, operator""il): Guard behind
      	__cpp_lib_complex_udls.
      	* include/std/charconv: Swtich to bits/version.h for
      	__cpp_lib_{to_chars,constexpr_charconv}.
      	* include/std/bitset: Switch to bits/version.h for
      	__cpp_lib_constexpr_bitset.
      	* include/std/bit: Switch to bits/version.h for
      	__cpp_lib_{bit_cast,byteswap,bitops,int_pow2,endian}.
      	(bit_cast): Guard behind __cpp_lib_bit_cast.
      	(byteswap): Guard behind __cpp_lib_byteswap.
      	(rotl, rotr, countl_zero, countl_one, countr_zero, countr_one)
      	(popcount): Guard behind __cpp_lib_bitops.
      	(has_single_bit, bit_ceil, bit_floor, bit_width): Guard behind
      	__cpp_lib_int_pow2.
      	(endian): Guard behind __cpp_lib_endian.
      	* include/std/barrier: Switch to bits/version.h for
      	__cpp_lib_barrier.  Guard header behind that FTM.
      	* include/std/atomic: Switch to bits/version.h for
      	__cpp_lib_atomic_{is_always_lock_free,float,ref}
      	and __cpp_lib_lock_free_type_aliases.
      	(*::is_always_lock_free): Guard behind
      	__cpp_lib_atomic_is_always_lock_free.
      	(atomic<float>): Guard behind __cpp_lib_atomic_float.
      	(atomic_ref): Guard behind __cpp_lib_atomic_ref.
      	(atomic_signed_lock_free, atomic_unsigned_lock_free): Guard behind
      	__cpp_lib_atomic_lock_free_type_aliases.
      	* include/std/array: Switch to bits/version.h for
      	__cpp_lib_to_array.
      	(to_array): Guard behind __cpp_lib_to_array.
      	* include/std/any: Switch to bits/version.h for __cpp_lib_any.
      	Guard header behind that FTM.
      	* include/std/algorithm: Switch to bits/version.h for
      	__cpp_lib_parallel_algorithm.
      	* include/c_global/cstddef: Switch to bits/version.h for
      	__cpp_lib_byte.
      	(byte): Guard behind __cpp_lib_byte.
      	* include/c_global/cmath: Switch to bits/version.h for
      	__cpp_lib_{hypot,interpolate}.
      	(hypot3): Guard behind __cpp_lib_hypot.
      	(lerp): Guard behind __cpp_lib_interpolate.
      	* include/c_compatibility/stdatomic.h: Switch to
      	bits/stl_version.h for __cpp_lib_atomic.  Guard header behind that
      	FTM.
      	* include/bits/utility.h: Switch to bits/version.h for
      	__cpp_lib_{tuple_element_t,integer_sequence,ranges_zip}.
      	(tuple_element_t): Guard behind __cpp_lib_tuple_element_t.
      	(integer_sequence et al): Guard behind __cpp_lib_integer_sequence.
      	* include/bits/uses_allocator_args.h: Switch to bits/version.h for
      	__cpp_lib_make_obj_using_allocator.  Guard header behind that FTM.
      	* include/bits/unordered_map.h: Switch to bits/version.h for
      	__cpp_lib_unordered_map_try_emplace.
      	(try_emplace): Guard behind __cpp_lib_unordered_map_try_emplace.
      	* include/bits/unique_ptr.h: Switch to bits/version.h for
      	__cpp_lib_{constexpr_memory,make_unique}.
      	(make_unique): Guard behind __cpp_lib_make_unique.
      	* include/bits/stl_vector.h: Switch to bits/version.h for
      	__cpp_lib_constexpr_vector.
      	* include/bits/stl_uninitialized.h: Switch to bits/version.h for
      	__cpp_lib_raw_memory_algorithms.
      	(uninitialized_default_construct)
      	(uninitialized_default_construct_n, uninitialized_move)
      	(uninitialized_move_n, uninitialized_value_construct)
      	(uninitialized_value_construct_n): Guard behind
      	__cpp_lib_raw_memory_algorithms.
      	* include/bits/stl_tree.h: Switch to bits/version.h for
      	__cpp_lib_generic_associative_lookup.
      	* include/bits/stl_stack.h: Switch to bits/version.h for
      	__cpp_lib_adaptor_iterator_pair_constructor.
      	(stack): Guard iterator-pair constructor behind
      	__cpp_lib_adaptor_iterator_pair_constructor.
      	* include/bits/stl_queue.h: Switch to bits/version.h for
      	__cpp_lib_adaptor_iterator_pair_constructor.
      	(queue): Guard iterator-pair constructor behind
      	__cpp_lib_adaptor_iterator_pair_constructor.
      	* include/bits/stl_pair.h: Switch to bits/version.h for
      	__cpp_lib_{concepts,tuples_by_type}.
      	(get): Guard type-getting overloads behind
      	__cpp_lib_tuples_by_type.
      	* include/bits/stl_map.h: Switch to bits/version.h for
      	__cpp_lib_map_try_emplace.
      	(map<>::try_emplace): Guard behind __cpp_lib_map_try_emplace.
      	* include/bits/stl_list.h: Switch to bits/version.h for
      	__cpp_lib_list_remove_return_type.
      	(__remove_return_type, _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG)
      	[C++20]: guard behind __cpp_lib_list_remove_return_type instead.
      	* include/bits/stl_iterator.h: Switch to bits/version.h for
      	__cpp_lib_{constexpr_iterator,array_constexpr} and
      	__cpp_lib_{make_reverse_iterator,move_iterator_concept}.
      	(make_reverse_iterator): Guard behind
      	__cpp_lib_make_reverse_iterator.
      	(iterator_concept et al): Guard __cpp_lib_move_iterator_concept
      	changes behind that FTM.
      	* include/bits/stl_function.h: Switch to bits/version.h for
      	__cpp_lib_transparent_operators.
      	(equal_to, not_equal_to, greater, less, greater_equal)
      	(less_equal, bit_and, bit_or, bit_xor, bit_not, logical_and)
      	(logical_or, logical_not, plus, minus, multiplies, divides)
      	(modulus, negate): Guard '= void' fwdecls behind
      	__cpp_lib_transparent_operators.
      	(plus<void>, minus<void>, multiplies<void>, divides<void>)
      	(modulus<void>, negate<void>, logical_and<void>, logical_or<void>)
      	(logical_not<void>, bit_and<void>, bit_or<void>, bit_xor<void>)
      	(equal_to<void>, not_equal_to<void>, greater<void>, less<void>)
      	(greater_equal<void>, less_equal<void>, bit_not<void>)
      	(__has_is_transparent): Guard behind
      	__cpp_lib_transparent_operators.
      	* include/bits/stl_algobase.h: Switch to bits/version.h for
      	__cpp_lib_robust_nonmodifying_seq_ops.
      	(robust equal, mismatch): Guard behind
      	__cpp_lib_nonmember_container_access.
      	* include/bits/stl_algo.h: Swtich to bits/version.h for
      	__cpp_lib_{clamp,sample}.
      	(clamp): Guard behind __cpp_lib_clamp.
      	(sample): Guard behind __cpp_lib_sample.
      	* include/bits/specfun.h: Switch to bits/version.h for
      	__cpp_lib_math_special_functions and __STDCPP_MATH_SPEC_FUNCS__.
      	* include/bits/shared_ptr_base.h: Switch to bits/version.h for
      	__cpp_lib_{smart_ptr_for_overwrite,shared_ptr_arrays}.
      	(_Sp_overwrite_tag): Guard behind
      	__cpp_lib_smart_ptr_for_overwrite.
      	* include/bits/shared_ptr_atomic.h: Switch to bits/version.h for
      	__cpp_lib_atomic_shared_ptr.
      	* include/bits/shared_ptr.h: Switch to bits/version.h for
      	__cpp_lib_{enable_shared_from_this,shared_ptr_weak_type}.
      	(shared_ptr<T>::weak_type): Guard behind
      	__cpp_lib_shared_ptr_weak_type.
      	(enable_shared_from_this<T>::weak_from_this): Guard behind
      	__cpp_lib_enable_shared_from_this.
      	* include/bits/ranges_cmp.h: Switch to bits/version.h for
      	__cpp_lib_ranges.
      	* include/bits/ranges_algo.h: Switch to bits/version.h for
      	__cpp_lib_{shift,ranges_{contains,find_last,fold,iota}}.
      	* include/bits/range_access.h: Switch to bits/version.h for
      	__cpp_lib_nonmember_container_access
      	(size, empty, data): Guard behind
      	__cpp_lib_nonmember_container_access.
      	(ssize): Guard behind __cpp_lib_ssize.
      	* include/bits/ptr_traits.h: Switch to bits/version.h. for
      	__cpp_lib_{constexpr_memory,to_address}.
      	(to_address): Guard behind __cpp_lib_to_address.
      	* include/bits/node_handle.h: Switch to bits/version.h for
      	__cpp_lib_node_extract.  Guard header behind that FTM.
      	* include/bits/move_only_function.h: Switch to bits/version.h for
      	__cpp_lib_move_only_function.  Guard header behind that FTM.
      	* include/bits/move.h: Switch to bits/version.h for
      	__cpp_lib_addressof_constexpr.
      	* include/bits/ios_base.h: Switch to bits/version.h for
      	__cpp_lib_ios_noreplace.
      	(noreplace): Guard with __cpp_lib_ios_noreplace.
      	* include/bits/hashtable.h: Switch to bits/version.h for
      	__cpp_lib_generic_unordered_lookup.
      	(_M_equal_range_tr, _M_count_tr, _M_find_tr): Guard behind
      	__cpp_lib_generic_unordered_lookup.
      	* include/bits/forward_list.h: Switch to bits/version.h for
      	__cpp_lib_list_remove_return_type.
      	(__remove_return_type): Guard behind
      	__cpp_lib_list_remove_return_type.
      	* include/bits/erase_if.h: Switch to bits/version.h for
      	__cpp_lib_erase_if.
      	* include/bits/cow_string.h: Switch to bits/version.h for
      	__cpp_lib_constexpr_string.
      	* include/bits/chrono.h: Swtich to bits/version.h for
      	__cpp_lib_chrono{,_udls}.
      	(ceil): Guard behind __cpp_lib_chrono.
      	(operator""ns et al): Guard behind __cpp_lib_chrono_udls.
      	* include/bits/char_traits.h: Switch to bits/version.h for
      	__cpp_lib_constexpr_char_traits.
      	* include/bits/basic_string.h: Switch to bits/version.h for
      	__cpp_lib_{constexpr_string,string_{resize_and_overwrite,udls}}.
      	(resize_and_overwrite): Guard behind
      	__cpp_lib_string_resize_and_overwrite.
      	(operator""s): Guard behind __cpp_lib_string_udls.
      	* include/bits/atomic_wait.h: Switch to bits/version.h for
      	__cpp_lib_atomic_wait.  Guard header behind that FTM.
      	* include/bits/atomic_base.h: Switch to bits/version.h for
      	__cpp_lib_atomic_value_initialization and
      	__cpp_lib_atomic_flag_test.
      	(atomic_flag::test): Guard behind __cpp_lib_atomic_flag_test,
      	rather than C++20.
      	* include/bits/allocator.h: Switch to bits/version.h for
      	__cpp_lib_incomplete_container_elements.
      	* include/bits/alloc_traits.h: Switch to using bits/version.h for
      	__cpp_lib_constexpr_dynamic_alloc and
      	__cpp_lib_allocator_traits_is_always_equal.
      	* include/bits/align.h: Switch to bits/version.h for defining
      	__cpp_lib_assume_aligned.
      	(assume_aligned): Guard with __cpp_lib_assume_aligned.
      	* include/bits/algorithmfwd.h: Switch to bits/version.h for
      	defining __cpp_lib_constexpr_algorithms.
      	* include/std/stacktrace: Switch to bits/version.h for
      	__cpp_lib_stacktrace.  Guard header behind that FTM.
      	* testsuite/23_containers/array/tuple_interface/get_neg.cc:
      	Update line numbers.
      083b7f28
  25. Jun 28, 2023
  26. Jun 04, 2023
    • Jason Merrill's avatar
      c++: use __cxa_call_terminate for MUST_NOT_THROW [PR97720] · 2415024e
      Jason Merrill authored
      [except.handle]/7 says that when we enter std::terminate due to a throw,
      that is considered an active handler.  We already implemented that properly
      for the case of not finding a handler (__cxa_throw calls __cxa_begin_catch
      before std::terminate) and the case of finding a callsite with no landing
      pad (the personality function calls __cxa_call_terminate which calls
      __cxa_begin_catch), but for the case of a throw in a try/catch in a noexcept
      function, we were emitting a cleanup that calls std::terminate directly
      without ever calling __cxa_begin_catch to handle the exception.
      
      A straightforward way to fix this seems to be calling __cxa_call_terminate
      instead.  However, that requires exporting it from libstdc++, which we have
      not previously done.  Despite the name, it isn't actually part of the ABI
      standard.  Nor is __cxa_call_unexpected, as far as I can tell, but that one
      is also used by clang.  For this case they use __clang_call_terminate; it
      seems reasonable to me for us to stick with __cxa_call_terminate.
      
      I also change __cxa_call_terminate to take void* for simplicity in the front
      end (and consistency with __cxa_call_unexpected) but that isn't necessary if
      it's undesirable for some reason.
      
      This patch does not fix the issue that representing the noexcept as a
      cleanup is wrong, and confuses the handler search; since it looks like a
      cleanup in the EH tables, the unwinder keeps looking until it finds the
      catch in main(), which it should never have gotten to.  Without the
      try/catch in main, the unwinder would reach the end of the stack and say no
      handler was found.  The noexcept is a handler, and should be treated as one,
      as it is when the landing pad is omitted.
      
      The best fix for that issue seems to me to be to represent an
      ERT_MUST_NOT_THROW after an ERT_TRY in an action list as though it were an
      ERT_ALLOWED_EXCEPTIONS (since indeed it is an exception-specification).  The
      actual code generation shouldn't need to change (apart from the change made
      by this patch), only the action table entry.
      
      	PR c++/97720
      
      gcc/cp/ChangeLog:
      
      	* cp-tree.h (enum cp_tree_index): Add CPTI_CALL_TERMINATE_FN.
      	(call_terminate_fn): New macro.
      	* cp-gimplify.cc (gimplify_must_not_throw_expr): Use it.
      	* except.cc (init_exception_processing): Set it.
      	(cp_protect_cleanup_actions): Return it.
      
      gcc/ChangeLog:
      
      	* tree-eh.cc (lower_resx): Pass the exception pointer to the
      	failure_decl.
      	* except.h: Tweak comment.
      
      libstdc++-v3/ChangeLog:
      
      	* libsupc++/eh_call.cc (__cxa_call_terminate): Take void*.
      	* config/abi/pre/gnu.ver: Add it.
      
      gcc/testsuite/ChangeLog:
      
      	* g++.dg/eh/terminate2.C: New test.
      2415024e
  27. Jun 01, 2023
    • Jason Merrill's avatar
      libstdc++: optimize EH phase 2 · 5d9c9119
      Jason Merrill authored
      In the ABI's two-phase EH model, first we walk the stack looking for a
      handler, then we walk the stack running cleanups until we reach that
      handler.  In the cleanup phase, we shouldn't redundantly check the handlers
      along the way, e.g. when walking through g():
      
        void f() { throw 42; }
        void g() { try { f(); } catch (void *) { } }
        int main() { try { g(); } catch (int) { } }
      
      libstdc++-v3/ChangeLog:
      
      	* libsupc++/eh_personality.cc (PERSONALITY_FUNCTION): Don't check
      	handlers in the cleanup phase.
      5d9c9119
  28. Apr 18, 2023
  29. Mar 07, 2023
  30. Feb 16, 2023
    • Jonathan Wakely's avatar
      libstdc++: Fix uses of non-reserved names in headers · dc79eba7
      Jonathan Wakely authored
      The non-reserved names 'val' and 'dest' were being used in our headers
      but haven't been added to the 17_intro/names.cc test. That's because
      they are used by <asm-generic/posix_types.h> and <netinet/tcp.h>
      respecitvely on glibc-based systems.
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/fs_ops.h (create_directory): Use reserved name
      	for parameter.
      	* include/bits/ranges_algo.h (__contains_subrange_fn):
      	Likewise.
      	* include/bits/regex_automaton.h (_State_base::_M_print):
      	Likewise.
      	* include/bits/regex_automaton.tcc(_State_base::_M_print):
      	Likewise.
      	* include/bits/regex_scanner.tcc(_Scanner::_M_print): Likewise.
      	* include/experimental/bits/fs_ops.h (create_directory):
      	Likewise.
      	* include/std/mutex (timed_mutex::_M_clocklock): Likewise.
      	(recursive_timed_mutex:_M_clocklock): Likewise.
      	* include/std/tuple (basic_common_reference): Likewise.
      	* libsupc++/cxxabi_init_exception.h
      	(__cxa_init_primary_exception): Likewise.
      	* testsuite/17_intro/names.cc: Add checks.
      dc79eba7
  31. Jan 16, 2023
  32. Nov 28, 2022
    • Jonathan Wakely's avatar
      libstdc++: Fix _Hash_bytes for I16LP32 targets [PR107885] · 7b79fa93
      Jonathan Wakely authored
      For H8/300 size_t is 32 bits wide, but (unsigned char)buf[2] << 16
      promotes to int which is only 16 bits wide. The shift is then undefined.
      This fixes it by converting to size_t before shifting.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/107885
      	* libsupc++/hash_bytes.cc (_Hash_bytes): Convert to size_t
      	instead of implicit integer promotion to 16 bits.
      7b79fa93
  33. Nov 08, 2022
    • Jonathan Wakely's avatar
      libstdc++: Fix -Wsystem-headers warnings · 8f6d25f1
      Jonathan Wakely authored
      Fix some problems noticed with -Wsystem-headers.
      
      libstdc++-v3/ChangeLog:
      
      	* include/bits/stl_tempbuf.h (_Temporary_buffer): Disable
      	warnings about get_temporary_buffer being deprecated.
      	* include/ext/functional (mem_fun1, mem_fun1_ref): Disable
      	warnings about mem_fun1_t, const_mem_fun1_t, mem_fun1_ref_t and
      	const_mem_fun1_ref_t being deprecated.
      	* include/std/array (__array_traits<T, 0>): Remove artificial
      	attributes which give warnings about being ignored.
      	* include/std/spanstream (basic_spanbuf::setbuf): Add assertion
      	and adjust to avoid narrowing warning.
      	* libsupc++/exception_ptr.h [!__cpp_rtti && !__cpp_exceptions]
      	(make_exception_ptr): Add missing inline specifier.
      8f6d25f1
  34. Nov 05, 2022
    • Jakob Hasse's avatar
      libstdc++: fix pointer type exception catch (no RTTI) [PR105387] · b83f01d0
      Jakob Hasse authored
      
      __pbase_type_info::__do_catch(), used to catch pointer type exceptions,
      did not check if the type info object to compare against is a pointer
      type info object before doing a static down-cast to a pointer type info
      object. If RTTI is disabled, this leads to the following situation:
      Since a pointer type info object has additional fields, they would
      end up being undefined if the actual type info object was not a pointer
      type info object.
      
      A simple check has been added before the down-cast happens.
      
      Note that a consequence of this check is that exceptions of type
      pointer-to-member cannot be caught anymore.
      
      In case RTTI is enabled, this does not seem to be a problem because
      RTTI-based checks would run before and prevent running into the bad
      down-cast. Hence, the fix is disabled if RTTI is enabled and exceptions
      of type pointer-to-member can still be caught.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/105387
      	* libsupc++/pbase_type_info.cc (__do_catch) [!__cpp_rtti]: Add
      	check that the thrown type is actually a pointer.
      	* testsuite/18_support/105387.cc: New test.
      	* testsuite/18_support/105387_memptr.cc: New test.
      
      Signed-off-by: default avatarJakob Hasse <jakob.hasse@espressif.com>
      b83f01d0
  35. Nov 04, 2022
    • Jonathan Wakely's avatar
      libstdc++: Simplify lifetime of eh_globals variable [PR107500] · 418999fe
      Jonathan Wakely authored
      Since this is a trivial type, we probably don't need to do anything to
      ensure it's still accessible after other static dtors.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/107500
      	* libsupc++/eh_globals.cc (eh_globals): Remove immortalizing
      	wrapper.
      	(__cxxabiv1::__cxa_get_globals_fast): Adjust.
      	(__cxxabiv1::__cxa_get_globals): Adjust.
      418999fe
    • Jonathan Wakely's avatar
      libstdc++: Define _GNU_SOURCE for secure_getenv on Cygwin [PR107511] · f505f37a
      Jonathan Wakely authored
      As in r12-6867-ge20486d508afdf we need to define _GNU_SOURCE explicitly
      for Cygwin, because configure finds it in libc but it isn't declared
      unless we request it.
      
      libstdc++-v3/ChangeLog:
      
      	PR libstdc++/107511
      	* libsupc++/eh_alloc.cc (_GNU_SOURCE): Define.
      f505f37a
  36. Nov 02, 2022
    • Jonathan Wakely's avatar
      libstdc++: Remove more redundant union members · 41602c85
      Jonathan Wakely authored
      We don't need these 'unused' members because they're never used, and a
      union with a single variant member is fine.
      
      libstdc++-v3/ChangeLog:
      
      	* libsupc++/eh_globals.cc (constant_init::unused): Remove.
      	* src/c++11/system_error.cc (constant_init::unused): Remove.
      	* src/c++17/memory_resource.cc (constant_init::unused): Remove.
      41602c85
Loading