diff --git a/CMakeLists.txt b/CMakeLists.txt index b40418d3314..2517ddc8375 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL Linux) endif() set(CLR_CMAKE_PLATFORM_LINUX 1) elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin) - add_definitions(-DPLATFORM_UNIX) + add_definitions( + -DPLATFORM_UNIX + -DU_DISABLE_RENAMING=1 #in case we link against to an older binary of icu + ) set(CLR_CMAKE_PLATFORM_UNIX 1) if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64) @@ -76,6 +79,11 @@ if(CLR_CMAKE_PLATFORM_UNIX) -Wno-implicit-function-declaration" ) + # todo: fix general visibility of the interface + # do not set to `fvisibility=hidden` as it is going to + # prevent the required interface is being exported + # clang by default sets fvisibility=default + # CXX WARNING FLAGS set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \ -Werror\ diff --git a/bin/ChakraCore/CMakeLists.txt b/bin/ChakraCore/CMakeLists.txt index b589a490053..b00d0c09028 100644 --- a/bin/ChakraCore/CMakeLists.txt +++ b/bin/ChakraCore/CMakeLists.txt @@ -3,10 +3,6 @@ add_library (ChakraCore SHARED ConfigParserExternals.cpp TestHooks.cpp ) - -# By default, don't export any symbols from this library -# We'll manually export the relevant individual functions -set_target_properties(ChakraCore PROPERTIES CXX_VISIBILITY_PRESET hidden) target_include_directories ( ChakraCore PUBLIC @@ -32,42 +28,88 @@ target_include_directories ( # dl: For shared library loading related functions # icuuc: For the ICU (xplat-todo: Make this optional) # -target_link_libraries(ChakraCore - -Wl,--no-undefined - -Wl,--start-group - -Wl,--whole-archive - Chakra.Jsrt - Chakra.Jsrt.Core - -Wl,--no-whole-archive - Chakra.Runtime.Types - Chakra.Runtime.Math - Chakra.Runtime.Library - Chakra.Runtime.Language - Chakra.Runtime.Debug - Chakra.Runtime.ByteCode - Chakra.Runtime.PlatformAgnostic - Chakra.Runtime.Base - Chakra.Parser - Chakra.Common.Util - Chakra.Common.Memory - Chakra.Common.Common - Chakra.Common.Core - Chakra.Common.DataStructures - Chakra.Common.Exceptions - Chakra.Common.Codex - -Wl,--end-group - Chakra.Pal - pthread - stdc++ - dl - icuuc - -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libChakraCoreLib.version -) +if(CMAKE_SYSTEM_NAME STREQUAL Linux) + target_link_libraries(ChakraCore + -Wl,--no-undefined + -Wl,--start-group + -Wl,--whole-archive + Chakra.Jsrt + Chakra.Jsrt.Core + -Wl,--no-whole-archive + Chakra.Runtime.Types + Chakra.Runtime.Math + Chakra.Runtime.Library + Chakra.Runtime.Language + Chakra.Runtime.Debug + Chakra.Runtime.ByteCode + Chakra.Runtime.PlatformAgnostic + Chakra.Runtime.Base + Chakra.Parser + Chakra.Common.Util + Chakra.Common.Memory + Chakra.Common.Common + Chakra.Common.Core + Chakra.Common.DataStructures + Chakra.Common.Exceptions + Chakra.Common.Codex + -Wl,--end-group + Chakra.Pal + pthread + stdc++ + dl + icuuc + -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libChakraCoreLib.version + ) + # + # Post build step to copy the built shared library + # to BuildLinux (or whatever the CMakeBuildDir is) + add_custom_command(TARGET ChakraCore POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${CHAKRACORE_BINARY_DIR}/bin/ChakraCore/libChakraCore.so" + ${CHAKRACORE_BINARY_DIR}/) +elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin) + # todo: combine link libraries into a list + # reminder: order of the link libraries matters + # we miss multiple keywords below + # can we handle the creation of the list + # with a single IF/case per platform? -# -# Post build step to copy the built shared library -# to BuildLinux (or whatever the CMakeBuildDir is) -add_custom_command(TARGET ChakraCore POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different - "${CHAKRACORE_BINARY_DIR}/bin/ChakraCore/libChakraCore.so" - ${CHAKRACORE_BINARY_DIR}/) + target_link_libraries(ChakraCore + -Wl,-undefined,error + # -Wl,--start-group + # -Wl,--whole-archive + Chakra.Jsrt + Chakra.Jsrt.Core + # -Wl,--no-whole-archive + Chakra.Runtime.Types + Chakra.Runtime.Math + Chakra.Runtime.Library + Chakra.Runtime.Language + Chakra.Runtime.Debug + Chakra.Runtime.ByteCode + Chakra.Runtime.PlatformAgnostic + Chakra.Runtime.Base + Chakra.Parser + Chakra.Common.Util + Chakra.Common.Memory + Chakra.Common.Common + Chakra.Common.Core + Chakra.Common.DataStructures + Chakra.Common.Exceptions + Chakra.Common.Codex + # -Wl,--end-group + Chakra.Pal + pthread + stdc++ + dl + icucore + # -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libChakraCoreLib.version + ) + # + # Post build step to copy the built shared library + # to BuildLinux (or whatever the CMakeBuildDir is) + add_custom_command(TARGET ChakraCore POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${CHAKRACORE_BINARY_DIR}/bin/ChakraCore/libChakraCore.dylib" + ${CHAKRACORE_BINARY_DIR}/) +endif() diff --git a/bin/ch/CMakeLists.txt b/bin/ch/CMakeLists.txt index 43f08cb8882..65e401c2f6f 100644 --- a/bin/ch/CMakeLists.txt +++ b/bin/ch/CMakeLists.txt @@ -22,15 +22,23 @@ target_include_directories (ch ../../lib/Jsrt ) -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fPIE -pie") - -target_link_libraries (ch - PRIVATE Chakra.Pal - PRIVATE Chakra.Common.Codex - PRIVATE Chakra.Runtime.PlatformAgnostic - -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/ch.version - ) +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fPIE") +if(CMAKE_SYSTEM_NAME STREQUAL Linux) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie") # osx clang adds this by default + target_link_libraries (ch + PRIVATE Chakra.Pal + PRIVATE Chakra.Common.Codex + PRIVATE Chakra.Runtime.PlatformAgnostic + -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/ch.version + ) +elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin) + target_link_libraries (ch + PRIVATE Chakra.Pal + PRIVATE Chakra.Common.Codex + PRIVATE Chakra.Runtime.PlatformAgnostic + ) +endif() # Add a post build event to the ch target # which executes a command to copy ch to # BuildLinux for convenience diff --git a/bin/ch/ChakraRtInterface.cpp b/bin/ch/ChakraRtInterface.cpp index cdba905d38a..e32c8c1a5c7 100644 --- a/bin/ch/ChakraRtInterface.cpp +++ b/bin/ch/ChakraRtInterface.cpp @@ -8,8 +8,12 @@ LPCSTR chakraDllName = "chakracore.dll"; #else #include +#ifdef __APPLE__ +LPCSTR chakraDllName = "libChakraCore.dylib"; +#else LPCSTR chakraDllName = "libChakraCore.so"; #endif +#endif bool ChakraRTInterface::m_testHooksSetup = false; bool ChakraRTInterface::m_testHooksInitialized = false; diff --git a/build.sh b/build.sh index 90d20d8aaf4..2dad33cc822 100755 --- a/build.sh +++ b/build.sh @@ -176,7 +176,7 @@ if [[ ${#_CXX} > 0 ]]; then CC_PREFIX="-DCMAKE_CXX_COMPILER=$_CXX -DCMAKE_C_COMPILER=$_CC" fi -build_directory="$CHAKRACORE_DIR/BuildLinux/${BUILD_TYPE,,}" +build_directory="$CHAKRACORE_DIR/BuildLinux/${BUILD_TYPE:0}" if [ ! -d "$build_directory" ]; then SAFE_RUN `mkdir -p $build_directory` fi diff --git a/lib/Runtime/Language/amd64/JavascriptOperatorsA.S b/lib/Runtime/Language/amd64/JavascriptOperatorsA.S index a8877061db7..e45ef22f5e3 100644 --- a/lib/Runtime/Language/amd64/JavascriptOperatorsA.S +++ b/lib/Runtime/Language/amd64/JavascriptOperatorsA.S @@ -5,9 +5,9 @@ .intel_syntax noprefix #include "unixasmmacros.inc" +// expected fvisibility=default .global C_FUNC(amd64_CallWithFakeFrame) .global C_FUNC(amd64_ReturnFromCallWithFakeFrame) - // r8 = arg0. // rcx = args size. // rdx = spill size. @@ -22,7 +22,7 @@ C_FUNC(amd64_CallWithFakeFrame): // The stack walker uses this marker to skip this frame. // Note that we use rip-relative addressing here since this // library is shared and therefore the code has to be position independent - lea rax, [rip+C_FUNC(amd64_ReturnFromCallWithFakeFrame)] + lea rax, [rip + C_FUNC(amd64_ReturnFromCallWithFakeFrame)] mov [rsp+8h], rax mov rax, [rsp + 28h] @@ -57,9 +57,9 @@ C_FUNC(amd64_CallWithFakeFrame): jmp rdi - // rcx = args size. // rdx = spill size. + .balign 16 C_FUNC(amd64_ReturnFromCallWithFakeFrame): add rsp, rcx diff --git a/lib/Runtime/Library/amd64/JavascriptFunctionA.S b/lib/Runtime/Library/amd64/JavascriptFunctionA.S index ca613103fc7..6ebc4565c68 100644 --- a/lib/Runtime/Library/amd64/JavascriptFunctionA.S +++ b/lib/Runtime/Library/amd64/JavascriptFunctionA.S @@ -6,13 +6,13 @@ .intel_syntax noprefix #include "unixasmmacros.inc" -.extern C_FUNC(_ZN2Js18JavascriptFunction13DeferredParseEPPNS_14ScriptFunctionE) -.extern C_FUNC(_ZN2Js18JavascriptFunction19DeferredDeserializeEPNS_14ScriptFunctionE) - .global C_FUNC(_ZN2Js18JavascriptFunction20DeferredParsingThunkEPNS_16RecyclableObjectENS_8CallInfoEz) .global C_FUNC(_ZN2Js18JavascriptFunction24DeferredDeserializeThunkEPNS_16RecyclableObjectENS_8CallInfoEz) #ifndef __APPLE__ +.extern _ZN2Js18JavascriptFunction13DeferredParseEPPNS_14ScriptFunctionE +.extern _ZN2Js18JavascriptFunction19DeferredDeserializeEPNS_14ScriptFunctionE + .type _ZN2Js18JavascriptFunction20DeferredParsingThunkEPNS_16RecyclableObjectENS_8CallInfoEz, @function .type _ZN2Js18JavascriptFunction24DeferredDeserializeThunkEPNS_16RecyclableObjectENS_8CallInfoEz, @function #endif @@ -103,11 +103,12 @@ LOCAL_LABEL(function_done): lea rsp, [rbp] pop_nonvol_reg rbp ret + NESTED_END amd64_CallFunction, _TEXT -// extrn ?DeferredParse@JavascriptFunction@Js@@SAP6APEAXPEAVRecyclableObject@2@UCallInfo@2@ZZPEAPEAVScriptFunction@2@@Z : PROC .balign 16 +.text C_FUNC(_ZN2Js18JavascriptFunction20DeferredParsingThunkEPNS_16RecyclableObjectENS_8CallInfoEz): push rbp lea rbp, [rsp] @@ -120,7 +121,7 @@ C_FUNC(_ZN2Js18JavascriptFunction20DeferredParsingThunkEPNS_16RecyclableObjectEN // JavascriptMethod JavascriptFunction::DeferredParse(ScriptFunction**) // lea rdi, [rbp + 10h] // &function, setup by custom calling convention - call C_PLTFUNC(_ZN2Js18JavascriptFunction13DeferredParseEPPNS_14ScriptFunctionE) + call C_FUNC(_ZN2Js18JavascriptFunction13DeferredParseEPPNS_14ScriptFunctionE) pop rsi pop rdi @@ -128,6 +129,7 @@ C_FUNC(_ZN2Js18JavascriptFunction20DeferredParsingThunkEPNS_16RecyclableObjectEN jmp rax + // Var JavascriptFunction::DeferredDeserializeThunk( // RecyclableObject* function, CallInfo callInfo, ...) .balign 16 @@ -144,7 +146,7 @@ C_FUNC(_ZN2Js18JavascriptFunction24DeferredDeserializeThunkEPNS_16RecyclableObje // ScriptFunction* function) // // RDI == function, setup by custom calling convention - call C_PLTFUNC(_ZN2Js18JavascriptFunction19DeferredDeserializeEPNS_14ScriptFunctionE) + call C_FUNC(_ZN2Js18JavascriptFunction19DeferredDeserializeEPNS_14ScriptFunctionE) pop rsi pop rdi diff --git a/lib/Runtime/PlatformAgnostic/Platform/CMakeLists.txt b/lib/Runtime/PlatformAgnostic/Platform/CMakeLists.txt index f54aaf23eac..d5f8a21693b 100644 --- a/lib/Runtime/PlatformAgnostic/Platform/CMakeLists.txt +++ b/lib/Runtime/PlatformAgnostic/Platform/CMakeLists.txt @@ -1,7 +1,5 @@ project(CHAKRA_PLATFORM_AGNOSTIC) -check_function_exists(gmtime_r HAVE_GMTIME_R) - if(CMAKE_SYSTEM_NAME STREQUAL Linux) add_library (Chakra.Runtime.PlatformAgnostic Linux/UnicodeText.ICU.cpp @@ -13,14 +11,15 @@ add_library (Chakra.Runtime.PlatformAgnostic ) elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin) add_library (Chakra.Runtime.PlatformAgnostic - #Linux/UnicodeText.ICU.cpp - #Linux/DateTime.cpp - #Linux/HiResTimer.cpp + # xplat-todo: implement them for unix! or carry them into common + Linux/UnicodeText.ICU.cpp + Linux/DateTime.cpp + Linux/HiResTimer.cpp + Linux/NumbersUtility.cpp Unix/SystemInfo.cpp Common/UnicodeText.Common.cpp ) endif() - target_include_directories ( Chakra.Runtime.PlatformAgnostic PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/pal/inc/pal.h b/pal/inc/pal.h index 23c92bfbab9..c725b0bc7f3 100644 --- a/pal/inc/pal.h +++ b/pal/inc/pal.h @@ -68,7 +68,6 @@ extern "C" { #endif -#include #include #include diff --git a/pal/inc/pal_char16.h b/pal/inc/pal_char16.h deleted file mode 100644 index f696de03e29..00000000000 --- a/pal/inc/pal_char16.h +++ /dev/null @@ -1,53 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// - -/*++ - - - -Module Name: - - pal_char16.h - -Abstract: - -This file is used to define the wchar_t type as a 16-bit type on Unix. - - - ---*/ - -// The unix compilers use a 32-bit wchar_t, so we must make a 16 bit wchar_t. -// The windows compilers, gcc and MSVC, both define a 16 bit wchar_t. - -// Note : wchar_t is a built-in type in C++, gcc/llvm ignores any attempts to -// typedef it. Using the preprocessor here, we make sure gcc sees -// __wchar_16_cpp__ instead of wchar_t. This is apparently not necessary under -// vc++, for whom wchar_t is already a typedef instead of a built-in. - -#if !defined(PAL_STDCPP_COMPAT) || defined(USING_PAL_STDLIB) -#if defined (PLATFORM_UNIX) && defined(__GNUC__) -#undef wchar_t -#define wchar_t __wchar_16_cpp__ -#endif // PLATFORM_UNIX - -// Set up the wchar_t type (which got preprocessed to __wchar_16_cpp__). -// In C++11, the standard gives us char16_t, which is what we want (and matches types with u"") -// In C, this doesn't exist, so use unsigned short. - -#if !defined(_WCHAR_T_DEFINED) || !defined(_MSC_VER) -#if defined (PLATFORM_UNIX) -#if defined(__cplusplus) -typedef char16_t wchar_t; -#else -typedef unsigned short wchar_t; -#endif // __cplusplus -#endif // PLATFORM_UNIX -#ifndef _WCHAR_T_DEFINED -#define _WCHAR_T_DEFINED -#endif // !_WCHAR_T_DEFINED -#endif // !_WCHAR_T_DEFINED || !_MSC_VER -#endif // !PAL_STDCPP_COMPAT - diff --git a/pal/inc/pal_mstypes.h b/pal/inc/pal_mstypes.h index 7e9aef3d795..4a79e0a3cd9 100644 --- a/pal/inc/pal_mstypes.h +++ b/pal/inc/pal_mstypes.h @@ -595,6 +595,21 @@ typedef LONG_PTR LPARAM; #define _PTRDIFF_T #endif +// CC uses both char16_t and wchar_t internally +#if !defined(_WCHAR_T_DEFINED) +#if defined(__cplusplus) +#undef wchar_t +#define wchar_t __wchar_16_cpp__ +typedef char16_t wchar_t; +#else +typedef unsigned short char16_t; +#endif // __cplusplus +#define _WCHAR_T_DEFINED +#endif // _WCHAR_T_DEFINED + +typedef char16_t WCHAR; +#define WCHAR_IS_CHAR16_T 1 + #ifdef PAL_STDCPP_COMPAT #ifdef __APPLE__ @@ -606,16 +621,9 @@ typedef unsigned long int uintptr_t; typedef unsigned int uintptr_t; #endif // !BIT64 #endif - -typedef char16_t WCHAR; - -#define WCHAR_IS_CHAR16_T 1 #else // !PAL_STDCPP_COMPAT - -#define WCHAR_IS_WCHAR_T 1 -typedef wchar_t WCHAR; #if defined(__LINUX__) #ifdef BIT64 typedef long int intptr_t; diff --git a/pal/inc/pal_type_traits b/pal/inc/pal_type_traits deleted file mode 100644 index d0d7093f77c..00000000000 --- a/pal/inc/pal_type_traits +++ /dev/null @@ -1,550 +0,0 @@ -// ==++== -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// ==--== -// -// clr_std/utility -// -// simonhal -// -// Copy of some key Standard Template Library functionality. -// See http://msdn.microsoft.com/en-us/library/bb982077.aspx for documentation. -// - -#ifdef _MSC_VER -#pragma once -#endif - -#ifndef __clr_std_type_traits_h__ -#define __clr_std_type_traits_h__ - -#ifdef USE_STL - -#include - -#else - -namespace std -{ - //----------------------------------------------------------------------------------------- - // TEMPLATE CLASS remove_const - template - struct remove_const - { // remove top level const qualifier - typedef _Ty type; - }; - - template - struct remove_const - { // remove top level const qualifier - typedef _Ty type; - }; - - template - struct remove_const - { // remove top level const qualifier - typedef _Ty type[]; - }; - - template - struct remove_const - { // remove top level const qualifier - typedef _Ty type[_Nx]; - }; - - //----------------------------------------------------------------------------------------- - // TEMPLATE CLASS remove_volatile - template - struct remove_volatile - { // remove top level volatile qualifier - typedef _Ty type; - }; - - template - struct remove_volatile - { // remove top level volatile qualifier - typedef _Ty type; - }; - - template - struct remove_volatile - { // remove top level volatile qualifier - typedef _Ty type[]; - }; - - template - struct remove_volatile - { // remove top level volatile qualifier - typedef _Ty type[_Nx]; - }; - - //----------------------------------------------------------------------------------------- - // TEMPLATE CLASS remove_cv - template - struct remove_cv - { // remove top level const and volatile qualifiers - typedef typename remove_const::type>::type type; - }; - - //----------------------------------------------------------------------------------------- - // TEMPLATE remove_reference - template - struct remove_reference - { // remove reference - typedef T type; - }; - - template - struct remove_reference - { // remove reference - typedef T type; - }; - - template - struct remove_reference - { // remove rvalue reference - typedef T type; - }; - - //----------------------------------------------------------------------------------------- - // TEMPLATE remove_pointer - template - struct remove_pointer - { // remove pointer - typedef T type; - }; - - template - struct remove_pointer - { // remove pointer - typedef T type; - }; - - //----------------------------------------------------------------------------------------- - // TEMPLATE FUNCTION identity - template - struct identity - { // map T to type unchanged - typedef T type; - - inline - const T& operator()(const T& left) const - { // apply identity operator to operand - return (left); - } - }; - - //----------------------------------------------------------------------------------------- - // TEMPLATE CLASS integral_constant - template - struct integral_constant - { // convenient template for integral constant types - static const _Ty value = _Val; - - typedef _Ty value_type; - typedef integral_constant<_Ty, _Val> type; - }; - - typedef integral_constant true_type; - typedef integral_constant false_type; - - // TEMPLATE CLASS _Cat_base - template - struct _Cat_base - : false_type - { // base class for type predicates - }; - - template<> - struct _Cat_base - : true_type - { // base class for type predicates - }; - - //----------------------------------------------------------------------------------------- - // TEMPLATE CLASS enable_if - template - struct enable_if - { // type is undefined for assumed !_Test - }; - - template - struct enable_if - { // type is _Type for _Test - typedef _Type type; - }; - - //----------------------------------------------------------------------------------------- - // TEMPLATE CLASS conditional - template - struct conditional - { // type is _Ty2 for assumed !_Test - typedef _Ty2 type; - }; - - template - struct conditional - { // type is _Ty1 for _Test - typedef _Ty1 type; - }; - - //----------------------------------------------------------------------------------------- - // TEMPLATE CLASS is_lvalue_reference - template - struct is_lvalue_reference - : false_type - { // determine whether _Ty is an lvalue reference - }; - - template - struct is_lvalue_reference<_Ty&> - : true_type - { // determine whether _Ty is an lvalue reference - }; - - //----------------------------------------------------------------------------------------- - // TEMPLATE CLASS is_rvalue_reference - template - struct is_rvalue_reference - : false_type - { // determine whether _Ty is an rvalue reference - }; - - template - struct is_rvalue_reference<_Ty&&> - : true_type - { // determine whether _Ty is an rvalue reference - }; - - //----------------------------------------------------------------------------------------- - // TEMPLATE CLASS is_reference - template - struct is_reference - : conditional< - is_lvalue_reference<_Ty>::value || is_rvalue_reference<_Ty>::value, - true_type, - false_type>::type - { // determine whether _Ty is a reference - }; - - // TEMPLATE CLASS is_pointer - template - struct is_pointer - : false_type - { // determine whether _Ty is a pointer - }; - - template - struct is_pointer<_Ty *> - : true_type - { // determine whether _Ty is a pointer - }; - - // TEMPLATE CLASS _Is_integral - template - struct _Is_integral - : false_type - { // determine whether _Ty is integral - }; - - template<> - struct _Is_integral - : true_type - { // determine whether _Ty is integral - }; - - template<> - struct _Is_integral - : true_type - { // determine whether _Ty is integral - }; - - template<> - struct _Is_integral - : true_type - { // determine whether _Ty is integral - }; - - template<> - struct _Is_integral - : true_type - { // determine whether _Ty is integral - }; - - #ifdef _NATIVE_WCHAR_T_DEFINED - template<> - struct _Is_integral - : true_type - { // determine whether _Ty is integral - }; - #endif /* _NATIVE_WCHAR_T_DEFINED */ - - template<> - struct _Is_integral - : true_type - { // determine whether _Ty is integral - }; - - template<> - struct _Is_integral - : true_type - { // determine whether _Ty is integral - }; - - template<> - struct _Is_integral - : true_type - { // determine whether _Ty is integral - }; - - template<> - struct _Is_integral - : true_type - { // determine whether _Ty is integral - }; - -// On Unix 'long' is a 64-bit type (same as __int64) and the following two definitions -// conflict with _Is_integral and _Is_integral. -#ifndef PLATFORM_UNIX - template<> - struct _Is_integral - : true_type - { // determine whether _Ty is integral - }; - - template<> - struct _Is_integral - : true_type - { // determine whether _Ty is integral - }; -#endif /* PLATFORM_UNIX */ - - #if _HAS_CHAR16_T_LANGUAGE_SUPPORT - template<> - struct _Is_integral - : true_type - { // determine whether _Ty is integral - }; - - template<> - struct _Is_integral - : true_type - { // determine whether _Ty is integral - }; - #endif /* _HAS_CHAR16_T_LANGUAGE_SUPPORT */ - - template<> - struct _Is_integral - : true_type - { // determine whether _Ty is integral - }; - - template<> - struct _Is_integral - : true_type - { // determine whether _Ty is integral - }; - - // TEMPLATE CLASS is_integral - template - struct is_integral - : _Is_integral::type> - { // determine whether _Ty is integral - }; - - // TEMPLATE CLASS _Is_floating_point - template - struct _Is_floating_point - : false_type - { // determine whether _Ty is floating point - }; - - template<> - struct _Is_floating_point - : true_type - { // determine whether _Ty is floating point - }; - - template<> - struct _Is_floating_point - : true_type - { // determine whether _Ty is floating point - }; - -// In PAL, we define long as int and so this becomes int double, -// which is a nonsense -#ifndef FEATURE_PAL - template<> - struct _Is_floating_point - : true_type - { // determine whether _Ty is floating point - }; -#endif - - // TEMPLATE CLASS is_floating_point - template - struct is_floating_point - : _Is_floating_point::type> - { // determine whether _Ty is floating point - }; - - // TEMPLATE CLASS is_arithmetic - template - struct is_arithmetic - : _Cat_base::value - || is_floating_point<_Ty>::value> - { // determine whether _Ty is an arithmetic type - }; - - //----------------------------------------------------------------------------------------- - // TEMPLATE CLASS is_signed - template - struct is_signed : conditional< - static_cast::type>(-1) < 0, true_type, false_type>::type {}; - - //----------------------------------------------------------------------------------------- - // TEMPLATE CLASS is_same - template - struct is_same : false_type { }; - - //----------------------------------------------------------------------------------------- - template - struct is_same : true_type { }; - - //----------------------------------------------------------------------------------------- - // TEMPLATE CLASS is_base_of -#ifdef _MSC_VER - - template - struct is_base_of : - conditional<__is_base_of( TBase, TDerived), true_type, false_type>::type {}; - -#else - namespace detail - { - //------------------------------------------------------------------------------------- - // Helper types Small and Big - guarantee that sizeof(Small) < sizeof(Big) - // - - template - struct conversion_helper - { - typedef char Small; - struct Big { char dummy[2]; }; - static Big Test(...); - static Small Test(U); - static T MakeT(); - }; - - //------------------------------------------------------------------------------------- - // class template conversion - // Figures out the conversion relationships between two types - // Invocations (T and U are types): - // a) conversion::exists - // returns (at compile time) true if there is an implicit conversion from T - // to U (example: Derived to Base) - // b) conversion::exists2Way - // returns (at compile time) true if there are both conversions from T - // to U and from U to T (example: int to char and back) - // c) conversion::sameType - // returns (at compile time) true if T and U represent the same type - // - // NOTE: might not work if T and U are in a private inheritance hierarchy. - // - - template - struct conversion - { - typedef detail::conversion_helper H; - static const bool exists = sizeof(typename H::Small) == sizeof((H::Test(H::MakeT()))); - static const bool exists2Way = exists && conversion::exists; - static const bool sameType = false; - }; - - template - struct conversion - { - static const bool exists = true; - static const bool exists2Way = true; - static const bool sameType = true; - }; - - template - struct conversion - { - static const bool exists = false; - static const bool exists2Way = false; - static const bool sameType = false; - }; - - template - struct conversion - { - static const bool exists = false; - static const bool exists2Way = false; - static const bool sameType = false; - }; - - template <> - struct conversion - { - static const bool exists = true; - static const bool exists2Way = true; - static const bool sameType = true; - }; - } // detail - - // Note that we need to compare pointer types here, since conversion of types by-value - // just tells us whether or not an implicit conversion constructor exists. We handle - // type parameters that are already pointers specially; see below. - template - struct is_base_of : - conditional::exists, true_type, false_type>::type {}; - - // Specialization to handle type parameters that are already pointers. - template - struct is_base_of : - conditional::exists, true_type, false_type>::type {}; - - // Specialization to handle invalid mixing of pointer types. - template - struct is_base_of : - false_type {}; - - // Specialization to handle invalid mixing of pointer types. - template - struct is_base_of : - false_type {}; - -#endif - - // Use to determine if a template type parameter is a string. - template - struct is_cstr - : public std::false_type - {}; - - template - struct is_cstr< T* > - : public std::conditional< - std::is_same::type, char>::value || - std::is_same::type, wchar_t>::value, - std::true_type, - std::false_type>::type - - { }; - -} // namespace std - -#endif // !USE_STL - -#define REM_CONST(T) typename std::remove_const< T >::type -#define REM_CV(T) typename std::remove_cv< T >::type -#define REM_REF(T) typename std::remove_reference< T >::type - -#define REF_T(T) REM_REF(T) & -#define REF_CT(T) REM_REF(REM_CONST(T)) const & - -#endif // __clr_std_type_traits_h__ - diff --git a/pal/inc/safemath.h b/pal/inc/safemath.h index 4d535c0fbcc..f9707982d67 100644 --- a/pal/inc/safemath.h +++ b/pal/inc/safemath.h @@ -28,12 +28,20 @@ #endif #endif -// #include "static_assert.h" - -#ifndef NO_PAL_TYPE_TRAITS -#include "inc/pal_type_traits" +// CC uses both char16_t and wchar_t internally +#if defined(__cplusplus) +#undef wchar_t +#define wchar_t void* #endif +#include + +#if defined(__cplusplus) +#undef wchar_t +#define wchar_t __wchar_16_cpp__ +typedef char16_t wchar_t; +#endif // __cplusplus + //================================================================== // Semantics: if val can be represented as the exact same value // when cast to Dst type, then FitsIn(val) will return true; diff --git a/pal/src/cruntime/file.cpp b/pal/src/cruntime/file.cpp index 12efa6449e9..72833230eed 100644 --- a/pal/src/cruntime/file.cpp +++ b/pal/src/cruntime/file.cpp @@ -389,8 +389,8 @@ see MSDN doc. PAL_FILE * __cdecl _wfopen( - const wchar_16 *fileName, - const wchar_16 *mode) + const char16_t *fileName, + const char16_t *mode) { CHAR mbFileName[ _MAX_PATH ]; CHAR mbMode[ 10 ]; @@ -436,8 +436,8 @@ see MSDN doc. PAL_FILE * __cdecl _wfsopen( - const wchar_16 *fileName, - const wchar_16 *mode, + const char16_t *fileName, + const char16_t *mode, int shflag) { // UNIXTODO: Implement this. @@ -557,9 +557,9 @@ int __cdecl PAL__close(int handle) return fflush(NULL); } -wchar_16 * +char16_t * __cdecl -PAL_fgetws(wchar_16 *s, int n, PAL_FILE *f) +PAL_fgetws(char16_t *s, int n, PAL_FILE *f) { ASSERT (0); return NULL; diff --git a/pal/src/cruntime/path.cpp b/pal/src/cruntime/path.cpp index d1227dd0dcb..89f43c3d1cf 100644 --- a/pal/src/cruntime/path.cpp +++ b/pal/src/cruntime/path.cpp @@ -72,11 +72,11 @@ Notes : void __cdecl _wsplitpath( - const wchar_16 *dospath, - wchar_16 *drive, - wchar_16 *dir, - wchar_16 *fname, - wchar_16 *ext) + const char16_t *dospath, + char16_t *drive, + char16_t *dir, + char16_t *fname, + char16_t *ext) { WCHAR path[_MAX_PATH+1]; LPCWSTR slash_ptr = NULL; @@ -445,11 +445,11 @@ See MSDN doc. void __cdecl _wmakepath( - wchar_16 *path, - const wchar_16 *drive, - const wchar_16 *dir, - const wchar_16 *fname, - const wchar_16 *ext) + char16_t *path, + const char16_t *drive, + const char16_t *dir, + const char16_t *fname, + const char16_t *ext) { CHAR Dir[ _MAX_DIR ]={0}; CHAR FileName[ _MAX_FNAME ]={0}; diff --git a/pal/src/cruntime/printf.cpp b/pal/src/cruntime/printf.cpp index 3197f6b7adc..9b3407428a9 100644 --- a/pal/src/cruntime/printf.cpp +++ b/pal/src/cruntime/printf.cpp @@ -231,7 +231,7 @@ See MSDN doc. int __cdecl PAL_wprintf( - const wchar_16 *format, + const char16_t *format, ...) { LONG Length; @@ -373,9 +373,9 @@ See MSDN doc. int __cdecl _snwprintf( - wchar_16 *buffer, + char16_t *buffer, size_t count, - const wchar_16 *format, + const char16_t *format, ...) { LONG Length; @@ -404,7 +404,7 @@ int __cdecl PAL_fwprintf( PAL_FILE *stream, - const wchar_16 *format, + const char16_t *format, ...) { LONG Length; @@ -1548,8 +1548,8 @@ See MSDN doc. int __cdecl PAL_swprintf( - wchar_16 *buffer, - const wchar_16 *format, + char16_t *buffer, + const char16_t *format, ...) { LONG Length; @@ -1576,8 +1576,8 @@ See MSDN doc. int __cdecl PAL_swscanf( - const wchar_16 *buffer, - const wchar_16 *format, + const char16_t *buffer, + const char16_t *format, ...) { int Length; @@ -1660,8 +1660,8 @@ See MSDN doc. --*/ int __cdecl -PAL_vswprintf(wchar_16 *buffer, - const wchar_16 *format, +PAL_vswprintf(char16_t *buffer, + const char16_t *format, va_list argptr) { LONG Length; @@ -1687,9 +1687,9 @@ See MSDN doc. --*/ int __cdecl -_vsnwprintf(wchar_16 *buffer, +_vsnwprintf(char16_t *buffer, size_t count, - const wchar_16 *format, + const char16_t *format, va_list argptr) { LONG Length; diff --git a/pal/src/cruntime/printfcpp.cpp b/pal/src/cruntime/printfcpp.cpp index 9e0d45d7928..11c5af6edbc 100644 --- a/pal/src/cruntime/printfcpp.cpp +++ b/pal/src/cruntime/printfcpp.cpp @@ -39,7 +39,7 @@ using namespace CorUnix; int CoreWvsnprintf(CPalThread *pthrCurrent, LPWSTR Buffer, size_t Count, LPCWSTR Format, va_list ap); int CoreVsnprintf(CPalThread *pthrCurrent, LPSTR Buffer, size_t Count, LPCSTR Format, va_list ap); int CoreVfprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const char *format, va_list ap); -int CoreVfwprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const wchar_16 *format, va_list ap); +int CoreVfwprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const char16_t *format, va_list ap); extern "C" { @@ -1039,7 +1039,7 @@ static INT Internal_AddPaddingVfwprintf(CPalThread *pthrCurrent, PAL_FILE *strea } if (Length > 0) { - Written = Internal_Convertfwrite(pthrCurrent, OutOriginal, sizeof(wchar_16), Length, + Written = Internal_Convertfwrite(pthrCurrent, OutOriginal, sizeof(char16_t), Length, (FILE*)(stream->bsdFilePtr), convert); if (-1 == Written) @@ -1115,7 +1115,7 @@ int __cdecl PAL_vfprintf(PAL_FILE *stream, const char *format, va_list ap) - stdarg parameter list *******************************************************************************/ -int __cdecl PAL_vfwprintf(PAL_FILE *stream, const wchar_16 *format, va_list ap) +int __cdecl PAL_vfwprintf(PAL_FILE *stream, const char16_t *format, va_list ap) { return CoreVfwprintf(InternalGetCurrentThread(), stream, format, ap); } @@ -1137,12 +1137,12 @@ int CorUnix::InternalVfprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const c return CoreVfprintf(pthrCurrent, stream, format, ap); } -int CorUnix::InternalVfwprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const wchar_16 *format, va_list ap) +int CorUnix::InternalVfwprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const char16_t *format, va_list ap) { return CoreVfwprintf(pthrCurrent, stream, format, ap); } -int CoreVfwprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const wchar_16 *format, va_list aparg) +int CoreVfwprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const char16_t *format, va_list aparg) { CHAR TempBuff[1024]; /* used to hold a single % format string */ LPCWSTR Fmt = format; @@ -1518,7 +1518,7 @@ int CoreVfwprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const wchar_16 *for ret = Internal_Convertfwrite( pthrCurrent, TempWideBuffer, - sizeof(wchar_16), + sizeof(char16_t), mbtowcResult-1, (FILE*)stream->bsdFilePtr, textMode); @@ -1548,7 +1548,7 @@ int CoreVfwprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const wchar_16 *for ret = Internal_Convertfwrite( pthrCurrent, Fmt++, - sizeof(wchar_16), + sizeof(char16_t), 1, (FILE*)stream->bsdFilePtr, textMode); /* copy regular chars into buffer */ diff --git a/pal/src/cruntime/silent_printf.cpp b/pal/src/cruntime/silent_printf.cpp index d01070cbf94..d1cc466c25b 100644 --- a/pal/src/cruntime/silent_printf.cpp +++ b/pal/src/cruntime/silent_printf.cpp @@ -38,7 +38,7 @@ static BOOL Silent_ExtractFormatA(LPCSTR *Fmt, LPSTR Out, LPINT Flags, LPINT Wid static INT Silent_AddPaddingVfprintf(PAL_FILE *stream, LPSTR In, INT Padding, INT Flags); -static size_t Silent_PAL_wcslen(const wchar_16 *string); +static size_t Silent_PAL_wcslen(const char16_t *string); /******************************************************************************* Function: @@ -973,7 +973,7 @@ INT Silent_AddPaddingVfprintf(PAL_FILE *stream, LPSTR In, INT Padding, INT Flags See MSDN or the man page for wcslen. --*/ -size_t Silent_PAL_wcslen(const wchar_16 *string) +size_t Silent_PAL_wcslen(const char16_t *string) { size_t nChar = 0; diff --git a/pal/src/cruntime/wchar.cpp b/pal/src/cruntime/wchar.cpp index b1f92db2dd0..ca92af030cd 100644 --- a/pal/src/cruntime/wchar.cpp +++ b/pal/src/cruntime/wchar.cpp @@ -54,17 +54,17 @@ SET_DEFAULT_DEBUG_CHANNEL(CRT); --*/ static -wchar_16 -wtolower(wchar_16 c) +char16_t +wtolower(char16_t c) { /* Note: Surrogate pairs unicode character are not supported */ #if HAVE_TOWLOWER - wchar_t w; - w = (wchar_t) c; + char16_t w; + w = (char16_t) c; w = towlower(w); - return (wchar_16) w; + return (char16_t) w; #else @@ -165,14 +165,14 @@ LPWSTR Internal_i64tow(INT64 value, LPWSTR string, int radix, BOOL isI64) 16-bit wide character version of the ANSI tolower() function. --*/ -wchar_16 * +char16_t * __cdecl _itow( int value, - wchar_16 *string, + char16_t *string, int radix) { - wchar_16 *ret; + char16_t *ret; PERF_ENTRY(_itow); ENTRY("_itow (value=%d, string=%p, radix=%d)\n", @@ -180,7 +180,7 @@ _itow( ret = Internal_i64tow(value, string, radix, FALSE); - LOGEXIT("_itow returns wchar_t* %p\n", ret); + LOGEXIT("_itow returns char16_t* %p\n", ret); PERF_EXIT(_itow); return ret; @@ -193,14 +193,14 @@ _itow( 16-bit wide character version of the ANSI ltow() function. --*/ -wchar_16 * +char16_t * __cdecl _ltow( long value, - wchar_16 *string, + char16_t *string, int radix) { - wchar_16 *ret; + char16_t *ret; PERF_ENTRY(_ltow); ENTRY("_ltow (value=%d, string=%p, radix=%d)\n", @@ -208,7 +208,7 @@ _ltow( ret = Internal_i64tow(value, string, radix, FALSE); - LOGEXIT("_ltow returns wchar_t* %p\n", ret); + LOGEXIT("_ltow returns char16_t* %p\n", ret); PERF_EXIT(_ltow); return ret; @@ -220,14 +220,14 @@ _ltow( See MSDN doc --*/ -wchar_16 * +char16_t * __cdecl _i64tow( __int64 value, - wchar_16 *string, + char16_t *string, int radix) { - wchar_16 *ret; + char16_t *ret; PERF_ENTRY(_i64tow); ENTRY("_i64tow (value=%ld, string=%p, radix=%d)\n", @@ -235,7 +235,7 @@ _i64tow( ret = Internal_i64tow(value, string, radix, TRUE); - LOGEXIT("_i64tow returns wchar_t* %p\n", ret); + LOGEXIT("_i64tow returns char16_t* %p\n", ret); PERF_EXIT(_i64tow); return ret; @@ -251,7 +251,7 @@ See MSDN doc int __cdecl _wtoi( - const wchar_16 *string) + const char16_t *string) { int len; int ret; @@ -299,7 +299,7 @@ See MSDN doc --*/ int __cdecl -PAL_iswspace(wchar_16 c) +PAL_iswspace(char16_t c) { int ret; @@ -351,8 +351,8 @@ is lesser. int __cdecl _wcsnicmp( - const wchar_16 *string1, - const wchar_16 *string2, + const char16_t *string1, + const char16_t *string2, size_t count) { size_t i; @@ -403,8 +403,8 @@ string1, string2 Null-terminated strings to compare int __cdecl _wcsicmp( - const wchar_16 *string1, - const wchar_16 *string2) + const char16_t *string1, + const char16_t *string2) { int ret; @@ -441,10 +441,10 @@ string Null-terminated string to convert to lowercase Remarks --*/ -wchar_16 * +char16_t * __cdecl _wcslwr( - wchar_16 *string) + char16_t *string) { int i; @@ -456,7 +456,7 @@ _wcslwr( string[i] = wtolower(string[i]); } - LOGEXIT("_wcslwr returning wchar_t %p (%S)\n", string?string:W16_NULLSTRING, string?string:W16_NULLSTRING); + LOGEXIT("_wcslwr returning char16_t %p (%S)\n", string?string:W16_NULLSTRING, string?string:W16_NULLSTRING); PERF_EXIT(_wcslwr); return string; } @@ -509,8 +509,8 @@ Windows behavior. */ LONG __cdecl PAL_wcstol( - const wchar_16 *nptr, - wchar_16 **endptr, + const char16_t *nptr, + char16_t **endptr, int base) { char *s_nptr = 0; @@ -571,7 +571,7 @@ PAL_wcstol( if( endptr ) { size = s_endptr - s_nptr; - *endptr = (wchar_16 *)&nptr[size]; + *endptr = (char16_t *)&nptr[size]; } PAL_wcstolExit: @@ -636,8 +636,8 @@ breaking Windows behavior .*/ ULONG __cdecl PAL_wcstoul( - const wchar_16 *nptr, - wchar_16 **endptr, + const char16_t *nptr, + char16_t **endptr, int base) { char *s_nptr = 0; @@ -682,7 +682,7 @@ PAL_wcstoul( #ifdef BIT64 if (res > _UI32_MAX) { - wchar_16 wc = *nptr; + char16_t wc = *nptr; while (PAL_iswspace(wc)) { wc = *nptr++; @@ -704,7 +704,7 @@ PAL_wcstoul( if( endptr ) { size = s_endptr - s_nptr; - *endptr = (wchar_16 *)&nptr[size]; + *endptr = (char16_t *)&nptr[size]; } PAL_wcstoulExit: @@ -726,8 +726,8 @@ PAL_wcstoul( ULONGLONG __cdecl PAL__wcstoui64( - const wchar_16 *nptr, - wchar_16 **endptr, + const char16_t *nptr, + char16_t **endptr, int base) { char *s_nptr = 0; @@ -775,7 +775,7 @@ PAL__wcstoui64( if( endptr ) { size = s_endptr - s_nptr; - *endptr = (wchar_16 *)&nptr[size]; + *endptr = (char16_t *)&nptr[size]; } PAL__wcstoui64Exit: @@ -793,9 +793,9 @@ PAL__wcstoui64( See MSDN --*/ -wchar_16 +char16_t __cdecl -PAL_towlower( wchar_16 c ) +PAL_towlower( char16_t c ) { #if HAVE_COREFOUNDATION PERF_ENTRY(towlower); @@ -852,9 +852,9 @@ PAL_towlower( wchar_16 c ) See MSDN --*/ -wchar_16 +char16_t __cdecl -PAL_towupper( wchar_16 c ) +PAL_towupper( char16_t c ) { #if HAVE_COREFOUNDATION PERF_ENTRY(towupper); @@ -912,7 +912,7 @@ See MSDN --*/ int __cdecl -PAL_iswupper( wchar_16 c ) +PAL_iswupper( char16_t c ) { BOOL bRetVal = FALSE; #if HAVE_COREFOUNDATION @@ -958,7 +958,7 @@ See MSDN --*/ int __cdecl -PAL_iswlower( wchar_16 c ) +PAL_iswlower( char16_t c ) { BOOL bRetVal = FALSE; #if HAVE_COREFOUNDATION @@ -1004,7 +1004,7 @@ See MSDN --*/ int __cdecl -PAL_iswalpha( wchar_16 c ) +PAL_iswalpha( char16_t c ) { PERF_ENTRY(iswalpha); ENTRY( "PAL_iswalpha (c=%d)\n", c); @@ -1029,13 +1029,13 @@ PAL_iswalpha( wchar_16 c ) See MSDN or the man page for mcscat. --*/ -wchar_16 * +char16_t * __cdecl PAL_wcscat( - wchar_16 *strDestination, - const wchar_16 *strSource) + char16_t *strDestination, + const char16_t *strSource) { - wchar_16 *ret; + char16_t *ret; PERF_ENTRY(wcscat); ENTRY("wcscat (strDestination=%p (%S), strSource=%p (%S))\n", strDestination?strDestination:W16_NULLSTRING, @@ -1043,7 +1043,7 @@ PAL_wcscat( ret = PAL_wcsncat( strDestination, strSource, PAL_wcslen( strSource ) ); - LOGEXIT("wcscat returnng wchar_t %p (%S)\n", ret, ret); + LOGEXIT("wcscat returnng char16_t %p (%S)\n", ret, ret); PERF_EXIT(wcscat); return ret; } @@ -1056,13 +1056,13 @@ PAL_wcscat( See MSDN or the man page for mcscpy. --*/ -wchar_16 * +char16_t * __cdecl PAL_wcscpy( - wchar_16 *strDestination, - const wchar_16 *strSource) + char16_t *strDestination, + const char16_t *strSource) { - wchar_16 *start = strDestination; + char16_t *start = strDestination; PERF_ENTRY(wcscpy); ENTRY("wcscpy (strDestination=%p, strSource=%p (%S))\n", @@ -1071,7 +1071,7 @@ PAL_wcscpy( if (strDestination == NULL) { ERROR("invalid strDestination argument\n"); - LOGEXIT("wcscpy returning wchar_t NULL\n"); + LOGEXIT("wcscpy returning char16_t NULL\n"); PERF_EXIT(wcscpy); return NULL; } @@ -1079,7 +1079,7 @@ PAL_wcscpy( if (strSource == NULL) { ERROR("invalid strSource argument\n"); - LOGEXIT("wcscpy returning wchar_t NULL\n"); + LOGEXIT("wcscpy returning char16_t NULL\n"); PERF_EXIT(wcscpy); return NULL; } @@ -1093,7 +1093,7 @@ PAL_wcscpy( /* add terminating null */ *strDestination = '\0'; - LOGEXIT("wcscpy returning wchar_t %p (%S)\n", start, start); + LOGEXIT("wcscpy returning char16_t %p (%S)\n", start, start); PERF_EXIT(wcscpy); return start; } @@ -1109,7 +1109,7 @@ See MSDN or the man page for wcslen. size_t __cdecl PAL_wcslen( - const wchar_16 *string) + const char16_t *string) { size_t nChar = 0; @@ -1141,8 +1141,8 @@ See MSDN or the man page for wmemcmp. int __cdecl PAL_wmemcmp( - const wchar_16 *string1, - const wchar_16 *string2, + const char16_t *string1, + const char16_t *string2, size_t count) { size_t i; @@ -1176,8 +1176,8 @@ See MSDN or the man page for wcsncmp. int __cdecl PAL_wcsncmp( - const wchar_16 *string1, - const wchar_16 *string2, + const char16_t *string1, + const char16_t *string2, size_t count) { size_t i; @@ -1217,8 +1217,8 @@ See MSDN or the man page for wcscmp. int __cdecl PAL_wcscmp( - const wchar_16 *string1, - const wchar_16 *string2) + const char16_t *string1, + const char16_t *string2) { int ret; @@ -1241,11 +1241,11 @@ PAL_wcscmp( See MSDN or man page for wcschr. --*/ -wchar_16 _WConst_return * +char16_t _WConst_return * __cdecl PAL_wcschr( - const wchar_16 * string, - wchar_16 c) + const char16_t * string, + char16_t c) { PERF_ENTRY(wcschr); ENTRY("wcschr (string=%p (%S), c=%C)\n", string?string:W16_NULLSTRING, string?string:W16_NULLSTRING, c); @@ -1254,18 +1254,18 @@ PAL_wcschr( { if (*string == c) { - LOGEXIT("wcschr returning wchar_t %p (%S)\n", string?string:W16_NULLSTRING, string?string:W16_NULLSTRING); + LOGEXIT("wcschr returning char16_t %p (%S)\n", string?string:W16_NULLSTRING, string?string:W16_NULLSTRING); PERF_EXIT(wcschr); - return (wchar_16 *) string; + return (char16_t *) string; } string++; } // Check if the comparand was \000 if (*string == c) - return (wchar_16 *) string; + return (char16_t *) string; - LOGEXIT("wcschr returning wchar_t NULL\n"); + LOGEXIT("wcschr returning char16_t NULL\n"); PERF_EXIT(wcschr); return NULL; } @@ -1278,13 +1278,13 @@ PAL_wcschr( See MSDN or man page for wcsrchr. --*/ -wchar_16 _WConst_return * +char16_t _WConst_return * __cdecl PAL_wcsrchr( - const wchar_16 * string, - wchar_16 c) + const char16_t * string, + char16_t c) { - wchar_16 *last = NULL; + char16_t *last = NULL; PERF_ENTRY(wcsrchr); ENTRY("wcsrchr (string=%p (%S), c=%C)\n", string?string:W16_NULLSTRING, string?string:W16_NULLSTRING, c); @@ -1293,14 +1293,14 @@ PAL_wcsrchr( { if (*string == c) { - last = (wchar_16 *) string; + last = (char16_t *) string; } string++; } - LOGEXIT("wcsrchr returning wchar_t %p (%S)\n", last?last:W16_NULLSTRING, last?last:W16_NULLSTRING); + LOGEXIT("wcsrchr returning char16_t %p (%S)\n", last?last:W16_NULLSTRING, last?last:W16_NULLSTRING); PERF_EXIT(wcsrchr); - return (wchar_16 *)last; + return (char16_t *)last; } @@ -1312,7 +1312,7 @@ See MSDN or man page for wcspbrk. --*/ size_t __cdecl -PAL_wcsspn (const wchar_16 *string, const wchar_16 *stringCharSet) +PAL_wcsspn (const char16_t *string, const char16_t *stringCharSet) { ASSERT(0); return 0; @@ -1325,11 +1325,11 @@ PAL_wcsspn (const wchar_16 *string, const wchar_16 *stringCharSet) See MSDN or man page for wcspbrk. --*/ -const wchar_16 * +const char16_t * __cdecl PAL_wcspbrk( - const wchar_16 *string, - const wchar_16 *strCharSet) + const char16_t *string, + const char16_t *strCharSet) { PERF_ENTRY(wcspbrk); ENTRY("wcspbrk (string=%p (%S), strCharSet=%p (%S))\n", @@ -1340,15 +1340,15 @@ PAL_wcspbrk( { if (PAL_wcschr(strCharSet, *string) != NULL) { - LOGEXIT("wcspbrk returning wchar_t %p (%S)\n", string?string:W16_NULLSTRING, string?string:W16_NULLSTRING); + LOGEXIT("wcspbrk returning char16_t %p (%S)\n", string?string:W16_NULLSTRING, string?string:W16_NULLSTRING); PERF_EXIT(wcspbrk); - return (wchar_16 *) string; + return (char16_t *) string; } string++; } - LOGEXIT("wcspbrk returning wchar_t NULL\n"); + LOGEXIT("wcspbrk returning char16_t NULL\n"); PERF_EXIT(wcspbrk); return NULL; } @@ -1360,13 +1360,13 @@ PAL_wcspbrk( See MSDN or man page for wcsstr. --*/ -const wchar_16 * +const char16_t * __cdecl PAL_wcsstr( - const wchar_16 *string, - const wchar_16 *strCharSet) + const char16_t *string, + const char16_t *strCharSet) { - wchar_16 *ret = NULL; + char16_t *ret = NULL; int i; PERF_ENTRY(wcsstr); @@ -1388,7 +1388,7 @@ PAL_wcsstr( if (*strCharSet == 0) { - ret = (wchar_16 *)string; + ret = (char16_t *)string; goto leave; } @@ -1399,7 +1399,7 @@ PAL_wcsstr( { if (*(string + i) == 0 || *(strCharSet + i) == 0) { - ret = (wchar_16 *) string; + ret = (char16_t *) string; goto leave; } if (*(string + i) != *(strCharSet + i)) @@ -1412,7 +1412,7 @@ PAL_wcsstr( } leave: - LOGEXIT("wcsstr returning wchar_t %p (%S)\n", ret?ret:W16_NULLSTRING, ret?ret:W16_NULLSTRING); + LOGEXIT("wcsstr returning char16_t %p (%S)\n", ret?ret:W16_NULLSTRING, ret?ret:W16_NULLSTRING); PERF_EXIT(wcsstr); return ret; } @@ -1424,20 +1424,20 @@ Function : see msdn doc. --*/ -wchar_16 * +char16_t * __cdecl -PAL_wcsncpy( wchar_16 * strDest, const wchar_16 *strSource, size_t count ) +PAL_wcsncpy( char16_t * strDest, const char16_t *strSource, size_t count ) { - UINT length = sizeof( wchar_16 ) * count; + UINT length = sizeof( char16_t ) * count; PERF_ENTRY(wcsncpy); ENTRY("wcsncpy( strDest:%p, strSource:%p (%S), count:%lu)\n", strDest, strSource, strSource, (unsigned long) count); memset( strDest, 0, length ); - length = min( count, PAL_wcslen( strSource ) ) * sizeof( wchar_16 ); + length = min( count, PAL_wcslen( strSource ) ) * sizeof( char16_t ); memcpy( strDest, strSource, length ); - LOGEXIT("wcsncpy returning (wchar_16*): %p\n", strDest); + LOGEXIT("wcsncpy returning (char16_t*): %p\n", strDest); PERF_EXIT(wcsncpy); return strDest; } @@ -1449,11 +1449,11 @@ Function : see msdn doc. --*/ -wchar_16 * +char16_t * __cdecl -PAL_wcsncat( wchar_16 * strDest, const wchar_16 *strSource, size_t count ) +PAL_wcsncat( char16_t * strDest, const char16_t *strSource, size_t count ) { - wchar_16 *start = strDest; + char16_t *start = strDest; UINT LoopCount = 0; UINT StrSourceLength = 0; @@ -1467,7 +1467,7 @@ PAL_wcsncat( wchar_16 * strDest, const wchar_16 *strSource, size_t count ) if ( strDest == NULL ) { ERROR("invalid strDest argument\n"); - LOGEXIT("wcsncat returning wchar_t NULL\n"); + LOGEXIT("wcsncat returning char16_t NULL\n"); PERF_EXIT(wcsncat); return NULL; } @@ -1475,7 +1475,7 @@ PAL_wcsncat( wchar_16 * strDest, const wchar_16 *strSource, size_t count ) if ( strSource == NULL ) { ERROR("invalid strSource argument\n"); - LOGEXIT("wcsncat returning wchar_t NULL\n"); + LOGEXIT("wcsncat returning char16_t NULL\n"); PERF_EXIT(wcsncat); return NULL; } @@ -1502,7 +1502,7 @@ PAL_wcsncat( wchar_16 * strDest, const wchar_16 *strSource, size_t count ) /* add terminating null */ *strDest = '\0'; - LOGEXIT("wcsncat returning wchar_t %p (%S)\n", start, start); + LOGEXIT("wcsncat returning char16_t %p (%S)\n", start, start); PERF_EXIT(wcsncat); return start; } @@ -1532,7 +1532,7 @@ see msdn doc. --*/ double __cdecl -PAL_wcstod( const wchar_16 * nptr, wchar_16 **endptr ) +PAL_wcstod( const char16_t * nptr, char16_t **endptr ) { double RetVal = 0.0; LPSTR lpStringRep = NULL; @@ -1627,9 +1627,9 @@ Function : See MSDN for more details. --*/ -wchar_16 * +char16_t * __cdecl -_ui64tow( unsigned __int64 value , wchar_16 * string , int radix ) +_ui64tow( unsigned __int64 value , char16_t * string , int radix ) { UINT ReversedIndex = 0; WCHAR ReversedString[ 65 ]; @@ -1700,7 +1700,7 @@ See MSDN for more details. --*/ int __cdecl -PAL_iswdigit( wchar_16 c ) +PAL_iswdigit( char16_t c ) { UINT nRetVal = 0; #if HAVE_COREFOUNDATION @@ -1756,7 +1756,7 @@ numbers and letters are considered as "hex"; other "numbers" --*/ int __cdecl -PAL_iswxdigit( wchar_16 c ) +PAL_iswxdigit( char16_t c ) { UINT nRetVal = 0; @@ -1797,7 +1797,7 @@ See MSDN for more details. --*/ int __cdecl -PAL_iswprint( wchar_16 c ) +PAL_iswprint( char16_t c ) { int ret; @@ -1832,9 +1832,9 @@ strCharSet Set of delimiter characters --*/ size_t __cdecl -PAL_wcscspn(const wchar_16 *string, const wchar_16 *strCharSet) +PAL_wcscspn(const char16_t *string, const char16_t *strCharSet) { - const wchar_16 *temp; + const char16_t *temp; size_t count = 0; PERF_ENTRY(wcscspn); @@ -1865,7 +1865,7 @@ Returns TRUE if c is a Win32 "blank" character. --*/ int __cdecl -PAL_iswblank(wchar_16 c) +PAL_iswblank(char16_t c) { int ret; static CFCharacterSetRef sSpaceAndNewlineSet; @@ -1906,7 +1906,7 @@ Returns TRUE if c is a control character. --*/ int __cdecl -PAL_iswcntrl(wchar_16 c) +PAL_iswcntrl(char16_t c) { int ret; static CFCharacterSetRef sControlSet; @@ -1927,7 +1927,7 @@ Returns TRUE if c is a punctuation character. --*/ int __cdecl -PAL_iswpunct(wchar_16 c) +PAL_iswpunct(char16_t c) { int ret; static CFCharacterSetRef sPunctuationSet = NULL; diff --git a/pal/src/debug/debug.cpp b/pal/src/debug/debug.cpp index fa8aa3848ff..1d30f42b54f 100644 --- a/pal/src/debug/debug.cpp +++ b/pal/src/debug/debug.cpp @@ -362,7 +362,7 @@ DebugBreakCommand() if (snprintf (pid_buf, sizeof (pid_buf), PID_TEXT "%d", getpid()) <= 0) { goto FAILED; } - if (snprintf (exe_buf, sizeof (CHAR) * (dwexe_buf + 1), EXE_TEXT "%ls", (wchar_t *)exe_module.lib_name) <= 0) { + if (snprintf (exe_buf, sizeof (CHAR) * (dwexe_buf + 1), EXE_TEXT "%ls", (char16_t *)exe_module.lib_name) <= 0) { goto FAILED; } diff --git a/pal/src/include/pal/cruntime.h b/pal/src/include/pal/cruntime.h index 56129de4df9..75b87eb49df 100644 --- a/pal/src/include/pal/cruntime.h +++ b/pal/src/include/pal/cruntime.h @@ -27,7 +27,6 @@ Module Name: #include #ifdef __cplusplus -typedef char16_t wchar_16; // __wchar_16 (which is defined in palinternal.h) is defined as wchar_16_cpp. extern "C" { @@ -158,7 +157,7 @@ int Silent_PAL_vfprintf(PAL_FILE *stream, const char *format, va_list ap); See MSDN --*/ -int __cdecl PAL_iswlower( wchar_16 c ); +int __cdecl PAL_iswlower( char16_t c ); /*++ @@ -168,7 +167,7 @@ int __cdecl PAL_iswlower( wchar_16 c ); See MSDN --*/ -int __cdecl PAL_iswalpha( wchar_16 c ); +int __cdecl PAL_iswalpha( char16_t c ); #if HAVE_COREFOUNDATION /*-- @@ -177,7 +176,7 @@ int __cdecl PAL_iswalpha( wchar_16 c ); Returns TRUE if c is a Win32 "blank" character. --*/ -int __cdecl PAL_iswblank(wchar_16 c); +int __cdecl PAL_iswblank(char16_t c); /*-- Function: @@ -185,7 +184,7 @@ int __cdecl PAL_iswblank(wchar_16 c); Returns TRUE if c is a control character. --*/ -int __cdecl PAL_iswcntrl(wchar_16 c); +int __cdecl PAL_iswcntrl(char16_t c); /*-- Function: @@ -193,7 +192,7 @@ int __cdecl PAL_iswcntrl(wchar_16 c); Returns TRUE if c is a control character. --*/ -int __cdecl PAL_iswpunct(wchar_16 c); +int __cdecl PAL_iswpunct(char16_t c); #endif // HAVE_COREFOUNDATION /*++ diff --git a/pal/src/include/pal/palinternal.h b/pal/src/include/pal/palinternal.h index 432e8fdfd3c..9bbe9f4feab 100644 --- a/pal/src/include/pal/palinternal.h +++ b/pal/src/include/pal/palinternal.h @@ -311,8 +311,6 @@ function_name() to call the system's implementation #undef va_copy #endif -#define wchar_t char16_t - #define ptrdiff_t PAL_ptrdiff_t #define intptr_t PAL_intptr_t #define uintptr_t PAL_uintptr_t @@ -464,7 +462,6 @@ function_name() to call the system's implementation #undef floor #undef modff -#undef wchar_t #undef ptrdiff_t #undef intptr_t #undef uintptr_t @@ -552,7 +549,6 @@ function_name() to call the system's implementation #undef siglongjmp #undef _SIZE_T_DEFINED -#undef _WCHAR_T_DEFINED #define _DONT_USE_CTYPE_INLINE_ #if HAVE_RUNETYPE_H diff --git a/pal/src/include/pal/printfcpp.hpp b/pal/src/include/pal/printfcpp.hpp index 22e107094eb..de6b35fb01a 100644 --- a/pal/src/include/pal/printfcpp.hpp +++ b/pal/src/include/pal/printfcpp.hpp @@ -28,7 +28,6 @@ Module Name: #include #ifdef __cplusplus -typedef char16_t wchar_16; // __wchar_16_cpp (which is defined in palinternal.h) needs to be redefined to wchar_16. extern "C" { @@ -59,7 +58,7 @@ extern "C" __cdecl PAL_vfwprintf( PAL_FILE *stream, - const wchar_16 *format, + const char16_t *format, va_list ap); } @@ -92,7 +91,7 @@ namespace CorUnix InternalVfwprintf( CPalThread *pthrCurrent, PAL_FILE *stream, - const wchar_16 *format, + const char16_t *format, va_list ap); } @@ -125,10 +124,9 @@ namespace CorUnix __cdecl PAL_vfwprintf( PAL_FILE *stream, - const wchar_16 *format, + const char16_t *format, va_list ap); #endif // __cplusplus #endif // _PRINTFCPP_HPP - diff --git a/pal/src/locale/unicode.cpp b/pal/src/locale/unicode.cpp index 305154397e2..297fefb5b89 100644 --- a/pal/src/locale/unicode.cpp +++ b/pal/src/locale/unicode.cpp @@ -432,7 +432,7 @@ GetStringTypeExW( UnicodeDataRec unicodeDataRec; #endif /* !HAVE_COREFOUNDATION */ BOOL bRet = TRUE; - wchar_t wcstr ; + char16_t wcstr ; PERF_ENTRY(GetStringTypeExW); ENTRY("GetStringTypeExW(Locale=%#x, dwInfoType=%#x, lpSrcStr=%p (%S), " "cchSrc=%d, lpCharType=%p)\n", diff --git a/pal/src/misc/dbgmsg.cpp b/pal/src/misc/dbgmsg.cpp index d902a149351..14c674d9b38 100644 --- a/pal/src/misc/dbgmsg.cpp +++ b/pal/src/misc/dbgmsg.cpp @@ -801,7 +801,7 @@ int DBG_change_entrylevel(int new_level) Wires up stack alignment checks (debug builds only) --*/ -static const char * PAL_CHECK_ALIGNMENT_MODE PAL_GLOBAL = "PAL_CheckAlignmentMode"; +#define PAL_CHECK_ALIGNMENT_MODE "PAL_CheckAlignmentMode" enum CheckAlignmentMode { // special value to indicate we've not initialized yet diff --git a/pal/src/safecrt/input.inl b/pal/src/safecrt/input.inl index 0e01f6b9454..b794b545d6d 100644 --- a/pal/src/safecrt/input.inl +++ b/pal/src/safecrt/input.inl @@ -270,7 +270,7 @@ static int __check_float_string(size_t nFloatStrUsed, #ifndef _UNICODE - wchar_t wctemp=L'\0'; + char16_t wctemp=L'\0'; #endif /* _UNICODE */ _TUCHAR *scanptr; /* for building "table" data */ int ch = 0; @@ -296,7 +296,7 @@ static int __check_float_string(size_t nFloatStrUsed, #if _INTEGRAL_MAX_BITS >= 64 int integer64; /* 1 for 64-bit integer, 0 otherwise */ #endif /* _INTEGRAL_MAX_BITS >= 64 */ - signed char widechar; /* -1 = char, 0 = ????, 1 = wchar_t */ + signed char widechar; /* -1 = char, 0 = ????, 1 = char16_t */ char reject; /* %[^ABC] instead of %[ABC] */ char negative; /* flag for '-' detected */ char suppress; /* don't assign anything */ @@ -523,7 +523,7 @@ DEFAULT_LABEL: if(array_width < 1) { if (widechar > 0) - *(wchar_t UNALIGNED *)pointer = L'\0'; + *(char16_t UNALIGNED *)pointer = L'\0'; else *(char *)pointer = '\0'; @@ -686,17 +686,17 @@ scanit: } #endif /* 0 */ _MBTOWC(&wctemp, temp, MB_CUR_MAX); - *(wchar_t UNALIGNED *)pointer = wctemp; + *(char16_t UNALIGNED *)pointer = wctemp; /* just copy L'?' if mbtowc fails, errno is set by mbtowc */ - pointer = (wchar_t *)pointer + 1; + pointer = (char16_t *)pointer + 1; #ifdef _SECURE_SCANF --array_width; #endif /* _SECURE_SCANF */ } else #else /* _UNICODE */ if (fl_wchar_arg) { - *(wchar_t UNALIGNED *)pointer = ch; - pointer = (wchar_t *)pointer + 1; + *(char16_t UNALIGNED *)pointer = ch; + pointer = (char16_t *)pointer + 1; #ifdef _SECURE_SCANF --array_width; #endif /* _SECURE_SCANF */ @@ -771,7 +771,7 @@ _END_SECURE_CRT_DEPRECATION_DISABLE /* In case of error, blank out the input buffer */ if (fl_wchar_arg) { - _RESET_STRING(((wchar_t UNALIGNED *)start), original_array_width); + _RESET_STRING(((char16_t UNALIGNED *)start), original_array_width); } else { @@ -789,10 +789,10 @@ _END_SECURE_CRT_DEPRECATION_DISABLE { if (fl_wchar_arg) { - *(wchar_t UNALIGNED *)pointer = L'\0'; + *(char16_t UNALIGNED *)pointer = L'\0'; #ifdef _SECURE_SCANF - _FILL_STRING(((wchar_t UNALIGNED *)start), original_array_width, - ((wchar_t UNALIGNED *)pointer - (wchar_t UNALIGNED *)start + 1)) + _FILL_STRING(((char16_t UNALIGNED *)start), original_array_width, + ((char16_t UNALIGNED *)pointer - (char16_t UNALIGNED *)start + 1)) #endif /* _SECURE_SCANF */ } else diff --git a/pal/src/safecrt/internal.h b/pal/src/safecrt/internal.h index d32069833ab..dd00ac3b5ff 100644 --- a/pal/src/safecrt/internal.h +++ b/pal/src/safecrt/internal.h @@ -276,7 +276,7 @@ extern void **__piob; FILE * __cdecl _getstream(void); FILE * __cdecl _openfile(__in_z const char * _Filename, __in_z const char * _Mode, __in int _ShFlag, __out FILE * _File); -FILE * __cdecl _wopenfile(__in_z const wchar_t * _Filename, __in_z const wchar_t * _Mode, __in int _ShFlag, __out FILE * _File); +FILE * __cdecl _wopenfile(__in_z const char16_t * _Filename, __in_z const char16_t * _Mode, __in int _ShFlag, __out FILE * _File); void __cdecl _getbuf(__out FILE * _File); int __cdecl _filwbuf (__inout FILE * _File); int __cdecl _flswbuf(__in int _Ch, __inout FILE * _File); @@ -287,44 +287,44 @@ void __cdecl _ftbuf(int _Flag, __inout FILE * _File); #ifdef _SAFECRT_IMPL int __cdecl _output(__inout FILE * _File, __in_z __format_string const char *_Format, va_list _ArgList); -int __cdecl _woutput(__inout FILE * _File, __in_z __format_string const wchar_t *_Format, va_list _ArgList); +int __cdecl _woutput(__inout FILE * _File, __in_z __format_string const char16_t *_Format, va_list _ArgList); int __cdecl _output_s(__inout FILE * _File, __in_z __format_string const char *_Format, va_list _ArgList); int __cdecl _output_p(__inout FILE * _File, __in_z __format_string const char *_Format, va_list _ArgList); -int __cdecl _woutput_s(__inout FILE * _File, __in_z __format_string const wchar_t *_Format, va_list _ArgList); -int __cdecl _woutput_p(__inout FILE * _File, __in_z __format_string const wchar_t *_Format, va_list _ArgList); +int __cdecl _woutput_s(__inout FILE * _File, __in_z __format_string const char16_t *_Format, va_list _ArgList); +int __cdecl _woutput_p(__inout FILE * _File, __in_z __format_string const char16_t *_Format, va_list _ArgList); typedef int (*OUTPUTFN)(FILE *, const char *, va_list); -typedef int (*WOUTPUTFN)(FILE *, const wchar_t *, va_list); +typedef int (*WOUTPUTFN)(FILE *, const char16_t *, va_list); #else /* _SAFECRT_IMPL */ int __cdecl _output_l(__inout FILE * _File, __in_z __format_string const char *_Format, __in_opt _locale_t _Locale, va_list _ArgList); -int __cdecl _woutput_l(__inout FILE * _File, __in_z __format_string const wchar_t *_Format, __in_opt _locale_t _Locale, va_list _ArgList); +int __cdecl _woutput_l(__inout FILE * _File, __in_z __format_string const char16_t *_Format, __in_opt _locale_t _Locale, va_list _ArgList); int __cdecl _output_s_l(__inout FILE * _File, __in_z __format_string const char *_Format, __in_opt _locale_t _Locale, va_list _ArgList); int __cdecl _output_p_l(__inout FILE * _File, __in_z __format_string const char *_Format, __in_opt _locale_t _Locale, va_list _ArgList); -int __cdecl _woutput_s_l(__inout FILE * _File, __in_z __format_string const wchar_t *_Format, __in_opt _locale_t _Locale, va_list _ArgList); -int __cdecl _woutput_p_l(__inout FILE * _File, __in_z __format_string const wchar_t *_Format, __in_opt _locale_t _Locale, va_list _ArgList); +int __cdecl _woutput_s_l(__inout FILE * _File, __in_z __format_string const char16_t *_Format, __in_opt _locale_t _Locale, va_list _ArgList); +int __cdecl _woutput_p_l(__inout FILE * _File, __in_z __format_string const char16_t *_Format, __in_opt _locale_t _Locale, va_list _ArgList); typedef int (*OUTPUTFN)(__inout FILE * _File, const char *, _locale_t, va_list); -typedef int (*WOUTPUTFN)(__inout FILE * _File, const wchar_t *, _locale_t, va_list); +typedef int (*WOUTPUTFN)(__inout FILE * _File, const char16_t *, _locale_t, va_list); #endif /* _SAFECRT_IMPL */ #ifdef _SAFECRT_IMPL int __cdecl _input(__in FILE * _File, __in_z __format_string const unsigned char * _Format, va_list _ArgList); -int __cdecl _winput(__in FILE * _File, __in_z __format_string const wchar_t * _Format, va_list _ArgList); +int __cdecl _winput(__in FILE * _File, __in_z __format_string const char16_t * _Format, va_list _ArgList); int __cdecl _input_s(__in FILE * _File, __in_z __format_string const unsigned char * _Format, va_list _ArgList); -int __cdecl _winput_s(__in FILE * _File, __in_z __format_string const wchar_t * _Format, va_list _ArgList); +int __cdecl _winput_s(__in FILE * _File, __in_z __format_string const char16_t * _Format, va_list _ArgList); typedef int (*INPUTFN)(FILE *, const unsigned char *, va_list); -typedef int (*WINPUTFN)(FILE *, const wchar_t *, va_list); +typedef int (*WINPUTFN)(FILE *, const char16_t *, va_list); #else /* _SAFECRT_IMPL */ int __cdecl _input_l(__inout FILE * _File, __in_z __format_string const unsigned char *, __in_opt _locale_t _Locale, va_list _ArgList); -int __cdecl _winput_l(__inout FILE * _File, __in_z __format_string const wchar_t *, __in_opt _locale_t _Locale, va_list _ArgList); +int __cdecl _winput_l(__inout FILE * _File, __in_z __format_string const char16_t *, __in_opt _locale_t _Locale, va_list _ArgList); int __cdecl _input_s_l(__inout FILE * _File, __in_z __format_string const unsigned char *, __in_opt _locale_t _Locale, va_list _ArgList); -int __cdecl _winput_s_l(__inout FILE * _File, __in_z __format_string const wchar_t *, __in_opt _locale_t _Locale, va_list _ArgList); +int __cdecl _winput_s_l(__inout FILE * _File, __in_z __format_string const char16_t *, __in_opt _locale_t _Locale, va_list _ArgList); typedef int (*INPUTFN)(FILE *, const unsigned char *, _locale_t, va_list); -typedef int (*WINPUTFN)(FILE *, const wchar_t *, _locale_t, va_list); +typedef int (*WINPUTFN)(FILE *, const char16_t *, _locale_t, va_list); #ifdef _UNICODE #define TINPUTFN WINPUTFN @@ -340,7 +340,7 @@ void __cdecl _endstdio(void); errno_t __cdecl _sopen_helper(__in_z const char * _Filename, __in int _OFlag, __in int _ShFlag, __in int _PMode, __out int * _PFileHandle, int _BSecure); -errno_t __cdecl _wsopen_helper(__in_z const wchar_t * _Filename, +errno_t __cdecl _wsopen_helper(__in_z const char16_t * _Filename, __in int _OFlag, __in int _ShFlag, __in int _PMode, __out int * _PFileHandle, int _BSecure); @@ -361,7 +361,7 @@ extern char _exitflag; /* callable termination flag */ extern int _C_Termination_Done; /* termination done flag */ char * __cdecl _getpath(__in_z const char * _Src, __out_ecount_z(_SizeInChars) char * _Dst, __in size_t _SizeInChars); -wchar_t * __cdecl _wgetpath(__in_z const wchar_t * _Src, __out_ecount_z(_SizeInWords) wchar_t * _Dst, __in size_t _SizeInWords); +char16_t * __cdecl _wgetpath(__in_z const char16_t * _Src, __out_ecount_z(_SizeInWords) char16_t * _Dst, __in size_t _SizeInWords); extern int _dowildcard; /* flag to enable argv[] wildcard expansion */ @@ -385,7 +385,7 @@ extern int _newmode; /* malloc new() handler mode */ /* pointer to initial environment block that is passed to [w]main */ #ifndef _M_CEE_PURE -extern _CRTIMP wchar_t **__winitenv; +extern _CRTIMP char16_t **__winitenv; extern _CRTIMP char **__initenv; #endif /* _M_CEE_PURE */ @@ -394,17 +394,17 @@ extern _CRTIMP char **__initenv; /* startup set values */ extern char *_aenvptr; /* environment ptr */ -extern wchar_t *_wenvptr; /* wide environment ptr */ +extern char16_t *_wenvptr; /* wide environment ptr */ /* command line */ #if defined (_DLL) _CRTIMP char ** __cdecl __p__acmdln(void); -_CRTIMP wchar_t ** __cdecl __p__wcmdln(void); +_CRTIMP char16_t ** __cdecl __p__wcmdln(void); #endif /* defined (_DLL) */ #ifndef _M_CEE_PURE _CRTIMP extern char *_acmdln; -_CRTIMP extern wchar_t *_wcmdln; +_CRTIMP extern char16_t *_wcmdln; #else /* _M_CEE_PURE */ #define _acmdln (*__p__acmdln()) #define _wcmdln (*__p__wcmdln()) @@ -476,7 +476,7 @@ int __cdecl __initmbctable(void); /* mbctype.c */ #ifndef _MANAGED_MAIN int __CRTDECL main(__in int _Argc, __in_ecount_z(_Argc) char ** _Argv, __in_z char ** _Env); -int __CRTDECL wmain(__in int _Argc, __in_ecount_z(_Argc) wchar_t ** _Argv, __in_z wchar_t ** _Env); +int __CRTDECL wmain(__in int _Argc, __in_ecount_z(_Argc) char16_t ** _Argv, __in_z char16_t ** _Env); #endif /* _MANAGED_MAIN */ /* helper functions for wide/multibyte environment conversion */ @@ -486,11 +486,11 @@ int __cdecl __wtomb_environ (void); /* These two functions take a char ** for the environment option At some point during their execution, they take ownership of the memory block passed in using option. At this point, they - NULL out the incoming char * / wchar_t * to ensure there is no + NULL out the incoming char * / char16_t * to ensure there is no double-free */ int __cdecl __crtsetenv (__deref_inout_opt char ** _POption, __in const int _Primary); -int __cdecl __crtwsetenv (__deref_inout_opt wchar_t ** _POption, __in const int _Primary); +int __cdecl __crtwsetenv (__deref_inout_opt char16_t ** _POption, __in const int _Primary); #ifndef _M_CEE_PURE _CRTIMP extern void (__cdecl * _aexit_rtn)(int); @@ -510,8 +510,8 @@ _CRTIMP int __cdecl __getmainargs(__out int * _Argc, __deref_out_ecount(*_Argc) __deref_out_opt char *** _Env, __in int _DoWildCard, __in _startupinfo * _StartInfo); -_CRTIMP int __cdecl __wgetmainargs(__out int * _Argc, __deref_out_ecount(*_Argc)wchar_t *** _Argv, - __deref_out_opt wchar_t *** _Env, __in int _DoWildCard, +_CRTIMP int __cdecl __wgetmainargs(__out int * _Argc, __deref_out_ecount(*_Argc)char16_t *** _Argv, + __deref_out_opt char16_t *** _Env, __in int _DoWildCard, __in _startupinfo * _StartInfo); #endif /* defined (_DLL) || defined (CRTDLL) */ @@ -626,14 +626,14 @@ extern int __cdecl _get_errno_from_oserr(unsigned long); */ extern intptr_t __cdecl _dospawn(__in int _Mode, __in_z_opt const char * _Name, __inout_z char * _Cmd, __in_z_opt char * _Env); -extern intptr_t __cdecl _wdospawn(__in int _Mode, __in_z_opt const wchar_t * _Name, __inout_z wchar_t * _Cmd, __in_z_opt wchar_t * _Env); +extern intptr_t __cdecl _wdospawn(__in int _Mode, __in_z_opt const char16_t * _Name, __inout_z char16_t * _Cmd, __in_z_opt char16_t * _Env); extern int __cdecl _cenvarg(__in_z const char * const * _Argv, __in_z_opt const char * const * _Env, __deref_out_opt char ** _ArgBlk, __deref_out_opt char ** _EnvBlk, __in_z const char *_Name); -extern int __cdecl _wcenvarg(__in_z const wchar_t * const * _Argv, __in_z_opt const wchar_t * const * _Env, - __deref_out_opt wchar_t ** _ArgBlk, __deref_out_opt wchar_t ** _EnvBlk, __in_z const wchar_t * _Name); +extern int __cdecl _wcenvarg(__in_z const char16_t * const * _Argv, __in_z_opt const char16_t * const * _Env, + __deref_out_opt char16_t ** _ArgBlk, __deref_out_opt char16_t ** _EnvBlk, __in_z const char16_t * _Name); #ifndef _M_IX86 extern char ** _capture_argv(__in va_list *, __in_z const char * _FirstArg, __out_ecount_z(_MaxCount) char ** _Static_argv, __in size_t _MaxCount); -extern wchar_t ** _wcapture_argv(__in va_list *, __in_z const wchar_t * _FirstArg, __out_ecount_z(_MaxCount) wchar_t ** _Static_argv, __in size_t _MaxCount); +extern char16_t ** _wcapture_argv(__in va_list *, __in_z const char16_t * _FirstArg, __out_ecount_z(_MaxCount) char16_t ** _Static_argv, __in size_t _MaxCount); #endif /* _M_IX86 */ /* @@ -690,23 +690,23 @@ typedef LONG NTSTATUS; #ifndef _SAFECRT_IMPL /* _invalid_parameter is already defined in safecrt.h and safecrt.lib */ -#if !defined (_NATIVE_WCHAR_T_DEFINED) && defined (_M_CEE_PURE) +#if !defined (_NATIVE_char16_t_DEFINED) && defined (_M_CEE_PURE) extern "C++" -#endif /* !defined (_NATIVE_WCHAR_T_DEFINED) && defined (_M_CEE_PURE) */ +#endif /* !defined (_NATIVE_char16_t_DEFINED) && defined (_M_CEE_PURE) */ _CRTIMP #endif /* _SAFECRT_IMPL */ -void __cdecl _invalid_parameter(__in_z_opt const wchar_t *, __in_z_opt const wchar_t *, __in_z_opt const wchar_t *, unsigned int, uintptr_t); +void __cdecl _invalid_parameter(__in_z_opt const char16_t *, __in_z_opt const char16_t *, __in_z_opt const char16_t *, unsigned int, uintptr_t); -#if !defined (_NATIVE_WCHAR_T_DEFINED) && defined (_M_CEE_PURE) +#if !defined (_NATIVE_char16_t_DEFINED) && defined (_M_CEE_PURE) extern "C++" -#endif /* !defined (_NATIVE_WCHAR_T_DEFINED) && defined (_M_CEE_PURE) */ +#endif /* !defined (_NATIVE_char16_t_DEFINED) && defined (_M_CEE_PURE) */ _CRTIMP -void __cdecl _invoke_watson(__in_z_opt const wchar_t *, __in_z_opt const wchar_t *, __in_z_opt const wchar_t *, unsigned int, uintptr_t); +void __cdecl _invoke_watson(__in_z_opt const char16_t *, __in_z_opt const char16_t *, __in_z_opt const char16_t *, unsigned int, uintptr_t); #ifndef _DEBUG -#if !defined (_NATIVE_WCHAR_T_DEFINED) && defined (_M_CEE_PURE) +#if !defined (_NATIVE_char16_t_DEFINED) && defined (_M_CEE_PURE) extern "C++" -#endif /* !defined (_NATIVE_WCHAR_T_DEFINED) && defined (_M_CEE_PURE) */ +#endif /* !defined (_NATIVE_char16_t_DEFINED) && defined (_M_CEE_PURE) */ _CRTIMP void __cdecl _invalid_parameter_noinfo(void); #endif /* _DEBUG */ @@ -715,9 +715,9 @@ void __cdecl _invalid_parameter_noinfo(void); __forceinline void _invoke_watson_if_error( errno_t _ExpressionError, - const wchar_t *_Expression, - const wchar_t *_Function, - const wchar_t *_File, + const char16_t *_Expression, + const char16_t *_Function, + const char16_t *_File, unsigned int _Line, uintptr_t _Reserved ) @@ -735,9 +735,9 @@ errno_t _invoke_watson_if_oneof( errno_t _ExpressionError, errno_t _ErrorValue1, errno_t _ErrorValue2, - const wchar_t *_Expression, - const wchar_t *_Function, - const wchar_t *_File, + const char16_t *_Expression, + const char16_t *_Function, + const char16_t *_File, unsigned int _Line, uintptr_t _Reserved ) @@ -1079,7 +1079,7 @@ BOOL DebuggerKnownHandle(); } /* internal helper function to access environment variable in read-only mode */ -const wchar_t * __cdecl _wgetenv_helper_nolock(const wchar_t *); +const char16_t * __cdecl _wgetenv_helper_nolock(const char16_t *); const char * __cdecl _getenv_helper_nolock(const char *); /* internal helper routines used to query a PE image header. */ diff --git a/pal/src/safecrt/mbusafecrt.c b/pal/src/safecrt/mbusafecrt.c index a150008a6aa..f4d4860a2c7 100644 --- a/pal/src/safecrt/mbusafecrt.c +++ b/pal/src/safecrt/mbusafecrt.c @@ -57,16 +57,16 @@ int _putc_nolock( char inChar, miniFILE* inStream ) * _putwc_nolock - putwc for the miniFILE stream. ****/ -int _putwc_nolock( wchar_t inChar, miniFILE* inStream ) +int _putwc_nolock( char16_t inChar, miniFILE* inStream ) { int returnValue = WEOF; - inStream->_cnt -= sizeof( wchar_t ); + inStream->_cnt -= sizeof( char16_t ); if ( ( inStream->_cnt ) >= 0 ) { - *( ( wchar_t* )( inStream->_ptr ) ) = inChar; - inStream->_ptr += sizeof( wchar_t ); + *( ( char16_t* )( inStream->_ptr ) ) = inChar; + inStream->_ptr += sizeof( char16_t ); returnValue = ( int )inChar; } @@ -99,11 +99,11 @@ int _getwc_nolock( miniFILE* inStream ) { int returnValue = EOF; - if ( ( inStream->_cnt ) >= ( int )( sizeof( wchar_t ) ) ) + if ( ( inStream->_cnt ) >= ( int )( sizeof( char16_t ) ) ) { - inStream->_cnt -= sizeof( wchar_t ); - returnValue = ( int )( *( ( wchar_t* )( inStream->_ptr ) ) ); - inStream->_ptr += sizeof( wchar_t ); + inStream->_cnt -= sizeof( char16_t ); + returnValue = ( int )( *( ( char16_t* )( inStream->_ptr ) ) ); + inStream->_ptr += sizeof( char16_t ); } return returnValue; @@ -131,14 +131,14 @@ int _ungetc_nolock( char inChar, miniFILE* inStream ) * _ungetwc_nolock - ungetwc for the miniFILE stream. ****/ -int _ungetwc_nolock( wchar_t inChar, miniFILE* inStream ) +int _ungetwc_nolock( char16_t inChar, miniFILE* inStream ) { int returnValue = WEOF; - if ( ( size_t )( ( inStream->_ptr ) - ( inStream->_base ) ) >= ( sizeof( wchar_t ) ) ) + if ( ( size_t )( ( inStream->_ptr ) - ( inStream->_base ) ) >= ( sizeof( char16_t ) ) ) { - inStream->_cnt += sizeof( wchar_t ); - inStream->_ptr -= sizeof( wchar_t ); + inStream->_cnt += sizeof( char16_t ); + inStream->_ptr -= sizeof( char16_t ); returnValue = ( unsigned short )inChar; } @@ -214,13 +214,13 @@ void _safecrt_fassign(int flag, void* argument, char* number ) /*** -* _safecrt_wfassign - convert a wchar_t string into a float or double. +* _safecrt_wfassign - convert a char16_t string into a float or double. ****/ -void _safecrt_wfassign(int flag, void* argument, wchar_t* number ) +void _safecrt_wfassign(int flag, void* argument, char16_t* number ) { // We cannot use system functions for this - they - // assume that wchar_t is four bytes, while we assume + // assume that char16_t is four bytes, while we assume // two. So, we need to convert to a regular char string // without using any system functions. To do this, // we'll assume that the numbers are in the 0-9 range and @@ -246,9 +246,9 @@ void _safecrt_wfassign(int flag, void* argument, wchar_t* number ) * _minimal_chartowchar - do a simple char to wchar conversion. ****/ -int _minimal_chartowchar( wchar_t* outWChar, const char* inChar ) +int _minimal_chartowchar( char16_t* outWChar, const char* inChar ) { - *outWChar = ( wchar_t )( ( unsigned short )( ( unsigned char )( *inChar ) ) ); + *outWChar = ( char16_t )( ( unsigned short )( ( unsigned char )( *inChar ) ) ); return 1; } diff --git a/pal/src/safecrt/mbusafecrt_internal.h b/pal/src/safecrt/mbusafecrt_internal.h index 8a0a31ba124..1f114e43ced 100644 --- a/pal/src/safecrt/mbusafecrt_internal.h +++ b/pal/src/safecrt/mbusafecrt_internal.h @@ -19,7 +19,6 @@ #ifndef MBUSAFECRT_INTERNAL_H #define MBUSAFECRT_INTERNAL_H -#include "pal_char16.h" #include "pal_mstypes.h" typedef __builtin_va_list va_list; @@ -63,27 +62,27 @@ typedef struct miniFILE_struct #define _IOMYBUF 8 int _putc_nolock( char inChar, miniFILE* inStream ); -int _putwc_nolock( wchar_t inChar, miniFILE* inStream ); +int _putwc_nolock( char16_t inChar, miniFILE* inStream ); int _getc_nolock( miniFILE* inStream ); int _getwc_nolock( miniFILE* inStream ); int _ungetc_nolock( char inChar, miniFILE* inStream ); -int _ungetwc_nolock( wchar_t inChar, miniFILE* inStream ); +int _ungetwc_nolock( char16_t inChar, miniFILE* inStream ); errno_t _safecrt_cfltcvt(double *arg, char *buffer, size_t sizeInBytes, int type, int precision, int flags); void _safecrt_fassign(int flag, void* argument, char * number ); -void _safecrt_wfassign(int flag, void* argument, wchar_t * number ); +void _safecrt_wfassign(int flag, void* argument, char16_t * number ); -int _minimal_chartowchar( wchar_t* outWChar, const char* inChar ); +int _minimal_chartowchar( char16_t* outWChar, const char* inChar ); int _output_s( miniFILE* outfile, const char* _Format, va_list _ArgList); -int _woutput_s( miniFILE* outfile, const wchar_t* _Format, va_list _ArgList); +int _woutput_s( miniFILE* outfile, const char16_t* _Format, va_list _ArgList); int _output( miniFILE *outfile, const char* _Format, va_list _ArgList); int _soutput_s( char *_Dst, size_t _Size, const char *_Format, va_list _ArgList ); -int _swoutput_s( wchar_t *_Dst, size_t _Size, const wchar_t *_Format, va_list _ArgList ); +int _swoutput_s( char16_t *_Dst, size_t _Size, const char16_t *_Format, va_list _ArgList ); int __tinput_s( miniFILE* inFile, const unsigned char * inFormat, va_list inArgList ); -int __twinput_s( miniFILE* inFile, const wchar_t * inFormat, va_list inArgList ); +int __twinput_s( miniFILE* inFile, const char16_t * inFormat, va_list inArgList ); #endif /* MBUSAFECRT_INTERNAL_H */ diff --git a/pal/src/safecrt/output.inl b/pal/src/safecrt/output.inl index 1a333187ec0..2f7b14011d6 100644 --- a/pal/src/safecrt/output.inl +++ b/pal/src/safecrt/output.inl @@ -82,7 +82,7 @@ Buffer size required to be passed to _gcvt, fcvt and other fp conversion routine #ifndef _UNICODE int __cdecl _soutput_s(char *_Dst, size_t _Size, const char *_Format, va_list _ArgList) #else /* _UNICODE */ -int __cdecl _swoutput_s(wchar_t *_Dst, size_t _Size, const wchar_t *_Format, va_list _ArgList) +int __cdecl _swoutput_s(char16_t *_Dst, size_t _Size, const char16_t *_Format, va_list _ArgList) #endif /* _UNICODE */ { miniFILE stream; @@ -108,14 +108,14 @@ int __cdecl _swoutput_s(wchar_t *_Dst, size_t _Size, const wchar_t *_Format, va_ /* user is attempting to make us unbounded, but we don't fit that much */ outfile->_cnt = INT_MAX; } - else if(_Size>(INT_MAX/sizeof(wchar_t))) + else if(_Size>(INT_MAX/sizeof(char16_t))) { /* we can't represent the amount of output the user asked for */ _VALIDATE_RETURN( 0 /* FALSE */, EINVAL, -1 ); } else { - outfile->_cnt = (int)(_Size*sizeof(wchar_t)); + outfile->_cnt = (int)(_Size*sizeof(char16_t)); } outfile->_ptr = outfile->_base = (char*)_Dst; #endif /* _UNICODE */ @@ -297,10 +297,10 @@ enum CHARTYPE { /* static data (read only, since we are re-entrant) */ //#if defined (_UNICODE) || defined (CPRFLAG) || defined (FORMAT_VALIDATIONS) //extern const char __nullstring[]; /* string to print on null ptr */ -//extern const wchar_t __wnullstring[]; /* string to print on null ptr */ +//extern const char16_t __wnullstring[]; /* string to print on null ptr */ //#else /* defined (_UNICODE) || defined (CPRFLAG) || defined (FORMAT_VALIDATIONS) */ static const char __nullstring[] = "(null)"; /* string to print on null ptr */ -static const wchar_t __wnullstring[] = {'(', 'n', 'u', 'l', 'l', ')', '\0'};/* string to print on null ptr */ +static const char16_t __wnullstring[] = {'(', 'n', 'u', 'l', 'l', ')', '\0'};/* string to print on null ptr */ //#endif /* defined (_UNICODE) || defined (CPRFLAG) || defined (FORMAT_VALIDATIONS) */ /* The state table. This table is actually two tables combined into one. */ @@ -761,7 +761,7 @@ int __cdecl _output ( int no_output=0; /* non-zero = prodcue no output for this specifier */ union { const char *sz; /* pointer text to be printed, not zero terminated */ - const wchar_t *wz; + const char16_t *wz; } text; int textlen; /* length of the text in bytes/wchars to be printed. @@ -769,10 +769,10 @@ int __cdecl _output ( union { char sz[BUFFERSIZE]; #ifdef _UNICODE - wchar_t wz[BUFFERSIZE]; + char16_t wz[BUFFERSIZE]; #endif /* _UNICODE */ } buffer; - wchar_t wchar; /* temp wchar_t */ + char16_t wchar; /* temp char16_t */ int buffersize; /* size of text.sz (used only for the call to _cfltcvt) */ int bufferiswide=0; /* non-zero = buffer contains wide chars already */ @@ -896,7 +896,7 @@ int __cdecl _output ( } else { - flags |= FL_LONG; /* 'l' => long int or wchar_t */ + flags |= FL_LONG; /* 'l' => long int or char16_t */ } break; @@ -975,7 +975,7 @@ int __cdecl _output ( /* print a single character specified by int argument */ #ifdef _UNICODE bufferiswide = 1; - wchar = (wchar_t) get_int_arg(&argptr); + wchar = (char16_t) get_int_arg(&argptr); if (flags & FL_SHORT) { /* format multibyte character */ /* this is an extension of ANSI */ @@ -997,13 +997,13 @@ int __cdecl _output ( textlen = 1; /* print just a single character */ #else /* _UNICODE */ if (flags & (FL_LONG|FL_WIDECHAR)) { - wchar = (wchar_t) get_int_arg(&argptr); + wchar = (char16_t) get_int_arg(&argptr); no_output = 1; } else { /* format multibyte character */ /* this is an extension of ANSI */ unsigned short temp; - wchar = (wchar_t)get_int_arg(&argptr); + wchar = (char16_t)get_int_arg(&argptr); temp = (unsigned short)wchar; { buffer.sz[0] = (char) temp; @@ -1030,8 +1030,8 @@ int __cdecl _output ( textlen = (int)strlen(text.sz); } else { if (flags & FL_WIDECHAR) { - text.wz = (wchar_t *)pstr->Buffer; - textlen = pstr->Length / (int)sizeof(wchar_t); + text.wz = (char16_t *)pstr->Buffer; + textlen = pstr->Length / (int)sizeof(char16_t); bufferiswide = 1; } else { bufferiswide = 0; @@ -1060,7 +1060,7 @@ int __cdecl _output ( int i; const char *p; /* temps */ - const wchar_t *pwch; + const char16_t *pwch; /* At this point it is tempting to use strlen(), but */ /* if a precision is specified, we're not allowed to */ @@ -1087,7 +1087,7 @@ int __cdecl _output ( pwch = text.wz; while (i-- && *pwch) ++pwch; - textlen = (int)(pwch - text.wz); /* in wchar_ts */ + textlen = (int)(pwch - text.wz); /* in char16_ts */ /* textlen now contains length in wide chars */ } #else /* _UNICODE */ @@ -1473,7 +1473,7 @@ int __cdecl _output ( /*** *void write_char(char ch, int *pnumwritten) *ifdef _UNICODE -*void write_char(wchar_t ch, FILE *f, int *pnumwritten) +*void write_char(char16_t ch, FILE *f, int *pnumwritten) *endif *void write_char(char ch, FILE *f, int *pnumwritten) * @@ -1539,7 +1539,7 @@ LOCAL(void) write_char ( /*** *void write_multi_char(char ch, int num, int *pnumwritten) *ifdef _UNICODE -*void write_multi_char(wchar_t ch, int num, FILE *f, int *pnumwritten) +*void write_multi_char(char16_t ch, int num, FILE *f, int *pnumwritten) *endif *void write_multi_char(char ch, int num, FILE *f, int *pnumwritten) * @@ -1597,7 +1597,7 @@ LOCAL(void) write_multi_char ( *void write_string(const char *string, int len, int *pnumwritten) *void write_string(const char *string, int len, FILE *f, int *pnumwritten) *ifdef _UNICODE -*void write_string(const wchar_t *string, int len, FILE *f, int *pnumwritten) +*void write_string(const char16_t *string, int len, FILE *f, int *pnumwritten) *endif * *Purpose: diff --git a/pal/src/safecrt/safecrt_output_l.c b/pal/src/safecrt/safecrt_output_l.c index 36b98c29753..50d0bb678b6 100644 --- a/pal/src/safecrt/safecrt_output_l.c +++ b/pal/src/safecrt/safecrt_output_l.c @@ -243,10 +243,10 @@ enum CHARTYPE { /* static data (read only, since we are re-entrant) */ #if defined (_UNICODE) || defined (CPRFLAG) || defined (FORMAT_VALIDATIONS) extern const char __nullstring[]; /* string to print on null ptr */ -extern const wchar_t __wnullstring[]; /* string to print on null ptr */ +extern const char16_t __wnullstring[]; /* string to print on null ptr */ #else /* defined (_UNICODE) || defined (CPRFLAG) || defined (FORMAT_VALIDATIONS) */ static const char __nullstring[] = "(null)"; /* string to print on null ptr */ -static const wchar_t __wnullstring[] = { '(', 'n', 'u', 'l', 'l', ')', '\0' };/* string to print on null ptr */ +static const char16_t __wnullstring[] = { '(', 'n', 'u', 'l', 'l', ')', '\0' };/* string to print on null ptr */ #endif /* defined (_UNICODE) || defined (CPRFLAG) || defined (FORMAT_VALIDATIONS) */ /* The state table. This table is actually two tables combined into one. */ @@ -386,7 +386,7 @@ const char __lookuptable[] = { LOCAL(void) write_char(_TCHAR ch, int *pnumwritten); LOCAL(void) write_multi_char(_TCHAR ch, int num, int *pnumwritten); LOCAL(void) write_string(const _TCHAR *string, int len, int *numwritten); -LOCAL(void) write_wstring(const wchar_t *string, int len, int *numwritten); +LOCAL(void) write_wstring(const char16_t *string, int len, int *numwritten); #else /* CPRFLAG */ @@ -398,7 +398,7 @@ LOCAL(void) write_wstring(const wchar_t *string, int len, int *numwritten); LOCAL(void) write_char(_TCHAR ch, miniFILE *f, int *pnumwritten); LOCAL(void) write_multi_char(_TCHAR ch, int num, miniFILE *f, int *pnumwritten); LOCAL(void) write_string(const _TCHAR *string, int len, miniFILE *f, int *numwritten); -//LOCAL(void) write_wstring(const wchar_t *string, int len, miniFILE *f, int *numwritten); +//LOCAL(void) write_wstring(const char16_t *string, int len, miniFILE *f, int *numwritten); #endif /* CPRFLAG */ @@ -623,7 +623,7 @@ int __cdecl _output ( int no_output=0; /* non-zero = prodcue no output for this specifier */ union { const char *sz; /* pointer text to be printed, not zero terminated */ - const wchar_t *wz; + const char16_t *wz; } text; int textlen; /* length of the text in bytes/wchars to be printed. @@ -631,10 +631,10 @@ int __cdecl _output ( union { char sz[BUFFERSIZE]; #ifdef _UNICODE - wchar_t wz[BUFFERSIZE]; + char16_t wz[BUFFERSIZE]; #endif /* _UNICODE */ } buffer; - wchar_t wchar; /* temp wchar_t */ + char16_t wchar; /* temp char16_t */ int buffersize; /* size of text.sz (used only for the call to _cfltcvt) */ int bufferiswide=0; /* non-zero = buffer contains wide chars already */ @@ -758,7 +758,7 @@ int __cdecl _output ( } else { - flags |= FL_LONG; /* 'l' => long int or wchar_t */ + flags |= FL_LONG; /* 'l' => long int or char16_t */ } break; @@ -837,7 +837,7 @@ int __cdecl _output ( /* print a single character specified by int argument */ #ifdef _UNICODE bufferiswide = 1; - wchar = (wchar_t) get_int_arg(&argptr); + wchar = (char16_t) get_int_arg(&argptr); if (flags & FL_SHORT) { /* format multibyte character */ /* this is an extension of ANSI */ @@ -859,13 +859,13 @@ int __cdecl _output ( textlen = 1; /* print just a single character */ #else /* _UNICODE */ if (flags & (FL_LONG|FL_WIDECHAR)) { - wchar = (wchar_t) get_short_arg(&argptr); + wchar = (char16_t) get_short_arg(&argptr); no_output = 1; } else { /* format multibyte character */ /* this is an extension of ANSI */ unsigned short temp; - wchar = (wchar_t)get_int_arg(&argptr); + wchar = (char16_t)get_int_arg(&argptr); temp = (unsigned short)wchar; { buffer.sz[0] = (char) temp; @@ -892,8 +892,8 @@ int __cdecl _output ( textlen = (int)strlen(text.sz); } else { if (flags & FL_WIDECHAR) { - text.wz = (wchar_t *)pstr->Buffer; - textlen = pstr->Length / (int)sizeof(wchar_t); + text.wz = (char16_t *)pstr->Buffer; + textlen = pstr->Length / (int)sizeof(char16_t); bufferiswide = 1; } else { bufferiswide = 0; @@ -922,7 +922,7 @@ int __cdecl _output ( int i; const char *p; /* temps */ - const wchar_t *pwch; + const char16_t *pwch; /* At this point it is tempting to use strlen(), but */ /* if a precision is specified, we're not allowed to */ @@ -949,7 +949,7 @@ int __cdecl _output ( pwch = text.wz; while (i-- && *pwch) ++pwch; - textlen = (int)(pwch - text.wz); /* in wchar_ts */ + textlen = (int)(pwch - text.wz); /* in char16_ts */ /* textlen now contains length in wide chars */ } #else /* _UNICODE */ @@ -1332,7 +1332,7 @@ int __cdecl _output ( /*** *void write_char(char ch, int *pnumwritten) *ifdef _UNICODE -*void write_char(wchar_t ch, FILE *f, int *pnumwritten) +*void write_char(char16_t ch, FILE *f, int *pnumwritten) *endif *void write_char(char ch, FILE *f, int *pnumwritten) * @@ -1398,7 +1398,7 @@ LOCAL(void) write_char ( /*** *void write_multi_char(char ch, int num, int *pnumwritten) *ifdef _UNICODE -*void write_multi_char(wchar_t ch, int num, FILE *f, int *pnumwritten) +*void write_multi_char(char16_t ch, int num, FILE *f, int *pnumwritten) *endif *void write_multi_char(char ch, int num, FILE *f, int *pnumwritten) * @@ -1456,10 +1456,10 @@ LOCAL(void) write_multi_char ( *void write_string(const char *string, int len, int *pnumwritten) *void write_string(const char *string, int len, FILE *f, int *pnumwritten) *ifdef _UNICODE -*void write_string(const wchar_t *string, int len, FILE *f, int *pnumwritten) +*void write_string(const char16_t *string, int len, FILE *f, int *pnumwritten) *endif -*void write_wstring(const wchar_t *string, int len, int *pnumwritten) -*void write_wstring(const wchar_t *string, int len, FILE *f, int *pnumwritten) +*void write_wstring(const char16_t *string, int len, int *pnumwritten) +*void write_wstring(const char16_t *string, int len, FILE *f, int *pnumwritten) * *Purpose: * Writes a string of the given length to the given file. If no error occurs, @@ -1602,7 +1602,7 @@ __inline __int64 __cdecl get_int64_arg ( * *Purpose: * Gets a short argument off the given argument list and updates *pargptr. -* *** CURRENTLY ONLY USED TO GET A WCHAR_T, IFDEF _INTL *** +* *** CURRENTLY ONLY USED TO GET A char16_t, IFDEF _INTL *** * *Entry: * va_list *pargptr - pointer to argument list; updated by function diff --git a/pal/src/safecrt/safecrt_winput_s.c b/pal/src/safecrt/safecrt_winput_s.c index f60f8dfd9c9..23373561914 100644 --- a/pal/src/safecrt/safecrt_winput_s.c +++ b/pal/src/safecrt/safecrt_winput_s.c @@ -43,9 +43,9 @@ #define _TCHAR CRT_TCHAR #define TCHAR CRTTCHAR -typedef wchar_t _TCHAR; -typedef wchar_t TCHAR; -typedef wchar_t _TUCHAR; +typedef char16_t _TCHAR; +typedef char16_t TCHAR; +typedef char16_t _TUCHAR; #define _T(x) x #define _TEOF WEOF diff --git a/pal/src/safecrt/safecrt_woutput_s.c b/pal/src/safecrt/safecrt_woutput_s.c index e74fbef4473..b0de006a9a7 100644 --- a/pal/src/safecrt/safecrt_woutput_s.c +++ b/pal/src/safecrt/safecrt_woutput_s.c @@ -51,8 +51,8 @@ #define _TCHAR CRT_TCHAR #define TCHAR CRTTCHAR -typedef wchar_t _TCHAR; -typedef wchar_t TCHAR; +typedef char16_t _TCHAR; +typedef char16_t TCHAR; #define _T(x) L##x #include "output.inl" diff --git a/pal/src/safecrt/sscanf.c b/pal/src/safecrt/sscanf.c index e8a734fa15c..44edb00b5e2 100644 --- a/pal/src/safecrt/sscanf.c +++ b/pal/src/safecrt/sscanf.c @@ -108,8 +108,8 @@ static int __cdecl vnscan_fn ( static int __cdecl vwscan_fn ( WINPUTFN inputfn, - const wchar_t *string, - const wchar_t *format, + const char16_t *string, + const char16_t *format, va_list arglist ) { @@ -124,14 +124,14 @@ static int __cdecl vwscan_fn ( infile->_flag = _IOREAD|_IOSTRG|_IOMYBUF; infile->_ptr = infile->_base = (char *) string; - if(count>(INT_MAX/sizeof(wchar_t))) + if(count>(INT_MAX/sizeof(char16_t))) { /* old-style functions allow any large value to mean unbounded */ infile->_cnt = INT_MAX; } else { - infile->_cnt = (int)count*sizeof(wchar_t); + infile->_cnt = (int)count*sizeof(char16_t); } retval = (inputfn(infile, format, arglist)); @@ -141,9 +141,9 @@ static int __cdecl vwscan_fn ( static int __cdecl vnwscan_fn ( WINPUTFN inputfn, - const wchar_t *string, + const char16_t *string, size_t count, - const wchar_t *format, + const char16_t *format, va_list arglist ) { @@ -163,14 +163,14 @@ static int __cdecl vnwscan_fn ( count = length; } - if(count>(INT_MAX/sizeof(wchar_t))) + if(count>(INT_MAX/sizeof(char16_t))) { /* old-style functions allow any large value to mean unbounded */ infile->_cnt = INT_MAX; } else { - infile->_cnt = (int)count*sizeof(wchar_t); + infile->_cnt = (int)count*sizeof(char16_t); } retval = (inputfn(infile, format, arglist)); @@ -220,8 +220,8 @@ int __cdecl _snscanf_s ( } int __cdecl swscanf_s ( - const wchar_t *string, - const wchar_t *format, + const char16_t *string, + const char16_t *format, ... ) { @@ -234,9 +234,9 @@ int __cdecl swscanf_s ( } int __cdecl _snwscanf_s ( - const wchar_t *string, + const char16_t *string, size_t count, - const wchar_t *format, + const char16_t *format, ... ) { diff --git a/pal/src/safecrt/swprintf.c b/pal/src/safecrt/swprintf.c index 306e85813a2..9f3b336b473 100644 --- a/pal/src/safecrt/swprintf.c +++ b/pal/src/safecrt/swprintf.c @@ -66,11 +66,11 @@ * allocated 'fake' iob, we must lock/unlock to prevent collisions. * *Entry: -* wchar_t *string - pointer to place to put output +* char16_t *string - pointer to place to put output *ifdef _COUNT_ * size_t count - max number of wide characters to put in buffer *endif -* wchar_t *format - format string to control data format/number +* char16_t *format - format string to control data format/number * of arguments followed by list of arguments, number and type * controlled by format string * @@ -82,9 +82,9 @@ *******************************************************************************/ int __cdecl swprintf_s ( - wchar_t *string, + char16_t *string, size_t sizeInWords, - const wchar_t *format, + const char16_t *format, ... ) { @@ -101,10 +101,10 @@ int __cdecl swprintf_s ( } int __cdecl _snwprintf_s ( - wchar_t *string, + char16_t *string, size_t sizeInWords, size_t count, - const wchar_t *format, + const char16_t *format, ... ) { diff --git a/pal/src/safecrt/vswprint.c b/pal/src/safecrt/vswprint.c index 2f7004c07b3..0fc71bbb2b3 100644 --- a/pal/src/safecrt/vswprint.c +++ b/pal/src/safecrt/vswprint.c @@ -21,10 +21,10 @@ #include "mbusafecrt_internal.h" -typedef int (*WOUTPUTFN)(miniFILE *, const wchar_t *, va_list); +typedef int (*WOUTPUTFN)(miniFILE *, const char16_t *, va_list); -static int _vswprintf_helper( WOUTPUTFN outfn, wchar_t *string, size_t count, const wchar_t *format, va_list ap ); -static int _vscwprintf_helper (WOUTPUTFN outfn, const wchar_t *format, va_list ap ); +static int _vswprintf_helper( WOUTPUTFN outfn, char16_t *string, size_t count, const char16_t *format, va_list ap ); +static int _vscwprintf_helper (WOUTPUTFN outfn, const char16_t *format, va_list ap ); /*** *ifndef _COUNT_ @@ -70,11 +70,11 @@ static int _vscwprintf_helper (WOUTPUTFN outfn, const wchar_t *format, va_list a * lock/unlock to prevent collisions. * *Entry: -* wchar_t *string - place to put destination string +* char16_t *string - place to put destination string *ifdef _COUNT_ * size_t count - max number of bytes to put in buffer *endif -* wchar_t *format - format string, describes format of data +* char16_t *format - format string, describes format of data * va_list ap - varargs argument pointer * *Exit: @@ -88,9 +88,9 @@ static int _vscwprintf_helper (WOUTPUTFN outfn, const wchar_t *format, va_list a int __cdecl _vswprintf_helper ( WOUTPUTFN woutfn, - wchar_t *string, + char16_t *string, size_t count, - const wchar_t *format, + const char16_t *format, va_list ap ) { @@ -105,14 +105,14 @@ int __cdecl _vswprintf_helper ( outfile->_flag = _IOWRT|_IOSTRG; outfile->_ptr = outfile->_base = (char *) string; - if(count>(INT_MAX/sizeof(wchar_t))) + if(count>(INT_MAX/sizeof(char16_t))) { /* old-style functions allow any large value to mean unbounded */ outfile->_cnt = INT_MAX; } else { - outfile->_cnt = (int)(count*sizeof(wchar_t)); + outfile->_cnt = (int)(count*sizeof(char16_t)); } retval = woutfn(outfile, format, ap ); @@ -135,9 +135,9 @@ int __cdecl _vswprintf_helper ( } int __cdecl _vswprintf_s ( - wchar_t *string, + char16_t *string, size_t sizeInWords, - const wchar_t *format, + const char16_t *format, va_list ap ) { @@ -166,10 +166,10 @@ int __cdecl _vswprintf_s ( } int __cdecl _vsnwprintf_s ( - wchar_t *string, + char16_t *string, size_t sizeInWords, size_t count, - const wchar_t *format, + const char16_t *format, va_list ap ) { @@ -240,7 +240,7 @@ int __cdecl _vsnwprintf_s ( * Counts the number of characters in the fotmatted data. * *Entry: -* wchar_t *format - format string, describes format of data +* char16_t *format - format string, describes format of data * va_list ap - varargs argument pointer * *Exit: @@ -254,7 +254,7 @@ int __cdecl _vsnwprintf_s ( int __cdecl _vscwprintf_helper ( WOUTPUTFN woutfn, - const wchar_t *format, + const char16_t *format, va_list ap ) { @@ -273,7 +273,7 @@ int __cdecl _vscwprintf_helper ( } int __cdecl _vscwprintf ( - const wchar_t *format, + const char16_t *format, va_list ap ) { diff --git a/pal/src/safecrt/wcscat_s.c b/pal/src/safecrt/wcscat_s.c index 816df946ae1..431adf3642d 100644 --- a/pal/src/safecrt/wcscat_s.c +++ b/pal/src/safecrt/wcscat_s.c @@ -9,7 +9,7 @@ * *Purpose: -* wcscat_s() appends one wchar_t string onto another. +* wcscat_s() appends one char16_t string onto another. * * wcscat() concatenates (appends) a copy of the source string to the * end of the destination string. @@ -29,7 +29,7 @@ #define _FUNC_PROLOGUE #define _FUNC_NAME wcscat_s -#define _CHAR wchar_t +#define _CHAR char16_t #define _DEST _Dst #define _SIZE _SizeInBytes #define _SRC _Src diff --git a/pal/src/safecrt/wcscpy_s.c b/pal/src/safecrt/wcscpy_s.c index 6fc02d24eea..46c176e09a2 100644 --- a/pal/src/safecrt/wcscpy_s.c +++ b/pal/src/safecrt/wcscpy_s.c @@ -25,7 +25,7 @@ #define _FUNC_PROLOGUE #define _FUNC_NAME wcscpy_s -#define _CHAR wchar_t +#define _CHAR char16_t #define _DEST _Dst #define _SIZE _SizeInWords #define _SRC _Src diff --git a/pal/src/safecrt/wcslen_s.c b/pal/src/safecrt/wcslen_s.c index 425f9c29e3a..0fa8d8358b8 100644 --- a/pal/src/safecrt/wcslen_s.c +++ b/pal/src/safecrt/wcslen_s.c @@ -10,7 +10,7 @@ * *Purpose: * wcslen returns the length of a null-terminated wide-character string, -* not including the null wchar_t itself. +* not including the null char16_t itself. * *******************************************************************************/ @@ -32,7 +32,7 @@ * returned. * *Entry: -* const wchar_t * wcs - string whose length is to be computed +* const char16_t * wcs - string whose length is to be computed * size_t maxsize * *Exit: @@ -43,7 +43,7 @@ * *******************************************************************************/ -size_t __cdecl wcsnlen(const wchar_t *wcs, size_t maxsize) +size_t __cdecl wcsnlen(const char16_t *wcs, size_t maxsize) { size_t n; diff --git a/pal/src/safecrt/wcsncat_s.c b/pal/src/safecrt/wcsncat_s.c index 00c3afafd0c..ad241cd1f43 100644 --- a/pal/src/safecrt/wcsncat_s.c +++ b/pal/src/safecrt/wcsncat_s.c @@ -26,7 +26,7 @@ #define _FUNC_PROLOGUE #define _FUNC_NAME wcsncat_s -#define _CHAR wchar_t +#define _CHAR char16_t #define _DEST _Dst #define _SIZE _SizeInWords #define _SRC _Src diff --git a/pal/src/safecrt/wcsncpy_s.c b/pal/src/safecrt/wcsncpy_s.c index d41c1635329..561f5e682a9 100644 --- a/pal/src/safecrt/wcsncpy_s.c +++ b/pal/src/safecrt/wcsncpy_s.c @@ -9,7 +9,7 @@ * *Purpose: -* defines wcsncpy_s() - copy at most n characters of wchar_t string +* defines wcsncpy_s() - copy at most n characters of char16_t string * *******************************************************************************/ @@ -25,7 +25,7 @@ #define _FUNC_PROLOGUE #define _FUNC_NAME wcsncpy_s -#define _CHAR wchar_t +#define _CHAR char16_t #define _DEST _Dst #define _SIZE _SizeInWords #define _SRC _Src diff --git a/pal/src/safecrt/wcstok_s.c b/pal/src/safecrt/wcstok_s.c index 4c87c3afb91..cc970204ed8 100644 --- a/pal/src/safecrt/wcstok_s.c +++ b/pal/src/safecrt/wcstok_s.c @@ -23,6 +23,6 @@ #define _FUNC_PROLOGUE #define _FUNC_NAME wcstok_s -#define _CHAR wchar_t +#define _CHAR char16_t #include "tcstok_s.inl" diff --git a/pal/src/safecrt/wmakepath_s.c b/pal/src/safecrt/wmakepath_s.c index 88a2329db7d..dab5af010a7 100644 --- a/pal/src/safecrt/wmakepath_s.c +++ b/pal/src/safecrt/wmakepath_s.c @@ -22,7 +22,7 @@ #define _FUNC_PROLOGUE #define _FUNC_NAME _wmakepath_s -#define _CHAR wchar_t +#define _CHAR char16_t #define _DEST _Dst #define _SIZE _SizeInWords #define _T(_Character) L##_Character diff --git a/pal/src/safecrt/wsplitpath_s.c b/pal/src/safecrt/wsplitpath_s.c index c801e0f7d75..46bb0feb989 100644 --- a/pal/src/safecrt/wsplitpath_s.c +++ b/pal/src/safecrt/wsplitpath_s.c @@ -23,7 +23,7 @@ #define _FUNC_PROLOGUE #define _FUNC_NAME _wsplitpath_s -#define _CHAR wchar_t +#define _CHAR char16_t #define _TCSNCPY_S wcsncpy_s #define _T(_Character) L##_Character #define _MBS_SUPPORT 0 diff --git a/pal/src/safecrt/xtow_s.c b/pal/src/safecrt/xtow_s.c index 2525a3c7c3c..0cdfd4ebb06 100644 --- a/pal/src/safecrt/xtow_s.c +++ b/pal/src/safecrt/xtow_s.c @@ -24,6 +24,6 @@ #define _SECURE_ITOA #define _UNICODE -#define TCHAR wchar_t +#define TCHAR char16_t #define _T(x) L##x #include "xtox_s.inl" diff --git a/pal/src/thread/thread.cpp b/pal/src/thread/thread.cpp index ada697c06e0..4f2c3137149 100644 --- a/pal/src/thread/thread.cpp +++ b/pal/src/thread/thread.cpp @@ -2869,7 +2869,12 @@ void GetCurrentThreadStackLimits(ULONG_PTR* lowLimit, ULONG_PTR* highLimit) #endif } -static thread_local ULONG_PTR s_cachedThreadStackHighLimit = 0; +#ifndef __APPLE__ +#define THREAD_LOCAL thread_local +#else +#define THREAD_LOCAL _Thread_local +#endif +static THREAD_LOCAL ULONG_PTR s_cachedThreadStackHighLimit = 0; bool IsAddressOnStack(ULONG_PTR address) { diff --git a/test/runtests.py b/test/runtests.py index 5687272f5c7..e3fb01602ee 100755 --- a/test/runtests.py +++ b/test/runtests.py @@ -69,13 +69,13 @@ arch_alias = 'amd64' if arch == 'x64' else None # flavor: debug, test, release -type_flavor = {'chk':'debug', 'test':'test', 'fre':'release'} -flavor = 'debug' if args.debug else ('test' if args.test else None) +type_flavor = {'chk':'Debug', 'test':'Test', 'fre':'Release'} +flavor = 'Debug' if args.debug else ('Test' if args.test else None) if flavor == None: print("ERROR: Test build target wasn't defined.") print("Try '-t' (test build) or '-d' (debug build).") sys.exit(1) -flavor_alias = 'chk' if flavor == 'debug' else 'fre' +flavor_alias = 'chk' if flavor == 'Debug' else 'fre' # binary: full ch path binary = args.binary diff --git a/test/runtests.sh b/test/runtests.sh index 0b8309fbcbd..3d4ee7d2ec2 100755 --- a/test/runtests.sh +++ b/test/runtests.sh @@ -13,10 +13,10 @@ build_type=$1 if [[ $build_type != "-d" && $build_type != "-t" ]]; then echo "Warning: You haven't provide either '-d' (debug) or '-t' (test)." echo "Warning: Searching for ch.." - if [[ -f "$test_path/../BuildLinux/debug/ch" ]]; then + if [[ -f "$test_path/../BuildLinux/Debug/ch" ]]; then echo "Warning: Debug build was found" build_type="-d" - elif [[ -f "$test_path/../BuildLinux/test/ch" ]]; then + elif [[ -f "$test_path/../BuildLinux/Test/ch" ]]; then echo "Warning: Test build was found" build_type="-t" else