Path: blob/main/contrib/llvm-project/libcxx/include/__chrono/statically_widen.h
35262 views
// -*- C++ -*-1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//89#ifndef _LIBCPP___CHRONO_STATICALLY_WIDEN_H10#define _LIBCPP___CHRONO_STATICALLY_WIDEN_H1112// Implements the STATICALLY-WIDEN exposition-only function. ([time.general]/2)1314#include <__concepts/same_as.h>15#include <__config>16#include <__format/concepts.h>1718#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)19# pragma GCC system_header20#endif2122_LIBCPP_BEGIN_NAMESPACE_STD2324#if _LIBCPP_STD_VER >= 202526# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS27template <__fmt_char_type _CharT>28_LIBCPP_HIDE_FROM_ABI constexpr const _CharT* __statically_widen(const char* __str, const wchar_t* __wstr) {29if constexpr (same_as<_CharT, char>)30return __str;31else32return __wstr;33}34# define _LIBCPP_STATICALLY_WIDEN(_CharT, __str) ::std::__statically_widen<_CharT>(__str, L##__str)35# else // _LIBCPP_HAS_NO_WIDE_CHARACTERS3637// Without this indirection the unit test test/libcxx/modules_include.sh.cpp38// fails for the CI build "No wide characters". This seems like a bug.39// TODO FMT investigate why this is needed.40template <__fmt_char_type _CharT>41_LIBCPP_HIDE_FROM_ABI constexpr const _CharT* __statically_widen(const char* __str) {42return __str;43}44# define _LIBCPP_STATICALLY_WIDEN(_CharT, __str) ::std::__statically_widen<_CharT>(__str)45# endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS4647#endif //_LIBCPP_STD_VER >= 204849_LIBCPP_END_NAMESPACE_STD5051#endif // _LIBCPP___CHRONO_STATICALLY_WIDEN_H525354