├── .github └── workflows │ └── compile_examples.yml ├── .gitignore ├── COPYING.MPLv2 ├── COPYING3 ├── README.md ├── examples ├── chrono │ ├── Makefile │ └── chrono.cpp ├── cmath │ ├── Makefile │ └── cmath.cpp ├── common │ ├── cxxabi.cpp │ ├── new.cpp │ └── uart.cpp ├── numeric │ ├── Makefile │ └── numeric.cpp └── vector │ ├── Makefile │ └── main.cpp ├── include ├── algorithm ├── any ├── array ├── atomic ├── backward │ ├── backward_warning.h │ ├── binders.h │ ├── hash_fun.h │ ├── hash_map │ ├── hash_set │ └── hashtable.h ├── bit ├── bits │ ├── algorithmfwd.h │ ├── alloc_traits.h │ ├── allocated_ptr.h │ ├── allocator.h │ ├── atomic_base.h │ ├── atomic_lockfree_defines.h │ ├── boost_concept_check.h │ ├── c++0x_warning.h │ ├── c++allocator.h │ ├── c++config.h │ ├── char_traits.h │ ├── charconv.h │ ├── concept_check.h │ ├── cpp_type_traits.h │ ├── cxxabi_forced.h │ ├── cxxabi_init_exception.h │ ├── deque.tcc │ ├── enable_special_members.h │ ├── erase_if.h │ ├── error_constants.h │ ├── exception_defines.h │ ├── forward_list.h │ ├── forward_list.tcc │ ├── functexcept.h │ ├── functional_hash.h │ ├── gslice.h │ ├── gslice_array.h │ ├── hash_bytes.h │ ├── hashtable.h │ ├── hashtable_policy.h │ ├── indirect_array.h │ ├── invoke.h │ ├── iterator_concepts.h │ ├── list.tcc │ ├── mask_array.h │ ├── memoryfwd.h │ ├── move.h │ ├── node_handle.h │ ├── parse_numbers.h │ ├── postypes.h │ ├── predefined_ops.h │ ├── ptr_traits.h │ ├── random.h │ ├── random.tcc │ ├── range_access.h │ ├── range_cmp.h │ ├── ranges_algo.h │ ├── ranges_algobase.h │ ├── ranges_uninitialized.h │ ├── refwrap.h │ ├── slice_array.h │ ├── std_abs.h │ ├── std_function.h │ ├── std_mutex.h │ ├── stl_algo.h │ ├── stl_algobase.h │ ├── stl_bvector.h │ ├── stl_construct.h │ ├── stl_deque.h │ ├── stl_function.h │ ├── stl_heap.h │ ├── stl_iterator.h │ ├── stl_iterator_base_funcs.h │ ├── stl_iterator_base_types.h │ ├── stl_list.h │ ├── stl_map.h │ ├── stl_multimap.h │ ├── stl_multiset.h │ ├── stl_numeric.h │ ├── stl_pair.h │ ├── stl_queue.h │ ├── stl_raw_storage_iter.h │ ├── stl_relops.h │ ├── stl_set.h │ ├── stl_stack.h │ ├── stl_tempbuf.h │ ├── stl_tree.h │ ├── stl_uninitialized.h │ ├── stl_vector.h │ ├── string_view.tcc │ ├── uniform_int_dist.h │ ├── unique_lock.h │ ├── unique_ptr.h │ ├── unordered_map.h │ ├── unordered_set.h │ ├── uses_allocator.h │ ├── valarray_after.h │ ├── valarray_array.h │ ├── valarray_array.tcc │ ├── valarray_before.h │ └── vector.tcc ├── bitset ├── cassert ├── ccomplex ├── cctype ├── cerrno ├── cfenv ├── cfloat ├── chrono ├── cinttypes ├── ciso646 ├── climits ├── cmath ├── compare ├── complex ├── concepts ├── coroutine ├── csetjmp ├── csignal ├── cstdalign ├── cstdarg ├── cstdbool ├── cstddef ├── cstdint ├── cstdio ├── cstdlib ├── cstring ├── ctgmath ├── ctime ├── cuchar ├── cwchar ├── cwctype ├── debug │ ├── assertions.h │ ├── debug.h │ ├── formatter.h │ ├── functions.h │ ├── helper_functions.h │ └── macros.h ├── decimal │ ├── decimal │ └── decimal.h ├── deque ├── ext │ ├── algorithm │ ├── aligned_buffer.h │ ├── alloc_traits.h │ ├── atomicity.h │ ├── cmath │ ├── functional │ ├── hash_map │ ├── hash_set │ ├── iterator │ ├── malloc_allocator.h │ ├── memory │ ├── new_allocator.h │ ├── numeric │ ├── numeric_traits.h │ ├── pod_char_traits.h │ ├── rb_tree │ ├── slist │ ├── type_traits.h │ └── typelist.h ├── forward_list ├── functional ├── initializer_list ├── iterator ├── limits ├── list ├── map ├── memory ├── mutex ├── new ├── numbers ├── numeric ├── optional ├── queue ├── random ├── ranges ├── ratio ├── scoped_allocator ├── set ├── shared_mutex ├── span ├── stack ├── string_view ├── tuple ├── type_traits ├── unordered_map ├── unordered_set ├── utility ├── valarray ├── variant ├── vector └── version └── src ├── functexcept.cc ├── hash_bytes.cc ├── hashtable-aux.h ├── hashtable_c++0x.cc ├── limits.cc ├── list.cc ├── math.cc ├── new_handler.cc └── tree.cc /.github/workflows/compile_examples.yml: -------------------------------------------------------------------------------- 1 | name: Compile Examples 2 | 3 | on: 4 | push: 5 | branches: 6 | - '**' 7 | pull_request: 8 | 9 | jobs: 10 | unittests-linux-generic: 11 | runs-on: ubuntu-latest 12 | container: 13 | image: ghcr.io/modm-ext/modm-build-avr:latest 14 | 15 | strategy: 16 | fail-fast: false 17 | matrix: 18 | standard: [ c++17, c++20 ] 19 | 20 | steps: 21 | - name: Check out repository 22 | uses: actions/checkout@v4 23 | 24 | - name: Check environment 25 | run: | 26 | env 27 | which avr-g++ 28 | avr-g++ --version 29 | 30 | - name: Compile Examples 31 | run: | 32 | for example in $(find examples/ | grep Makefile); do 33 | (cd $(dirname $example) && make -j4 STD=${{ matrix.standard }}) 34 | done 35 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | examples/**/build 2 | 3 | -------------------------------------------------------------------------------- /examples/chrono/Makefile: -------------------------------------------------------------------------------- 1 | NAME=chrono-test 2 | MCU=atmega328p 3 | 4 | ifeq ($(STD),) 5 | STD=c++17 6 | endif 7 | 8 | BUILD_DIR=./build 9 | LIB_DIR=../.. 10 | 11 | ifeq ($(INC),) 12 | INCLUDES= -I$(LIB_DIR)/include 13 | else 14 | INCLUDES= -I$(INC) 15 | endif 16 | 17 | SOURCES=$(LIB_DIR)/examples/chrono/chrono.cpp 18 | VPATH=.:$(LIB_DIR)/examples/chrono 19 | OBJECTS=$(addprefix $(BUILD_DIR)/,$(notdir $(SOURCES:%=%.o))) 20 | 21 | WARNFLAGS=-Wall -Wextra -pedantic 22 | 23 | ifeq ($(STD),c++20) 24 | WARNFLAGS+=-Wno-volatile 25 | endif 26 | 27 | CXXFLAGS=-std=$(STD) -O2 $(WARNFLAGS) -fno-exceptions -fno-rtti -fno-unwind-tables -fno-threadsafe-statics -Wshadow -Wcast-qual -Wpointer-arith -Wundef 28 | LDFLAGS= 29 | 30 | TARGET=$(BUILD_DIR)/$(NAME) 31 | 32 | all: hex size 33 | 34 | hex: $(TARGET).hex 35 | 36 | $(TARGET).hex: $(TARGET).elf 37 | avr-objcopy -O ihex -j .data -j .text $(TARGET).elf $(TARGET).hex 38 | 39 | $(TARGET).elf: $(OBJECTS) 40 | avr-g++ $(LDFLAGS) -mmcu=$(MCU) $(OBJECTS) -o $(TARGET).elf 41 | 42 | $(BUILD_DIR)/%.cpp.o: %.cpp 43 | @mkdir -p $(BUILD_DIR) 44 | avr-g++ -c $(CXXFLAGS) -mmcu=$(MCU) $(INCLUDES) $< -o $@ 45 | 46 | $(BUILD_DIR)/%.cc.o: %.cc 47 | @mkdir -p $(BUILD_DIR) 48 | avr-g++ -c $(CXXFLAGS) -mmcu=$(MCU) $(INCLUDES) $< -o $@ 49 | 50 | size: $(TARGET).elf 51 | avr-objdump -Pmem-usage $(TARGET).elf 52 | 53 | program: $(TARGET).hex 54 | avrdude -p$(MCU) $(AVRDUDE_FLAGS) -c$(PROGRAMMER) -Uflash:w:$(TARGET).hex:a 55 | 56 | clean: 57 | rm -rf $(BUILD_DIR)/*.o 58 | rm -rf $(BUILD_DIR)/*.elf 59 | rm -rf $(BUILD_DIR)/*.hex 60 | -------------------------------------------------------------------------------- /examples/chrono/chrono.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, Christopher Kormanyos 3 | * 4 | * This file is part of the modm project. 5 | * 6 | * This Source Code Form is subject to the terms of the Mozilla Public 7 | * License, v. 2.0. If a copy of the MPL was not distributed with this 8 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | */ 10 | // ---------------------------------------------------------------------------- 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | static void app_hw_init(); 19 | 20 | int main() 21 | { 22 | // Initialize the application hardware. This includes WDT, PORTB.5 and TIMER0. 23 | app_hw_init(); 24 | 25 | for(;;) 26 | { 27 | // Toggle the LED on portb.5. 28 | PINB = (1U << PORTB5); 29 | 30 | // Make use of to insert a 1s delay (i.e., 1000 milliseconds). 31 | const auto start = std::chrono::high_resolution_clock::now(); 32 | 33 | auto delta = std::chrono::duration_cast(std::chrono::milliseconds()); 34 | 35 | do 36 | { 37 | delta = 38 | std::chrono::duration_cast 39 | ( 40 | std::chrono::high_resolution_clock::now() - start 41 | ); 42 | } 43 | while(delta < std::chrono::milliseconds(1000U)); 44 | } 45 | } 46 | 47 | static void app_hw_init() 48 | { 49 | // Initialize the application including WDT, PORTB.5 and TIMER0 50 | 51 | // We will now disable the watchdog. 52 | // Service the watchdog just to be sure to avoid pending timeout. 53 | wdt_reset(); 54 | 55 | // Clear WDRF in MCUSR. 56 | MCUSR &= ~(1U << WDRF); 57 | 58 | // Write logical one to WDCE and WDE. 59 | // Keep the old prescaler setting to prevent unintentional time-out. 60 | WDTCSR |= (1U << WDCE) | (1U << WDE); 61 | 62 | // Turn off the WDT. 63 | WDTCSR = 0x00; 64 | 65 | // We will now initialize PORTB.5 to be used as an LED driver port. 66 | // Set PORTB.5 value to low. 67 | PORTB &= ~(1U << PORTB5); 68 | 69 | // Set PORTB.5 direction to output. 70 | DDRB |= (1U << DDB5); 71 | 72 | // We will now initialize the TIMER0 clock and interrupt. 73 | // Clear the TIMER0 overflow flag. 74 | TIFR0 = static_cast(1U << TOV0); 75 | 76 | // Enable the TIMER0 overflow interrupt. 77 | TIMSK0 = static_cast(1U << TOIE0); 78 | 79 | // Set the TIMER0 clock source to f_osc/8 = 2MHz and begin counting. 80 | TCCR0B = static_cast(1U << CS01); 81 | 82 | // Enable all interrupts. 83 | sei(); 84 | } 85 | 86 | namespace { 87 | 88 | std::uint64_t gpt_system_tick; 89 | std::uint64_t gpt_get_time_elapsed(); 90 | 91 | std::uint64_t gpt_get_time_elapsed() 92 | { 93 | // The entire system-tick is composed of the static 94 | // 64-bit variable mcal_gpt_system_tick and the 8-bit 95 | // timer register TCNT0. These are concatenated together 96 | // in software as a cohesive, consistent 64-bit tick. 97 | 98 | // This subroutine returns the concatenated 64-bit 99 | // mcal_gpt_system_tick/TCNT0 64-bit system tick. 100 | // A multiple read of the tick is used in order 101 | // to ensure data consistency. 102 | 103 | // Do the first read of the TIMER0 counter and the system tick. 104 | const auto tim0_cnt_1 = TCNT0; 105 | const auto sys_tick_1 = gpt_system_tick; 106 | 107 | // Do the second read of the TIMER0 counter. 108 | const auto tim0_cnt_2 = TCNT0; 109 | 110 | // Perform the consistency check to obtain the concatenated, 111 | // consistent, 64-bit system-tick. 112 | const auto consistent_microsecond_tick = 113 | ((tim0_cnt_2 >= tim0_cnt_1) 114 | ? static_cast(sys_tick_1 | static_cast(tim0_cnt_1 >> 1U)) 115 | : static_cast(gpt_system_tick | static_cast(tim0_cnt_2 >> 1U))); 116 | 117 | return consistent_microsecond_tick; 118 | } 119 | 120 | } 121 | 122 | ISR(TIMER0_OVF_vect) 123 | { 124 | // Increment the 64-bit system tick with 0x80, representing 128 microseconds. 125 | gpt_system_tick += UINT8_C(0x80); 126 | } 127 | 128 | auto std::chrono::high_resolution_clock::now() noexcept -> std::chrono::high_resolution_clock::time_point 129 | { 130 | // Implement std::chrono::high_resolution_clock::now() 131 | // for the standard library's high-resolution clock. 132 | 133 | // Your project must supply a monotonic clock counting up. 134 | // In this example, this is done with gpt_get_time_elapsed() 135 | // which returns a 64-bit unsigned integral value representing 136 | // a tick having microsecond resolution. 137 | 138 | // The source of the high-resolution clock is microseconds. 139 | using microsecond_time_point_type = std::chrono::time_point; 140 | 141 | // Obtain a time-point with microsecond resolution. 142 | const auto time_point_in_microseconds = 143 | microsecond_time_point_type 144 | ( 145 | microseconds(gpt_get_time_elapsed()) 146 | ); 147 | 148 | // And return the corresponding duration with microsecond resolution. 149 | return time_point_cast(time_point_in_microseconds); 150 | } 151 | -------------------------------------------------------------------------------- /examples/cmath/Makefile: -------------------------------------------------------------------------------- 1 | NAME=cmath-test 2 | MCU=atmega328p 3 | 4 | ifeq ($(STD),) 5 | STD=c++17 6 | endif 7 | 8 | BUILD_DIR=./build 9 | LIB_DIR=../.. 10 | 11 | ifeq ($(INC),) 12 | INCLUDES= -I$(LIB_DIR)/include 13 | else 14 | INCLUDES= -I$(INC) 15 | endif 16 | 17 | SOURCES=$(LIB_DIR)/examples/cmath/cmath.cpp 18 | VPATH=.:$(LIB_DIR)/examples/cmath 19 | OBJECTS=$(addprefix $(BUILD_DIR)/,$(notdir $(SOURCES:%=%.o))) 20 | 21 | WARNFLAGS=-Wall -Wextra -pedantic 22 | 23 | ifeq ($(STD),c++20) 24 | WARNFLAGS+=-Wno-volatile 25 | endif 26 | 27 | CXXFLAGS=-std=$(STD) -O2 $(WARNFLAGS) -fno-exceptions -fno-rtti -fno-unwind-tables -fno-threadsafe-statics -Wshadow -Wcast-qual -Wpointer-arith -Wundef 28 | LDFLAGS=-lm 29 | 30 | TARGET=$(BUILD_DIR)/$(NAME) 31 | 32 | all: hex size 33 | 34 | hex: $(TARGET).hex 35 | 36 | $(TARGET).hex: $(TARGET).elf 37 | avr-objcopy -O ihex -j .data -j .text $(TARGET).elf $(TARGET).hex 38 | 39 | $(TARGET).elf: $(OBJECTS) 40 | avr-g++ $(LDFLAGS) -mmcu=$(MCU) $(OBJECTS) -o $(TARGET).elf 41 | 42 | $(BUILD_DIR)/%.cpp.o: %.cpp 43 | @mkdir -p $(BUILD_DIR) 44 | avr-g++ -c $(CXXFLAGS) -mmcu=$(MCU) $(INCLUDES) $< -o $@ 45 | 46 | $(BUILD_DIR)/%.cc.o: %.cc 47 | @mkdir -p $(BUILD_DIR) 48 | avr-g++ -c $(CXXFLAGS) -mmcu=$(MCU) $(INCLUDES) $< -o $@ 49 | 50 | size: $(TARGET).elf 51 | avr-objdump -Pmem-usage $(TARGET).elf 52 | 53 | program: $(TARGET).hex 54 | avrdude -p$(MCU) $(AVRDUDE_FLAGS) -c$(PROGRAMMER) -Uflash:w:$(TARGET).hex:a 55 | 56 | clean: 57 | rm -rf $(BUILD_DIR)/*.o 58 | rm -rf $(BUILD_DIR)/*.elf 59 | rm -rf $(BUILD_DIR)/*.hex 60 | -------------------------------------------------------------------------------- /examples/cmath/cmath.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, 2025, Christopher Kormanyos 3 | * 4 | * This file is part of the modm project. 5 | * 6 | * This Source Code Form is subject to the terms of the Mozilla Public 7 | * License, v. 2.0. If a copy of the MPL was not distributed with this 8 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | */ 10 | // ---------------------------------------------------------------------------- 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | namespace local { 17 | 18 | namespace detail { 19 | 20 | template 21 | auto integral 22 | ( 23 | const RealValueType& a, 24 | const RealValueType& b, 25 | const RealValueType& tol, 26 | RealFunctionType real_function 27 | ) noexcept -> RealValueType 28 | { 29 | using real_value_type = RealValueType; 30 | 31 | std::uint_fast32_t n2(1); 32 | 33 | real_value_type step = ((b - a) / 2U); 34 | real_value_type result = (real_function(a) + real_function(b)) * step; 35 | 36 | constexpr std::uint_fast8_t k_max { UINT8_C(32) }; 37 | 38 | for(std::uint_fast8_t k = UINT8_C(0); k < k_max; ++k) 39 | { 40 | real_value_type sum(0); 41 | 42 | for(std::uint_fast32_t j(0U); j < n2; ++j) 43 | { 44 | const std::uint_fast32_t two_j_plus_one = (j * UINT32_C(2)) + UINT32_C(1); 45 | 46 | sum += real_function(a + real_value_type(step * real_value_type(two_j_plus_one))); 47 | } 48 | 49 | const real_value_type tmp = result; 50 | 51 | result = (result / 2U) + (step * sum); 52 | 53 | using std::fabs; 54 | 55 | const real_value_type ratio = fabs(tmp / result); 56 | 57 | const real_value_type delta = fabs(ratio - 1U); 58 | 59 | if((k > UINT8_C(1)) && (delta < tol)) 60 | { 61 | break; 62 | } 63 | 64 | n2 *= 2U; 65 | 66 | step /= 2U; 67 | } 68 | 69 | return result; 70 | } 71 | 72 | template 73 | auto is_close_fraction 74 | ( 75 | const FloatingPointType a, 76 | const FloatingPointType b, 77 | const FloatingPointType tol = FloatingPointType(std::numeric_limits::epsilon() * FloatingPointType(100)) 78 | ) noexcept -> bool 79 | { 80 | using floating_point_type = FloatingPointType; 81 | 82 | using std::fabs; 83 | using std::fpclassify; 84 | 85 | const int fpc_a { fpclassify(a) }; 86 | const int fpc_b { fpclassify(b) }; 87 | 88 | bool result_is_ok { }; 89 | 90 | if(fpc_b == FP_ZERO) 91 | { 92 | const floating_point_type closeness { (fpc_a == FP_ZERO) ? floating_point_type { 0 } : fabs(a - b) }; 93 | 94 | result_is_ok = (closeness < tol); 95 | } 96 | else 97 | { 98 | const floating_point_type ratio = fabs(floating_point_type((floating_point_type(1) * a) / b)); 99 | 100 | const floating_point_type closeness = fabs(floating_point_type(1 - ratio)); 101 | 102 | result_is_ok = (closeness < tol); 103 | } 104 | 105 | return result_is_ok; 106 | } 107 | 108 | // N[Pi, 51] 109 | // 3.14159265358979323846264338327950288419716939937511 110 | template constexpr FloatingPointType pi_v; 111 | template<> constexpr float pi_v = 3.14159265358979323846264338327950288419716939937511F; 112 | template<> constexpr double pi_v = 3.14159265358979323846264338327950288419716939937511; 113 | template<> constexpr long double pi_v = 3.14159265358979323846264338327950288419716939937511L; 114 | 115 | } // namespace detail 116 | 117 | template 118 | auto cyl_bessel_j(const std::uint_fast8_t n, const FloatingPointType& x) noexcept -> FloatingPointType 119 | { 120 | using floating_point_type = FloatingPointType; 121 | 122 | constexpr floating_point_type epsilon = std::numeric_limits::epsilon(); 123 | 124 | using std::cos; 125 | using std::sin; 126 | using std::sqrt; 127 | 128 | const floating_point_type tol { sqrt(epsilon) }; 129 | 130 | const auto integration_result = 131 | detail::integral 132 | ( 133 | static_cast(0), 134 | detail::pi_v, 135 | tol, 136 | [&x, &n](const floating_point_type& t) noexcept -> floating_point_type 137 | { 138 | return cos(x * sin(t) - (t * static_cast(n))); 139 | }); 140 | 141 | const floating_point_type jn { static_cast(integration_result / detail::pi_v) }; 142 | 143 | return jn; 144 | } 145 | 146 | } // namespace local 147 | 148 | auto main() -> int 149 | { 150 | using my_float_type = std::float_t; 151 | 152 | static_assert((std::numeric_limits::digits == 24), "Error: Incorrect my_float_type type definition"); 153 | 154 | constexpr my_float_type my_tol = 155 | static_cast 156 | ( 157 | std::numeric_limits::epsilon() * static_cast(100.0L) 158 | ); 159 | 160 | // Compute y = cyl_bessel_j(2, 1.23) = 0.16636938378681407351267852431513159437103348245333 161 | // N[BesselJ[2, 123/100], 50] 162 | const my_float_type j2 = local::cyl_bessel_j(UINT8_C(2), static_cast(1.23L)); 163 | 164 | const bool result_is_ok = 165 | local::detail::is_close_fraction 166 | ( 167 | static_cast(0.1663693837868140735126785243L), 168 | j2, 169 | my_tol 170 | ); 171 | 172 | return (result_is_ok ? 0 : -1); 173 | } 174 | -------------------------------------------------------------------------------- /examples/common/cxxabi.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2011, Fabian Greif 3 | * Copyright (c) 2010, Martin Rosekeit 4 | * Copyright (c) 2012, Sascha Schade 5 | * Copyright (c) 2012-2014, Niklas Hauser 6 | * Copyright (c) 2018, Christopher Durand 7 | * 8 | * This file is part of the modm project. 9 | * 10 | * This Source Code Form is subject to the terms of the Mozilla Public 11 | * License, v. 2.0. If a copy of the MPL was not distributed with this 12 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 13 | */ 14 | // ---------------------------------------------------------------------------- 15 | 16 | extern "C" 17 | { 18 | /** 19 | * \brief Pure-virtual workaround. 20 | * 21 | * The avr-libc does not support a default implementation for handling 22 | * possible pure-virtual calls. This is a short and empty workaround for this. 23 | */ 24 | void 25 | __cxa_pure_virtual() 26 | { 27 | __builtin_abort(); 28 | } 29 | 30 | __extension__ typedef int __guard __attribute__((mode (__DI__))); 31 | 32 | int 33 | __cxa_guard_acquire(__guard *g) 34 | { 35 | return !*(char *)(g); 36 | } 37 | 38 | void 39 | __cxa_guard_release (__guard *g) 40 | { 41 | *(char *)g = 1; 42 | } 43 | 44 | void 45 | __cxa_guard_abort (__guard *) 46 | { 47 | } 48 | 49 | int 50 | __cxa_atexit (void (* /*destructor*/)(void*), void* /*object*/, void* /*dso_handle*/) 51 | { 52 | return 0; 53 | } 54 | 55 | void* __dso_handle = (void*) &__dso_handle; 56 | } 57 | -------------------------------------------------------------------------------- /examples/common/new.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Christopher Durand 3 | * 4 | * This file is part of the modm project. 5 | * 6 | * This Source Code Form is subject to the terms of the Mozilla Public 7 | * License, v. 2.0. If a copy of the MPL was not distributed with this 8 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | */ 10 | // ---------------------------------------------------------------------------- 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | template 18 | static inline void* 19 | allocate(size_t size) _GLIBCXX_USE_NOEXCEPT 20 | { 21 | void* ptr = malloc(size); 22 | 23 | if constexpr(abortOnFail) { 24 | if(!ptr) { 25 | std::__throw_bad_alloc(); 26 | } 27 | } 28 | 29 | return ptr; 30 | } 31 | 32 | void * 33 | operator new(size_t size) 34 | { 35 | return allocate(size); 36 | } 37 | 38 | void * 39 | operator new[](size_t size) 40 | { 41 | return allocate(size); 42 | } 43 | 44 | void* 45 | operator new(std::size_t size, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT 46 | { 47 | return allocate(size); 48 | } 49 | 50 | void* 51 | operator new[](std::size_t size, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT 52 | { 53 | return allocate(size); 54 | } 55 | 56 | void 57 | operator delete(void* ptr) _GLIBCXX_USE_NOEXCEPT 58 | { 59 | free(ptr); 60 | } 61 | 62 | void 63 | operator delete(void* ptr, size_t) _GLIBCXX_USE_NOEXCEPT 64 | { 65 | free(ptr); 66 | } 67 | 68 | void 69 | operator delete[](void* ptr) _GLIBCXX_USE_NOEXCEPT 70 | { 71 | free(ptr); 72 | } 73 | 74 | void 75 | operator delete[](void* ptr, size_t) _GLIBCXX_USE_NOEXCEPT 76 | { 77 | free(ptr); 78 | } 79 | 80 | void 81 | operator delete(void* ptr, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT 82 | { 83 | free(ptr); 84 | } 85 | 86 | void 87 | operator delete[](void* ptr, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT 88 | { 89 | free(ptr); 90 | } 91 | -------------------------------------------------------------------------------- /examples/common/uart.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Christopher Durand 3 | * 4 | * This file is part of the modm project. 5 | * 6 | * This Source Code Form is subject to the terms of the Mozilla Public 7 | * License, v. 2.0. If a copy of the MPL was not distributed with this 8 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | */ 10 | // ---------------------------------------------------------------------------- 11 | 12 | #define BAUD 9600 13 | 14 | #ifndef F_CPU 15 | #error "F_CPU must be defined!" 16 | #endif 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | 23 | // naive unbuffered uart implementation for C standard IO 24 | 25 | static int 26 | uart_putc(char c, [[maybe_unused]] FILE* stream) 27 | { 28 | loop_until_bit_is_set(UCSR0A, UDRE0); 29 | UDR0 = c; 30 | return 0; 31 | } 32 | 33 | static int 34 | uart_getc([[maybe_unused]] FILE* stream) 35 | { 36 | loop_until_bit_is_set(UCSR0A, RXC0); 37 | return UDR0; 38 | } 39 | 40 | // constructor attribute: call function before main 41 | static void uart_init() __attribute__ ((constructor, used)); 42 | 43 | static void 44 | uart_init() 45 | { 46 | UBRR0H = UBRRH_VALUE; 47 | UBRR0L = UBRRL_VALUE; 48 | 49 | #if USE_2X 50 | UCSR0A |= _BV(U2X0); 51 | #else 52 | UCSR0A &= ~(_BV(U2X0)); 53 | #endif 54 | 55 | UCSR0C = _BV(UCSZ01) | _BV(UCSZ00); 56 | UCSR0B = _BV(RXEN0) | _BV(TXEN0); 57 | 58 | static FILE uart_output = {}; 59 | static FILE uart_input = {}; 60 | 61 | fdev_setup_stream(&uart_output, uart_putc, nullptr, _FDEV_SETUP_WRITE); 62 | fdev_setup_stream(&uart_input, nullptr, uart_getc, _FDEV_SETUP_READ); 63 | 64 | stdout = &uart_output; 65 | stdin = &uart_input; 66 | } 67 | -------------------------------------------------------------------------------- /examples/numeric/Makefile: -------------------------------------------------------------------------------- 1 | NAME=numeric-test 2 | MCU=atmega328p 3 | 4 | ifeq ($(STD),) 5 | STD=c++17 6 | endif 7 | 8 | BUILD_DIR=./build 9 | LIB_DIR=../.. 10 | 11 | ifeq ($(INC),) 12 | INCLUDES= -I$(LIB_DIR)/include 13 | else 14 | INCLUDES= -I$(INC) 15 | endif 16 | 17 | SOURCES=$(LIB_DIR)/examples/numeric/numeric.cpp 18 | VPATH=.:$(LIB_DIR)/examples/numeric 19 | OBJECTS=$(addprefix $(BUILD_DIR)/,$(notdir $(SOURCES:%=%.o))) 20 | 21 | WARNFLAGS=-Wall -Wextra -pedantic 22 | 23 | ifeq ($(STD),c++20) 24 | WARNFLAGS+=-Wno-volatile 25 | endif 26 | 27 | CXXFLAGS=-std=$(STD) -O2 $(WARNFLAGS) -fno-exceptions -fno-rtti -fno-unwind-tables -fno-threadsafe-statics -Wshadow -Wcast-qual -Wpointer-arith -Wundef 28 | LDFLAGS= 29 | 30 | TARGET=$(BUILD_DIR)/$(NAME) 31 | 32 | all: hex size 33 | 34 | hex: $(TARGET).hex 35 | 36 | $(TARGET).hex: $(TARGET).elf 37 | avr-objcopy -O ihex -j .data -j .text $(TARGET).elf $(TARGET).hex 38 | 39 | $(TARGET).elf: $(OBJECTS) 40 | avr-g++ $(LDFLAGS) -mmcu=$(MCU) $(OBJECTS) -o $(TARGET).elf 41 | 42 | $(BUILD_DIR)/%.cpp.o: %.cpp 43 | @mkdir -p $(BUILD_DIR) 44 | avr-g++ -c $(CXXFLAGS) -mmcu=$(MCU) $(INCLUDES) $< -o $@ 45 | 46 | $(BUILD_DIR)/%.cc.o: %.cc 47 | @mkdir -p $(BUILD_DIR) 48 | avr-g++ -c $(CXXFLAGS) -mmcu=$(MCU) $(INCLUDES) $< -o $@ 49 | 50 | size: $(TARGET).elf 51 | avr-objdump -Pmem-usage $(TARGET).elf 52 | 53 | program: $(TARGET).hex 54 | avrdude -p$(MCU) $(AVRDUDE_FLAGS) -c$(PROGRAMMER) -Uflash:w:$(TARGET).hex:a 55 | 56 | clean: 57 | rm -rf $(BUILD_DIR)/*.o 58 | rm -rf $(BUILD_DIR)/*.elf 59 | rm -rf $(BUILD_DIR)/*.hex 60 | -------------------------------------------------------------------------------- /examples/numeric/numeric.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, Christopher Kormanyos 3 | * 4 | * This file is part of the modm project. 5 | * 6 | * This Source Code Form is subject to the terms of the Mozilla Public 7 | * License, v. 2.0. If a copy of the MPL was not distributed with this 8 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | */ 10 | // ---------------------------------------------------------------------------- 11 | 12 | #include 13 | #include 14 | 15 | #if (defined(__cpp_lib_constexpr_numeric) && (__cpp_lib_constexpr_numeric >= 201911L)) 16 | #define MODM_CONSTEXPR constexpr 17 | #define MODM_CONSTEXPR_NUMERIC_IS_CONSTEXPR 1 18 | #else 19 | #define MODM_CONSTEXPR 20 | #define MODM_CONSTEXPR_NUMERIC_IS_CONSTEXPR 0 21 | #endif 22 | 23 | MODM_CONSTEXPR std::array a { 1, 2, 3 }; 24 | 25 | int main() 26 | { 27 | // 6 28 | auto MODM_CONSTEXPR sum = std::accumulate(a.cbegin(), a.cend(), 0); 29 | 30 | #if (MODM_CONSTEXPR_NUMERIC_IS_CONSTEXPR == 1) 31 | static_assert(sum == 6, "Error: Unexpected std::accumulate result!"); 32 | #endif 33 | 34 | return (sum == 6 ? 0 : -1); 35 | } 36 | -------------------------------------------------------------------------------- /examples/vector/Makefile: -------------------------------------------------------------------------------- 1 | NAME=vector-test 2 | MCU=atmega328p 3 | F_CPU=16000000ul 4 | 5 | PROGRAMMER=arduino 6 | AVRDUDE_FLAGS= -P/dev/ttyUSB0 -b57600 7 | 8 | ifeq ($(STD),) 9 | STD=c++17 10 | endif 11 | 12 | BUILD_DIR=./build 13 | LIB_DIR=../.. 14 | COMMON_DIR=../common 15 | 16 | INCLUDES=-I$(COMMON_DIR) -I$(LIB_DIR)/include 17 | 18 | SOURCES=$(wildcard *.cpp $(LIB_DIR)/src/*.cc $(COMMON_DIR)/*.cpp) 19 | VPATH=.:$(LIB_DIR)/src:$(COMMON_DIR) 20 | OBJECTS=$(addprefix $(BUILD_DIR)/,$(notdir $(SOURCES:%=%.o))) 21 | 22 | CXXFLAGS=-std=$(STD) -O2 -Wall -Wextra -pedantic -fno-exceptions -fno-rtti -fno-unwind-tables -fno-threadsafe-statics -Wshadow -Wcast-qual -Wpointer-arith -Wundef -DF_CPU=$(F_CPU) 23 | LDFLAGS= 24 | 25 | TARGET=$(BUILD_DIR)/$(NAME) 26 | 27 | all: hex size 28 | 29 | hex: $(TARGET).hex 30 | 31 | $(TARGET).hex: $(TARGET).elf 32 | avr-objcopy -O ihex -j .data -j .text $(TARGET).elf $(TARGET).hex 33 | 34 | $(TARGET).elf: $(OBJECTS) 35 | avr-g++ $(LDFLAGS) -mmcu=$(MCU) $(OBJECTS) -o $(TARGET).elf 36 | 37 | $(BUILD_DIR)/%.cpp.o: %.cpp 38 | @mkdir -p $(BUILD_DIR) 39 | avr-g++ -c $(CXXFLAGS) -mmcu=$(MCU) $(INCLUDES) $< -o $@ 40 | 41 | $(BUILD_DIR)/%.cc.o: %.cc 42 | @mkdir -p $(BUILD_DIR) 43 | avr-g++ -c $(CXXFLAGS) -mmcu=$(MCU) $(INCLUDES) $< -o $@ 44 | 45 | size: $(TARGET).elf 46 | avr-objdump -Pmem-usage $(TARGET).elf 47 | 48 | program: $(TARGET).hex 49 | avrdude -p$(MCU) $(AVRDUDE_FLAGS) -c$(PROGRAMMER) -Uflash:w:$(TARGET).hex:a 50 | 51 | clean: 52 | rm -rf $(BUILD_DIR)/*.o 53 | rm -rf $(BUILD_DIR)/*.elf 54 | rm -rf $(BUILD_DIR)/*.hex 55 | -------------------------------------------------------------------------------- /examples/vector/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main() 6 | { 7 | // output on Uart0, see common/uart.cpp 8 | puts("AVR libstdc++ vector test\n"); 9 | 10 | std::vector test{10, 1, 2, 42, 3}; 11 | test.push_back(4); 12 | test.erase(test.begin()); 13 | 14 | if(auto it = std::find(test.begin(), test.end(), 42); it != test.end()) { 15 | test.erase(it); 16 | } 17 | 18 | for(auto i : test) { 19 | printf("%i ", i); 20 | } 21 | puts("\n"); 22 | } 23 | -------------------------------------------------------------------------------- /include/algorithm: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | 3 | // Copyright (C) 2001-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /* 26 | * 27 | * Copyright (c) 1994 28 | * Hewlett-Packard Company 29 | * 30 | * Permission to use, copy, modify, distribute and sell this software 31 | * and its documentation for any purpose is hereby granted without fee, 32 | * provided that the above copyright notice appear in all copies and 33 | * that both that copyright notice and this permission notice appear 34 | * in supporting documentation. Hewlett-Packard Company makes no 35 | * representations about the suitability of this software for any 36 | * purpose. It is provided "as is" without express or implied warranty. 37 | * 38 | * 39 | * Copyright (c) 1996,1997 40 | * Silicon Graphics Computer Systems, Inc. 41 | * 42 | * Permission to use, copy, modify, distribute and sell this software 43 | * and its documentation for any purpose is hereby granted without fee, 44 | * provided that the above copyright notice appear in all copies and 45 | * that both that copyright notice and this permission notice appear 46 | * in supporting documentation. Silicon Graphics makes no 47 | * representations about the suitability of this software for any 48 | * purpose. It is provided "as is" without express or implied warranty. 49 | */ 50 | 51 | /** @file include/algorithm 52 | * This is a Standard C++ Library header. 53 | */ 54 | 55 | #ifndef _GLIBCXX_ALGORITHM 56 | #define _GLIBCXX_ALGORITHM 1 57 | 58 | #pragma GCC system_header 59 | 60 | #include // UK-300. 61 | #include 62 | #include 63 | #if __cplusplus > 201703L 64 | # include 65 | #endif 66 | 67 | #endif /* _GLIBCXX_ALGORITHM */ 68 | -------------------------------------------------------------------------------- /include/backward/backward_warning.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2001-2020 Free Software Foundation, Inc. 2 | // 3 | // This file is part of the GNU ISO C++ Library. This library is free 4 | // software; you can redistribute it and/or modify it under the 5 | // terms of the GNU General Public License as published by the 6 | // Free Software Foundation; either version 3, or (at your option) 7 | // any later version. 8 | 9 | // This library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // Under Section 7 of GPL version 3, you are granted additional 15 | // permissions described in the GCC Runtime Library Exception, version 16 | // 3.1, as published by the Free Software Foundation. 17 | 18 | // You should have received a copy of the GNU General Public License and 19 | // a copy of the GCC Runtime Library Exception along with this program; 20 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 21 | // . 22 | 23 | /** @file backward/backward_warning.h 24 | * This is an internal header file, included by other library headers. 25 | * Do not attempt to use it directly. @headername{iosfwd} 26 | */ 27 | 28 | #ifndef _BACKWARD_BACKWARD_WARNING_H 29 | #define _BACKWARD_BACKWARD_WARNING_H 1 30 | 31 | #ifdef __DEPRECATED 32 | #warning \ 33 | This file includes at least one deprecated or antiquated header which \ 34 | may be removed without further notice at a future date. Please use a \ 35 | non-deprecated interface with equivalent functionality instead. For a \ 36 | listing of replacement headers and interfaces, consult the file \ 37 | backward_warning.h. To disable this warning use -Wno-deprecated. 38 | 39 | /* 40 | A list of valid replacements is as follows: 41 | 42 | Use: Instead of: 43 | , unordered_set , hash_set 44 | , unordered_multiset , hash_multiset 45 | , unordered_map , hash_map 46 | , unordered_multimap , hash_multimap 47 | , bind , binder1st 48 | , bind , binder2nd 49 | , bind , bind1st 50 | , bind , bind2nd 51 | , unique_ptr , auto_ptr 52 | */ 53 | 54 | #endif 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /include/backward/hash_fun.h: -------------------------------------------------------------------------------- 1 | // 'struct hash' from SGI -*- C++ -*- 2 | 3 | // Copyright (C) 2001-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /* 26 | * Copyright (c) 1996-1998 27 | * Silicon Graphics Computer Systems, Inc. 28 | * 29 | * Permission to use, copy, modify, distribute and sell this software 30 | * and its documentation for any purpose is hereby granted without fee, 31 | * provided that the above copyright notice appear in all copies and 32 | * that both that copyright notice and this permission notice appear 33 | * in supporting documentation. Silicon Graphics makes no 34 | * representations about the suitability of this software for any 35 | * purpose. It is provided "as is" without express or implied warranty. 36 | * 37 | * 38 | * Copyright (c) 1994 39 | * Hewlett-Packard Company 40 | * 41 | * Permission to use, copy, modify, distribute and sell this software 42 | * and its documentation for any purpose is hereby granted without fee, 43 | * provided that the above copyright notice appear in all copies and 44 | * that both that copyright notice and this permission notice appear 45 | * in supporting documentation. Hewlett-Packard Company makes no 46 | * representations about the suitability of this software for any 47 | * purpose. It is provided "as is" without express or implied warranty. 48 | * 49 | */ 50 | 51 | /** @file backward/hash_fun.h 52 | * This file is a GNU extension to the Standard C++ Library (possibly 53 | * containing extensions from the HP/SGI STL subset). 54 | */ 55 | 56 | #ifndef _BACKWARD_HASH_FUN_H 57 | #define _BACKWARD_HASH_FUN_H 1 58 | 59 | #include 60 | 61 | namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) 62 | { 63 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 64 | 65 | using std::size_t; 66 | 67 | template 68 | struct hash { }; 69 | 70 | inline size_t 71 | __stl_hash_string(const char* __s) 72 | { 73 | unsigned long __h = 0; 74 | for ( ; *__s; ++__s) 75 | __h = 5 * __h + *__s; 76 | return size_t(__h); 77 | } 78 | 79 | template<> 80 | struct hash 81 | { 82 | size_t 83 | operator()(const char* __s) const 84 | { return __stl_hash_string(__s); } 85 | }; 86 | 87 | template<> 88 | struct hash 89 | { 90 | size_t 91 | operator()(const char* __s) const 92 | { return __stl_hash_string(__s); } 93 | }; 94 | 95 | template<> 96 | struct hash 97 | { 98 | size_t 99 | operator()(char __x) const 100 | { return __x; } 101 | }; 102 | 103 | template<> 104 | struct hash 105 | { 106 | size_t 107 | operator()(unsigned char __x) const 108 | { return __x; } 109 | }; 110 | 111 | template<> 112 | struct hash 113 | { 114 | size_t 115 | operator()(unsigned char __x) const 116 | { return __x; } 117 | }; 118 | 119 | template<> 120 | struct hash 121 | { 122 | size_t 123 | operator()(short __x) const 124 | { return __x; } 125 | }; 126 | 127 | template<> 128 | struct hash 129 | { 130 | size_t 131 | operator()(unsigned short __x) const 132 | { return __x; } 133 | }; 134 | 135 | template<> 136 | struct hash 137 | { 138 | size_t 139 | operator()(int __x) const 140 | { return __x; } 141 | }; 142 | 143 | template<> 144 | struct hash 145 | { 146 | size_t 147 | operator()(unsigned int __x) const 148 | { return __x; } 149 | }; 150 | 151 | template<> 152 | struct hash 153 | { 154 | size_t 155 | operator()(long __x) const 156 | { return __x; } 157 | }; 158 | 159 | template<> 160 | struct hash 161 | { 162 | size_t 163 | operator()(unsigned long __x) const 164 | { return __x; } 165 | }; 166 | 167 | _GLIBCXX_END_NAMESPACE_VERSION 168 | } // namespace 169 | 170 | #endif 171 | -------------------------------------------------------------------------------- /include/bits/allocated_ptr.h: -------------------------------------------------------------------------------- 1 | // Guarded Allocation -*- C++ -*- 2 | 3 | // Copyright (C) 2014-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file bits/allocated_ptr.h 26 | * This is an internal header file, included by other library headers. 27 | * Do not attempt to use it directly. @headername{memory} 28 | */ 29 | 30 | #ifndef _ALLOCATED_PTR_H 31 | #define _ALLOCATED_PTR_H 1 32 | 33 | #if __cplusplus < 201103L 34 | # include 35 | #else 36 | # include 37 | # include 38 | # include 39 | 40 | namespace std _GLIBCXX_VISIBILITY(default) 41 | { 42 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 43 | 44 | /// Non-standard RAII type for managing pointers obtained from allocators. 45 | template 46 | struct __allocated_ptr 47 | { 48 | using pointer = typename allocator_traits<_Alloc>::pointer; 49 | using value_type = typename allocator_traits<_Alloc>::value_type; 50 | 51 | /// Take ownership of __ptr 52 | __allocated_ptr(_Alloc& __a, pointer __ptr) noexcept 53 | : _M_alloc(std::__addressof(__a)), _M_ptr(__ptr) 54 | { } 55 | 56 | /// Convert __ptr to allocator's pointer type and take ownership of it 57 | template>> 59 | __allocated_ptr(_Alloc& __a, _Ptr __ptr) 60 | : _M_alloc(std::__addressof(__a)), 61 | _M_ptr(pointer_traits::pointer_to(*__ptr)) 62 | { } 63 | 64 | /// Transfer ownership of the owned pointer 65 | __allocated_ptr(__allocated_ptr&& __gd) noexcept 66 | : _M_alloc(__gd._M_alloc), _M_ptr(__gd._M_ptr) 67 | { __gd._M_ptr = nullptr; } 68 | 69 | /// Deallocate the owned pointer 70 | ~__allocated_ptr() 71 | { 72 | if (_M_ptr != nullptr) 73 | std::allocator_traits<_Alloc>::deallocate(*_M_alloc, _M_ptr, 1); 74 | } 75 | 76 | /// Release ownership of the owned pointer 77 | __allocated_ptr& 78 | operator=(std::nullptr_t) noexcept 79 | { 80 | _M_ptr = nullptr; 81 | return *this; 82 | } 83 | 84 | /// Get the address that the owned pointer refers to. 85 | value_type* get() { return std::__to_address(_M_ptr); } 86 | 87 | private: 88 | _Alloc* _M_alloc; 89 | pointer _M_ptr; 90 | }; 91 | 92 | /// Allocate space for a single object using __a 93 | template 94 | __allocated_ptr<_Alloc> 95 | __allocate_guarded(_Alloc& __a) 96 | { 97 | return { __a, std::allocator_traits<_Alloc>::allocate(__a, 1) }; 98 | } 99 | 100 | _GLIBCXX_END_NAMESPACE_VERSION 101 | } // namespace std 102 | 103 | #endif 104 | #endif 105 | -------------------------------------------------------------------------------- /include/bits/atomic_lockfree_defines.h: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- header. 2 | 3 | // Copyright (C) 2008-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file bits/atomic_lockfree_defines.h 26 | * This is an internal header file, included by other library headers. 27 | * Do not attempt to use it directly. @headername{atomic} 28 | */ 29 | 30 | #ifndef _GLIBCXX_ATOMIC_LOCK_FREE_H 31 | #define _GLIBCXX_ATOMIC_LOCK_FREE_H 1 32 | 33 | #pragma GCC system_header 34 | 35 | /** 36 | * @addtogroup atomics 37 | * @{ 38 | */ 39 | 40 | /** 41 | * Lock-free property. 42 | * 43 | * 0 indicates that the types are never lock-free. 44 | * 1 indicates that the types are sometimes lock-free. 45 | * 2 indicates that the types are always lock-free. 46 | */ 47 | 48 | #if __cplusplus >= 201103L 49 | #define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE 50 | #define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE 51 | #define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE 52 | #ifdef _GLIBCXX_USE_CHAR8_T 53 | #define ATOMIC_CHAR8_T_LOCK_FREE __GCC_ATOMIC_CHAR8_T_LOCK_FREE 54 | #endif 55 | #define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE 56 | #define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE 57 | #define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE 58 | #define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE 59 | #define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE 60 | #define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE 61 | #define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE 62 | #endif 63 | 64 | // @} group atomics 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /include/bits/c++0x_warning.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2007-2020 Free Software Foundation, Inc. 2 | // 3 | // This file is part of the GNU ISO C++ Library. This library is free 4 | // software; you can redistribute it and/or modify it under the 5 | // terms of the GNU General Public License as published by the 6 | // Free Software Foundation; either version 3, or (at your option) 7 | // any later version. 8 | 9 | // This library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // Under Section 7 of GPL version 3, you are granted additional 15 | // permissions described in the GCC Runtime Library Exception, version 16 | // 3.1, as published by the Free Software Foundation. 17 | 18 | // You should have received a copy of the GNU General Public License and 19 | // a copy of the GCC Runtime Library Exception along with this program; 20 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 21 | // . 22 | 23 | /** @file bits/c++0x_warning.h 24 | * This is an internal header file, included by other library headers. 25 | * Do not attempt to use it directly. @headername{iosfwd} 26 | */ 27 | 28 | #ifndef _CXX0X_WARNING_H 29 | #define _CXX0X_WARNING_H 1 30 | 31 | #if __cplusplus < 201103L 32 | #error This file requires compiler and library support \ 33 | for the ISO C++ 2011 standard. This support must be enabled \ 34 | with the -std=c++11 or -std=gnu++11 compiler options. 35 | #endif 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /include/bits/c++allocator.h: -------------------------------------------------------------------------------- 1 | // Base to std::allocator -*- C++ -*- 2 | 3 | // Copyright (C) 2004-2018 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file bits/c++allocator.h 26 | * This is an internal header file, included by other library headers. 27 | * Do not attempt to use it directly. @headername{memory} 28 | */ 29 | 30 | #ifndef _GLIBCXX_CXX_ALLOCATOR_H 31 | #define _GLIBCXX_CXX_ALLOCATOR_H 1 32 | 33 | #include 34 | 35 | #if __cplusplus >= 201103L 36 | namespace std 37 | { 38 | /** 39 | * @brief An alias to the base class for std::allocator. 40 | * @ingroup allocators 41 | * 42 | * Used to set the std::allocator base class to 43 | * __gnu_cxx::new_allocator. 44 | * 45 | * @tparam _Tp Type of allocated object. 46 | */ 47 | template 48 | using __allocator_base = __gnu_cxx::new_allocator<_Tp>; 49 | } 50 | #else 51 | // Define new_allocator as the base class to std::allocator. 52 | # define __allocator_base __gnu_cxx::new_allocator 53 | #endif 54 | 55 | #if defined(__SANITIZE_ADDRESS__) && !defined(_GLIBCXX_SANITIZE_STD_ALLOCATOR) 56 | # define _GLIBCXX_SANITIZE_STD_ALLOCATOR 1 57 | #endif 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /include/bits/charconv.h: -------------------------------------------------------------------------------- 1 | // Numeric conversions (to_string, to_chars) -*- C++ -*- 2 | 3 | // Copyright (C) 2017-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file bits/charconv.h 26 | * This is an internal header file, included by other library headers. 27 | * Do not attempt to use it directly. @headername{charconv} 28 | */ 29 | 30 | #ifndef _GLIBCXX_CHARCONV_H 31 | #define _GLIBCXX_CHARCONV_H 1 32 | 33 | #pragma GCC system_header 34 | 35 | #if __cplusplus >= 201103L 36 | 37 | #include 38 | 39 | namespace std _GLIBCXX_VISIBILITY(default) 40 | { 41 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 42 | namespace __detail 43 | { 44 | // Generic implementation for arbitrary bases. 45 | template 46 | _GLIBCXX14_CONSTEXPR unsigned 47 | __to_chars_len(_Tp __value, int __base = 10) noexcept 48 | { 49 | static_assert(is_integral<_Tp>::value, "implementation bug"); 50 | static_assert(is_unsigned<_Tp>::value, "implementation bug"); 51 | 52 | unsigned __n = 1; 53 | const unsigned __b2 = __base * __base; 54 | const unsigned __b3 = __b2 * __base; 55 | const unsigned long __b4 = __b3 * __base; 56 | for (;;) 57 | { 58 | if (__value < (unsigned)__base) return __n; 59 | if (__value < __b2) return __n + 1; 60 | if (__value < __b3) return __n + 2; 61 | if (__value < __b4) return __n + 3; 62 | __value /= __b4; 63 | __n += 4; 64 | } 65 | } 66 | 67 | // Write an unsigned integer value to the range [first,first+len). 68 | // The caller is required to provide a buffer of exactly the right size 69 | // (which can be determined by the __to_chars_len function). 70 | template 71 | void 72 | __to_chars_10_impl(char* __first, unsigned __len, _Tp __val) noexcept 73 | { 74 | static_assert(is_integral<_Tp>::value, "implementation bug"); 75 | static_assert(is_unsigned<_Tp>::value, "implementation bug"); 76 | 77 | static constexpr char __digits[201] = 78 | "0001020304050607080910111213141516171819" 79 | "2021222324252627282930313233343536373839" 80 | "4041424344454647484950515253545556575859" 81 | "6061626364656667686970717273747576777879" 82 | "8081828384858687888990919293949596979899"; 83 | unsigned __pos = __len - 1; 84 | while (__val >= 100) 85 | { 86 | auto const __num = (__val % 100) * 2; 87 | __val /= 100; 88 | __first[__pos] = __digits[__num + 1]; 89 | __first[__pos - 1] = __digits[__num]; 90 | __pos -= 2; 91 | } 92 | if (__val >= 10) 93 | { 94 | auto const __num = __val * 2; 95 | __first[1] = __digits[__num + 1]; 96 | __first[0] = __digits[__num]; 97 | } 98 | else 99 | __first[0] = '0' + __val; 100 | } 101 | 102 | } // namespace __detail 103 | _GLIBCXX_END_NAMESPACE_VERSION 104 | } // namespace std 105 | #endif // C++11 106 | #endif // _GLIBCXX_CHARCONV_H 107 | -------------------------------------------------------------------------------- /include/bits/concept_check.h: -------------------------------------------------------------------------------- 1 | // Concept-checking control -*- C++ -*- 2 | 3 | // Copyright (C) 2001-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file bits/concept_check.h 26 | * This is an internal header file, included by other library headers. 27 | * Do not attempt to use it directly. @headername{iterator} 28 | */ 29 | 30 | #ifndef _CONCEPT_CHECK_H 31 | #define _CONCEPT_CHECK_H 1 32 | 33 | #pragma GCC system_header 34 | 35 | #include 36 | 37 | // All places in libstdc++-v3 where these are used, or /might/ be used, or 38 | // don't need to be used, or perhaps /should/ be used, are commented with 39 | // "concept requirements" (and maybe some more text). So grep like crazy 40 | // if you're looking for additional places to use these. 41 | 42 | // Concept-checking code is off by default unless users turn it on via 43 | // configure options or editing c++config.h. 44 | // It is not supported for freestanding implementations. 45 | 46 | #if !defined(_GLIBCXX_CONCEPT_CHECKS) || !_GLIBCXX_HOSTED 47 | 48 | #define __glibcxx_function_requires(...) 49 | #define __glibcxx_class_requires(_a,_b) 50 | #define __glibcxx_class_requires2(_a,_b,_c) 51 | #define __glibcxx_class_requires3(_a,_b,_c,_d) 52 | #define __glibcxx_class_requires4(_a,_b,_c,_d,_e) 53 | 54 | #else // the checks are on 55 | 56 | #include 57 | 58 | // Note that the obvious and elegant approach of 59 | // 60 | //#define glibcxx_function_requires(C) debug::function_requires< debug::C >() 61 | // 62 | // won't work due to concept templates with more than one parameter, e.g., 63 | // BinaryPredicateConcept. The preprocessor tries to split things up on 64 | // the commas in the template argument list. We can't use an inner pair of 65 | // parenthesis to hide the commas, because "debug::(Temp)" isn't 66 | // a valid instantiation pattern. Thus, we steal a feature from C99. 67 | 68 | #define __glibcxx_function_requires(...) \ 69 | __gnu_cxx::__function_requires< __gnu_cxx::__VA_ARGS__ >(); 70 | #define __glibcxx_class_requires(_a,_C) \ 71 | _GLIBCXX_CLASS_REQUIRES(_a, __gnu_cxx, _C); 72 | #define __glibcxx_class_requires2(_a,_b,_C) \ 73 | _GLIBCXX_CLASS_REQUIRES2(_a, _b, __gnu_cxx, _C); 74 | #define __glibcxx_class_requires3(_a,_b,_c,_C) \ 75 | _GLIBCXX_CLASS_REQUIRES3(_a, _b, _c, __gnu_cxx, _C); 76 | #define __glibcxx_class_requires4(_a,_b,_c,_d,_C) \ 77 | _GLIBCXX_CLASS_REQUIRES4(_a, _b, _c, _d, __gnu_cxx, _C); 78 | 79 | #endif // enable/disable 80 | 81 | #endif // _GLIBCXX_CONCEPT_CHECK 82 | -------------------------------------------------------------------------------- /include/bits/cxxabi_forced.h: -------------------------------------------------------------------------------- 1 | // cxxabi.h subset for cancellation -*- C++ -*- 2 | 3 | // Copyright (C) 2007-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of GCC. 6 | // 7 | // GCC is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation; either version 3, or (at your option) 10 | // any later version. 11 | // 12 | // GCC is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // Under Section 7 of GPL version 3, you are granted additional 18 | // permissions described in the GCC Runtime Library Exception, version 19 | // 3.1, as published by the Free Software Foundation. 20 | 21 | // You should have received a copy of the GNU General Public License and 22 | // a copy of the GCC Runtime Library Exception along with this program; 23 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 24 | // . 25 | 26 | /** @file bits/cxxabi_forced.h 27 | * This is an internal header file, included by other library headers. 28 | * Do not attempt to use it directly. @headername{cxxabi.h} 29 | */ 30 | 31 | #ifndef _CXXABI_FORCED_H 32 | #define _CXXABI_FORCED_H 1 33 | 34 | #pragma GCC system_header 35 | 36 | #pragma GCC visibility push(default) 37 | 38 | #ifdef __cplusplus 39 | namespace __cxxabiv1 40 | { 41 | /** 42 | * @brief Thrown as part of forced unwinding. 43 | * @ingroup exceptions 44 | * 45 | * A magic placeholder class that can be caught by reference to 46 | * recognize forced unwinding. 47 | */ 48 | class __forced_unwind 49 | { 50 | virtual ~__forced_unwind() throw(); 51 | 52 | // Prevent catch by value. 53 | virtual void __pure_dummy() = 0; 54 | }; 55 | } 56 | #endif // __cplusplus 57 | 58 | #pragma GCC visibility pop 59 | 60 | #endif // __CXXABI_FORCED_H 61 | -------------------------------------------------------------------------------- /include/bits/cxxabi_init_exception.h: -------------------------------------------------------------------------------- 1 | // ABI Support -*- C++ -*- 2 | 3 | // Copyright (C) 2016-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of GCC. 6 | // 7 | // GCC is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation; either version 3, or (at your option) 10 | // any later version. 11 | // 12 | // GCC is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // Under Section 7 of GPL version 3, you are granted additional 18 | // permissions described in the GCC Runtime Library Exception, version 19 | // 3.1, as published by the Free Software Foundation. 20 | 21 | // You should have received a copy of the GNU General Public License and 22 | // a copy of the GCC Runtime Library Exception along with this program; 23 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 24 | // . 25 | 26 | /** @file bits/cxxabi_init_exception.h 27 | * This is an internal header file, included by other library headers. 28 | * Do not attempt to use it directly. 29 | */ 30 | 31 | #ifndef _CXXABI_INIT_EXCEPTION_H 32 | #define _CXXABI_INIT_EXCEPTION_H 1 33 | 34 | #pragma GCC system_header 35 | 36 | #pragma GCC visibility push(default) 37 | 38 | #include 39 | #include 40 | 41 | #ifndef _GLIBCXX_CDTOR_CALLABI 42 | #define _GLIBCXX_CDTOR_CALLABI 43 | #define _GLIBCXX_HAVE_CDTOR_CALLABI 0 44 | #else 45 | #define _GLIBCXX_HAVE_CDTOR_CALLABI 1 46 | #endif 47 | 48 | #ifdef __cplusplus 49 | 50 | namespace std 51 | { 52 | class type_info; 53 | } 54 | 55 | namespace __cxxabiv1 56 | { 57 | struct __cxa_refcounted_exception; 58 | 59 | extern "C" 60 | { 61 | // Allocate memory for the primary exception plus the thrown object. 62 | void* 63 | __cxa_allocate_exception(size_t) _GLIBCXX_NOTHROW; 64 | 65 | void 66 | __cxa_free_exception(void*) _GLIBCXX_NOTHROW; 67 | 68 | // Initialize exception (this is a GNU extension) 69 | __cxa_refcounted_exception* 70 | __cxa_init_primary_exception(void *object, std::type_info *tinfo, 71 | void (_GLIBCXX_CDTOR_CALLABI *dest) (void *)) _GLIBCXX_NOTHROW; 72 | 73 | } 74 | } // namespace __cxxabiv1 75 | 76 | #endif 77 | 78 | #pragma GCC visibility pop 79 | 80 | #endif // _CXXABI_INIT_EXCEPTION_H 81 | -------------------------------------------------------------------------------- /include/bits/erase_if.h: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | 3 | // Copyright (C) 2015-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file bits/erase_if.h 26 | * This is an internal header file, included by other library headers. 27 | * Do not attempt to use it directly. 28 | */ 29 | 30 | #ifndef _GLIBCXX_ERASE_IF_H 31 | #define _GLIBCXX_ERASE_IF_H 1 32 | 33 | #pragma GCC system_header 34 | 35 | #if __cplusplus >= 201402L 36 | 37 | namespace std 38 | { 39 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 40 | 41 | #if __cplusplus > 201703L 42 | # define __cpp_lib_erase_if 202002L 43 | #endif 44 | 45 | namespace __detail 46 | { 47 | template 48 | typename _Container::size_type 49 | __erase_nodes_if(_Container& __cont, _Predicate __pred) 50 | { 51 | typename _Container::size_type __num = 0; 52 | for (auto __iter = __cont.begin(), __last = __cont.end(); 53 | __iter != __last;) 54 | { 55 | if (__pred(*__iter)) 56 | { 57 | __iter = __cont.erase(__iter); 58 | ++__num; 59 | } 60 | else 61 | ++__iter; 62 | } 63 | return __num; 64 | } 65 | } // namespace __detail 66 | 67 | _GLIBCXX_END_NAMESPACE_VERSION 68 | } // namespace std 69 | 70 | #endif // C++14 71 | 72 | #endif // _GLIBCXX_ERASE_IF_H 73 | -------------------------------------------------------------------------------- /include/bits/exception_defines.h: -------------------------------------------------------------------------------- 1 | // -fno-exceptions Support -*- C++ -*- 2 | 3 | // Copyright (C) 2001-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file bits/exception_defines.h 26 | * This is an internal header file, included by other library headers. 27 | * Do not attempt to use it directly. @headername{exception} 28 | */ 29 | 30 | #ifndef _EXCEPTION_DEFINES_H 31 | #define _EXCEPTION_DEFINES_H 1 32 | 33 | #pragma GCC system_header 34 | 35 | #if ! __cpp_exceptions 36 | // Iff -fno-exceptions, transform error handling code to work without it. 37 | # define __try if (true) 38 | # define __catch(X) if (false) 39 | # define __throw_exception_again 40 | #else 41 | // Else proceed normally. 42 | # define __try try 43 | # define __catch(X) catch(X) 44 | # define __throw_exception_again throw 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /include/bits/functexcept.h: -------------------------------------------------------------------------------- 1 | // Function-Based Exception Support -*- C++ -*- 2 | 3 | // Copyright (C) 2001-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file bits/functexcept.h 26 | * This is an internal header file, included by other library headers. 27 | * Do not attempt to use it directly. @headername{exception} 28 | * 29 | * This header provides support for -fno-exceptions. 30 | */ 31 | 32 | // 33 | // ISO C++ 14882: 19.1 Exception classes 34 | // 35 | 36 | #ifndef _FUNCTEXCEPT_H 37 | #define _FUNCTEXCEPT_H 1 38 | 39 | #include 40 | #include 41 | #include 42 | 43 | namespace std _GLIBCXX_VISIBILITY(default) 44 | { 45 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 46 | 47 | // Helper for exception objects in 48 | void 49 | __throw_bad_exception(void) __attribute__((__noreturn__)); 50 | 51 | // Helper for exception objects in 52 | void 53 | __throw_bad_alloc(void) __attribute__((__noreturn__)); 54 | 55 | // Helper for exception objects in 56 | void 57 | __throw_bad_cast(void) __attribute__((__noreturn__)); 58 | 59 | void 60 | __throw_bad_typeid(void) __attribute__((__noreturn__)); 61 | 62 | // Helpers for exception objects in 63 | void 64 | __throw_logic_error(const char* __s = "") __attribute__((__noreturn__)); 65 | 66 | void 67 | __throw_domain_error(const char* __s = "") __attribute__((__noreturn__)); 68 | 69 | void 70 | __throw_invalid_argument(const char* __s = "") __attribute__((__noreturn__)); 71 | 72 | void 73 | __throw_length_error(const char* __s = "") __attribute__((__noreturn__)); 74 | 75 | void 76 | __throw_out_of_range(const char* __s = "") __attribute__((__noreturn__)); 77 | 78 | inline void __attribute__((__noreturn__)) __attribute__((always_inline)) 79 | __throw_out_of_range_fmt(const char*, ...) 80 | { __throw_out_of_range(); } 81 | 82 | void 83 | __throw_runtime_error(const char* __s = "") __attribute__((__noreturn__)); 84 | 85 | void 86 | __throw_range_error(const char* __s = "") __attribute__((__noreturn__)); 87 | 88 | void 89 | __throw_overflow_error(const char* __s = "") __attribute__((__noreturn__)); 90 | 91 | void 92 | __throw_underflow_error(const char* __s = "") __attribute__((__noreturn__)); 93 | 94 | // Helpers for exception objects in 95 | void 96 | __throw_system_error(int) __attribute__((__noreturn__)); 97 | 98 | // Helpers for exception objects in 99 | void 100 | __throw_bad_function_call() __attribute__((__noreturn__)); 101 | 102 | void 103 | __throw_bad_optional_access() __attribute__((__noreturn__)); 104 | 105 | void 106 | __throw_bad_variant_access(const char* __s = "") __attribute__((__noreturn__)); 107 | 108 | void 109 | __throw_bad_any_cast() __attribute__((__noreturn__)); 110 | 111 | _GLIBCXX_END_NAMESPACE_VERSION 112 | } // namespace 113 | 114 | #endif 115 | -------------------------------------------------------------------------------- /include/bits/hash_bytes.h: -------------------------------------------------------------------------------- 1 | // Declarations for hash functions. -*- C++ -*- 2 | 3 | // Copyright (C) 2010-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file bits/hash_bytes.h 26 | * This is an internal header file, included by other library headers. 27 | * Do not attempt to use it directly. @headername{functional} 28 | */ 29 | 30 | #ifndef _HASH_BYTES_H 31 | #define _HASH_BYTES_H 1 32 | 33 | #pragma GCC system_header 34 | 35 | #include 36 | 37 | namespace std 38 | { 39 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 40 | 41 | // Hash function implementation for the nontrivial specialization. 42 | // All of them are based on a primitive that hashes a pointer to a 43 | // byte array. The actual hash algorithm is not guaranteed to stay 44 | // the same from release to release -- it may be updated or tuned to 45 | // improve hash quality or speed. 46 | size_t 47 | _Hash_bytes(const void* __ptr, size_t __len, size_t __seed); 48 | 49 | // A similar hash primitive, using the FNV hash algorithm. This 50 | // algorithm is guaranteed to stay the same from release to release. 51 | // (although it might not produce the same values on different 52 | // machines.) 53 | size_t 54 | _Fnv_hash_bytes(const void* __ptr, size_t __len, size_t __seed); 55 | 56 | _GLIBCXX_END_NAMESPACE_VERSION 57 | } // namespace 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /include/bits/memoryfwd.h: -------------------------------------------------------------------------------- 1 | // Forward declarations -*- C++ -*- 2 | 3 | // Copyright (C) 2001-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /* 26 | * Copyright (c) 1996-1997 27 | * Silicon Graphics Computer Systems, Inc. 28 | * 29 | * Permission to use, copy, modify, distribute and sell this software 30 | * and its documentation for any purpose is hereby granted without fee, 31 | * provided that the above copyright notice appear in all copies and 32 | * that both that copyright notice and this permission notice appear 33 | * in supporting documentation. Silicon Graphics makes no 34 | * representations about the suitability of this software for any 35 | * purpose. It is provided "as is" without express or implied warranty. 36 | */ 37 | 38 | /** @file bits/memoryfwd.h 39 | * This is an internal header file, included by other library headers. 40 | * Do not attempt to use it directly. @headername{memory} 41 | */ 42 | 43 | #ifndef _MEMORYFWD_H 44 | #define _MEMORYFWD_H 1 45 | 46 | #pragma GCC system_header 47 | 48 | #include 49 | 50 | namespace std _GLIBCXX_VISIBILITY(default) 51 | { 52 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 53 | 54 | /** 55 | * @defgroup allocators Allocators 56 | * @ingroup memory 57 | * 58 | * Classes encapsulating memory operations. 59 | * 60 | * @{ 61 | */ 62 | 63 | template 64 | class allocator; 65 | 66 | #if __cplusplus <= 201703L 67 | template<> 68 | class allocator; 69 | #endif 70 | 71 | #if __cplusplus >= 201103L 72 | /// Declare uses_allocator so it can be specialized in \ etc. 73 | template 74 | struct uses_allocator; 75 | #endif 76 | 77 | /// @} group memory 78 | 79 | _GLIBCXX_END_NAMESPACE_VERSION 80 | } // namespace std 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /include/bits/std_abs.h: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- C library enhancements header. 2 | 3 | // Copyright (C) 2016-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file include/bits/std_abs.h 26 | * This is an internal header file, included by other library headers. 27 | * Do not attempt to use it directly. @headername{cmath, cstdlib} 28 | */ 29 | 30 | #ifndef _GLIBCXX_BITS_STD_ABS_H 31 | #define _GLIBCXX_BITS_STD_ABS_H 32 | 33 | #pragma GCC system_header 34 | 35 | #include 36 | 37 | #define _GLIBCXX_INCLUDE_NEXT_C_HEADERS 38 | #include_next 39 | #ifdef __CORRECT_ISO_CPP_MATH_H_PROTO 40 | # include_next 41 | #endif 42 | #undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS 43 | 44 | #undef abs 45 | 46 | extern "C++" 47 | { 48 | namespace std _GLIBCXX_VISIBILITY(default) 49 | { 50 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 51 | 52 | using ::abs; 53 | 54 | #ifndef __CORRECT_ISO_CPP_STDLIB_H_PROTO 55 | inline long 56 | abs(long __i) { return __builtin_labs(__i); } 57 | #endif 58 | 59 | #ifdef _GLIBCXX_USE_LONG_LONG 60 | inline long long 61 | abs(long long __x) { return __builtin_llabs (__x); } 62 | #endif 63 | 64 | // _GLIBCXX_RESOLVE_LIB_DEFECTS 65 | // 2192. Validity and return type of std::abs(0u) is unclear 66 | // 2294. should declare abs(double) 67 | // 2735. std::abs(short), std::abs(signed char) and others should return int 68 | 69 | #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO 70 | inline _GLIBCXX_CONSTEXPR double 71 | abs(double __x) 72 | { return __builtin_fabs(__x); } 73 | 74 | inline _GLIBCXX_CONSTEXPR float 75 | abs(float __x) 76 | { return __builtin_fabsf(__x); } 77 | 78 | inline _GLIBCXX_CONSTEXPR long double 79 | abs(long double __x) 80 | { return __builtin_fabsl(__x); } 81 | #endif 82 | 83 | #if defined(__GLIBCXX_TYPE_INT_N_0) 84 | inline _GLIBCXX_CONSTEXPR __GLIBCXX_TYPE_INT_N_0 85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } 86 | #endif 87 | #if defined(__GLIBCXX_TYPE_INT_N_1) 88 | inline _GLIBCXX_CONSTEXPR __GLIBCXX_TYPE_INT_N_1 89 | abs(__GLIBCXX_TYPE_INT_N_1 __x) { return __x >= 0 ? __x : -__x; } 90 | #endif 91 | #if defined(__GLIBCXX_TYPE_INT_N_2) 92 | inline _GLIBCXX_CONSTEXPR __GLIBCXX_TYPE_INT_N_2 93 | abs(__GLIBCXX_TYPE_INT_N_2 __x) { return __x >= 0 ? __x : -__x; } 94 | #endif 95 | #if defined(__GLIBCXX_TYPE_INT_N_3) 96 | inline _GLIBCXX_CONSTEXPR __GLIBCXX_TYPE_INT_N_3 97 | abs(__GLIBCXX_TYPE_INT_N_3 __x) { return __x >= 0 ? __x : -__x; } 98 | #endif 99 | 100 | #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128) 101 | inline _GLIBCXX_CONSTEXPR 102 | __float128 103 | abs(__float128 __x) 104 | { return __x < 0 ? -__x : __x; } 105 | #endif 106 | 107 | _GLIBCXX_END_NAMESPACE_VERSION 108 | } // namespace 109 | } // extern "C"++" 110 | 111 | #endif // _GLIBCXX_BITS_STD_ABS_H 112 | -------------------------------------------------------------------------------- /include/bits/stl_raw_storage_iter.h: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | 3 | // Copyright (C) 2001-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /* 26 | * 27 | * Copyright (c) 1994 28 | * Hewlett-Packard Company 29 | * 30 | * Permission to use, copy, modify, distribute and sell this software 31 | * and its documentation for any purpose is hereby granted without fee, 32 | * provided that the above copyright notice appear in all copies and 33 | * that both that copyright notice and this permission notice appear 34 | * in supporting documentation. Hewlett-Packard Company makes no 35 | * representations about the suitability of this software for any 36 | * purpose. It is provided "as is" without express or implied warranty. 37 | * 38 | * 39 | * Copyright (c) 1996 40 | * Silicon Graphics Computer Systems, Inc. 41 | * 42 | * Permission to use, copy, modify, distribute and sell this software 43 | * and its documentation for any purpose is hereby granted without fee, 44 | * provided that the above copyright notice appear in all copies and 45 | * that both that copyright notice and this permission notice appear 46 | * in supporting documentation. Silicon Graphics makes no 47 | * representations about the suitability of this software for any 48 | * purpose. It is provided "as is" without express or implied warranty. 49 | */ 50 | 51 | /** @file bits/stl_raw_storage_iter.h 52 | * This is an internal header file, included by other library headers. 53 | * Do not attempt to use it directly. @headername{memory} 54 | */ 55 | 56 | #ifndef _STL_RAW_STORAGE_ITERATOR_H 57 | #define _STL_RAW_STORAGE_ITERATOR_H 1 58 | 59 | namespace std _GLIBCXX_VISIBILITY(default) 60 | { 61 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 62 | 63 | /** 64 | * This iterator class lets algorithms store their results into 65 | * uninitialized memory. 66 | */ 67 | template 68 | class raw_storage_iterator 69 | : public iterator 70 | { 71 | protected: 72 | _OutputIterator _M_iter; 73 | 74 | public: 75 | explicit 76 | raw_storage_iterator(_OutputIterator __x) 77 | : _M_iter(__x) {} 78 | 79 | raw_storage_iterator& 80 | operator*() { return *this; } 81 | 82 | raw_storage_iterator& 83 | operator=(const _Tp& __element) 84 | { 85 | std::_Construct(std::__addressof(*_M_iter), __element); 86 | return *this; 87 | } 88 | 89 | #if __cplusplus >= 201103L 90 | // _GLIBCXX_RESOLVE_LIB_DEFECTS 91 | // 2127. Move-construction with raw_storage_iterator 92 | raw_storage_iterator& 93 | operator=(_Tp&& __element) 94 | { 95 | std::_Construct(std::__addressof(*_M_iter), std::move(__element)); 96 | return *this; 97 | } 98 | #endif 99 | 100 | raw_storage_iterator& 101 | operator++() 102 | { 103 | ++_M_iter; 104 | return *this; 105 | } 106 | 107 | raw_storage_iterator 108 | operator++(int) 109 | { 110 | raw_storage_iterator __tmp = *this; 111 | ++_M_iter; 112 | return __tmp; 113 | } 114 | 115 | // _GLIBCXX_RESOLVE_LIB_DEFECTS 116 | // 2454. Add raw_storage_iterator::base() member 117 | _OutputIterator base() const { return _M_iter; } 118 | }; 119 | 120 | _GLIBCXX_END_NAMESPACE_VERSION 121 | } // namespace 122 | 123 | #endif 124 | -------------------------------------------------------------------------------- /include/bits/stl_relops.h: -------------------------------------------------------------------------------- 1 | // std::rel_ops implementation -*- C++ -*- 2 | 3 | // Copyright (C) 2001-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the, 2009 Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /* 26 | * 27 | * Copyright (c) 1994 28 | * Hewlett-Packard Company 29 | * 30 | * Permission to use, copy, modify, distribute and sell this software 31 | * and its documentation for any purpose is hereby granted without fee, 32 | * provided that the above copyright notice appear in all copies and 33 | * that both that copyright notice and this permission notice appear 34 | * in supporting documentation. Hewlett-Packard Company makes no 35 | * representations about the suitability of this software for any 36 | * purpose. It is provided "as is" without express or implied warranty. 37 | * 38 | * Copyright (c) 1996,1997 39 | * Silicon Graphics 40 | * 41 | * Permission to use, copy, modify, distribute and sell this software 42 | * and its documentation for any purpose is hereby granted without fee, 43 | * provided that the above copyright notice appear in all copies and 44 | * that both that copyright notice and this permission notice appear 45 | * in supporting documentation. Silicon Graphics makes no 46 | * representations about the suitability of this software for any 47 | * purpose. It is provided "as is" without express or implied warranty. 48 | * 49 | */ 50 | 51 | /** @file bits/stl_relops.h 52 | * This is an internal header file, included by other library headers. 53 | * Do not attempt to use it directly. @headername{utility} 54 | * 55 | * Inclusion of this file has been removed from 56 | * all of the other STL headers for safety reasons, except std_utility.h. 57 | * For more information, see the thread of about twenty messages starting 58 | * with http://gcc.gnu.org/ml/libstdc++/2001-01/msg00223.html, or 59 | * http://gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.ambiguous_overloads 60 | * 61 | * Short summary: the rel_ops operators should be avoided for the present. 62 | */ 63 | 64 | #ifndef _STL_RELOPS_H 65 | #define _STL_RELOPS_H 1 66 | 67 | namespace std _GLIBCXX_VISIBILITY(default) 68 | { 69 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 70 | 71 | namespace rel_ops 72 | { 73 | /** @namespace std::rel_ops 74 | * @brief The generated relational operators are sequestered here. 75 | */ 76 | 77 | /** 78 | * @brief Defines @c != for arbitrary types, in terms of @c ==. 79 | * @param __x A thing. 80 | * @param __y Another thing. 81 | * @return __x != __y 82 | * 83 | * This function uses @c == to determine its result. 84 | */ 85 | template 86 | inline bool 87 | operator!=(const _Tp& __x, const _Tp& __y) 88 | { return !(__x == __y); } 89 | 90 | /** 91 | * @brief Defines @c > for arbitrary types, in terms of @c <. 92 | * @param __x A thing. 93 | * @param __y Another thing. 94 | * @return __x > __y 95 | * 96 | * This function uses @c < to determine its result. 97 | */ 98 | template 99 | inline bool 100 | operator>(const _Tp& __x, const _Tp& __y) 101 | { return __y < __x; } 102 | 103 | /** 104 | * @brief Defines @c <= for arbitrary types, in terms of @c <. 105 | * @param __x A thing. 106 | * @param __y Another thing. 107 | * @return __x <= __y 108 | * 109 | * This function uses @c < to determine its result. 110 | */ 111 | template 112 | inline bool 113 | operator<=(const _Tp& __x, const _Tp& __y) 114 | { return !(__y < __x); } 115 | 116 | /** 117 | * @brief Defines @c >= for arbitrary types, in terms of @c <. 118 | * @param __x A thing. 119 | * @param __y Another thing. 120 | * @return __x >= __y 121 | * 122 | * This function uses @c < to determine its result. 123 | */ 124 | template 125 | inline bool 126 | operator>=(const _Tp& __x, const _Tp& __y) 127 | { return !(__x < __y); } 128 | } // namespace rel_ops 129 | 130 | _GLIBCXX_END_NAMESPACE_VERSION 131 | } // namespace std 132 | 133 | #endif /* _STL_RELOPS_H */ 134 | -------------------------------------------------------------------------------- /include/cassert: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- forwarding header. 2 | 3 | // Copyright (C) 1997-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file cassert 26 | * This is a Standard C++ Library file. You should @c \#include this file 27 | * in your programs, rather than any of the @a *.h implementation files. 28 | * 29 | * This is the C++ version of the Standard C Library header @c assert.h, 30 | * and its contents are (mostly) the same as that header, but are all 31 | * contained in the namespace @c std (except for names which are defined 32 | * as macros in C). 33 | */ 34 | 35 | // 36 | // ISO C++ 14882: 19.2 Assertions 37 | // 38 | 39 | // No include guards on this header... 40 | 41 | #pragma GCC system_header 42 | 43 | #include 44 | #include 45 | -------------------------------------------------------------------------------- /include/ccomplex: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | 3 | // Copyright (C) 2007-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file include/ccomplex 26 | * This is a Standard C++ Library header. 27 | */ 28 | 29 | #pragma GCC system_header 30 | 31 | #ifndef _GLIBCXX_CCOMPLEX 32 | #define _GLIBCXX_CCOMPLEX 1 33 | 34 | #if __cplusplus < 201103L 35 | # include 36 | #endif 37 | 38 | extern "C++" { 39 | #include 40 | } 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /include/cctype: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- forwarding header. 2 | 3 | // Copyright (C) 1997-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file include/cctype 26 | * This is a Standard C++ Library file. You should @c \#include this file 27 | * in your programs, rather than any of the @a *.h implementation files. 28 | * 29 | * This is the C++ version of the Standard C Library header @c ctype.h, 30 | * and its contents are (mostly) the same as that header, but are all 31 | * contained in the namespace @c std (except for names which are defined 32 | * as macros in C). 33 | */ 34 | 35 | // 36 | // ISO C++ 14882: 37 | // 38 | 39 | #pragma GCC system_header 40 | 41 | #include 42 | #include 43 | 44 | #ifndef _GLIBCXX_CCTYPE 45 | #define _GLIBCXX_CCTYPE 1 46 | 47 | // Get rid of those macros defined in in lieu of real functions. 48 | #undef isalnum 49 | #undef isalpha 50 | #undef iscntrl 51 | #undef isdigit 52 | #undef isgraph 53 | #undef islower 54 | #undef isprint 55 | #undef ispunct 56 | #undef isspace 57 | #undef isupper 58 | #undef isxdigit 59 | #undef tolower 60 | #undef toupper 61 | 62 | namespace std 63 | { 64 | using ::isalnum; 65 | using ::isalpha; 66 | using ::iscntrl; 67 | using ::isdigit; 68 | using ::isgraph; 69 | using ::islower; 70 | using ::isprint; 71 | using ::ispunct; 72 | using ::isspace; 73 | using ::isupper; 74 | using ::isxdigit; 75 | using ::tolower; 76 | using ::toupper; 77 | } // namespace std 78 | 79 | #if __cplusplus >= 201103L 80 | 81 | #ifdef _GLIBCXX_USE_C99_CTYPE_TR1 82 | 83 | #undef isblank 84 | 85 | namespace std 86 | { 87 | using ::isblank; 88 | } // namespace std 89 | 90 | #endif // _GLIBCXX_USE_C99_CTYPE_TR1 91 | 92 | #endif // C++11 93 | 94 | #endif 95 | -------------------------------------------------------------------------------- /include/cerrno: -------------------------------------------------------------------------------- 1 | // The -*- C++ -*- forwarding header. 2 | 3 | // Copyright (C) 1997-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file cerrno 26 | * This is a Standard C++ Library file. You should @c \#include this file 27 | * in your programs, rather than any of the @a *.h implementation files. 28 | * 29 | * This is the C++ version of the Standard C Library header @c errno.h, 30 | * and its contents are (mostly) the same as that header, but are all 31 | * contained in the namespace @c std (except for names which are defined 32 | * as macros in C). 33 | */ 34 | 35 | // 36 | // ISO C++ 14882: 19.3 Error numbers 37 | // 38 | 39 | #pragma GCC system_header 40 | 41 | #include 42 | #include 43 | 44 | #ifndef _GLIBCXX_CERRNO 45 | #define _GLIBCXX_CERRNO 1 46 | 47 | // Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998 48 | #ifndef errno 49 | #define errno errno 50 | #endif 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /include/cfenv: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | 3 | // Copyright (C) 2007-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file include/cfenv 26 | * This is a Standard C++ Library header. 27 | */ 28 | 29 | #ifndef _GLIBCXX_CFENV 30 | #define _GLIBCXX_CFENV 1 31 | 32 | #pragma GCC system_header 33 | 34 | #if __cplusplus < 201103L 35 | # include 36 | #else 37 | 38 | #include 39 | 40 | #if _GLIBCXX_HAVE_FENV_H 41 | # include 42 | #endif 43 | 44 | #ifdef _GLIBCXX_USE_C99_FENV_TR1 45 | 46 | #undef feclearexcept 47 | #undef fegetexceptflag 48 | #undef feraiseexcept 49 | #undef fesetexceptflag 50 | #undef fetestexcept 51 | #undef fegetround 52 | #undef fesetround 53 | #undef fegetenv 54 | #undef feholdexcept 55 | #undef fesetenv 56 | #undef feupdateenv 57 | 58 | namespace std 59 | { 60 | // types 61 | using ::fenv_t; 62 | using ::fexcept_t; 63 | 64 | // functions 65 | using ::feclearexcept; 66 | using ::fegetexceptflag; 67 | using ::feraiseexcept; 68 | using ::fesetexceptflag; 69 | using ::fetestexcept; 70 | 71 | using ::fegetround; 72 | using ::fesetround; 73 | 74 | using ::fegetenv; 75 | using ::feholdexcept; 76 | using ::fesetenv; 77 | using ::feupdateenv; 78 | } // namespace std 79 | 80 | #endif // _GLIBCXX_USE_C99_FENV_TR1 81 | 82 | #endif // C++11 83 | 84 | #endif // _GLIBCXX_CFENV 85 | -------------------------------------------------------------------------------- /include/cfloat: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- forwarding header. 2 | 3 | // Copyright (C) 1997-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file include/cfloat 26 | * This is a Standard C++ Library file. You should @c \#include this file 27 | * in your programs, rather than any of the @a *.h implementation files. 28 | * 29 | * This is the C++ version of the Standard C Library header @c float.h, 30 | * and its contents are (mostly) the same as that header, but are all 31 | * contained in the namespace @c std (except for names which are defined 32 | * as macros in C). 33 | */ 34 | 35 | // 36 | // ISO C++ 14882: 18.2.2 Implementation properties: C library 37 | // 38 | 39 | #pragma GCC system_header 40 | 41 | #include 42 | #include 43 | 44 | #ifndef _GLIBCXX_CFLOAT 45 | #define _GLIBCXX_CFLOAT 1 46 | 47 | #if __cplusplus >= 201103L 48 | # ifndef DECIMAL_DIG 49 | # define DECIMAL_DIG __DECIMAL_DIG__ 50 | # endif 51 | # ifndef FLT_EVAL_METHOD 52 | # define FLT_EVAL_METHOD __FLT_EVAL_METHOD__ 53 | # endif 54 | #endif 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /include/cinttypes: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | 3 | // Copyright (C) 2007-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file include/cinttypes 26 | * This is a Standard C++ Library header. 27 | */ 28 | 29 | #ifndef _GLIBCXX_CINTTYPES 30 | #define _GLIBCXX_CINTTYPES 1 31 | 32 | #pragma GCC system_header 33 | 34 | #if __cplusplus < 201103L 35 | # include 36 | #else 37 | 38 | #include 39 | 40 | // For 27.9.2/3 (see C99, Note 184) 41 | #if _GLIBCXX_HAVE_INTTYPES_H 42 | # ifndef __STDC_FORMAT_MACROS 43 | # define _UNDEF__STDC_FORMAT_MACROS 44 | # define __STDC_FORMAT_MACROS 45 | # endif 46 | # include 47 | # ifdef _UNDEF__STDC_FORMAT_MACROS 48 | # undef __STDC_FORMAT_MACROS 49 | # undef _UNDEF__STDC_FORMAT_MACROS 50 | # endif 51 | #endif 52 | 53 | #endif // C++11 54 | 55 | #endif // _GLIBCXX_CINTTYPES 56 | -------------------------------------------------------------------------------- /include/ciso646: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- forwarding header. 2 | 3 | // Copyright (C) 2001-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file ciso646 26 | * This is a Standard C++ Library file. You should @c \#include this file 27 | * in your programs, rather than any of the @a *.h implementation files. 28 | * 29 | * This is the C++ version of the Standard C Library header @c iso646.h, 30 | * which is empty in C++. 31 | */ 32 | #ifndef _GLIBCXX_CISO646 33 | #define _GLIBCXX_CISO646 34 | 35 | #pragma GCC system_header 36 | 37 | #include 38 | #endif 39 | -------------------------------------------------------------------------------- /include/climits: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- forwarding header. 2 | 3 | // Copyright (C) 1997-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file include/climits 26 | * This is a Standard C++ Library file. You should @c \#include this file 27 | * in your programs, rather than any of the @a *.h implementation files. 28 | * 29 | * This is the C++ version of the Standard C Library header @c limits.h, 30 | * and its contents are (mostly) the same as that header, but are all 31 | * contained in the namespace @c std (except for names which are defined 32 | * as macros in C). 33 | */ 34 | 35 | // 36 | // ISO C++ 14882: 18.2.2 Implementation properties: C library 37 | // 38 | 39 | #pragma GCC system_header 40 | 41 | #include 42 | #include 43 | 44 | #ifndef _GLIBCXX_CLIMITS 45 | #define _GLIBCXX_CLIMITS 1 46 | 47 | #ifndef LLONG_MIN 48 | #define LLONG_MIN (-__LONG_LONG_MAX__ - 1) 49 | #endif 50 | 51 | #ifndef LLONG_MAX 52 | #define LLONG_MAX __LONG_LONG_MAX__ 53 | #endif 54 | 55 | #ifndef ULLONG_MAX 56 | #define ULLONG_MAX (__LONG_LONG_MAX__ * 2ULL + 1) 57 | #endif 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /include/csetjmp: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- forwarding header. 2 | 3 | // Copyright (C) 1997-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file csetjmp 26 | * This is a Standard C++ Library file. You should @c \#include this file 27 | * in your programs, rather than any of the @a *.h implementation files. 28 | * 29 | * This is the C++ version of the Standard C Library header @c setjmp.h, 30 | * and its contents are (mostly) the same as that header, but are all 31 | * contained in the namespace @c std (except for names which are defined 32 | * as macros in C). 33 | */ 34 | 35 | // 36 | // ISO C++ 14882: 20.4.6 C library 37 | // 38 | 39 | #pragma GCC system_header 40 | 41 | #include 42 | #include 43 | 44 | #ifndef _GLIBCXX_CSETJMP 45 | #define _GLIBCXX_CSETJMP 1 46 | 47 | // Get rid of those macros defined in in lieu of real functions. 48 | #undef longjmp 49 | 50 | // Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998 51 | #ifndef setjmp 52 | #define setjmp(env) setjmp (env) 53 | #endif 54 | 55 | namespace std 56 | { 57 | using ::jmp_buf; 58 | using ::longjmp; 59 | } // namespace std 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /include/csignal: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- forwarding header. 2 | 3 | // Copyright (C) 1997-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file csignal 26 | * This is a Standard C++ Library file. You should @c \#include this file 27 | * in your programs, rather than any of the @a *.h implementation files. 28 | * 29 | * This is the C++ version of the Standard C Library header @c signal.h, 30 | * and its contents are (mostly) the same as that header, but are all 31 | * contained in the namespace @c std (except for names which are defined 32 | * as macros in C). 33 | */ 34 | 35 | // 36 | // ISO C++ 14882: 20.4.6 C library 37 | // 38 | 39 | #pragma GCC system_header 40 | 41 | #include 42 | #include 43 | 44 | #ifndef _GLIBCXX_CSIGNAL 45 | #define _GLIBCXX_CSIGNAL 1 46 | 47 | // Get rid of those macros defined in in lieu of real functions. 48 | #undef raise 49 | 50 | namespace std 51 | { 52 | using ::sig_atomic_t; 53 | using ::signal; 54 | using ::raise; 55 | } // namespace std 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /include/cstdalign: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | 3 | // Copyright (C) 2011-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file include/cstdalign 26 | * This is a Standard C++ Library header. 27 | */ 28 | 29 | #pragma GCC system_header 30 | 31 | #ifndef _GLIBCXX_CSTDALIGN 32 | #define _GLIBCXX_CSTDALIGN 1 33 | 34 | #if __cplusplus < 201103L 35 | # include 36 | #else 37 | # include 38 | # if _GLIBCXX_HAVE_STDALIGN_H 39 | # include 40 | # endif 41 | #endif 42 | 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /include/cstdarg: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- forwarding header. 2 | 3 | // Copyright (C) 1997-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file include/cstdarg 26 | * This is a Standard C++ Library file. You should @c \#include this file 27 | * in your programs, rather than any of the @a *.h implementation files. 28 | * 29 | * This is the C++ version of the Standard C Library header @c stdarg.h, 30 | * and its contents are (mostly) the same as that header, but are all 31 | * contained in the namespace @c std (except for names which are defined 32 | * as macros in C). 33 | */ 34 | 35 | // 36 | // ISO C++ 14882: 20.4.6 C library 37 | // 38 | 39 | #pragma GCC system_header 40 | 41 | #undef __need___va_list 42 | #include 43 | #include 44 | 45 | #ifndef _GLIBCXX_CSTDARG 46 | #define _GLIBCXX_CSTDARG 1 47 | 48 | // Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998 49 | #ifndef va_end 50 | #define va_end(ap) va_end (ap) 51 | #endif 52 | 53 | namespace std 54 | { 55 | using ::va_list; 56 | } // namespace std 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /include/cstdbool: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | 3 | // Copyright (C) 2007-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file include/cstdbool 26 | * This is a Standard C++ Library header. 27 | */ 28 | 29 | #pragma GCC system_header 30 | 31 | #ifndef _GLIBCXX_CSTDBOOL 32 | #define _GLIBCXX_CSTDBOOL 1 33 | 34 | #if __cplusplus < 201103L 35 | # include 36 | #else 37 | # include 38 | # if _GLIBCXX_HAVE_STDBOOL_H 39 | # include 40 | # endif 41 | #endif 42 | 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /include/cstdint: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | 3 | // Copyright (C) 2007-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file include/cstdint 26 | * This is a Standard C++ Library header. 27 | */ 28 | 29 | #ifndef _GLIBCXX_CSTDINT 30 | #define _GLIBCXX_CSTDINT 1 31 | 32 | #pragma GCC system_header 33 | 34 | #if __cplusplus < 201103L 35 | # include 36 | #else 37 | 38 | #include 39 | 40 | #if _GLIBCXX_HAVE_STDINT_H 41 | # include 42 | #endif 43 | 44 | namespace std 45 | { 46 | #ifdef _GLIBCXX_USE_C99_STDINT_TR1 47 | using ::int8_t; 48 | using ::int16_t; 49 | using ::int32_t; 50 | using ::int64_t; 51 | 52 | using ::int_fast8_t; 53 | using ::int_fast16_t; 54 | using ::int_fast32_t; 55 | using ::int_fast64_t; 56 | 57 | using ::int_least8_t; 58 | using ::int_least16_t; 59 | using ::int_least32_t; 60 | using ::int_least64_t; 61 | 62 | using ::intmax_t; 63 | using ::intptr_t; 64 | 65 | using ::uint8_t; 66 | using ::uint16_t; 67 | using ::uint32_t; 68 | using ::uint64_t; 69 | 70 | using ::uint_fast8_t; 71 | using ::uint_fast16_t; 72 | using ::uint_fast32_t; 73 | using ::uint_fast64_t; 74 | 75 | using ::uint_least8_t; 76 | using ::uint_least16_t; 77 | using ::uint_least32_t; 78 | using ::uint_least64_t; 79 | 80 | using ::uintmax_t; 81 | using ::uintptr_t; 82 | #else // !_GLIBCXX_USE_C99_STDINT_TR1 83 | // Define the minimum needed for , etc. 84 | using intmax_t = __INTMAX_TYPE__; 85 | using uintmax_t = __UINTMAX_TYPE__; 86 | #endif // _GLIBCXX_USE_C99_STDINT_TR1 87 | } // namespace std 88 | 89 | #endif // C++11 90 | 91 | #endif // _GLIBCXX_CSTDINT 92 | -------------------------------------------------------------------------------- /include/cstdio: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- forwarding header. 2 | 3 | // Copyright (C) 1997-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file include/cstdio 26 | * This is a Standard C++ Library file. You should @c \#include this file 27 | * in your programs, rather than any of the @a *.h implementation files. 28 | * 29 | * This is the C++ version of the Standard C Library header @c stdio.h, 30 | * and its contents are (mostly) the same as that header, but are all 31 | * contained in the namespace @c std (except for names which are defined 32 | * as macros in C). 33 | */ 34 | 35 | // 36 | // ISO C++ 14882: 27.8.2 C Library files 37 | // 38 | 39 | #pragma GCC system_header 40 | 41 | #include 42 | #include 43 | 44 | #ifndef _GLIBCXX_CSTDIO 45 | #define _GLIBCXX_CSTDIO 1 46 | 47 | #if __cplusplus <= 201103L && !defined(_GLIBCXX_HAVE_GETS) 48 | extern "C" char* gets (char* __s) __attribute__((__deprecated__)); 49 | #endif 50 | 51 | // Get rid of those macros defined in in lieu of real functions. 52 | #undef clearerr 53 | #undef fclose 54 | #undef feof 55 | #undef ferror 56 | #undef fflush 57 | #undef fgetc 58 | #undef fgetpos 59 | #undef fgets 60 | #undef fopen 61 | #undef fprintf 62 | #undef fputc 63 | #undef fputs 64 | #undef fread 65 | #undef freopen 66 | #undef fscanf 67 | #undef fseek 68 | #undef fsetpos 69 | #undef ftell 70 | #undef fwrite 71 | #undef getc 72 | #undef getchar 73 | #if __cplusplus <= 201103L 74 | # undef gets 75 | #endif 76 | #undef perror 77 | #undef printf 78 | #undef putc 79 | #undef putchar 80 | #undef puts 81 | #undef remove 82 | #undef rename 83 | #undef rewind 84 | #undef scanf 85 | #undef setbuf 86 | #undef setvbuf 87 | #undef sprintf 88 | #undef sscanf 89 | #undef tmpfile 90 | #undef tmpnam 91 | #undef ungetc 92 | #undef vfprintf 93 | #undef vprintf 94 | #undef vsprintf 95 | 96 | namespace std 97 | { 98 | using ::FILE; 99 | using ::fpos_t; 100 | 101 | using ::clearerr; 102 | using ::fclose; 103 | using ::feof; 104 | using ::ferror; 105 | using ::fflush; 106 | using ::fgetc; 107 | using ::fgetpos; 108 | using ::fgets; 109 | using ::fopen; 110 | using ::fprintf; 111 | using ::fputc; 112 | using ::fputs; 113 | using ::fread; 114 | using ::freopen; 115 | using ::fscanf; 116 | using ::fseek; 117 | using ::fsetpos; 118 | using ::ftell; 119 | using ::fwrite; 120 | using ::getc; 121 | using ::getchar; 122 | #if __cplusplus <= 201103L 123 | // LWG 2249 124 | using ::gets; 125 | #endif 126 | using ::perror; 127 | using ::printf; 128 | using ::putc; 129 | using ::putchar; 130 | using ::puts; 131 | using ::remove; 132 | using ::rename; 133 | using ::rewind; 134 | using ::scanf; 135 | using ::setbuf; 136 | using ::setvbuf; 137 | using ::sprintf; 138 | using ::sscanf; 139 | using ::tmpfile; 140 | #if _GLIBCXX_USE_TMPNAM 141 | using ::tmpnam; 142 | #endif 143 | using ::ungetc; 144 | using ::vfprintf; 145 | using ::vprintf; 146 | using ::vsprintf; 147 | } // namespace 148 | 149 | #if _GLIBCXX_USE_C99_STDIO 150 | 151 | #undef snprintf 152 | #undef vfscanf 153 | #undef vscanf 154 | #undef vsnprintf 155 | #undef vsscanf 156 | 157 | namespace __gnu_cxx 158 | { 159 | #if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC 160 | extern "C" int 161 | (snprintf)(char * __restrict, std::size_t, const char * __restrict, ...) 162 | throw (); 163 | extern "C" int 164 | (vfscanf)(FILE * __restrict, const char * __restrict, __gnuc_va_list); 165 | extern "C" int (vscanf)(const char * __restrict, __gnuc_va_list); 166 | extern "C" int 167 | (vsnprintf)(char * __restrict, std::size_t, const char * __restrict, 168 | __gnuc_va_list) throw (); 169 | extern "C" int 170 | (vsscanf)(const char * __restrict, const char * __restrict, __gnuc_va_list) 171 | throw (); 172 | #endif 173 | 174 | #if !_GLIBCXX_USE_C99_DYNAMIC 175 | using ::snprintf; 176 | using ::vfscanf; 177 | using ::vscanf; 178 | using ::vsnprintf; 179 | #endif 180 | } // namespace __gnu_cxx 181 | 182 | namespace std 183 | { 184 | using ::__gnu_cxx::snprintf; 185 | using ::__gnu_cxx::vfscanf; 186 | using ::__gnu_cxx::vscanf; 187 | using ::__gnu_cxx::vsnprintf; 188 | } // namespace std 189 | 190 | #endif // _GLIBCXX_USE_C99_STDIO 191 | 192 | #endif 193 | -------------------------------------------------------------------------------- /include/cstring: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- forwarding header. 2 | 3 | // Copyright (C) 1997-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file cstring 26 | * This is a Standard C++ Library file. You should @c \#include this file 27 | * in your programs, rather than any of the @a *.h implementation files. 28 | * 29 | * This is the C++ version of the Standard C Library header @c string.h, 30 | * and its contents are (mostly) the same as that header, but are all 31 | * contained in the namespace @c std (except for names which are defined 32 | * as macros in C). 33 | */ 34 | 35 | // 36 | // ISO C++ 14882: 20.4.6 C library 37 | // 38 | 39 | #pragma GCC system_header 40 | 41 | #include 42 | #include 43 | 44 | #ifndef _GLIBCXX_CSTRING 45 | #define _GLIBCXX_CSTRING 1 46 | 47 | // Get rid of those macros defined in in lieu of real functions. 48 | #undef memchr 49 | #undef memcmp 50 | #undef memcpy 51 | #undef memmove 52 | #undef memset 53 | #undef strcat 54 | #undef strchr 55 | #undef strcmp 56 | #undef strcoll 57 | #undef strcpy 58 | #undef strcspn 59 | #undef strerror 60 | #undef strlen 61 | #undef strncat 62 | #undef strncmp 63 | #undef strncpy 64 | #undef strpbrk 65 | #undef strrchr 66 | #undef strspn 67 | #undef strstr 68 | #undef strtok 69 | #undef strxfrm 70 | 71 | extern "C++" 72 | { 73 | namespace std _GLIBCXX_VISIBILITY(default) 74 | { 75 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 76 | 77 | using ::memchr; 78 | using ::memcmp; 79 | using ::memcpy; 80 | using ::memmove; 81 | using ::memset; 82 | using ::strcat; 83 | using ::strcmp; 84 | using ::strcoll; 85 | using ::strcpy; 86 | using ::strcspn; 87 | using ::strerror; 88 | using ::strlen; 89 | using ::strncat; 90 | using ::strncmp; 91 | using ::strncpy; 92 | using ::strspn; 93 | using ::strtok; 94 | using ::strxfrm; 95 | using ::strchr; 96 | using ::strpbrk; 97 | using ::strrchr; 98 | using ::strstr; 99 | 100 | #ifndef __CORRECT_ISO_CPP_STRING_H_PROTO 101 | inline void* 102 | memchr(void* __s, int __c, size_t __n) 103 | { return __builtin_memchr(__s, __c, __n); } 104 | 105 | inline char* 106 | strchr(char* __s, int __n) 107 | { return __builtin_strchr(__s, __n); } 108 | 109 | inline char* 110 | strpbrk(char* __s1, const char* __s2) 111 | { return __builtin_strpbrk(__s1, __s2); } 112 | 113 | inline char* 114 | strrchr(char* __s, int __n) 115 | { return __builtin_strrchr(__s, __n); } 116 | 117 | inline char* 118 | strstr(char* __s1, const char* __s2) 119 | { return __builtin_strstr(__s1, __s2); } 120 | #endif 121 | 122 | _GLIBCXX_END_NAMESPACE_VERSION 123 | } // namespace 124 | } // extern "C++" 125 | 126 | #endif 127 | -------------------------------------------------------------------------------- /include/ctgmath: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | 3 | // Copyright (C) 2007-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file include/ctgmath 26 | * This is a Standard C++ Library header. 27 | */ 28 | 29 | #pragma GCC system_header 30 | 31 | #ifndef _GLIBCXX_CTGMATH 32 | #define _GLIBCXX_CTGMATH 1 33 | 34 | #if __cplusplus < 201103L 35 | # include 36 | #else 37 | # include 38 | extern "C++" { 39 | # include 40 | } 41 | #endif 42 | 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /include/ctime: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- forwarding header. 2 | 3 | // Copyright (C) 1997-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file include/ctime 26 | * This is a Standard C++ Library file. You should @c \#include this file 27 | * in your programs, rather than any of the @a *.h implementation files. 28 | * 29 | * This is the C++ version of the Standard C Library header @c time.h, 30 | * and its contents are (mostly) the same as that header, but are all 31 | * contained in the namespace @c std (except for names which are defined 32 | * as macros in C). 33 | */ 34 | 35 | // 36 | // ISO C++ 14882: 20.5 Date and time 37 | // 38 | 39 | #pragma GCC system_header 40 | 41 | #include 42 | #include 43 | 44 | #ifndef _GLIBCXX_CTIME 45 | #define _GLIBCXX_CTIME 1 46 | 47 | // Get rid of those macros defined in in lieu of real functions. 48 | #undef clock 49 | #undef difftime 50 | #undef mktime 51 | #undef time 52 | #undef asctime 53 | #undef ctime 54 | #undef gmtime 55 | #undef localtime 56 | #undef strftime 57 | 58 | namespace std 59 | { 60 | using ::clock_t; 61 | using ::time_t; 62 | using ::tm; 63 | 64 | using ::clock; 65 | using ::difftime; 66 | using ::mktime; 67 | using ::time; 68 | using ::asctime; 69 | using ::ctime; 70 | using ::gmtime; 71 | using ::localtime; 72 | using ::strftime; 73 | } // namespace 74 | 75 | #if __cplusplus >= 201703L && defined(_GLIBCXX_HAVE_TIMESPEC_GET) 76 | #undef timespec_get 77 | namespace std 78 | { 79 | using ::timespec; 80 | using ::timespec_get; 81 | } // namespace std 82 | #endif 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /include/cuchar: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- forwarding header. 2 | 3 | // Copyright (C) 2015-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file include/cuchar 26 | * This is a Standard C++ Library file. You should @c \#include this file 27 | * in your programs, rather than any of the @a *.h implementation files. 28 | * 29 | * This is the C++ version of the Standard C Library header @c uchar.h, 30 | * and its contents are (mostly) the same as that header, but are all 31 | * contained in the namespace @c std (except for names which are defined 32 | * as macros in C). 33 | */ 34 | 35 | // 36 | // ISO C++ 14882:2011 21.8 37 | // 38 | 39 | #ifndef _GLIBCXX_CUCHAR 40 | #define _GLIBCXX_CUCHAR 1 41 | 42 | #pragma GCC system_header 43 | 44 | #if __cplusplus < 201103L 45 | # include 46 | #else 47 | 48 | #include 49 | #include 50 | 51 | #if _GLIBCXX_USE_C11_UCHAR_CXX11 52 | 53 | #include 54 | 55 | // Get rid of those macros defined in in lieu of real functions. 56 | #undef mbrtoc16 57 | #undef c16rtomb 58 | #undef mbrtoc32 59 | #undef c32rtomb 60 | 61 | namespace std _GLIBCXX_VISIBILITY(default) 62 | { 63 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 64 | 65 | using ::mbrtoc16; 66 | using ::c16rtomb; 67 | using ::mbrtoc32; 68 | using ::c32rtomb; 69 | 70 | _GLIBCXX_END_NAMESPACE_VERSION 71 | } // namespace std 72 | 73 | #endif // _GLIBCXX_USE_C11_UCHAR_CXX11 74 | 75 | #endif // C++11 76 | 77 | #endif // _GLIBCXX_CUCHAR 78 | -------------------------------------------------------------------------------- /include/cwctype: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- forwarding header. 2 | 3 | // Copyright (C) 1997-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file include/cwctype 26 | * This is a Standard C++ Library file. You should @c \#include this file 27 | * in your programs, rather than any of the @a *.h implementation files. 28 | * 29 | * This is the C++ version of the Standard C Library header @c wctype.h, 30 | * and its contents are (mostly) the same as that header, but are all 31 | * contained in the namespace @c std (except for names which are defined 32 | * as macros in C). 33 | */ 34 | 35 | // 36 | // ISO C++ 14882: 37 | // 38 | 39 | #pragma GCC system_header 40 | 41 | #include 42 | 43 | #if _GLIBCXX_HAVE_WCTYPE_H 44 | 45 | #if __GLIBC__ == 2 && __GLIBC_MINOR__ < 10 46 | // Work around glibc BZ 9694 47 | #include 48 | #endif 49 | 50 | #include 51 | #endif // _GLIBCXX_HAVE_WCTYPE_H 52 | 53 | #ifndef _GLIBCXX_CWCTYPE 54 | #define _GLIBCXX_CWCTYPE 1 55 | 56 | // Get rid of those macros defined in in lieu of real functions. 57 | #undef iswalnum 58 | #undef iswalpha 59 | #if _GLIBCXX_HAVE_ISWBLANK 60 | # undef iswblank 61 | #endif 62 | #undef iswcntrl 63 | #undef iswctype 64 | #undef iswdigit 65 | #undef iswgraph 66 | #undef iswlower 67 | #undef iswprint 68 | #undef iswpunct 69 | #undef iswspace 70 | #undef iswupper 71 | #undef iswxdigit 72 | #undef towctrans 73 | #undef towlower 74 | #undef towupper 75 | #undef wctrans 76 | #undef wctype 77 | 78 | #if _GLIBCXX_USE_WCHAR_T 79 | 80 | namespace std 81 | { 82 | using ::wctrans_t; 83 | using ::wctype_t; 84 | using ::wint_t; 85 | 86 | using ::iswalnum; 87 | using ::iswalpha; 88 | #if _GLIBCXX_HAVE_ISWBLANK 89 | using ::iswblank; 90 | #endif 91 | using ::iswcntrl; 92 | using ::iswctype; 93 | using ::iswdigit; 94 | using ::iswgraph; 95 | using ::iswlower; 96 | using ::iswprint; 97 | using ::iswpunct; 98 | using ::iswspace; 99 | using ::iswupper; 100 | using ::iswxdigit; 101 | using ::towctrans; 102 | using ::towlower; 103 | using ::towupper; 104 | using ::wctrans; 105 | using ::wctype; 106 | } // namespace 107 | 108 | #endif //_GLIBCXX_USE_WCHAR_T 109 | 110 | #endif // _GLIBCXX_CWCTYPE 111 | -------------------------------------------------------------------------------- /include/debug/assertions.h: -------------------------------------------------------------------------------- 1 | // Debugging support implementation -*- C++ -*- 2 | 3 | // Copyright (C) 2003-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file debug/assertions.h 26 | * This file is a GNU debug extension to the Standard C++ Library. 27 | */ 28 | 29 | #ifndef _GLIBCXX_DEBUG_ASSERTIONS_H 30 | #define _GLIBCXX_DEBUG_ASSERTIONS_H 1 31 | 32 | #ifndef _GLIBCXX_DEBUG 33 | 34 | # define _GLIBCXX_DEBUG_ASSERT(_Condition) 35 | # define _GLIBCXX_DEBUG_PEDASSERT(_Condition) 36 | # define _GLIBCXX_DEBUG_ONLY(_Statement) 37 | 38 | #endif 39 | 40 | #ifndef _GLIBCXX_ASSERTIONS 41 | # define __glibcxx_requires_non_empty_range(_First,_Last) 42 | # define __glibcxx_requires_nonempty() 43 | # define __glibcxx_requires_subscript(_N) 44 | #else 45 | 46 | // Verify that [_First, _Last) forms a non-empty iterator range. 47 | # define __glibcxx_requires_non_empty_range(_First,_Last) \ 48 | __glibcxx_assert(__builtin_expect(_First != _Last, true)) 49 | # define __glibcxx_requires_subscript(_N) \ 50 | __glibcxx_assert(__builtin_expect(_N < this->size(), true)) 51 | // Verify that the container is nonempty 52 | # define __glibcxx_requires_nonempty() \ 53 | __glibcxx_assert(__builtin_expect(!this->empty(), true)) 54 | #endif 55 | 56 | #ifdef _GLIBCXX_DEBUG 57 | # define _GLIBCXX_DEBUG_ASSERT(_Condition) __glibcxx_assert(_Condition) 58 | 59 | # ifdef _GLIBCXX_DEBUG_PEDANTIC 60 | # define _GLIBCXX_DEBUG_PEDASSERT(_Condition) _GLIBCXX_DEBUG_ASSERT(_Condition) 61 | # else 62 | # define _GLIBCXX_DEBUG_PEDASSERT(_Condition) 63 | # endif 64 | 65 | # define _GLIBCXX_DEBUG_ONLY(_Statement) _Statement 66 | #endif 67 | 68 | #endif // _GLIBCXX_DEBUG_ASSERTIONS 69 | -------------------------------------------------------------------------------- /include/deque: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | 3 | // Copyright (C) 2001-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /* 26 | * 27 | * Copyright (c) 1994 28 | * Hewlett-Packard Company 29 | * 30 | * Permission to use, copy, modify, distribute and sell this software 31 | * and its documentation for any purpose is hereby granted without fee, 32 | * provided that the above copyright notice appear in all copies and 33 | * that both that copyright notice and this permission notice appear 34 | * in supporting documentation. Hewlett-Packard Company makes no 35 | * representations about the suitability of this software for any 36 | * purpose. It is provided "as is" without express or implied warranty. 37 | * 38 | * 39 | * Copyright (c) 1997 40 | * Silicon Graphics Computer Systems, Inc. 41 | * 42 | * Permission to use, copy, modify, distribute and sell this software 43 | * and its documentation for any purpose is hereby granted without fee, 44 | * provided that the above copyright notice appear in all copies and 45 | * that both that copyright notice and this permission notice appear 46 | * in supporting documentation. Silicon Graphics makes no 47 | * representations about the suitability of this software for any 48 | * purpose. It is provided "as is" without express or implied warranty. 49 | */ 50 | 51 | /** @file include/deque 52 | * This is a Standard C++ Library header. 53 | */ 54 | 55 | #ifndef _GLIBCXX_DEQUE 56 | #define _GLIBCXX_DEQUE 1 57 | 58 | #pragma GCC system_header 59 | 60 | #include 61 | #if __cplusplus > 201703L 62 | # include // For remove and remove_if 63 | #endif // C++20 64 | #include 65 | #include 66 | #include 67 | #include 68 | #include 69 | #include 70 | 71 | #ifdef _GLIBCXX_DEBUG 72 | # include 73 | #endif 74 | 75 | #if __cplusplus >= 201703L 76 | namespace std _GLIBCXX_VISIBILITY(default) 77 | { 78 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 79 | namespace pmr 80 | { 81 | template class polymorphic_allocator; 82 | template 83 | using deque = std::deque<_Tp, polymorphic_allocator<_Tp>>; 84 | } // namespace pmr 85 | _GLIBCXX_END_NAMESPACE_VERSION 86 | } // namespace std 87 | #endif // C++17 88 | 89 | #if __cplusplus > 201703L 90 | namespace std _GLIBCXX_VISIBILITY(default) 91 | { 92 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 93 | 94 | #define __cpp_lib_erase_if 202002L 95 | 96 | template 97 | inline typename deque<_Tp, _Alloc>::size_type 98 | erase_if(deque<_Tp, _Alloc>& __cont, _Predicate __pred) 99 | { 100 | const auto __osz = __cont.size(); 101 | __cont.erase(std::remove_if(__cont.begin(), __cont.end(), __pred), 102 | __cont.end()); 103 | return __osz - __cont.size(); 104 | } 105 | 106 | template 107 | inline typename deque<_Tp, _Alloc>::size_type 108 | erase(deque<_Tp, _Alloc>& __cont, const _Up& __value) 109 | { 110 | const auto __osz = __cont.size(); 111 | __cont.erase(std::remove(__cont.begin(), __cont.end(), __value), 112 | __cont.end()); 113 | return __osz - __cont.size(); 114 | } 115 | _GLIBCXX_END_NAMESPACE_VERSION 116 | } // namespace std 117 | #endif // C++20 118 | 119 | #endif /* _GLIBCXX_DEQUE */ 120 | -------------------------------------------------------------------------------- /include/ext/aligned_buffer.h: -------------------------------------------------------------------------------- 1 | // Aligned memory buffer -*- C++ -*- 2 | 3 | // Copyright (C) 2013-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file ext/aligned_buffer.h 26 | * This file is a GNU extension to the Standard C++ Library. 27 | */ 28 | 29 | #ifndef _ALIGNED_BUFFER_H 30 | #define _ALIGNED_BUFFER_H 1 31 | 32 | #pragma GCC system_header 33 | 34 | #if __cplusplus >= 201103L 35 | # include 36 | #else 37 | # include 38 | #endif 39 | 40 | namespace __gnu_cxx 41 | { 42 | // A utility type containing a POD object that can hold an object of type 43 | // _Tp initialized via placement new or allocator_traits::construct. 44 | // Intended for use as a data member subobject, use __aligned_buffer for 45 | // complete objects. 46 | template 47 | struct __aligned_membuf 48 | { 49 | // Target macro ADJUST_FIELD_ALIGN can produce different alignment for 50 | // types when used as class members. __aligned_membuf is intended 51 | // for use as a class member, so align the buffer as for a class member. 52 | // Since GCC 8 we could just use alignof(_Tp) instead, but older 53 | // versions of non-GNU compilers might still need this trick. 54 | struct _Tp2 { _Tp _M_t; }; 55 | 56 | alignas(__alignof__(_Tp2::_M_t)) unsigned char _M_storage[sizeof(_Tp)]; 57 | 58 | __aligned_membuf() = default; 59 | 60 | // Can be used to avoid value-initialization zeroing _M_storage. 61 | __aligned_membuf(std::nullptr_t) { } 62 | 63 | void* 64 | _M_addr() noexcept 65 | { return static_cast(&_M_storage); } 66 | 67 | const void* 68 | _M_addr() const noexcept 69 | { return static_cast(&_M_storage); } 70 | 71 | _Tp* 72 | _M_ptr() noexcept 73 | { return static_cast<_Tp*>(_M_addr()); } 74 | 75 | const _Tp* 76 | _M_ptr() const noexcept 77 | { return static_cast(_M_addr()); } 78 | }; 79 | 80 | #if _GLIBCXX_INLINE_VERSION 81 | template 82 | using __aligned_buffer = __aligned_membuf<_Tp>; 83 | #else 84 | // Similar to __aligned_membuf but aligned for complete objects, not members. 85 | // This type is used in , , 86 | // and , but ideally they would use __aligned_membuf 87 | // instead, as it has smaller size for some types on some targets. 88 | // This type is still used to avoid an ABI change. 89 | template 90 | struct __aligned_buffer 91 | : std::aligned_storage 92 | { 93 | typename 94 | std::aligned_storage::type _M_storage; 95 | 96 | __aligned_buffer() = default; 97 | 98 | // Can be used to avoid value-initialization 99 | __aligned_buffer(std::nullptr_t) { } 100 | 101 | void* 102 | _M_addr() noexcept 103 | { 104 | return static_cast(&_M_storage); 105 | } 106 | 107 | const void* 108 | _M_addr() const noexcept 109 | { 110 | return static_cast(&_M_storage); 111 | } 112 | 113 | _Tp* 114 | _M_ptr() noexcept 115 | { return static_cast<_Tp*>(_M_addr()); } 116 | 117 | const _Tp* 118 | _M_ptr() const noexcept 119 | { return static_cast(_M_addr()); } 120 | }; 121 | #endif 122 | 123 | } // namespace 124 | 125 | #endif /* _ALIGNED_BUFFER_H */ 126 | -------------------------------------------------------------------------------- /include/ext/atomicity.h: -------------------------------------------------------------------------------- 1 | // Support for atomic operations -*- C++ -*- 2 | 3 | // Copyright (C) 2004-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file ext/atomicity.h 26 | * This file is a GNU extension to the Standard C++ Library. 27 | */ 28 | 29 | #ifndef _GLIBCXX_ATOMICITY_H 30 | #define _GLIBCXX_ATOMICITY_H 1 31 | 32 | #pragma GCC system_header 33 | 34 | #include 35 | 36 | typedef int _Atomic_word; 37 | 38 | namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) 39 | { 40 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 41 | 42 | // Functions for portable atomic access. 43 | // To abstract locking primitives across all thread policies, use: 44 | // __exchange_and_add_dispatch 45 | // __atomic_add_dispatch 46 | #ifdef _GLIBCXX_ATOMIC_BUILTINS 47 | inline _Atomic_word 48 | __attribute__((__always_inline__)) 49 | __exchange_and_add(volatile _Atomic_word* __mem, int __val) 50 | { return __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); } 51 | 52 | inline void 53 | __attribute__((__always_inline__)) 54 | __atomic_add(volatile _Atomic_word* __mem, int __val) 55 | { __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); } 56 | #else 57 | _Atomic_word 58 | __exchange_and_add(volatile _Atomic_word*, int) _GLIBCXX_NOTHROW; 59 | 60 | void 61 | __atomic_add(volatile _Atomic_word*, int) _GLIBCXX_NOTHROW; 62 | #endif 63 | 64 | inline _Atomic_word 65 | __attribute__((__always_inline__)) 66 | __exchange_and_add_single(_Atomic_word* __mem, int __val) 67 | { 68 | _Atomic_word __result = *__mem; 69 | *__mem += __val; 70 | return __result; 71 | } 72 | 73 | inline void 74 | __attribute__((__always_inline__)) 75 | __atomic_add_single(_Atomic_word* __mem, int __val) 76 | { *__mem += __val; } 77 | 78 | inline _Atomic_word 79 | __attribute__ ((__always_inline__)) 80 | __exchange_and_add_dispatch(_Atomic_word* __mem, int __val) 81 | { 82 | #ifdef __GTHREADS 83 | if (__gthread_active_p()) 84 | return __exchange_and_add(__mem, __val); 85 | #endif 86 | return __exchange_and_add_single(__mem, __val); 87 | } 88 | 89 | inline void 90 | __attribute__ ((__always_inline__)) 91 | __atomic_add_dispatch(_Atomic_word* __mem, int __val) 92 | { 93 | #ifdef __GTHREADS 94 | if (__gthread_active_p()) 95 | { 96 | __atomic_add(__mem, __val); 97 | return; 98 | } 99 | #endif 100 | __atomic_add_single(__mem, __val); 101 | } 102 | 103 | _GLIBCXX_END_NAMESPACE_VERSION 104 | } // namespace 105 | 106 | // Even if the CPU doesn't need a memory barrier, we need to ensure 107 | // that the compiler doesn't reorder memory accesses across the 108 | // barriers. 109 | #ifndef _GLIBCXX_READ_MEM_BARRIER 110 | #define _GLIBCXX_READ_MEM_BARRIER __atomic_thread_fence (__ATOMIC_ACQUIRE) 111 | #endif 112 | #ifndef _GLIBCXX_WRITE_MEM_BARRIER 113 | #define _GLIBCXX_WRITE_MEM_BARRIER __atomic_thread_fence (__ATOMIC_RELEASE) 114 | #endif 115 | 116 | #endif 117 | -------------------------------------------------------------------------------- /include/ext/iterator: -------------------------------------------------------------------------------- 1 | // HP/SGI iterator extensions -*- C++ -*- 2 | 3 | // Copyright (C) 2001-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /* 26 | * 27 | * Copyright (c) 1994 28 | * Hewlett-Packard Company 29 | * 30 | * Permission to use, copy, modify, distribute and sell this software 31 | * and its documentation for any purpose is hereby granted without fee, 32 | * provided that the above copyright notice appear in all copies and 33 | * that both that copyright notice and this permission notice appear 34 | * in supporting documentation. Hewlett-Packard Company makes no 35 | * representations about the suitability of this software for any 36 | * purpose. It is provided "as is" without express or implied warranty. 37 | * 38 | * 39 | * Copyright (c) 1996-1998 40 | * Silicon Graphics Computer Systems, Inc. 41 | * 42 | * Permission to use, copy, modify, distribute and sell this software 43 | * and its documentation for any purpose is hereby granted without fee, 44 | * provided that the above copyright notice appear in all copies and 45 | * that both that copyright notice and this permission notice appear 46 | * in supporting documentation. Silicon Graphics makes no 47 | * representations about the suitability of this software for any 48 | * purpose. It is provided "as is" without express or implied warranty. 49 | */ 50 | 51 | /** @file ext/iterator 52 | * This file is a GNU extension to the Standard C++ Library (possibly 53 | * containing extensions from the HP/SGI STL subset). 54 | */ 55 | 56 | #ifndef _EXT_ITERATOR 57 | #define _EXT_ITERATOR 1 58 | 59 | #pragma GCC system_header 60 | 61 | #include 62 | #include 63 | 64 | namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) 65 | { 66 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 67 | 68 | // There are two signatures for distance. In addition to the one 69 | // taking two iterators and returning a result, there is another 70 | // taking two iterators and a reference-to-result variable, and 71 | // returning nothing. The latter seems to be an SGI extension. 72 | // -- pedwards 73 | template 74 | inline void 75 | __distance(_InputIterator __first, _InputIterator __last, 76 | _Distance& __n, std::input_iterator_tag) 77 | { 78 | // concept requirements 79 | __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) 80 | while (__first != __last) 81 | { 82 | ++__first; 83 | ++__n; 84 | } 85 | } 86 | 87 | template 88 | inline void 89 | __distance(_RandomAccessIterator __first, _RandomAccessIterator __last, 90 | _Distance& __n, std::random_access_iterator_tag) 91 | { 92 | // concept requirements 93 | __glibcxx_function_requires(_RandomAccessIteratorConcept< 94 | _RandomAccessIterator>) 95 | __n += __last - __first; 96 | } 97 | 98 | /** 99 | * This is an SGI extension. 100 | * @ingroup SGIextensions 101 | * @doctodo 102 | */ 103 | template 104 | inline void 105 | distance(_InputIterator __first, _InputIterator __last, 106 | _Distance& __n) 107 | { 108 | // concept requirements -- taken care of in __distance 109 | __distance(__first, __last, __n, std::__iterator_category(__first)); 110 | } 111 | 112 | _GLIBCXX_END_NAMESPACE_VERSION 113 | } // namespace 114 | 115 | #endif 116 | 117 | -------------------------------------------------------------------------------- /include/ext/rb_tree: -------------------------------------------------------------------------------- 1 | // rb_tree extension -*- C++ -*- 2 | 3 | // Copyright (C) 2002-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /* 26 | * 27 | * Copyright (c) 1994 28 | * Hewlett-Packard Company 29 | * 30 | * Permission to use, copy, modify, distribute and sell this software 31 | * and its documentation for any purpose is hereby granted without fee, 32 | * provided that the above copyright notice appear in all copies and 33 | * that both that copyright notice and this permission notice appear 34 | * in supporting documentation. Hewlett-Packard Company makes no 35 | * representations about the suitability of this software for any 36 | * purpose. It is provided "as is" without express or implied warranty. 37 | * 38 | * 39 | * Copyright (c) 1996 40 | * Silicon Graphics Computer Systems, Inc. 41 | * 42 | * Permission to use, copy, modify, distribute and sell this software 43 | * and its documentation for any purpose is hereby granted without fee, 44 | * provided that the above copyright notice appear in all copies and 45 | * that both that copyright notice and this permission notice appear 46 | * in supporting documentation. Silicon Graphics makes no 47 | * representations about the suitability of this software for any 48 | * purpose. It is provided "as is" without express or implied warranty. 49 | */ 50 | 51 | /** @file ext/rb_tree 52 | * This file is a GNU extension to the Standard C++ Library (possibly 53 | * containing extensions from the HP/SGI STL subset). 54 | */ 55 | 56 | #ifndef _RB_TREE 57 | #define _RB_TREE 1 58 | 59 | #pragma GCC system_header 60 | 61 | #include 62 | 63 | namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) 64 | { 65 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 66 | 67 | // Class rb_tree is not part of the C++ standard. It is provided for 68 | // compatibility with the HP STL. 69 | 70 | /** 71 | * This is an SGI extension. 72 | * @ingroup SGIextensions 73 | * @doctodo 74 | */ 75 | template > 77 | struct rb_tree 78 | : public std::_Rb_tree<_Key, _Value, _KeyOfValue, _Compare, _Alloc> 79 | { 80 | typedef std::_Rb_tree<_Key, _Value, _KeyOfValue, _Compare, _Alloc> _Base; 81 | typedef typename _Base::allocator_type allocator_type; 82 | 83 | rb_tree(const _Compare& __comp = _Compare(), 84 | const allocator_type& __a = allocator_type()) 85 | : _Base(__comp, __a) { } 86 | 87 | ~rb_tree() { } 88 | }; 89 | 90 | _GLIBCXX_END_NAMESPACE_VERSION 91 | } // namespace 92 | 93 | #endif 94 | -------------------------------------------------------------------------------- /include/forward_list: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | 3 | // Copyright (C) 2008-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file include/forward_list 26 | * This is a Standard C++ Library header. 27 | */ 28 | 29 | #ifndef _GLIBCXX_FORWARD_LIST 30 | #define _GLIBCXX_FORWARD_LIST 1 31 | 32 | #pragma GCC system_header 33 | 34 | #if __cplusplus < 201103L 35 | # include 36 | #else 37 | 38 | #include 39 | #include 40 | #include 41 | 42 | #ifdef _GLIBCXX_DEBUG 43 | # include 44 | #endif 45 | 46 | #if __cplusplus >= 201703L 47 | namespace std _GLIBCXX_VISIBILITY(default) 48 | { 49 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 50 | namespace pmr 51 | { 52 | template class polymorphic_allocator; 53 | template 54 | using forward_list = std::forward_list<_Tp, polymorphic_allocator<_Tp>>; 55 | } // namespace pmr 56 | _GLIBCXX_END_NAMESPACE_VERSION 57 | } // namespace std 58 | #endif // C++17 59 | 60 | #if __cplusplus > 201703L 61 | namespace std _GLIBCXX_VISIBILITY(default) 62 | { 63 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 64 | 65 | #define __cpp_lib_erase_if 202002L 66 | 67 | template 68 | inline typename forward_list<_Tp, _Alloc>::size_type 69 | erase_if(forward_list<_Tp, _Alloc>& __cont, _Predicate __pred) 70 | { return __cont.remove_if(__pred); } 71 | 72 | template 73 | inline typename forward_list<_Tp, _Alloc>::size_type 74 | erase(forward_list<_Tp, _Alloc>& __cont, const _Up& __value) 75 | { 76 | using __elem_type = typename forward_list<_Tp, _Alloc>::value_type; 77 | return std::erase_if(__cont, [&](__elem_type& __elem) { 78 | return __elem == __value; 79 | }); 80 | } 81 | _GLIBCXX_END_NAMESPACE_VERSION 82 | } // namespace std 83 | #endif // C++20 84 | 85 | #endif // C++11 86 | 87 | #endif // _GLIBCXX_FORWARD_LIST 88 | -------------------------------------------------------------------------------- /include/initializer_list: -------------------------------------------------------------------------------- 1 | // std::initializer_list support -*- C++ -*- 2 | 3 | // Copyright (C) 2008-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of GCC. 6 | // 7 | // GCC is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation; either version 3, or (at your option) 10 | // any later version. 11 | // 12 | // GCC is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // Under Section 7 of GPL version 3, you are granted additional 18 | // permissions described in the GCC Runtime Library Exception, version 19 | // 3.1, as published by the Free Software Foundation. 20 | 21 | // You should have received a copy of the GNU General Public License and 22 | // a copy of the GCC Runtime Library Exception along with this program; 23 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 24 | // . 25 | 26 | /** @file initializer_list 27 | * This is a Standard C++ Library header. 28 | */ 29 | 30 | #ifndef _INITIALIZER_LIST 31 | #define _INITIALIZER_LIST 32 | 33 | #pragma GCC system_header 34 | 35 | #if __cplusplus < 201103L 36 | # include 37 | #else // C++0x 38 | 39 | #pragma GCC visibility push(default) 40 | 41 | #include 42 | 43 | namespace std 44 | { 45 | /// initializer_list 46 | template 47 | class initializer_list 48 | { 49 | public: 50 | typedef _E value_type; 51 | typedef const _E& reference; 52 | typedef const _E& const_reference; 53 | typedef size_t size_type; 54 | typedef const _E* iterator; 55 | typedef const _E* const_iterator; 56 | 57 | private: 58 | iterator _M_array; 59 | size_type _M_len; 60 | 61 | // The compiler can call a private constructor. 62 | constexpr initializer_list(const_iterator __a, size_type __l) 63 | : _M_array(__a), _M_len(__l) { } 64 | 65 | public: 66 | constexpr initializer_list() noexcept 67 | : _M_array(0), _M_len(0) { } 68 | 69 | // Number of elements. 70 | constexpr size_type 71 | size() const noexcept { return _M_len; } 72 | 73 | // First element. 74 | constexpr const_iterator 75 | begin() const noexcept { return _M_array; } 76 | 77 | // One past the last element. 78 | constexpr const_iterator 79 | end() const noexcept { return begin() + size(); } 80 | }; 81 | 82 | /** 83 | * @brief Return an iterator pointing to the first element of 84 | * the initializer_list. 85 | * @param __ils Initializer list. 86 | * @relates initializer_list 87 | */ 88 | template 89 | constexpr const _Tp* 90 | begin(initializer_list<_Tp> __ils) noexcept 91 | { return __ils.begin(); } 92 | 93 | /** 94 | * @brief Return an iterator pointing to one past the last element 95 | * of the initializer_list. 96 | * @param __ils Initializer list. 97 | * @relates initializer_list 98 | */ 99 | template 100 | constexpr const _Tp* 101 | end(initializer_list<_Tp> __ils) noexcept 102 | { return __ils.end(); } 103 | } 104 | 105 | #pragma GCC visibility pop 106 | 107 | #endif // C++11 108 | 109 | #endif // _INITIALIZER_LIST 110 | -------------------------------------------------------------------------------- /include/iterator: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | 3 | // Copyright (C) 2001-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /* 26 | * 27 | * Copyright (c) 1994 28 | * Hewlett-Packard Company 29 | * 30 | * Permission to use, copy, modify, distribute and sell this software 31 | * and its documentation for any purpose is hereby granted without fee, 32 | * provided that the above copyright notice appear in all copies and 33 | * that both that copyright notice and this permission notice appear 34 | * in supporting documentation. Hewlett-Packard Company makes no 35 | * representations about the suitability of this software for any 36 | * purpose. It is provided "as is" without express or implied warranty. 37 | * 38 | * 39 | * Copyright (c) 1996,1997 40 | * Silicon Graphics Computer Systems, Inc. 41 | * 42 | * Permission to use, copy, modify, distribute and sell this software 43 | * and its documentation for any purpose is hereby granted without fee, 44 | * provided that the above copyright notice appear in all copies and 45 | * that both that copyright notice and this permission notice appear 46 | * in supporting documentation. Silicon Graphics makes no 47 | * representations about the suitability of this software for any 48 | * purpose. It is provided "as is" without express or implied warranty. 49 | */ 50 | 51 | /** @file include/iterator 52 | * This is a Standard C++ Library header. 53 | */ 54 | 55 | #ifndef _GLIBCXX_ITERATOR 56 | #define _GLIBCXX_ITERATOR 1 57 | 58 | #pragma GCC system_header 59 | 60 | #include 61 | #include 62 | #include 63 | #include 64 | #include 65 | 66 | #if __cplusplus >= 201402L && ! defined _GLIBCXX_DEBUG // PR libstdc++/70303 67 | # define __cpp_lib_null_iterators 201304L 68 | #endif 69 | 70 | #endif /* _GLIBCXX_ITERATOR */ 71 | -------------------------------------------------------------------------------- /include/list: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | 3 | // Copyright (C) 2001-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /* 26 | * 27 | * Copyright (c) 1994 28 | * Hewlett-Packard Company 29 | * 30 | * Permission to use, copy, modify, distribute and sell this software 31 | * and its documentation for any purpose is hereby granted without fee, 32 | * provided that the above copyright notice appear in all copies and 33 | * that both that copyright notice and this permission notice appear 34 | * in supporting documentation. Hewlett-Packard Company makes no 35 | * representations about the suitability of this software for any 36 | * purpose. It is provided "as is" without express or implied warranty. 37 | * 38 | * 39 | * Copyright (c) 1996,1997 40 | * Silicon Graphics Computer Systems, Inc. 41 | * 42 | * Permission to use, copy, modify, distribute and sell this software 43 | * and its documentation for any purpose is hereby granted without fee, 44 | * provided that the above copyright notice appear in all copies and 45 | * that both that copyright notice and this permission notice appear 46 | * in supporting documentation. Silicon Graphics makes no 47 | * representations about the suitability of this software for any 48 | * purpose. It is provided "as is" without express or implied warranty. 49 | */ 50 | 51 | /** @file include/list 52 | * This is a Standard C++ Library header. 53 | */ 54 | 55 | #ifndef _GLIBCXX_LIST 56 | #define _GLIBCXX_LIST 1 57 | 58 | #pragma GCC system_header 59 | 60 | #include 61 | #include 62 | #include 63 | #include 64 | #include 65 | 66 | #ifdef _GLIBCXX_DEBUG 67 | # include 68 | #endif 69 | 70 | #if __cplusplus >= 201703L 71 | namespace std _GLIBCXX_VISIBILITY(default) 72 | { 73 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 74 | namespace pmr 75 | { 76 | template class polymorphic_allocator; 77 | template 78 | using list = std::list<_Tp, polymorphic_allocator<_Tp>>; 79 | } // namespace pmr 80 | _GLIBCXX_END_NAMESPACE_VERSION 81 | } // namespace std 82 | #endif // C++17 83 | 84 | #if __cplusplus > 201703L 85 | namespace std _GLIBCXX_VISIBILITY(default) 86 | { 87 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 88 | 89 | #define __cpp_lib_erase_if 202002L 90 | 91 | template 92 | inline typename list<_Tp, _Alloc>::size_type 93 | erase_if(list<_Tp, _Alloc>& __cont, _Predicate __pred) 94 | { return __cont.remove_if(__pred); } 95 | 96 | template 97 | inline typename list<_Tp, _Alloc>::size_type 98 | erase(list<_Tp, _Alloc>& __cont, const _Up& __value) 99 | { 100 | using __elem_type = typename list<_Tp, _Alloc>::value_type; 101 | return std::erase_if(__cont, [&](__elem_type& __elem) { 102 | return __elem == __value; 103 | }); 104 | } 105 | _GLIBCXX_END_NAMESPACE_VERSION 106 | } // namespace std 107 | #endif // C++20 108 | 109 | #endif /* _GLIBCXX_LIST */ 110 | -------------------------------------------------------------------------------- /include/map: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | 3 | // Copyright (C) 2001-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /* 26 | * 27 | * Copyright (c) 1994 28 | * Hewlett-Packard Company 29 | * 30 | * Permission to use, copy, modify, distribute and sell this software 31 | * and its documentation for any purpose is hereby granted without fee, 32 | * provided that the above copyright notice appear in all copies and 33 | * that both that copyright notice and this permission notice appear 34 | * in supporting documentation. Hewlett-Packard Company makes no 35 | * representations about the suitability of this software for any 36 | * purpose. It is provided "as is" without express or implied warranty. 37 | * 38 | * 39 | * Copyright (c) 1996,1997 40 | * Silicon Graphics Computer Systems, Inc. 41 | * 42 | * Permission to use, copy, modify, distribute and sell this software 43 | * and its documentation for any purpose is hereby granted without fee, 44 | * provided that the above copyright notice appear in all copies and 45 | * that both that copyright notice and this permission notice appear 46 | * in supporting documentation. Silicon Graphics makes no 47 | * representations about the suitability of this software for any 48 | * purpose. It is provided "as is" without express or implied warranty. 49 | */ 50 | 51 | /** @file include/map 52 | * This is a Standard C++ Library header. 53 | */ 54 | 55 | #ifndef _GLIBCXX_MAP 56 | #define _GLIBCXX_MAP 1 57 | 58 | #pragma GCC system_header 59 | 60 | #include 61 | #include 62 | #include 63 | #include 64 | #include 65 | 66 | #ifdef _GLIBCXX_DEBUG 67 | # include 68 | #endif 69 | 70 | #if __cplusplus >= 201703L 71 | namespace std _GLIBCXX_VISIBILITY(default) 72 | { 73 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 74 | namespace pmr 75 | { 76 | template class polymorphic_allocator; 77 | template> 78 | using map 79 | = std::map<_Key, _Tp, _Cmp, 80 | polymorphic_allocator>>; 81 | template> 82 | using multimap 83 | = std::multimap<_Key, _Tp, _Cmp, 84 | polymorphic_allocator>>; 85 | } // namespace pmr 86 | _GLIBCXX_END_NAMESPACE_VERSION 87 | } // namespace std 88 | #endif // C++17 89 | 90 | #if __cplusplus > 201703L 91 | namespace std _GLIBCXX_VISIBILITY(default) 92 | { 93 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 94 | template 96 | inline typename map<_Key, _Tp, _Compare, _Alloc>::size_type 97 | erase_if(map<_Key, _Tp, _Compare, _Alloc>& __cont, _Predicate __pred) 98 | { return __detail::__erase_nodes_if(__cont, __pred); } 99 | 100 | template 102 | inline typename multimap<_Key, _Tp, _Compare, _Alloc>::size_type 103 | erase_if(multimap<_Key, _Tp, _Compare, _Alloc>& __cont, _Predicate __pred) 104 | { return __detail::__erase_nodes_if(__cont, __pred); } 105 | _GLIBCXX_END_NAMESPACE_VERSION 106 | } // namespace std 107 | #endif // C++20 108 | 109 | #endif /* _GLIBCXX_MAP */ 110 | -------------------------------------------------------------------------------- /include/queue: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | 3 | // Copyright (C) 2001-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /* 26 | * 27 | * Copyright (c) 1994 28 | * Hewlett-Packard Company 29 | * 30 | * Permission to use, copy, modify, distribute and sell this software 31 | * and its documentation for any purpose is hereby granted without fee, 32 | * provided that the above copyright notice appear in all copies and 33 | * that both that copyright notice and this permission notice appear 34 | * in supporting documentation. Hewlett-Packard Company makes no 35 | * representations about the suitability of this software for any 36 | * purpose. It is provided "as is" without express or implied warranty. 37 | * 38 | * 39 | * Copyright (c) 1996,1997 40 | * Silicon Graphics Computer Systems, Inc. 41 | * 42 | * Permission to use, copy, modify, distribute and sell this software 43 | * and its documentation for any purpose is hereby granted without fee, 44 | * provided that the above copyright notice appear in all copies and 45 | * that both that copyright notice and this permission notice appear 46 | * in supporting documentation. Silicon Graphics makes no 47 | * representations about the suitability of this software for any 48 | * purpose. It is provided "as is" without express or implied warranty. 49 | */ 50 | 51 | /** @file include/queue 52 | * This is a Standard C++ Library header. 53 | */ 54 | 55 | #ifndef _GLIBCXX_QUEUE 56 | #define _GLIBCXX_QUEUE 1 57 | 58 | #pragma GCC system_header 59 | 60 | #include 61 | #include 62 | #include 63 | #include 64 | #include 65 | 66 | #endif /* _GLIBCXX_QUEUE */ 67 | -------------------------------------------------------------------------------- /include/random: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | 3 | // Copyright (C) 2007-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file include/random 26 | * This is a Standard C++ Library header. 27 | */ 28 | 29 | #ifndef _GLIBCXX_RANDOM 30 | #define _GLIBCXX_RANDOM 1 31 | 32 | #pragma GCC system_header 33 | 34 | #if __cplusplus < 201103L 35 | # include 36 | #else 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | 44 | #ifdef _GLIBCXX_USE_C99_STDINT_TR1 45 | 46 | #include // For uint_fast32_t, uint_fast64_t, uint_least32_t 47 | #include 48 | #include 49 | 50 | #endif // _GLIBCXX_USE_C99_STDINT_TR1 51 | 52 | #endif // C++11 53 | 54 | #endif // _GLIBCXX_RANDOM 55 | -------------------------------------------------------------------------------- /include/set: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | 3 | // Copyright (C) 2001-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /* 26 | * 27 | * Copyright (c) 1994 28 | * Hewlett-Packard Company 29 | * 30 | * Permission to use, copy, modify, distribute and sell this software 31 | * and its documentation for any purpose is hereby granted without fee, 32 | * provided that the above copyright notice appear in all copies and 33 | * that both that copyright notice and this permission notice appear 34 | * in supporting documentation. Hewlett-Packard Company makes no 35 | * representations about the suitability of this software for any 36 | * purpose. It is provided "as is" without express or implied warranty. 37 | * 38 | * 39 | * Copyright (c) 1996,1997 40 | * Silicon Graphics Computer Systems, Inc. 41 | * 42 | * Permission to use, copy, modify, distribute and sell this software 43 | * and its documentation for any purpose is hereby granted without fee, 44 | * provided that the above copyright notice appear in all copies and 45 | * that both that copyright notice and this permission notice appear 46 | * in supporting documentation. Silicon Graphics makes no 47 | * representations about the suitability of this software for any 48 | * purpose. It is provided "as is" without express or implied warranty. 49 | */ 50 | 51 | /** @file include/set 52 | * This is a Standard C++ Library header. 53 | */ 54 | 55 | #ifndef _GLIBCXX_SET 56 | #define _GLIBCXX_SET 1 57 | 58 | #pragma GCC system_header 59 | 60 | #include 61 | #include 62 | #include 63 | #include 64 | #include 65 | 66 | #ifdef _GLIBCXX_DEBUG 67 | # include 68 | #endif 69 | 70 | #if __cplusplus >= 201703L 71 | namespace std _GLIBCXX_VISIBILITY(default) 72 | { 73 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 74 | namespace pmr 75 | { 76 | template class polymorphic_allocator; 77 | template> 78 | using set = std::set<_Key, _Cmp, polymorphic_allocator<_Key>>; 79 | template> 80 | using multiset = std::multiset<_Key, _Cmp, polymorphic_allocator<_Key>>; 81 | } // namespace pmr 82 | _GLIBCXX_END_NAMESPACE_VERSION 83 | } // namespace std 84 | #endif // C++17 85 | 86 | #if __cplusplus > 201703L 87 | namespace std _GLIBCXX_VISIBILITY(default) 88 | { 89 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 90 | template 92 | inline typename set<_Key, _Compare, _Alloc>::size_type 93 | erase_if(set<_Key, _Compare, _Alloc>& __cont, _Predicate __pred) 94 | { return __detail::__erase_nodes_if(__cont, __pred); } 95 | 96 | template 98 | inline typename multiset<_Key, _Compare, _Alloc>::size_type 99 | erase_if(multiset<_Key, _Compare, _Alloc>& __cont, _Predicate __pred) 100 | { return __detail::__erase_nodes_if(__cont, __pred); } 101 | _GLIBCXX_END_NAMESPACE_VERSION 102 | } // namespace std 103 | #endif // C++20 104 | 105 | #endif /* _GLIBCXX_SET */ 106 | -------------------------------------------------------------------------------- /include/stack: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | 3 | // Copyright (C) 2001-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /* 26 | * 27 | * Copyright (c) 1994 28 | * Hewlett-Packard Company 29 | * 30 | * Permission to use, copy, modify, distribute and sell this software 31 | * and its documentation for any purpose is hereby granted without fee, 32 | * provided that the above copyright notice appear in all copies and 33 | * that both that copyright notice and this permission notice appear 34 | * in supporting documentation. Hewlett-Packard Company makes no 35 | * representations about the suitability of this software for any 36 | * purpose. It is provided "as is" without express or implied warranty. 37 | * 38 | * 39 | * Copyright (c) 1996,1997 40 | * Silicon Graphics Computer Systems, Inc. 41 | * 42 | * Permission to use, copy, modify, distribute and sell this software 43 | * and its documentation for any purpose is hereby granted without fee, 44 | * provided that the above copyright notice appear in all copies and 45 | * that both that copyright notice and this permission notice appear 46 | * in supporting documentation. Silicon Graphics makes no 47 | * representations about the suitability of this software for any 48 | * purpose. It is provided "as is" without express or implied warranty. 49 | */ 50 | 51 | /** @file include/stack 52 | * This is a Standard C++ Library header. 53 | */ 54 | 55 | #ifndef _GLIBCXX_STACK 56 | #define _GLIBCXX_STACK 1 57 | 58 | #pragma GCC system_header 59 | 60 | #include 61 | #include 62 | 63 | #endif /* _GLIBCXX_STACK */ 64 | -------------------------------------------------------------------------------- /include/unordered_map: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | 3 | // Copyright (C) 2007-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file include/unordered_map 26 | * This is a Standard C++ Library header. 27 | */ 28 | 29 | #ifndef _GLIBCXX_UNORDERED_MAP 30 | #define _GLIBCXX_UNORDERED_MAP 1 31 | 32 | #pragma GCC system_header 33 | 34 | #if __cplusplus < 201103L 35 | # include 36 | #else 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include // equal_to, _Identity, _Select1st 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | 51 | #ifdef _GLIBCXX_DEBUG 52 | # include 53 | #endif 54 | 55 | #if __cplusplus >= 201703L 56 | namespace std _GLIBCXX_VISIBILITY(default) 57 | { 58 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 59 | namespace pmr 60 | { 61 | template class polymorphic_allocator; 62 | template, 63 | typename _Pred = std::equal_to<_Key>> 64 | using unordered_map 65 | = std::unordered_map<_Key, _Tp, _Hash, _Pred, 66 | polymorphic_allocator>>; 67 | template, 68 | typename _Pred = std::equal_to<_Key>> 69 | using unordered_multimap 70 | = std::unordered_multimap<_Key, _Tp, _Hash, _Pred, 71 | polymorphic_allocator>>; 72 | } // namespace pmr 73 | _GLIBCXX_END_NAMESPACE_VERSION 74 | } // namespace std 75 | #endif // C++17 76 | 77 | #if __cplusplus > 201703L 78 | namespace std _GLIBCXX_VISIBILITY(default) 79 | { 80 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 81 | template 83 | inline typename unordered_map<_Key, _Tp, _Hash, _CPred, _Alloc>::size_type 84 | erase_if(unordered_map<_Key, _Tp, _Hash, _CPred, _Alloc>& __cont, 85 | _Predicate __pred) 86 | { return __detail::__erase_nodes_if(__cont, __pred); } 87 | 88 | template 90 | inline typename unordered_multimap<_Key, _Tp, _Hash, _CPred, _Alloc>:: 91 | size_type 92 | erase_if(unordered_multimap<_Key, _Tp, _Hash, _CPred, _Alloc>& __cont, 93 | _Predicate __pred) 94 | { return __detail::__erase_nodes_if(__cont, __pred); } 95 | _GLIBCXX_END_NAMESPACE_VERSION 96 | } // namespace std 97 | #endif // C++20 98 | 99 | #endif // C++11 100 | 101 | #endif // _GLIBCXX_UNORDERED_MAP 102 | -------------------------------------------------------------------------------- /include/unordered_set: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | 3 | // Copyright (C) 2007-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /** @file include/unordered_set 26 | * This is a Standard C++ Library header. 27 | */ 28 | 29 | #ifndef _GLIBCXX_UNORDERED_SET 30 | #define _GLIBCXX_UNORDERED_SET 1 31 | 32 | #pragma GCC system_header 33 | 34 | #if __cplusplus < 201103L 35 | # include 36 | #else 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include // equal_to, _Identity, _Select1st 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | 51 | #ifdef _GLIBCXX_DEBUG 52 | # include 53 | #endif 54 | 55 | #if __cplusplus >= 201703L 56 | namespace std _GLIBCXX_VISIBILITY(default) 57 | { 58 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 59 | namespace pmr 60 | { 61 | template class polymorphic_allocator; 62 | template, 63 | typename _Pred = std::equal_to<_Key>> 64 | using unordered_set 65 | = std::unordered_set<_Key, _Hash, _Pred, 66 | polymorphic_allocator<_Key>>; 67 | template, 68 | typename _Pred = std::equal_to<_Key>> 69 | using unordered_multiset 70 | = std::unordered_multiset<_Key, _Hash, _Pred, 71 | polymorphic_allocator<_Key>>; 72 | } // namespace pmr 73 | _GLIBCXX_END_NAMESPACE_VERSION 74 | } // namespace std 75 | #endif // C++17 76 | 77 | #if __cplusplus > 201703L 78 | namespace std _GLIBCXX_VISIBILITY(default) 79 | { 80 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 81 | template 83 | inline typename unordered_set<_Key, _Hash, _CPred, _Alloc>::size_type 84 | erase_if(unordered_set<_Key, _Hash, _CPred, _Alloc>& __cont, 85 | _Predicate __pred) 86 | { return __detail::__erase_nodes_if(__cont, __pred); } 87 | 88 | template 90 | inline typename unordered_multiset<_Key, _Hash, _CPred, _Alloc>::size_type 91 | erase_if(unordered_multiset<_Key, _Hash, _CPred, _Alloc>& __cont, 92 | _Predicate __pred) 93 | { return __detail::__erase_nodes_if(__cont, __pred); } 94 | _GLIBCXX_END_NAMESPACE_VERSION 95 | } // namespace std 96 | #endif // C++20 97 | 98 | #endif // C++11 99 | 100 | #endif // _GLIBCXX_UNORDERED_SET 101 | -------------------------------------------------------------------------------- /include/vector: -------------------------------------------------------------------------------- 1 | // -*- C++ -*- 2 | 3 | // Copyright (C) 2001-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /* 26 | * 27 | * Copyright (c) 1994 28 | * Hewlett-Packard Company 29 | * 30 | * Permission to use, copy, modify, distribute and sell this software 31 | * and its documentation for any purpose is hereby granted without fee, 32 | * provided that the above copyright notice appear in all copies and 33 | * that both that copyright notice and this permission notice appear 34 | * in supporting documentation. Hewlett-Packard Company makes no 35 | * representations about the suitability of this software for any 36 | * purpose. It is provided "as is" without express or implied warranty. 37 | * 38 | * 39 | * Copyright (c) 1996 40 | * Silicon Graphics Computer Systems, Inc. 41 | * 42 | * Permission to use, copy, modify, distribute and sell this software 43 | * and its documentation for any purpose is hereby granted without fee, 44 | * provided that the above copyright notice appear in all copies and 45 | * that both that copyright notice and this permission notice appear 46 | * in supporting documentation. Silicon Graphics makes no 47 | * representations about the suitability of this software for any 48 | * purpose. It is provided "as is" without express or implied warranty. 49 | */ 50 | 51 | /** @file include/vector 52 | * This is a Standard C++ Library header. 53 | */ 54 | 55 | #ifndef _GLIBCXX_VECTOR 56 | #define _GLIBCXX_VECTOR 1 57 | 58 | #pragma GCC system_header 59 | 60 | #include 61 | #if __cplusplus > 201703L 62 | # include // For remove and remove_if 63 | #endif // C++20 64 | #include 65 | #include 66 | #include 67 | #include 68 | #include 69 | #include 70 | 71 | #ifndef _GLIBCXX_EXPORT_TEMPLATE 72 | # include 73 | #endif 74 | 75 | #ifdef _GLIBCXX_DEBUG 76 | # include 77 | #endif 78 | 79 | #if __cplusplus >= 201703L 80 | namespace std _GLIBCXX_VISIBILITY(default) 81 | { 82 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 83 | namespace pmr { 84 | template class polymorphic_allocator; 85 | template 86 | using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>; 87 | } // namespace pmr 88 | # ifdef _GLIBCXX_DEBUG 89 | namespace _GLIBCXX_STD_C::pmr { 90 | template 91 | using vector 92 | = _GLIBCXX_STD_C::vector<_Tp, std::pmr::polymorphic_allocator<_Tp>>; 93 | } // namespace _GLIBCXX_STD_C::pmr 94 | # endif 95 | _GLIBCXX_END_NAMESPACE_VERSION 96 | } // namespace std 97 | #endif // C++17 98 | 99 | #if __cplusplus > 201703L 100 | namespace std _GLIBCXX_VISIBILITY(default) 101 | { 102 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 103 | 104 | #define __cpp_lib_erase_if 202002L 105 | 106 | template 107 | inline typename vector<_Tp, _Alloc>::size_type 108 | erase_if(vector<_Tp, _Alloc>& __cont, _Predicate __pred) 109 | { 110 | const auto __osz = __cont.size(); 111 | __cont.erase(std::remove_if(__cont.begin(), __cont.end(), __pred), 112 | __cont.end()); 113 | return __osz - __cont.size(); 114 | } 115 | 116 | template 117 | inline typename vector<_Tp, _Alloc>::size_type 118 | erase(vector<_Tp, _Alloc>& __cont, const _Up& __value) 119 | { 120 | const auto __osz = __cont.size(); 121 | __cont.erase(std::remove(__cont.begin(), __cont.end(), __value), 122 | __cont.end()); 123 | return __osz - __cont.size(); 124 | } 125 | _GLIBCXX_END_NAMESPACE_VERSION 126 | } // namespace std 127 | #endif // C++20 128 | 129 | #endif /* _GLIBCXX_VECTOR */ 130 | -------------------------------------------------------------------------------- /src/functexcept.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Christopher Durand 3 | * 4 | * This file is part of the modm project. 5 | * 6 | * This Source Code Form is subject to the terms of the Mozilla Public 7 | * License, v. 2.0. If a copy of the MPL was not distributed with this 8 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | */ 10 | // ---------------------------------------------------------------------------- 11 | 12 | #include 13 | 14 | namespace std _GLIBCXX_VISIBILITY(default) 15 | { 16 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 17 | 18 | void __attribute__((weak)) 19 | __throw_bad_exception() 20 | { __builtin_abort(); } 21 | 22 | void __attribute__((weak)) 23 | __throw_bad_alloc() 24 | { __builtin_abort(); } 25 | 26 | void __attribute__((weak)) 27 | __throw_bad_cast() 28 | { __builtin_abort(); } 29 | 30 | void __attribute__((weak)) 31 | __throw_bad_typeid() 32 | { __builtin_abort(); } 33 | 34 | void __attribute__((weak)) 35 | __throw_logic_error(const char* __s __attribute__((unused))) 36 | { __builtin_abort(); } 37 | 38 | void __attribute__((weak)) 39 | __throw_domain_error(const char* __s __attribute__((unused))) 40 | { __builtin_abort(); } 41 | 42 | void __attribute__((weak)) 43 | __throw_invalid_argument(const char* __s __attribute__((unused))) 44 | { __builtin_abort(); } 45 | 46 | void __attribute__((weak)) 47 | __throw_length_error(const char* __s __attribute__((unused))) 48 | { __builtin_abort(); } 49 | 50 | void __attribute__((weak)) 51 | __throw_out_of_range(const char* __s __attribute__((unused))) 52 | { __builtin_abort(); } 53 | 54 | void __attribute__((weak)) 55 | __throw_runtime_error(const char* __s __attribute__((unused))) 56 | { __builtin_abort(); } 57 | 58 | void __attribute__((weak)) 59 | __throw_range_error(const char* __s __attribute__((unused))) 60 | { __builtin_abort(); } 61 | 62 | void __attribute__((weak)) 63 | __throw_overflow_error(const char* __s __attribute__((unused))) 64 | { __builtin_abort(); } 65 | 66 | void __attribute__((weak)) 67 | __throw_underflow_error(const char* __s __attribute__((unused))) 68 | { __builtin_abort(); } 69 | 70 | void __attribute__((weak)) 71 | __throw_bad_optional_access() 72 | { __builtin_abort(); } 73 | 74 | void __attribute__((weak)) 75 | __throw_bad_variant_access(const char* __s __attribute__((unused))) 76 | { __builtin_abort(); } 77 | 78 | void __attribute__((weak)) 79 | __throw_bad_function_call() 80 | { __builtin_abort(); } 81 | 82 | void __attribute__((weak)) 83 | __throw_bad_any_cast() 84 | { __builtin_abort(); } 85 | 86 | _GLIBCXX_END_NAMESPACE_VERSION 87 | } // namespace 88 | -------------------------------------------------------------------------------- /src/hashtable-aux.h: -------------------------------------------------------------------------------- 1 | // std::__detail and std::tr1::__detail definitions -*- C++ -*- 2 | 3 | // Copyright (C) 2007-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | namespace __detail 26 | { 27 | // The sentinel value is kept only for abi backward compatibility. 28 | extern const unsigned long __prime_list[] = // 256 + 1 or 256 + 48 + 1 29 | { 30 | 2ul, 3ul, 5ul, 7ul, 11ul, 13ul, 17ul, 19ul, 23ul, 29ul, 31ul, 31 | 37ul, 41ul, 43ul, 47ul, 53ul, 59ul, 61ul, 67ul, 71ul, 73ul, 79ul, 32 | 83ul, 89ul, 97ul, 103ul, 109ul, 113ul, 127ul, 137ul, 139ul, 149ul, 33 | 157ul, 167ul, 179ul, 193ul, 199ul, 211ul, 227ul, 241ul, 257ul, 34 | 277ul, 293ul, 313ul, 337ul, 359ul, 383ul, 409ul, 439ul, 467ul, 35 | 503ul, 541ul, 577ul, 619ul, 661ul, 709ul, 761ul, 823ul, 887ul, 36 | 953ul, 1031ul, 1109ul, 1193ul, 1289ul, 1381ul, 1493ul, 1613ul, 37 | 1741ul, 1879ul, 2029ul, 2179ul, 2357ul, 2549ul, 2753ul, 2971ul, 38 | 3209ul, 3469ul, 3739ul, 4027ul, 4349ul, 4703ul, 5087ul, 5503ul, 39 | 5953ul, 6427ul, 6949ul, 7517ul, 8123ul, 8783ul, 9497ul, 10273ul, 40 | 11113ul, 12011ul, 12983ul, 14033ul, 15173ul, 16411ul, 17749ul, 41 | 19183ul, 20753ul, 22447ul, 24281ul, 26267ul, 28411ul, 30727ul, 42 | 33223ul, 35933ul, 38873ul, 42043ul, 45481ul, 49201ul, 53201ul, 43 | 57557ul, 62233ul, 67307ul, 72817ul, 78779ul, 85229ul, 92203ul, 44 | 99733ul, 107897ul, 116731ul, 126271ul, 136607ul, 147793ul, 45 | 159871ul, 172933ul, 187091ul, 202409ul, 218971ul, 236897ul, 46 | 256279ul, 277261ul, 299951ul, 324503ul, 351061ul, 379787ul, 47 | 410857ul, 444487ul, 480881ul, 520241ul, 562841ul, 608903ul, 48 | 658753ul, 712697ul, 771049ul, 834181ul, 902483ul, 976369ul, 49 | 1056323ul, 1142821ul, 1236397ul, 1337629ul, 1447153ul, 1565659ul, 50 | 1693859ul, 1832561ul, 1982627ul, 2144977ul, 2320627ul, 2510653ul, 51 | 2716249ul, 2938679ul, 3179303ul, 3439651ul, 3721303ul, 4026031ul, 52 | 4355707ul, 4712381ul, 5098259ul, 5515729ul, 5967347ul, 6456007ul, 53 | 6984629ul, 7556579ul, 8175383ul, 8844859ul, 9569143ul, 10352717ul, 54 | 11200489ul, 12117689ul, 13109983ul, 14183539ul, 15345007ul, 55 | 16601593ul, 17961079ul, 19431899ul, 21023161ul, 22744717ul, 56 | 24607243ul, 26622317ul, 28802401ul, 31160981ul, 33712729ul, 57 | 36473443ul, 39460231ul, 42691603ul, 46187573ul, 49969847ul, 58 | 54061849ul, 58488943ul, 63278561ul, 68460391ul, 74066549ul, 59 | 80131819ul, 86693767ul, 93793069ul, 101473717ul, 109783337ul, 60 | 118773397ul, 128499677ul, 139022417ul, 150406843ul, 162723577ul, 61 | 176048909ul, 190465427ul, 206062531ul, 222936881ul, 241193053ul, 62 | 260944219ul, 282312799ul, 305431229ul, 330442829ul, 357502601ul, 63 | 386778277ul, 418451333ul, 452718089ul, 489790921ul, 529899637ul, 64 | 573292817ul, 620239453ul, 671030513ul, 725980837ul, 785430967ul, 65 | 849749479ul, 919334987ul, 994618837ul, 1076067617ul, 1164186217ul, 66 | 1259520799ul, 1362662261ul, 1474249943ul, 1594975441ul, 1725587117ul, 67 | 1866894511ul, 2019773507ul, 2185171673ul, 2364114217ul, 2557710269ul, 68 | 2767159799ul, 2993761039ul, 3238918481ul, 3504151727ul, 3791104843ul, 69 | 4101556399ul, 4294967291ul, 70 | // Sentinel, so we don't have to test the result of lower_bound, 71 | // or, on 64-bit machines, rest of the table. 72 | #if __SIZEOF_LONG__ != 8 73 | 4294967291ul 74 | #else 75 | 6442450933ul, 8589934583ul, 12884901857ul, 17179869143ul, 76 | 25769803693ul, 34359738337ul, 51539607367ul, 68719476731ul, 77 | 103079215087ul, 137438953447ul, 206158430123ul, 274877906899ul, 78 | 412316860387ul, 549755813881ul, 824633720731ul, 1099511627689ul, 79 | 1649267441579ul, 2199023255531ul, 3298534883309ul, 4398046511093ul, 80 | 6597069766607ul, 8796093022151ul, 13194139533241ul, 17592186044399ul, 81 | 26388279066581ul, 35184372088777ul, 52776558133177ul, 70368744177643ul, 82 | 105553116266399ul, 140737488355213ul, 211106232532861ul, 281474976710597ul, 83 | 562949953421231ul, 1125899906842597ul, 2251799813685119ul, 84 | 4503599627370449ul, 9007199254740881ul, 18014398509481951ul, 85 | 36028797018963913ul, 72057594037927931ul, 144115188075855859ul, 86 | 288230376151711717ul, 576460752303423433ul, 87 | 1152921504606846883ul, 2305843009213693951ul, 88 | 4611686018427387847ul, 9223372036854775783ul, 89 | 18446744073709551557ul, 18446744073709551557ul 90 | #endif 91 | }; 92 | } // namespace __detail 93 | -------------------------------------------------------------------------------- /src/hashtable_c++0x.cc: -------------------------------------------------------------------------------- 1 | // std::__detail definitions -*- C++ -*- 2 | 3 | // Copyright (C) 2007-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | #if __cplusplus < 201103L 26 | # error "hashtable_c++0x.cc must be compiled with -std=gnu++0x" 27 | #endif 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | namespace std _GLIBCXX_VISIBILITY(default) 36 | { 37 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 38 | 39 | #include "hashtable-aux.h" 40 | 41 | namespace __detail 42 | { 43 | // Return a prime no smaller than n. 44 | std::size_t 45 | _Prime_rehash_policy::_M_next_bkt(std::size_t __n) const 46 | { 47 | // Optimize lookups involving the first elements of __prime_list. 48 | // (useful to speed-up, eg, constructors) 49 | static const unsigned char __fast_bkt[] 50 | = { 2, 2, 2, 3, 5, 5, 7, 7, 11, 11, 11, 11, 13, 13 }; 51 | 52 | if (__n < sizeof(__fast_bkt)) 53 | { 54 | if (__n == 0) 55 | // Special case on container 1st initialization with 0 bucket count 56 | // hint. We keep _M_next_resize to 0 to make sure that next time we 57 | // want to add an element allocation will take place. 58 | return 1; 59 | 60 | _M_next_resize = 61 | __builtin_floorl(__fast_bkt[__n] * (long double)_M_max_load_factor); 62 | return __fast_bkt[__n]; 63 | } 64 | 65 | // Number of primes (without sentinel). 66 | constexpr auto __n_primes 67 | = sizeof(__prime_list) / sizeof(unsigned long) - 1; 68 | 69 | // Don't include the last prime in the search, so that anything 70 | // higher than the second-to-last prime returns a past-the-end 71 | // iterator that can be dereferenced to get the last prime. 72 | constexpr auto __last_prime = __prime_list + __n_primes - 1; 73 | 74 | const unsigned long* __next_bkt = 75 | std::lower_bound(__prime_list + 6, __last_prime, __n); 76 | 77 | if (__next_bkt == __last_prime) 78 | // Set next resize to the max value so that we never try to rehash again 79 | // as we already reach the biggest possible bucket number. 80 | // Note that it might result in max_load_factor not being respected. 81 | _M_next_resize = size_t(-1); 82 | else 83 | _M_next_resize = 84 | __builtin_floorl(*__next_bkt * (long double)_M_max_load_factor); 85 | 86 | return *__next_bkt; 87 | } 88 | 89 | // Finds the smallest prime p such that alpha p > __n_elt + __n_ins. 90 | // If p > __n_bkt, return make_pair(true, p); otherwise return 91 | // make_pair(false, 0). In principle this isn't very different from 92 | // _M_bkt_for_elements. 93 | 94 | // The only tricky part is that we're caching the element count at 95 | // which we need to rehash, so we don't have to do a floating-point 96 | // multiply for every insertion. 97 | 98 | std::pair 99 | _Prime_rehash_policy:: 100 | _M_need_rehash(std::size_t __n_bkt, std::size_t __n_elt, 101 | std::size_t __n_ins) const 102 | { 103 | if (__n_elt + __n_ins > _M_next_resize) 104 | { 105 | // If _M_next_resize is 0 it means that we have nothing allocated so 106 | // far and that we start inserting elements. In this case we start 107 | // with an initial bucket size of 11. 108 | long double __min_bkts 109 | = std::max(__n_elt + __n_ins, _M_next_resize ? 0 : 11) 110 | / (long double)_M_max_load_factor; 111 | if (__min_bkts >= __n_bkt) 112 | return { true, 113 | _M_next_bkt(std::max(__builtin_floorl(__min_bkts) + 1, 114 | __n_bkt * _S_growth_factor)) }; 115 | 116 | _M_next_resize 117 | = __builtin_floorl(__n_bkt * (long double)_M_max_load_factor); 118 | return { false, 0 }; 119 | } 120 | else 121 | return { false, 0 }; 122 | } 123 | } // namespace __detail 124 | 125 | _GLIBCXX_END_NAMESPACE_VERSION 126 | } // namespace std 127 | -------------------------------------------------------------------------------- /src/list.cc: -------------------------------------------------------------------------------- 1 | // std::list utilities implementation -*- C++ -*- 2 | 3 | // Copyright (C) 2003-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of the GNU ISO C++ Library. This library is free 6 | // software; you can redistribute it and/or modify it under the 7 | // terms of the GNU General Public License as published by the 8 | // Free Software Foundation; either version 3, or (at your option) 9 | // any later version. 10 | 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | 16 | // Under Section 7 of GPL version 3, you are granted additional 17 | // permissions described in the GCC Runtime Library Exception, version 18 | // 3.1, as published by the Free Software Foundation. 19 | 20 | // You should have received a copy of the GNU General Public License and 21 | // a copy of the GCC Runtime Library Exception along with this program; 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 | // . 24 | 25 | /* 26 | * 27 | * Copyright (c) 1994 28 | * Hewlett-Packard Company 29 | * 30 | * Permission to use, copy, modify, distribute and sell this software 31 | * and its documentation for any purpose is hereby granted without fee, 32 | * provided that the above copyright notice appear in all copies and 33 | * that both that copyright notice and this permission notice appear 34 | * in supporting documentation. Hewlett-Packard Company makes no 35 | * representations about the suitability of this software for any 36 | * purpose. It is provided "as is" without express or implied warranty. 37 | * 38 | * 39 | * Copyright (c) 1996,1997 40 | * Silicon Graphics Computer Systems, Inc. 41 | * 42 | * Permission to use, copy, modify, distribute and sell this software 43 | * and its documentation for any purpose is hereby granted without fee, 44 | * provided that the above copyright notice appear in all copies and 45 | * that both that copyright notice and this permission notice appear 46 | * in supporting documentation. Silicon Graphics makes no 47 | * representations about the suitability of this software for any 48 | * purpose. It is provided "as is" without express or implied warranty. 49 | */ 50 | 51 | #include 52 | 53 | namespace std _GLIBCXX_VISIBILITY(default) 54 | { 55 | _GLIBCXX_BEGIN_NAMESPACE_VERSION 56 | 57 | namespace __detail 58 | { 59 | void 60 | _List_node_base::swap(_List_node_base& __x, 61 | _List_node_base& __y) _GLIBCXX_USE_NOEXCEPT 62 | { 63 | if ( __x._M_next != &__x ) 64 | { 65 | if ( __y._M_next != &__y ) 66 | { 67 | // Both __x and __y are not empty. 68 | std::swap(__x._M_next,__y._M_next); 69 | std::swap(__x._M_prev,__y._M_prev); 70 | __x._M_next->_M_prev = __x._M_prev->_M_next = &__x; 71 | __y._M_next->_M_prev = __y._M_prev->_M_next = &__y; 72 | } 73 | else 74 | { 75 | // __x is not empty, __y is empty. 76 | __y._M_next = __x._M_next; 77 | __y._M_prev = __x._M_prev; 78 | __y._M_next->_M_prev = __y._M_prev->_M_next = &__y; 79 | __x._M_next = __x._M_prev = &__x; 80 | } 81 | } 82 | else if ( __y._M_next != &__y ) 83 | { 84 | // __x is empty, __y is not empty. 85 | __x._M_next = __y._M_next; 86 | __x._M_prev = __y._M_prev; 87 | __x._M_next->_M_prev = __x._M_prev->_M_next = &__x; 88 | __y._M_next = __y._M_prev = &__y; 89 | } 90 | } 91 | 92 | void 93 | _List_node_base:: 94 | _M_transfer(_List_node_base * const __first, 95 | _List_node_base * const __last) _GLIBCXX_USE_NOEXCEPT 96 | { 97 | if (this != __last) 98 | { 99 | // Remove [first, last) from its old position. 100 | __last->_M_prev->_M_next = this; 101 | __first->_M_prev->_M_next = __last; 102 | this->_M_prev->_M_next = __first; 103 | 104 | // Splice [first, last) into its new position. 105 | _List_node_base* const __tmp = this->_M_prev; 106 | this->_M_prev = __last->_M_prev; 107 | __last->_M_prev = __first->_M_prev; 108 | __first->_M_prev = __tmp; 109 | } 110 | } 111 | 112 | void 113 | _List_node_base::_M_reverse() _GLIBCXX_USE_NOEXCEPT 114 | { 115 | _List_node_base* __tmp = this; 116 | do 117 | { 118 | std::swap(__tmp->_M_next, __tmp->_M_prev); 119 | 120 | // Old next node is now prev. 121 | __tmp = __tmp->_M_prev; 122 | } 123 | while (__tmp != this); 124 | } 125 | 126 | void 127 | _List_node_base:: 128 | _M_hook(_List_node_base* const __position) _GLIBCXX_USE_NOEXCEPT 129 | { 130 | this->_M_next = __position; 131 | this->_M_prev = __position->_M_prev; 132 | __position->_M_prev->_M_next = this; 133 | __position->_M_prev = this; 134 | } 135 | 136 | void 137 | _List_node_base::_M_unhook() _GLIBCXX_USE_NOEXCEPT 138 | { 139 | _List_node_base* const __next_node = this->_M_next; 140 | _List_node_base* const __prev_node = this->_M_prev; 141 | __prev_node->_M_next = __next_node; 142 | __next_node->_M_prev = __prev_node; 143 | } 144 | } // namespace __detail 145 | 146 | _GLIBCXX_END_NAMESPACE_VERSION 147 | } // namespace std 148 | -------------------------------------------------------------------------------- /src/math.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, Christopher Durand 3 | * 4 | * This file is part of the modm project. 5 | * 6 | * This Source Code Form is subject to the terms of the Mozilla Public 7 | * License, v. 2.0. If a copy of the MPL was not distributed with this 8 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | */ 10 | 11 | #include 12 | 13 | #ifdef __AVR__ 14 | #include 15 | 16 | extern "C" 17 | { 18 | #if defined(__AVR_LIBC_VERSION__) && (__AVR_LIBC_VERSION__ < 20100UL) 19 | float cosf(float x) 20 | { 21 | return ::cos(x); 22 | } 23 | 24 | float sinf(float x) 25 | { 26 | return ::sin(x); 27 | } 28 | 29 | float tanf(float x) 30 | { 31 | return ::tan(x); 32 | } 33 | 34 | float fabsf(float x) 35 | { 36 | return ::fabs(x); 37 | } 38 | 39 | float fmodf(float x, float y) 40 | { 41 | return ::fmod(x, y); 42 | } 43 | 44 | float cbrtf(float x) 45 | { 46 | return ::cbrt(x); 47 | } 48 | 49 | float hypotf(float x, float y) 50 | { 51 | return ::hypot(x, y); 52 | } 53 | 54 | float squaref(float x) 55 | { 56 | return ::square(x); 57 | } 58 | 59 | float floorf(float x) 60 | { 61 | return ::floor(x); 62 | } 63 | 64 | float ceilf(float x) 65 | { 66 | return ::ceil(x); 67 | } 68 | 69 | float frexpf(float value, int* exp) 70 | { 71 | return ::frexp(value, exp); 72 | } 73 | 74 | float ldexpf(float x, int exp) 75 | { 76 | return ::ldexp(x, exp); 77 | } 78 | 79 | float expf(float x) 80 | { 81 | return ::exp(x); 82 | } 83 | 84 | float coshf(float x) 85 | { 86 | return ::cosh(x); 87 | } 88 | 89 | float sinhf(float x) 90 | { 91 | return ::sinh(x); 92 | } 93 | 94 | float tanhf(float x) 95 | { 96 | return ::tanh(x); 97 | } 98 | 99 | float acosf(float x) 100 | { 101 | return ::acos(x); 102 | } 103 | 104 | float asinf(float x) 105 | { 106 | return ::asin(x); 107 | } 108 | 109 | float atanf(float x) 110 | { 111 | return ::atan(x); 112 | } 113 | 114 | float atan2f(float y, float x) 115 | { 116 | return ::atan2(y, x); 117 | } 118 | 119 | float logf(float x) 120 | { 121 | return ::log(x); 122 | } 123 | 124 | float log10f(float x) 125 | { 126 | return ::log10(x); 127 | } 128 | 129 | float powf(float x, float y) 130 | { 131 | return ::pow(x, y); 132 | } 133 | 134 | int isnanf(float x) 135 | { 136 | return ::isnan(x); 137 | } 138 | 139 | int isinff(float x) 140 | { 141 | return ::isinf(x); 142 | } 143 | 144 | int isfinitef(float x) 145 | { 146 | return ::isfinite(x); 147 | } 148 | 149 | float copysignf(float x, float y) 150 | { 151 | return ::copysign(x, y); 152 | } 153 | 154 | int signbitf(float x) 155 | { 156 | return ::signbit(x); 157 | } 158 | 159 | float fdimf(float x, float y) 160 | { 161 | return ::fdim(x, y); 162 | } 163 | 164 | float fmaf(float x, float y, float z) 165 | { 166 | return ::fma(x, y, z); 167 | } 168 | 169 | float fmaxf(float x, float y) 170 | { 171 | return ::fmax(x, y); 172 | } 173 | 174 | float fminf(float x, float y) 175 | { 176 | return ::fmin(x, y); 177 | } 178 | 179 | float truncf(float x) 180 | { 181 | return ::trunc(x); 182 | } 183 | 184 | float roundf(float x) 185 | { 186 | return ::round(x); 187 | } 188 | 189 | long lroundf(float x) 190 | { 191 | return ::lround(x); 192 | } 193 | 194 | long lrintf(float x) 195 | { 196 | return ::lrint(x); 197 | } 198 | #endif 199 | } // extern "C" 200 | 201 | #endif // __AVR__ 202 | -------------------------------------------------------------------------------- /src/new_handler.cc: -------------------------------------------------------------------------------- 1 | // Implementation file for the -*- C++ -*- dynamic memory management header. 2 | 3 | // Copyright (C) 1996-2020 Free Software Foundation, Inc. 4 | // 5 | // This file is part of GCC. 6 | // 7 | // GCC is free software; you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation; either version 3, or (at your option) 10 | // any later version. 11 | // 12 | // GCC is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // Under Section 7 of GPL version 3, you are granted additional 18 | // permissions described in the GCC Runtime Library Exception, version 19 | // 3.1, as published by the Free Software Foundation. 20 | 21 | // You should have received a copy of the GNU General Public License and 22 | // a copy of the GCC Runtime Library Exception along with this program; 23 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 24 | // . 25 | 26 | #include "new" 27 | 28 | const std::nothrow_t std::nothrow = std::nothrow_t{ }; 29 | 30 | using std::new_handler; 31 | namespace 32 | { 33 | new_handler __new_handler; 34 | } 35 | 36 | new_handler 37 | std::set_new_handler (new_handler handler) throw() 38 | { 39 | new_handler prev_handler = __new_handler; 40 | __new_handler = handler; 41 | return prev_handler; 42 | } 43 | 44 | new_handler 45 | std::get_new_handler () noexcept 46 | { 47 | return __new_handler; 48 | } 49 | --------------------------------------------------------------------------------