Skip to content

Commit

Permalink
Merging [time.zone], [time.clock], and [time.parse] pieces of P…
Browse files Browse the repository at this point in the history
…0355R7 (#1789)

Co-authored-by: d-winsor <[email protected]>
Co-authored-by: MattStephanson <[email protected]>
Co-authored-by: Miya Natsuhara <[email protected]>
Co-authored-by: mnatsuhara <[email protected]>
Co-authored-by: Stephan T. Lavavej <[email protected]>
  • Loading branch information
5 people authored Apr 6, 2021
1 parent b88c580 commit fb2f89f
Show file tree
Hide file tree
Showing 26 changed files with 6,227 additions and 156 deletions.
12 changes: 7 additions & 5 deletions azure-devops/create-vmss.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ $Prefix = 'StlBuild-' + (Get-Date -Format 'yyyy-MM-dd')
$VMSize = 'Standard_D32ds_v4'
$ProtoVMName = 'PROTOTYPE'
$LiveVMPrefix = 'BUILD'
$WindowsServerSku = '2019-Datacenter'
$ImagePublisher = 'MicrosoftWindowsDesktop'
$ImageOffer = 'Windows-10'
$ImageSku = '20h2-ent-g2'

$ProgressActivity = 'Creating Scale Set'
$TotalProgress = 12
Expand Down Expand Up @@ -268,9 +270,9 @@ $VM = Set-AzVMOperatingSystem `
$VM = Add-AzVMNetworkInterface -VM $VM -Id $Nic.Id
$VM = Set-AzVMSourceImage `
-VM $VM `
-PublisherName 'MicrosoftWindowsServer' `
-Offer 'WindowsServer' `
-Skus $WindowsServerSku `
-PublisherName $ImagePublisher `
-Offer $ImageOffer `
-Skus $ImageSku `
-Version latest

$VM = Set-AzVMBootDiagnostic -VM $VM -Disable
Expand Down Expand Up @@ -340,7 +342,7 @@ Set-AzVM `

$VM = Get-AzVM -ResourceGroupName $ResourceGroupName -Name $ProtoVMName
$PrototypeOSDiskName = $VM.StorageProfile.OsDisk.Name
$ImageConfig = New-AzImageConfig -Location $Location -SourceVirtualMachineId $VM.ID
$ImageConfig = New-AzImageConfig -Location $Location -SourceVirtualMachineId $VM.ID -HyperVGeneration 'V2'
$Image = New-AzImage -Image $ImageConfig -ImageName $ProtoVMName -ResourceGroupName $ResourceGroupName

####################################################################################################
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ variables:
buildOutputLocation: 'D:\build'
vcpkgLocation: '$(Build.SourcesDirectory)/vcpkg'

pool: 'StlBuild-2021-03-02'
pool: 'StlBuild-2021-03-09-win10'

stages:
- stage: Code_Format
Expand Down
4 changes: 3 additions & 1 deletion stl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
set(HEADERS
${CMAKE_CURRENT_LIST_DIR}/inc/__msvc_all_public_headers.hpp
${CMAKE_CURRENT_LIST_DIR}/inc/__msvc_system_error_abi.hpp
${CMAKE_CURRENT_LIST_DIR}/inc/__msvc_tzdb.hpp
${CMAKE_CURRENT_LIST_DIR}/inc/algorithm
${CMAKE_CURRENT_LIST_DIR}/inc/any
${CMAKE_CURRENT_LIST_DIR}/inc/array
Expand Down Expand Up @@ -399,6 +400,7 @@ set(SOURCES_SATELLITE_ATOMIC_WAIT
${CMAKE_CURRENT_LIST_DIR}/src/atomic_wait.cpp
${CMAKE_CURRENT_LIST_DIR}/src/parallel_algorithms.cpp
${CMAKE_CURRENT_LIST_DIR}/src/syncstream.cpp
${CMAKE_CURRENT_LIST_DIR}/src/tzdb.cpp
)

set(SOURCES_SATELLITE_CODECVT_IDS
Expand Down Expand Up @@ -498,7 +500,7 @@ function(add_stl_dlls D_SUFFIX THIS_CONFIG_DEFINITIONS THIS_CONFIG_COMPILE_OPTIO
file(WRITE "${_ATOMIC_WAIT_DEF_NAME}" "${_ATOMIC_WAIT_DEF_CONTENTS}")

add_library(msvcp${D_SUFFIX}_atomic_wait SHARED "${_ATOMIC_WAIT_DEF_NAME}")
target_link_libraries(msvcp${D_SUFFIX}_atomic_wait PRIVATE msvcp${D_SUFFIX}_atomic_wait_objects msvcp${D_SUFFIX}_satellite_objects msvcp${D_SUFFIX}_implib_objects "msvcp${D_SUFFIX}" "${TOOLSET_LIB}/vcruntime${D_SUFFIX}.lib" "${TOOLSET_LIB}/msvcrt${D_SUFFIX}.lib" "ucrt${D_SUFFIX}.lib")
target_link_libraries(msvcp${D_SUFFIX}_atomic_wait PRIVATE msvcp${D_SUFFIX}_atomic_wait_objects msvcp${D_SUFFIX}_satellite_objects msvcp${D_SUFFIX}_implib_objects "msvcp${D_SUFFIX}" "${TOOLSET_LIB}/vcruntime${D_SUFFIX}.lib" "${TOOLSET_LIB}/msvcrt${D_SUFFIX}.lib" "ucrt${D_SUFFIX}.lib" "advapi32.lib")
set_target_properties(msvcp${D_SUFFIX}_atomic_wait PROPERTIES ARCHIVE_OUTPUT_NAME "msvcp140_atomic_wait${D_SUFFIX}${VCLIBS_SUFFIX}")
set_target_properties(msvcp${D_SUFFIX}_atomic_wait PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
set_target_properties(msvcp${D_SUFFIX}_atomic_wait PROPERTIES OUTPUT_NAME "${_ATOMIC_WAIT_OUTPUT_NAME}")
Expand Down
154 changes: 154 additions & 0 deletions stl/inc/__msvc_tzdb.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
// __msvc_tzdb.hpp internal header

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

#pragma once
#ifndef __MSVC_TZDB_HPP
#define __MSVC_TZDB_HPP
#include <yvals.h>
#if _STL_COMPILER_PREPROCESSOR
#include <cstddef>
#include <cstdint>
#include <type_traits>
#include <xutility>

#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

using __std_tzdb_epoch_milli = double;

struct __std_tzdb_leap_info {
uint16_t _Year;
uint16_t _Month;
uint16_t _Day;
uint16_t _Hour;
uint16_t _Negative;
uint16_t _Reserved;
};

enum class __std_tzdb_error {
_Success = 0,
_Win_error = 1,
_Icu_error = 2,
};

struct __std_tzdb_time_zones_info {
__std_tzdb_error _Err;
// timezone data version currently being used
const char* _Version;
size_t _Num_time_zones;
// ordered list of null-terminated time_zone/time_zone_link names
const char** _Names;
// contains corresponding entry for every name, if:
// (_Links[i] == nullptr) then _Names[i] is a time_zone
// (_Links[i] != nullptr) then _Names[i] is a time_zone_link to time_zone with name _Links[i]
const char** _Links;
};

struct __std_tzdb_current_zone_info {
__std_tzdb_error _Err;
const char* _Tz_name;
};

struct __std_tzdb_sys_info {
__std_tzdb_error _Err;
__std_tzdb_epoch_milli _Begin;
__std_tzdb_epoch_milli _End;
int32_t _Offset;
int32_t _Save;
const char* _Abbrev;
};

_EXTERN_C

_NODISCARD __std_tzdb_time_zones_info* __stdcall __std_tzdb_get_time_zones() noexcept;
void __stdcall __std_tzdb_delete_time_zones(__std_tzdb_time_zones_info* _Info) noexcept;

_NODISCARD __std_tzdb_current_zone_info* __stdcall __std_tzdb_get_current_zone() noexcept;
void __stdcall __std_tzdb_delete_current_zone(__std_tzdb_current_zone_info* _Info) noexcept;

_NODISCARD __std_tzdb_sys_info* __stdcall __std_tzdb_get_sys_info(
const char* _Tz, size_t _Tz_len, __std_tzdb_epoch_milli _Local) noexcept;
void __stdcall __std_tzdb_delete_sys_info(__std_tzdb_sys_info* _Info) noexcept;

_NODISCARD __std_tzdb_leap_info* __stdcall __std_tzdb_get_leap_seconds(
size_t _Prev_ls_size, size_t* _Current_ls_size) noexcept;
void __stdcall __std_tzdb_delete_leap_seconds(__std_tzdb_leap_info* _Info) noexcept;

_NODISCARD void* __stdcall __std_calloc_crt(size_t _Count, size_t _Size) noexcept;
void __stdcall __std_free_crt(void* _Ptr) noexcept;

_END_EXTERN_C

_STD_BEGIN

template <class _Ty>
struct _Tzdb_deleter;

template <>
struct _Tzdb_deleter<__std_tzdb_time_zones_info> {
void operator()(__std_tzdb_time_zones_info* _Info) const noexcept {
__std_tzdb_delete_time_zones(_Info);
}
};

template <>
struct _Tzdb_deleter<__std_tzdb_current_zone_info> {
void operator()(__std_tzdb_current_zone_info* _Info) const noexcept {
__std_tzdb_delete_current_zone(_Info);
}
};

template <>
struct _Tzdb_deleter<__std_tzdb_sys_info> {
void operator()(__std_tzdb_sys_info* _Info) const noexcept {
__std_tzdb_delete_sys_info(_Info);
}
};

template <>
struct _Tzdb_deleter<__std_tzdb_leap_info[]> {
void operator()(__std_tzdb_leap_info* _Info) const noexcept {
__std_tzdb_delete_leap_seconds(_Info);
}
};

template <class _Ty>
class _Crt_allocator {
public:
using value_type = _Ty;
using propagate_on_container_move_assignment = true_type;
using is_always_equal = true_type;

constexpr _Crt_allocator() noexcept = default;

constexpr _Crt_allocator(const _Crt_allocator&) noexcept = default;
template <class _Other>
constexpr _Crt_allocator(const _Crt_allocator<_Other>&) noexcept {}

_NODISCARD __declspec(allocator) _Ty* allocate(_CRT_GUARDOVERFLOW const size_t _Count) {
const auto _Ptr = __std_calloc_crt(_Count, sizeof(_Ty));
if (!_Ptr) {
_Xbad_alloc();
}
return static_cast<_Ty*>(_Ptr);
}

void deallocate(_Ty* const _Ptr, size_t) noexcept {
__std_free_crt(_Ptr);
}
};

_STD_END

#pragma pop_macro("new")
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
#pragma pack(pop)
#endif // _STL_COMPILER_PREPROCESSOR
#endif // __MSVC_TZDB_HPP
Loading

0 comments on commit fb2f89f

Please sign in to comment.