diff --git a/CMakeLists.txt b/CMakeLists.txt index 52a27a637c2..d9813e4cd34 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -201,12 +201,12 @@ elseif(CC_TARGET_OS_OSX) if(NOT CC_XCODE_PROJECT) set(OSX_DEPLOYMENT_TARGET "$ENV{MACOSX_DEPLOYMENT_TARGET} CC") if (${OSX_DEPLOYMENT_TARGET} STREQUAL " CC") - set(OSX_DEPLOYMENT_TARGET "10.7") - add_compile_options(-mmacosx-version-min=10.7) + set(OSX_DEPLOYMENT_TARGET "10.9") + add_compile_options(-mmacosx-version-min=10.9) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} \ - -mmacosx-version-min=10.7") + -mmacosx-version-min=10.9 -std=gnu99") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \ - -mmacosx-version-min=10.7") + -mmacosx-version-min=10.9 -std=gnu++11") else() set(OSX_DEPLOYMENT_TARGET "$ENV{MACOSX_DEPLOYMENT_TARGET}") message(WARNING "!! macOS Deployment Target was set to $ENV{MACOSX_DEPLOYMENT_TARGET}. Using it as is.") diff --git a/bin/ChakraCore/CMakeLists.txt b/bin/ChakraCore/CMakeLists.txt index e1cf9201e66..ee56a23147f 100644 --- a/bin/ChakraCore/CMakeLists.txt +++ b/bin/ChakraCore/CMakeLists.txt @@ -58,6 +58,7 @@ target_include_directories ( ${CHAKRACORE_SOURCE_DIR}/lib/Parser ${CHAKRACORE_SOURCE_DIR}/lib/Jsrt ${wasm_includes} + "-fvisibility=hidden" ) if (NOT STATIC_LIBRARY) diff --git a/lib/Common/Codex/Utf8Codex.h b/lib/Common/Codex/Utf8Codex.h index 7d1bd83b305..d065f1f974b 100644 --- a/lib/Common/Codex/Utf8Codex.h +++ b/lib/Common/Codex/Utf8Codex.h @@ -20,7 +20,6 @@ typedef WCHAR char16; #define _u(s) L##s #else -typedef char16_t char16; #define _u(s) u##s #endif @@ -164,7 +163,7 @@ namespace utf8 // special cases ASCII to avoid a call the most common characters. LPUTF8 EncodeFull(char16 ch, __out_ecount(3) LPUTF8 ptr); - // Encode a surrogate pair into a utf8 sequence + // Encode a surrogate pair into a utf8 sequence LPUTF8 EncodeSurrogatePair(char16 surrogateHigh, char16 surrogateLow, __out_ecount(4) LPUTF8 ptr); // Encode ch into a UTF8 sequence ignoring surrogate pairs (which are encoded as two @@ -190,7 +189,7 @@ namespace utf8 else if (ch < 0xD800 || (ch >= 0xE000 && ch <= 0xFFFF)) { return EncodeFull(ch, ptr); - } + } // We're now decoding a surrogate pair. If the input is malformed (eg. low surrogate is absent) // we'll instead encode the unicode replacement character as utf8 @@ -199,13 +198,13 @@ namespace utf8 char16 surrogateHigh = ch; char16 surrogateLow = **source; - // Validate that the surrogate code units are within the appropriate + // Validate that the surrogate code units are within the appropriate // ranges for high and low surrogates if ((surrogateHigh >= 0xD800 && surrogateHigh <= 0xDBFF) && (surrogateLow >= 0xDC00 && surrogateLow <= 0xDFFF)) { LPUTF8 retptr = EncodeSurrogatePair(surrogateHigh, surrogateLow, ptr); - + // SAL analysis gets confused if we call EncodeSurrogatePair after // modifying cch diff --git a/lib/Common/CommonDefines.h b/lib/Common/CommonDefines.h index c6ca85e9356..757dba3f6ca 100644 --- a/lib/Common/CommonDefines.h +++ b/lib/Common/CommonDefines.h @@ -482,14 +482,10 @@ #define PROFILE_BAILOUT_RECORD_MEMORY #define MEMSPECT_TRACKING -// xplat-todo: Depends on C++ type-info -// enable later on non-VC++ compilers -#ifndef __APPLE__ #define PROFILE_RECYCLER_ALLOC // Needs to compile in debug mode // Just needs strings converted #define PROFILE_DICTIONARY 1 -#endif #define PROFILE_STRINGS @@ -523,12 +519,9 @@ #endif #endif -// xplat: on apple looks typeid(char16_t) does not work, hit error: Undefined symbols for architecture x86_64: "typeinfo for char16_t" -#ifndef __APPLE__ #define HEAP_TRACK_ALLOC #define CHECK_MEMORY_LEAK #define LEAK_REPORT -#endif #define PROJECTION_METADATA_TRACE #define ERROR_TRACE @@ -770,3 +763,9 @@ #endif #endif // __APPLE__ #endif // THREAD_LOCAL + +#ifndef _WIN32 +#define NO_EXPORT __attribute__((visibility("hidden"))) +#else +#define NO_EXPORT +#endif diff --git a/lib/Common/CommonPal.h b/lib/Common/CommonPal.h index 7518972bfb2..8d3db941cd1 100644 --- a/lib/Common/CommonPal.h +++ b/lib/Common/CommonPal.h @@ -103,7 +103,6 @@ __forceinline void __int2c() #include "inc/rt/no_sal2.h" #include "inc/rt/oaidl.h" -typedef char16_t char16; #define _u(s) u##s typedef GUID UUID; diff --git a/lib/Common/Core/CommonTypedefs.h b/lib/Common/Core/CommonTypedefs.h index 46efe422fac..df1f797a73f 100644 --- a/lib/Common/Core/CommonTypedefs.h +++ b/lib/Common/Core/CommonTypedefs.h @@ -10,7 +10,6 @@ typedef WCHAR char16; #define _u(s) L##s #else -typedef char16_t char16; #define _u(s) u##s #endif @@ -18,7 +17,7 @@ typedef char16 wchar; typedef unsigned int uint; typedef unsigned short ushort; -// Use of ulong is not allowed in ChakraCore- uint32 should be used instead since +// Use of ulong is not allowed in ChakraCore- uint32 should be used instead since // it's our cross-platform 32 bit integer value. However, legacy code in ChakraFull // still depends on ulong so it's allowed for full builds. #ifdef NTBUILD @@ -62,4 +61,3 @@ namespace Js { typedef uint32 LocalFunctionId; }; - diff --git a/lib/Common/Memory/Allocator.h b/lib/Common/Memory/Allocator.h index 8b1db170c6a..a0dcc569c69 100644 --- a/lib/Common/Memory/Allocator.h +++ b/lib/Common/Memory/Allocator.h @@ -369,7 +369,7 @@ void AssertValue(void * mem, T value, uint byteCount) #ifndef __PLACEMENT_NEW_INLINE #define __PLACEMENT_NEW_INLINE -_Ret_notnull_ +NO_EXPORT _Ret_notnull_ inline void * __cdecl operator new( DECLSPEC_GUARD_OVERFLOW size_t byteSize, @@ -379,7 +379,7 @@ _In_ void * previousAllocation) throw() } -inline void __cdecl +NO_EXPORT inline void __cdecl operator delete( void * allocationToFree, // Allocation to free void * previousAllocation // Previously allocated memory @@ -394,7 +394,7 @@ void * previousAllocation // Previously allocated memory // throwing operator new overrides //---------------------------------------- template -_Ret_notnull_ void * __cdecl +NO_EXPORT _Ret_notnull_ void * __cdecl operator new(DECLSPEC_GUARD_OVERFLOW size_t byteSize, TAllocator * alloc, char * (TAllocator::*AllocFunc)(size_t)) { AssertCanHandleOutOfMemory(); @@ -405,7 +405,7 @@ operator new(DECLSPEC_GUARD_OVERFLOW size_t byteSize, TAllocator * alloc, char * } template -_Ret_notnull_ inline void * __cdecl +NO_EXPORT _Ret_notnull_ inline void * __cdecl operator new[](DECLSPEC_GUARD_OVERFLOW size_t byteSize, TAllocator * alloc, char * (TAllocator::*AllocFunc)(size_t)) { AssertCanHandleOutOfMemory(); @@ -416,7 +416,7 @@ operator new[](DECLSPEC_GUARD_OVERFLOW size_t byteSize, TAllocator * alloc, char } template -_Ret_notnull_ inline void * __cdecl +NO_EXPORT _Ret_notnull_ inline void * __cdecl operator new(DECLSPEC_GUARD_OVERFLOW size_t byteSize, TAllocator * alloc, char * (TAllocator::*AllocFunc)(size_t), DECLSPEC_GUARD_OVERFLOW size_t plusSize) { AssertCanHandleOutOfMemory(); @@ -433,7 +433,7 @@ operator new(DECLSPEC_GUARD_OVERFLOW size_t byteSize, TAllocator * alloc, char * // nothrow operator new overrides //---------------------------------------- template -_Ret_maybenull_ inline void * __cdecl +NO_EXPORT _Ret_maybenull_ inline void * __cdecl operator new(DECLSPEC_GUARD_OVERFLOW size_t byteSize, TAllocator * alloc, bool nothrow, char * (TAllocator::*AllocFunc)(size_t)) { Assert(nothrow); @@ -444,7 +444,7 @@ operator new(DECLSPEC_GUARD_OVERFLOW size_t byteSize, TAllocator * alloc, bool n template -_Ret_maybenull_ inline void * __cdecl +NO_EXPORT _Ret_maybenull_ inline void * __cdecl operator new[](DECLSPEC_GUARD_OVERFLOW size_t byteSize, TAllocator * alloc, bool nothrow, char * (TAllocator::*AllocFunc)(size_t)) { Assert(nothrow); @@ -455,7 +455,7 @@ operator new[](DECLSPEC_GUARD_OVERFLOW size_t byteSize, TAllocator * alloc, bool template -_Ret_maybenull_ inline void * __cdecl +NO_EXPORT _Ret_maybenull_ inline void * __cdecl operator new(DECLSPEC_GUARD_OVERFLOW size_t byteSize, TAllocator * alloc, bool nothrow, char * (TAllocator::*AllocFunc)(size_t), DECLSPEC_GUARD_OVERFLOW size_t plusSize) { Assert(nothrow); @@ -469,7 +469,7 @@ operator new(DECLSPEC_GUARD_OVERFLOW size_t byteSize, TAllocator * alloc, bool n template -_Ret_maybenull_ inline void * __cdecl +NO_EXPORT _Ret_maybenull_ inline void * __cdecl operator new(DECLSPEC_GUARD_OVERFLOW size_t byteSize, TAllocator * alloc, bool nothrow, char * (TAllocator::*AllocFunc)(size_t), DECLSPEC_GUARD_OVERFLOW size_t plusSize, bool prefix) { Assert(nothrow); diff --git a/lib/Runtime/PlatformAgnostic/RuntimePlatformAgnosticPch.h b/lib/Runtime/PlatformAgnostic/RuntimePlatformAgnosticPch.h index 119ce2cbf57..44147a3a37b 100644 --- a/lib/Runtime/PlatformAgnostic/RuntimePlatformAgnosticPch.h +++ b/lib/Runtime/PlatformAgnostic/RuntimePlatformAgnosticPch.h @@ -7,6 +7,8 @@ #ifdef _WIN32 #include "CommonDefines.h" #include "CommonMin.h" +#else +#include "pal.h" #endif #ifdef _MSC_VER diff --git a/pal/inc/pal_mstypes.h b/pal/inc/pal_mstypes.h index d2edf9daf17..620c033f542 100644 --- a/pal/inc/pal_mstypes.h +++ b/pal/inc/pal_mstypes.h @@ -558,8 +558,8 @@ typedef LONG_PTR LPARAM; typedef unsigned short char16_t; #endif // __cplusplus +typedef char16_t char16; typedef char16_t WCHAR; -#define WCHAR_IS_CHAR16_T 1 #ifdef PAL_STDCPP_COMPAT