Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions stl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ set(HEADERS
${CMAKE_CURRENT_LIST_DIR}/inc/stack
${CMAKE_CURRENT_LIST_DIR}/inc/stacktrace
${CMAKE_CURRENT_LIST_DIR}/inc/stdexcept
${CMAKE_CURRENT_LIST_DIR}/inc/stdfloat
${CMAKE_CURRENT_LIST_DIR}/inc/stop_token
${CMAKE_CURRENT_LIST_DIR}/inc/streambuf
${CMAKE_CURRENT_LIST_DIR}/inc/string
Expand Down
1 change: 1 addition & 0 deletions stl/inc/__msvc_all_public_headers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include <numbers>
#include <ratio>
#include <source_location>
#include <stdfloat>
#include <tuple>
#include <type_traits>
#include <utility>
Expand Down
1 change: 1 addition & 0 deletions stl/inc/header-units.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
"stack",
"stacktrace",
"stdexcept",
"stdfloat",
"stop_token",
"streambuf",
"string",
Expand Down
36 changes: 36 additions & 0 deletions stl/inc/stdfloat
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// stdfloat standard header (core)

// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#pragma once
#ifndef _STDFLOAT_
#define _STDFLOAT_
#include <yvals_core.h>
#if _STL_COMPILER_PREPROCESSOR

#if !_HAS_CXX23
_EMIT_STL_WARNING(STL4038, "The contents of <stdfloat> are available only with C++23 or later.");
#else // ^^^ !_HAS_CXX23 / _HAS_CXX23 vvv

#pragma pack(push, _CRT_PACKING)
#pragma warning(push, _STL_WARNING_LEVEL)
#pragma warning(disable : _STL_DISABLED_WARNINGS)
_STL_DISABLE_CLANG_WARNINGS
#pragma push_macro("new")
#undef new

// We don't support any optional extended floating-point types, but we do need to provide an empty `namespace std`.
// We don't need to `export` it for modules, as the other headers will implicitly do so (N4928 [module.interface]/2.1).
_STD_BEGIN
_STD_END

#pragma pop_macro("new")
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
#pragma pack(pop)

#endif // ^^^ _HAS_CXX23 ^^^

#endif // _STL_COMPILER_PREPROCESSOR
#endif // _STDFLOAT_
2 changes: 2 additions & 0 deletions stl/inc/yvals_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,8 @@
// P1272R4 byteswap()
// P1328R1 constexpr type_info::operator==()
// P1425R4 Iterator Pair Constructors For stack And queue
// P1467R9 Extended Floating-Point Types
// (only the <stdfloat> header; we don't support any optional extended floating-point types)
Comment thread
CaseyCarter marked this conversation as resolved.
// P1659R3 ranges::starts_with, ranges::ends_with
// P1679R3 contains() For basic_string/basic_string_view
// P1682R3 to_underlying() For Enumerations
Expand Down
1 change: 1 addition & 0 deletions stl/modules/std.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export module std;
#include <stack>
#include <stacktrace>
#include <stdexcept>
#include <stdfloat>
#include <stop_token>
#include <streambuf>
#include <string>
Expand Down
7 changes: 7 additions & 0 deletions tests/std/include/test_header_units_and_modules.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,12 @@ void test_stdexcept() {
assert(caught_puppies);
}

void test_stdfloat() {
using namespace std;
puts("Testing <stdfloat>.");
// `namespace std` is available, so we're done.
}

void test_stop_token() {
using namespace std;
puts("Testing <stop_token>.");
Expand Down Expand Up @@ -1109,6 +1115,7 @@ void all_cpp_header_tests() {
test_stack();
test_stacktrace();
test_stdexcept();
test_stdfloat();
test_stop_token();
test_streambuf();
test_string();
Expand Down
6 changes: 6 additions & 0 deletions tests/std/tests/Dev10_555491_complex_linker_errors/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,4 +292,10 @@ int main() {
assert((proj(-inf) == complex<double>{inf, 0.0}));

test_gh_2728();

// Also test N4928 [complex.numbers.general]/2:
// "Specializations of complex for cv-unqualified floating-point types are trivially-copyable literal types"
STATIC_ASSERT(is_trivially_copyable_v<complex<float>>);
STATIC_ASSERT(is_trivially_copyable_v<complex<double>>);
STATIC_ASSERT(is_trivially_copyable_v<complex<long double>>);
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"stack",
"stacktrace",
"stdexcept",
"stdfloat",
"stop_token",
"streambuf",
"string",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ import <sstream>;
import <stack>;
import <stacktrace>;
import <stdexcept>;
import <stdfloat>;
import <stop_token>;
import <streambuf>;
import <string>;
Expand Down
1 change: 1 addition & 0 deletions tests/std/tests/include_each_header_alone_matrix.lst
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ PM_CL="/DMEOW_HEADER=stack"
PM_CL="/DMEOW_HEADER=stacktrace"
PM_CL="/DMEOW_HEADER=stdatomic.h"
PM_CL="/DMEOW_HEADER=stdexcept"
PM_CL="/DMEOW_HEADER=stdfloat"
PM_CL="/DMEOW_HEADER=stop_token"
PM_CL="/DMEOW_HEADER=streambuf"
PM_CL="/DMEOW_HEADER=string"
Expand Down