gcc/libstdc++-v3/testsuite/17_intro/freestanding.cc
Jonathan Wakely 9866abe31e libstdc++ P1956R1 On the names of low-level bit manipulation functions
Implement this change for C++20 that was just approved in Prague.

	P1956R1 On the names of low-level bit manipulation functions
	* include/bits/hashtable_policy.h: Update comment.
	* include/std/bit (__ispow2, __ceil2, __floor2, __log2p1): Rename.
	(ispow2, ceil2, floor2, log2p1): Likewise.
	(__cpp_lib_int_pow2): Add feature test macro.
	* include/std/charconv (__to_chars_len_2): Adjust use of __log2p1.
	* include/std/memory (assume_aligned): Adjust use of ispow2.
	* include/std/version (__cpp_lib_int_pow2): Add.
	* libsupc++/new_opa.cc: Adjust use of __ispow2.
	* src/c++17/memory_resource.cc: Likewise, and for __ceil2 and __log2p1.
	* testsuite/17_intro/freestanding.cc: Adjust use of ispow2.
	* testsuite/26_numerics/bit/bit.pow.two/ceil2.cc: Rename to ...
	* testsuite/26_numerics/bit/bit.pow.two/bit_ceil.cc: ... here.
	* testsuite/26_numerics/bit/bit.pow.two/ceil2_neg.cc: Rename to ...
	* testsuite/26_numerics/bit/bit.pow.two/bit_ceil_neg.cc: ... here.
	* testsuite/26_numerics/bit/bit.pow.two/floor2.cc: Rename to ...
	* testsuite/26_numerics/bit/bit.pow.two/bit_floor.cc: ... here.
	* testsuite/26_numerics/bit/bit.pow.two/log2p1.cc: Rename to ...
	* testsuite/26_numerics/bit/bit.pow.two/bit_width.cc: ... here.
	* testsuite/26_numerics/bit/bit.pow.two/ispow2.cc: Rename to ...
	* testsuite/26_numerics/bit/bit.pow.two/has_single_bit.cc: ... here.
2020-02-17 17:09:18 +00:00

61 lines
1.6 KiB
C++

// { dg-options "-lsupc++ -fvtable-verify=none" }
// { dg-do run { target c++11 } }
// Copyright (C) 2010-2020 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <cstdarg>
#include <cstddef>
#include <cstdlib>
#include <exception>
#include <limits>
#include <new>
#include <typeinfo>
#include <initializer_list>
#include <type_traits>
// C++2a headers:
#include <bit>
#include <version>
int main()
{
std::exception e;
const char* str __attribute__((unused)) = typeid(e).name();
typedef std::numeric_limits<long> limit_type;
limit_type limit_l __attribute__((unused));
int r __attribute__((unused)) = limit_type::radix;
const char* cp = new char;
delete cp;
bool b __attribute__((unused)) = std::is_integral<int>::value;
std::initializer_list<int> ilisti __attribute__((unused));
#if __cplusplus > 201703L
static_assert( std::has_single_bit(256u) );
static_assert( __cpp_lib_void_t >= 201411L );
#endif
return 0;
}