Skip to content

Commit e201dbd

Browse files
committed
[MERGE chakra-core#1235 @obastemur] cross platform: ch runs on OSX and passes 1198 tests
Merge pull request chakra-core#1235 from obastemur:osx_pass We have some minor issues left with ICU, PAL and stack limits. (24 failing tests)
2 parents e6e2857 + dceadaa commit e201dbd

13 files changed

Lines changed: 32 additions & 101 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ endif()
109109
-Wno-inconsistent-missing-override\
110110
-Wno-c++14-extensions\
111111
-Wno-macro-redefined\
112-
-Wno-ignored-pragmas\
112+
-Wno-pragmas\
113113
-Wno-invalid-token-paste\
114114
-Wno-format\
115115
-Wno-invalid-noreturn\

bin/ChakraCore/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,14 @@ if(CMAKE_SYSTEM_NAME STREQUAL Linux)
3636
Chakra.Jsrt
3737
Chakra.Jsrt.Core
3838
-Wl,--no-whole-archive
39+
Chakra.Pal
3940
)
4041
elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
4142
set(lib_target
4243
-Wl,-undefined,error
4344
Chakra.Jsrt
4445
Chakra.Jsrt.Core
46+
Chakra.Pal
4547
)
4648
else()
4749
message("This platform is not yet supported")
@@ -76,15 +78,13 @@ set(lib_target "${lib_target}"
7678
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
7779
set(lib_target "${lib_target}"
7880
-Wl,--end-group
79-
Chakra.Pal
8081
pthread
8182
stdc++
8283
dl
8384
icuuc
8485
)
8586
elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
8687
set(lib_target "${lib_target}"
87-
Chakra.Pal
8888
pthread
8989
stdc++
9090
dl

bin/ch/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,14 @@ if(STATIC_LIBRARY)
4545
Chakra.Jsrt
4646
Chakra.Jsrt.Core
4747
-Wl,--no-whole-archive
48+
Chakra.Pal
4849
)
4950
elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
5051
set(lib_target
5152
-Wl,-undefined,error
5253
Chakra.Jsrt
5354
Chakra.Jsrt.Core
55+
Chakra.Pal
5456
)
5557
else()
5658
message("This platform is not yet supported")
@@ -85,15 +87,13 @@ if(STATIC_LIBRARY)
8587
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
8688
set(lib_target "${lib_target}"
8789
-Wl,--end-group
88-
Chakra.Pal
8990
pthread
9091
stdc++
9192
dl
9293
icuuc
9394
)
9495
elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
9596
set(lib_target "${lib_target}"
96-
Chakra.Pal
9797
pthread
9898
stdc++
9999
dl

lib/Common/CommonPal.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,19 @@
2727
#define __forceinline inline
2828
#endif
2929

30+
#ifdef __clang__
31+
#define CLANG_WNO_BEGIN_(x) \
32+
_Pragma("clang diagnostic push")\
33+
_Pragma(#x)
34+
35+
#define CLANG_WNO_BEGIN(x) CLANG_WNO_BEGIN_(clang diagnostic ignored x)
36+
#define CLANG_WNO_END
37+
_Pragma("clang diagnostic pop")
38+
#else
39+
#define CLANG_WNO_BEGIN(x)
40+
#define CLANG_WNO_END
41+
#endif
42+
3043
#ifdef _WIN32
3144
#pragma warning(push)
3245
#pragma warning(disable: 4995) /* 'function': name was marked as #pragma deprecated */

lib/Common/Core/ConfigParser.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@ class ConfigParser
3131
static const int MaxRegSize = 2048;
3232
static const LPWSTR featureKeyName ;
3333
bool _hasReadConfig;
34+
35+
CLANG_WNO_BEGIN("-Wunused-private-field")
3436
Js::ConfigFlagsTable& _flags;
3537
const LPCWSTR _configFileName;
38+
CLANG_WNO_END
3639

3740
// NT version of CRT has the "backward compat" behavior that returns 0 instead of EOF
3841
// for unicode version of fwscanf.

lib/Common/Exceptions/Throw.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ namespace Js {
256256
}
257257

258258
#ifdef ENABLE_DEBUG_CONFIG_OPTIONS
259-
static const char16 * caption = _u("CHAKRA ASSERT");
259+
#define CHAKRA_ASSERT_CAPTION _u("CHAKRA ASSERT")
260260
#endif
261261

262262
bool Throw::ReportAssert(__in LPCSTR fileName, uint lineNumber, __in LPCSTR error, __in LPCSTR message)
@@ -301,7 +301,7 @@ namespace Js {
301301
swprintf_s(buff, _countof(buff), _u("%S (%u)\n%S\n%S"), fileName, lineNumber, message, error);
302302
buff[_countof(buff)-1] = 0;
303303

304-
int ret = MessageBox(nullptr, buff, caption, MB_ABORTRETRYIGNORE);
304+
int ret = MessageBox(nullptr, buff, CHAKRA_ASSERT_CAPTION, MB_ABORTRETRYIGNORE);
305305

306306
switch (ret)
307307
{

lib/Common/PlatformAgnostic/DateTime.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ namespace DateTime
6666

6767
class DaylightTimeHelper
6868
{
69+
CLANG_WNO_BEGIN("-Wunused-private-field")
6970
DaylightTimeHelperPlatformData data;
71+
CLANG_WNO_END
72+
7073
public:
7174
double UtcToLocal(double utcTime, int &bias, int &offset, bool &isDaylightSavings);
7275
double LocalToUtc(double time);

lib/Common/TemplateParameter.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,19 @@ namespace TemplateParameter
1717
private:
1818
static void Constrain(T *const t)
1919
{
20+
CLANG_WNO_BEGIN("-Wunused-variable")
2021
#pragma warning(suppress: 4189) // C4189: local variable is initialized but not referenced
2122
Base *const b = t;
23+
CLANG_WNO_END
2224
}
2325

2426
public:
2527
SameOrDerivedFrom()
2628
{
29+
CLANG_WNO_BEGIN("-Wunused-variable")
2730
#pragma warning(suppress: 4189) // C4189: local variable is initialized but not referenced
2831
void (*const p)(T *const t) = Constrain;
32+
CLANG_WNO_END
2933
}
3034
};
3135

lib/Runtime/Library/JSONString.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,15 @@ namespace Js
9696
{
9797
if (wch < _countof(escapeMap))
9898
{
99-
extra = UInt32Math::Add(extra, escapeMapCount[(char)wch]);
99+
extra = UInt32Math::Add(extra, escapeMapCount[static_cast<int>((char)wch)]);
100100
}
101101
}
102102
else
103103
{
104104
WCHAR specialChar;
105105
if (wch < _countof(escapeMap))
106106
{
107-
specialChar = escapeMap[(char)wch];
107+
specialChar = escapeMap[static_cast<int>((char)wch)];
108108
}
109109
else
110110
{

pal/inc/pal.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -599,12 +599,6 @@ PALAPI
599599
PAL_InitializeDebug(
600600
void);
601601

602-
PALIMPORT
603-
HINSTANCE
604-
PALAPI
605-
PAL_RegisterModule(
606-
IN LPCSTR lpLibFileName);
607-
608602
PALIMPORT
609603
VOID
610604
PALAPI

0 commit comments

Comments
 (0)