* Replace __sync_swap with __atomic_exchange_n
__sync_swap() is a clang specific function.
* Remove multiline comment
* Add paranthesis around sum
src/md/hotdata/../inc/streamutil.h:73:34: warning: suggest parentheses around ‘+’ in operand of ‘&’ [-Wparentheses]
UINT32 aligned = *totalBytes + 3 & ~3;
* Define __int64
* Define windows types for tests
* Remove undefined has_builtin defines and define alloca and inline for GNUC
* Remove __clang__ where possible
* Add implicit casting to help compiler find WCHAR* variant
src/binder/assembly.cpp:294:73: error: no matching function for call to ‘SString::SString(SString)’
return (pAsmName == nullptr ? nullptr : pAsmName->GetSimpleName());
^
In file included from src/inc/sstring.h:1082:0,
from src/inc/ex.h:19,
from src/inc/stgpool.h:28,
from src/inc/../md/inc/metamodel.h:18,
from src/inc/../md/inc/metamodelro.h:19,
from src/inc/metadata.h:17,
from src/binder/../vm/util.hpp:19,
from src/binder/../vm/common.h:110,
from src/binder/assembly.cpp:14:
src/inc/sstring.inl:73:8: note: candidate: SString::SString(void*, COUNT_T)
inline SString::SString(void *buffer, COUNT_T size)
^
src/inc/sstring.inl:73:8: note: candidate expects 2 arguments, 1 provided
src/inc/sstring.inl:436:8: note: candidate: SString::SString(SString::tagLiteral, const WCHAR*, COUNT_T)
inline SString::SString(tagLiteral dummytag, const WCHAR *literal, COUNT_T count)
^
src/inc/sstring.inl:436:8: note: candidate expects 3 arguments, 1 provided
src/inc/sstring.inl:418:8: note: candidate: SString::SString(SString::tagLiteral, const WCHAR*)
inline SString::SString(tagLiteral dummytag, const WCHAR *literal)
^
src/inc/sstring.inl:418:8: note: candidate expects 2 arguments, 1 provided
src/inc/sstring.inl:401:8: note: candidate: SString::SString(SString::tagUTF8Literal, const UTF8*)
inline SString::SString(tagUTF8Literal dummytag, const UTF8 *literal)
^
src/inc/sstring.inl:401:8: note: candidate expects 2 arguments, 1 provided
src/inc/sstring.inl:382:8: note: candidate: SString::SString(SString::tagLiteral, const CHAR*)
inline SString::SString(tagLiteral dummytag, const ASCII *literal)
* Reorder DLLEXPORT and STDAPI
GNUC wants extern "C" <attribute> format.
* Abstract __FUNCSIG__
* Abstract __debugbreak()
* Move common compiler options out of clang and add Wno-unused-value
* Add paranthesis around || and &&
src/gc/gc.cpp:9084:38: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
(!chosen_power2) && (i < free_space_count));
* Set Wno-delete-non-virtual-dtor for CXX files only
* Don't warn on unterminated endif labels
* Suppress unused functions
* Use 0x syntax rather than h syntax on GNU asm files
* Correct constructor call directly
src/ToolBox/superpmi/superpmi-shared/logging.cpp:301:27: required from here
src/inc/clr_std/string:58:9: error: cannot call constructor ‘std::basic_string<char>::basic_string’ directly
this->basic_string::basic_string(_Ptr, c_len(_Ptr));
* Suppress NULL used in arithmetic warnings
Commit migrated from https://github.com/dotnet/coreclr/commit/
0495f7377fca88999d335757e9680052cfedc51d
add_compile_options(-Werror)
endif(CLR_CMAKE_WARNINGS_ARE_ERRORS)
+ # Disabled common warnings
+ add_compile_options(-Wno-unused-variable)
+ add_compile_options(-Wno-unused-value)
+ add_compile_options(-Wno-unused-function)
+
+ #These seem to indicate real issues
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-offsetof")
+
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# The -ferror-limit is helpful during the porting, it makes sure the compiler doesn't stop
# after hitting just about 20 errors.
# Disabled warnings
add_compile_options(-Wno-unused-private-field)
- add_compile_options(-Wno-unused-variable)
# Explicit constructor calls are not supported by clang (this->ClassName::ClassName())
add_compile_options(-Wno-microsoft)
# This warning is caused by comparing 'this' to NULL
add_compile_options(-Wno-unknown-warning-option)
- #These seem to indicate real issues
- add_compile_options(-Wno-invalid-offsetof)
# The following warning indicates that an attribute __attribute__((__ms_struct__)) was applied
# to a struct or a class that has virtual members or a base class. In that case, clang
# may not generate the same object layout as MSVC.
)
else(WIN32)
add_definitions(-DPAL_STDCPP_COMPAT=1)
- add_compile_options(-Wno-null-arithmetic)
+ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+ add_compile_options(-Wno-null-arithmetic)
+ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-conversion-null")
+ add_compile_options(-Wno-pointer-arith)
+ endif()
add_compile_options(-Wno-format)
include_directories(BEFORE xplat)
message(STATUS "LLDB_H: ${LLDB_H}")
-add_compile_options(-Wno-delete-non-virtual-dtor)
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-delete-non-virtual-dtor")
include_directories(inc)
include_directories("${LLDB_H}")
#define DEFAULT_REAL_JIT_NAME_A MAKEDLLNAME_A("clrjit2")
#define DEFAULT_REAL_JIT_NAME_W MAKEDLLNAME_W("clrjit2")
+
+#if !defined(_MSC_VER) && !defined(__llvm__)
+static inline void __debugbreak()
+{
+ DebugBreak();
+}
+#endif
+
LPCWSTR Assembly::GetSimpleName()
{
AssemblyName *pAsmName = GetAssemblyName();
- return (pAsmName == nullptr ? nullptr : pAsmName->GetSimpleName());
+ return (pAsmName == nullptr ? nullptr : (LPCWSTR)pAsmName->GetSimpleName());
}
HRESULT Assembly::BindAssemblyByName(IAssemblyName * pIAssemblyName, ICLRPrivAssembly ** ppAssembly)
extern VOID STDMETHODCALLTYPE TLS_FreeMasterSlotIndex();
+EXTERN_C
#ifdef FEATURE_PAL
DLLEXPORT // For Win32 PAL LoadLibrary emulation
#endif
-EXTERN_C BOOL WINAPI DllMain(HANDLE instance, DWORD reason, LPVOID reserved)
+BOOL WINAPI DllMain(HANDLE instance, DWORD reason, LPVOID reserved)
{
static bool g_procInitialized = false;
//
// This function gets the Dispenser interface given the CLSID and REFIID.
-DLLEXPORT STDAPI MetaDataGetDispenser(
+STDAPI DLLEXPORT MetaDataGetDispenser(
REFCLSID rclsid, // The class to desired.
REFIID riid, // Interface wanted on class factory.
LPVOID FAR * ppv) // Return interface pointer here.
//
// epilogue
//
- add rsp, 20h
+ add rsp, 0x20
TAILJMP_RAX
NESTED_END FuncEvalHijack, _TEXT
// its arguments on the stack. In x64, it gets its arguments in
// registers (set up for us by DacDbiInterfaceImpl::Hijack),
// and this stack space may be reused.
- mov rax, [rsp + 20h]
+ mov rax, [rsp + 0x20]
mov [rsp], rax
- mov rax, [rsp + 28h]
- mov [rsp + 8h], rax
- mov rax, [rsp + 30h]
- mov [rsp + 10h], rax
- mov rax, [rsp + 38h]
- mov [rsp + 18h], rax
+ mov rax, [rsp + 0x28]
+ mov [rsp + 0x8], rax
+ mov rax, [rsp + 0x30]
+ mov [rsp + 0x10], rax
+ mov rax, [rsp + 0x38]
+ mov [rsp + 0x18], rax
// DD Hijack primitive already set the stack. So just make the call now.
call C_FUNC(ExceptionHijackWorker)
//
// epilogue
//
- add rsp, 20h
+ add rsp, 0x20
TAILJMP_RAX
// Put a label here to tell the debugger where the end of this function is.
// The main dll entry point for this module. This routine is called by the
// OS when the dll gets loaded. Control is simply deferred to the main code.
//*****************************************************************************
+extern "C"
#ifdef FEATURE_PAL
DLLEXPORT // For Win32 PAL LoadLibrary emulation
#endif
-extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
+BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
// Defer to the main debugging code.
return DbgDllMain(hInstance, dwReason, lpReserved);
// we need to capture coreclr's hInstance before the C runtime initializes. This function
// will capture hInstance, let the C runtime initialize and then invoke the "classic"
// DllMain that initializes everything else.
+extern "C"
#ifdef FEATURE_PAL
DLLEXPORT // For Win32 PAL LoadLibrary emulation
#endif
-extern "C" BOOL WINAPI CoreDllMain(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved)
+BOOL WINAPI CoreDllMain(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved)
{
STATIC_CONTRACT_NOTHROW;
return result;
}
+extern "C"
#ifdef FEATURE_PAL
DLLEXPORT // For Win32 PAL LoadLibrary emulation
#endif
-extern "C" BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved)
+BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved)
{
STATIC_CONTRACT_NOTHROW;
// %%Function: MetaDataGetDispenser
// This function gets the Dispenser interface given the CLSID and REFIID.
// ---------------------------------------------------------------------------
-DLLEXPORT STDAPI MetaDataGetDispenser( // Return HRESULT
+STDAPI DLLEXPORT MetaDataGetDispenser( // Return HRESULT
REFCLSID rclsid, // The class to desired.
REFIID riid, // Interface wanted on class factory.
LPVOID FAR *ppv) // Return interface pointer here.
// %%Function: GetMetaDataInternalInterface
// This function gets the IMDInternalImport given the metadata on memory.
// ---------------------------------------------------------------------------
-DLLEXPORT STDAPI GetMetaDataInternalInterface(
+STDAPI DLLEXPORT GetMetaDataInternalInterface(
LPVOID pData, // [IN] in memory metadata section
ULONG cbData, // [IN] size of the metadata section
DWORD flags, // [IN] MDInternal_OpenForRead or MDInternal_OpenForENC
// This function gets the internal scopeless interface given the public
// scopeless interface.
// ---------------------------------------------------------------------------
-DLLEXPORT STDAPI GetMetaDataInternalInterfaceFromPublic(
+STDAPI DLLEXPORT GetMetaDataInternalInterfaceFromPublic(
IUnknown *pv, // [IN] Given interface.
REFIID riid, // [IN] desired interface
void **ppv) // [OUT] returned interface
// This function gets the public scopeless interface given the internal
// scopeless interface.
// ---------------------------------------------------------------------------
-DLLEXPORT STDAPI GetMetaDataPublicInterfaceFromInternal(
+STDAPI DLLEXPORT GetMetaDataPublicInterfaceFromInternal(
void *pv, // [IN] Given interface.
REFIID riid, // [IN] desired interface.
void **ppv) // [OUT] returned interface
if(WIN32)
else()
- add_compile_options(-Wno-delete-non-virtual-dtor)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-delete-non-virtual-dtor")
endif(WIN32)
add_library_clr(mscorpe STATIC
#define REDHAWK_PALIMPORT extern "C"
#define REDHAWK_PALAPI __stdcall
+#if !defined(_MSC_VER)
+#define _alloca alloca
+#endif //_MSC_VER
+
#ifndef _MSC_VER
#define __stdcall
-#ifdef __clang__
+#ifdef __GNUC__
#define __forceinline __attribute__((always_inline)) inline
-#else // __clang__
+#else // __GNUC__
#define __forceinline inline
-#endif // __clang__
+#endif // __GNUC__
// [LOCALGC TODO] is there a better place for this?
#define NOINLINE __attribute__((noinline))
#else // !_MSC_VER
#endif
#else // _MSC_VER
+#ifdef __llvm__
+#define HAS_IA32_PAUSE __has_builtin(__builtin_ia32_pause)
+#define HAS_IA32_MFENCE __has_builtin(__builtin_ia32_mfence)
+#else
+#define HAS_IA32_PAUSE 0
+#define HAS_IA32_MFENCE 0
+#endif
+
// Only clang defines __has_builtin, so we first test for a GCC define
// before using __has_builtin.
#if defined(__i386__) || defined(__x86_64__)
-#if (__GNUC__ > 4 && __GNUC_MINOR > 7) || __has_builtin(__builtin_ia32_pause)
+#if (__GNUC__ > 4 && __GNUC_MINOR > 7) || HAS_IA32_PAUSE
// clang added this intrinsic in 3.8
// gcc added this intrinsic by 4.7.1
#define YieldProcessor __builtin_ia32_pause
#endif // __has_builtin(__builtin_ia32_pause)
-#if defined(__GNUC__) || __has_builtin(__builtin_ia32_mfence)
+#if defined(__GNUC__) || HAS_IA32_MFENCE
// clang has had this intrinsic since at least 3.0
// gcc has had this intrinsic since forever
#define MemoryBarrier __builtin_ia32_mfence
#define DATA_ALIGNMENT sizeof(uintptr_t)
#define RAW_KEYWORD(x) x
+
+#ifdef _MSC_VER
#define DECLSPEC_ALIGN(x) __declspec(align(x))
+#else
+#define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
+#endif
+
#ifndef _ASSERTE
#define _ASSERTE(_expr) ASSERT(_expr)
#endif
static_assert(sizeof(long) == sizeof(T), "Size of long must be the same as size of T");
return _InterlockedExchange((long*)destination, value);
#else
- T result = __sync_swap(destination, value);
+ T result = __atomic_exchange_n(destination, value, __ATOMIC_ACQ_REL);
ArmInterlockedOperationBarrier();
return result;
#endif
return (T)(TADDR)_InterlockedExchange((long volatile *)(void* volatile *)destination, (long)(void*)value);
#endif
#else
- T result = (T)(TADDR)__sync_swap((void* volatile *)destination, value);
+ T result = (T)(TADDR)__atomic_exchange_n((void* volatile *)destination, value, __ATOMIC_ACQ_REL);
ArmInterlockedOperationBarrier();
return result;
#endif
return (T)(TADDR)_InterlockedExchange((long volatile *)(void* volatile *)destination, (long)(void*)value);
#endif
#else
- T result = (T)(TADDR)__sync_swap((void* volatile *)destination, value);
+ T result = (T)(TADDR)__atomic_exchange_n((void* volatile *)destination, value, __ATOMIC_ACQ_REL);
ArmInterlockedOperationBarrier();
return result;
#endif
{
return (ptrdiff_t)__rdtsc();
}
-#elif defined(__clang__)
+#elif defined(__GNUC__)
static ptrdiff_t get_cycle_count()
{
ptrdiff_t cycles;
new_address += pad;
}
assert ((chosen_power2 && (i == 0)) ||
- (!chosen_power2) && (i < free_space_count));
+ ((!chosen_power2) && (i < free_space_count)));
}
int new_bucket_power2 = index_of_highest_set_bit (new_free_space_size);
#pragma optimize( "t", on )
#endif
#endif
+
+#ifdef __GNUC__
+#define inline __attribute__((always_inline)) inline
+#else
#define inline __forceinline
+#endif // __GNUC__
#include "gc.h"
# Need generate a right form of asmparse.cpp to avoid the following options.
# Clang also produces a bad-codegen on this prebuilt file with optimization.
# https://github.com/dotnet/coreclr/issues/2305
- add_compile_options(-Wno-delete-non-virtual-dtor)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-delete-non-virtual-dtor")
add_compile_options(-Wno-deprecated-register)
add_compile_options(-Wno-array-bounds)
add_compile_options(-Wno-unused-label)
# The prebuilt files contain extra '!_MIDL_USE_GUIDDEF_' after the #endif, but not in the comment.
# In order to not to have to modify these prebuilt files, we disable the extra tokens warning.
+if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_compile_options(-Wno-extra-tokens)
+elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+add_compile_options(-Wno-endif-labels)
+endif()
+
add_compile_options(-D_MIDL_USE_GUIDDEF_)
foreach(IDL_SOURCE IN LISTS CORGUIDS_IDL_SOURCES)
get_filename_component(IDLNAME ${IDL_SOURCE} NAME_WE)
copy(_Ptr, _Count);
}
- basic_string(const value_type* _Ptr)
+ basic_string(const value_type* _Ptr) : basic_string(_Ptr, c_len(_Ptr))
{
- this->basic_string::basic_string(_Ptr, c_len(_Ptr));
}
void reserve(size_t newcapacity)
return true;
}
-#elif defined(__clang__)
+#elif defined(__GNUC__)
inline bool _our_GetThreadCycles(unsigned __int64* cycleOut)
{
return true;
}
-#else // neither _MSC_VER nor __clang__
+#else // neither _MSC_VER nor __GNUC__
// The following *might* work - might as well try.
#define _our_GetThreadCycles(cp) GetThreadCycles(cp)
#if !defined(_HOST_X86_) && !defined(_HOST_AMD64_)
#define MEASURE_CLRAPI_CALLS 0 // Cycle counters only hooked up on x86/x64.
#endif
-#if !defined(_MSC_VER) && !defined(__clang__)
+#if !defined(_MSC_VER) && !defined(__GNUC__)
#define MEASURE_CLRAPI_CALLS 0 // Only know how to do this with VC and Clang.
#endif
{
HRESULT hr = S_OK;
- UINT32 aligned = *totalBytes + 3 & ~3;
+ UINT32 aligned = (*totalBytes + 3) & ~3;
if (aligned > *totalBytes)
{ // The *totalBytes were not aligned to DWORD, we need to add padding
DWORD data = 0;
SourceAddress = StartingSp + FIELD_OFFSET(ARM64_KTRAP_FRAME, X);
for (RegIndex = 0; RegIndex < 18; RegIndex++) {
UPDATE_CONTEXT_POINTERS(UnwindParams, RegIndex, SourceAddress);
-#ifdef __clang__
+#ifdef __GNUC__
*(&ContextRecord->X0 + RegIndex) = MEMORY_READ_QWORD(UnwindParams, SourceAddress);
#else
ContextRecord->X[RegIndex] = MEMORY_READ_QWORD(UnwindParams, SourceAddress);
SourceAddress = StartingSp + FIELD_OFFSET(T_CONTEXT, X0);
for (RegIndex = 0; RegIndex < 29; RegIndex++) {
UPDATE_CONTEXT_POINTERS(UnwindParams, RegIndex, SourceAddress);
-#ifdef __clang__
+#ifdef __GNUC__
*(&ContextRecord->X0 + RegIndex) = MEMORY_READ_QWORD(UnwindParams, SourceAddress);
#else
ContextRecord->X[RegIndex] = MEMORY_READ_QWORD(UnwindParams, SourceAddress);
for (RegIndex = 0; RegIndex < RegisterCount; RegIndex++) {
UPDATE_CONTEXT_POINTERS(UnwindParams, FirstRegister + RegIndex, CurAddress);
-#ifdef __clang__
+#ifdef __GNUC__
*(&ContextRecord->X0 + FirstRegister + RegIndex) = MEMORY_READ_QWORD(UnwindParams, CurAddress);
#else
ContextRecord->X[FirstRegister + RegIndex] = MEMORY_READ_QWORD(UnwindParams, CurAddress);
//
//
-// Inline definitions of various items declared in REJIT.H\
+// Inline definitions of various items declared in REJIT.H
// ===========================================================================
#ifndef _REJIT_INL_
#define _REJIT_INL_
#define _HRESULT_TYPEDEF_(_sc) ((HRESULT)_sc)
#endif // RC_INVOKED
#define E_INVALIDARG _HRESULT_TYPEDEF_(0x80070057L)
+
+#ifdef BIT64
+#define __int64 long
+#else // BIT64
+#define __int64 long long
+#endif // BIT64
+
#define UInt32x32To64(a, b) ((unsigned __int64)((ULONG)(a)) * (unsigned __int64)((ULONG)(b)))
#define ARRAYSIZE(x) (sizeof(x)/sizeof(*x))
#define EQUALS(__actual, __cActual, __expected) Equals((__actual), (__cActual), (__expected), (int)sizeof(__expected) / sizeof(__expected[0]))
+#if defined(_MSC_VER)
+#define FUNCTIONNAME __FUNCSIG__
+#else
+#define FUNCTIONNAME __PRETTY_FUNCTION__
+#endif //_MSC_VER
+
/*----------------------------------------------------------------------------
struct definition
----------------------------------------------------------------------------*/
return TRUE;
else if ( cActual != cExpected )
{
- printf("WARNING: Test error - %s\n", __FUNCSIG__);
+ printf("WARNING: Test error - %s\n", FUNCTIONNAME);
return FALSE;
}
{
if ( !IsObjectEquals(pActual[i], pExpected[i]) )
{
- printf("WARNING: Test error - %s\n", __FUNCSIG__);
+ printf("WARNING: Test error - %s\n", FUNCTIONNAME);
return FALSE;
}
}
IsObjectEquals(Actual[i].l, Expected[i].l) &&
IsObjectEquals(Actual[i].str, Expected[i].str) ))
{
- printf("WARNING: Test error - %s\n", __FUNCSIG__);
+ printf("WARNING: Test error - %s\n", FUNCTIONNAME);
return false;
}
}
return false; \
}
+#if defined(_MSC_VER)
+#define FUNCTIONNAME __FUNCSIG__
+#else
+#define FUNCTIONNAME __PRETTY_FUNCTION__
+#endif //_MSC_VER
+
#define VERIFY_ERROR(__expect, __actual) \
- std::cout << '[' << __FUNCSIG__ << "] EXPECT: " << (__expect) << ", ACTUAL: " << (__actual) << std::endl
+ std::cout << '[' << FUNCTIONNAME << "] EXPECT: " << (__expect) << ", ACTUAL: " << (__actual) << std::endl
#define TRACE(__msg) \
std::cout << __msg << std::endl
#define VERIFY_ERROR_MSG(__msg, __expect, __actual) \
- printf("["##__FUNCSIG__##"] "##__msg, (__expect), (__actual))
+ printf("["##FUNCTIONNAME##"] "##__msg, (__expect), (__actual))
//////////////////////////////////////////////////////////////////////////////
// Verify helper methods
#define EQUALS(__actual, __cActual, __expected) Equals((__actual), (__cActual), (__expected), (int)sizeof(__expected) / sizeof(__expected[0]))
+#if defined(_MSC_VER)
+#define FUNCTIONNAME __FUNCSIG__
+#else
+#define FUNCTIONNAME __PRETTY_FUNCTION__
+#endif //_MSC_VER
+
+
/*----------------------------------------------------------------------------
struct definition
----------------------------------------------------------------------------*/
return TRUE;
else if ( cActual != cExpected )
{
- printf("WARNING: Test error - %s\n", __FUNCSIG__);
+ printf("WARNING: Test error - %s\n", FUNCTIONNAME);
printf("Array Length: expected: %d, actual: %d\n", cExpected, cActual);
return FALSE;
}
{
if ( !IsObjectEquals(pActual[i], pExpected[i]) )
{
- printf("WARNING: Test error - %s\n", __FUNCSIG__);
+ printf("WARNING: Test error - %s\n", FUNCTIONNAME);
printf("Array Element Not Equal: index: %d", static_cast<int>(i));
return FALSE;
}
IsObjectEquals(Actual[i].l, Expected[i].l) &&
IsObjectEquals(Actual[i].str, Expected[i].str) ))
{
- printf("WARNING: Test error - %s\n", __FUNCSIG__);
+ printf("WARNING: Test error - %s\n", FUNCTIONNAME);
return false;
}
}
#include <xplatform.h>
#include "MarshalArray.h"
+#if defined(_MSC_VER)
+#define FUNCTIONNAME __FUNCSIG__
+#else
+#define FUNCTIONNAME __PRETTY_FUNCTION__
+#endif //_MSC_VER
+
template<typename T>
bool Equals(T *pActual, int cActual, T *pExpected, int cExpected)
{
{
if (!IsObjectEquals(pActual[i], pExpected[i]))
{
- printf("WARNING: Test error - %s\n", __FUNCSIG__);
+ printf("WARNING: Test error - %s\n", FUNCTIONNAME);
return false;
}
}
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT __attribute__((visibility("default")))
+#ifdef BIT64
+#define __int64 long
+#else // BIT64
+#define __int64 long long
+#endif // BIT64
+
+#define __int32 int
+#define __int16 short int
+#define __int8 char // assumes char is signed
+
#endif // _MSC_VER
struct SingleByte
#define _cdecl
#endif
-#endif // _MSC_VER
+#define __int32 int
+#define __int16 short int
+#define __int8 char // assumes char is signed
+
+#ifdef BIT64
+#define __int64 long
+#else // BIT64
+#define __int64 long long
+#endif // BIT64
+
+#endif // !_MSC_VER
/* Structures */
#define EXPORT_API extern "C" __declspec(dllexport)
#else
#define EXPORT_API extern "C" __attribute__((visibility("default")))
+
+#ifdef BIT64
+#define __int64 long
+#else // BIT64
+#define __int64 long long
+#endif // BIT64
+
+#define __int32 int
+#define __int16 short int
+#define __int8 char // assumes char is signed
+
#endif
#include <cstddef>
#include <stdio.h>
-#if defined(__clang__)
-#define EXPORT(type) __attribute__((visibility("default"))) extern "C" type
-#else // defined(__clang__)
+#if defined(__GNUC__)
+#define EXPORT(type) extern "C" __attribute__((visibility("default"))) type
+#else // defined(__GNUC__)
#define EXPORT(type) type
-#endif // !defined(__clang__)
+#endif // !defined(__GNUC__)
#if !defined(_MSC_VER)
#if __i386__
EXPORT(void) NATIVEAPI InvokeCallback20(PFNACTION20 callback, S20 s)
{
-#ifdef __clang__
+#ifdef __GNUC__
printf("Native S20: %lld, %lld, %lld, %lld\n", s.x, s.y, s.z, s.w);
#else
printf("Native S20: %I64d, %I64d, %I64d, %I64d\n", s.x, s.y, s.z, s.w);
EXPORT(S20) NATIVEAPI InvokeCallback20R(PFNACTION20 callback, S20 s)
{
-#ifdef __clang__
+#ifdef __GNUC__
printf("Native S20: %lld, %lld, %lld, %lld\n", s.x, s.y, s.z, s.w);
#else
printf("Native S20: %I64d, %I64d, %I64d, %I64d\n", s.x, s.y, s.z, s.w);
#include <stdio.h>
#include <string.h>
-#if defined(__clang__)
-#define EXPORT(type) __attribute__((visibility("default"))) extern "C" type
+#if defined(__GNUC__)
+#define EXPORT(type) extern "C" __attribute__((visibility("default"))) type
#elif defined(_MSC_VER)
#define EXPORT(type) extern "C" __declspec(dllexport) type
-#else // defined(__clang__)
+#else // defined(__GNUC__)
#define EXPORT(type) type
-#endif // !defined(__clang__)
+#endif // !defined(__GNUC__)
#if !defined(_MSC_VER)
#if __i386__
#include "hfa_native.h"
+#ifndef _MSC_VER
+#ifdef BIT64
+#define __int64 long
+#else // BIT64
+#define __int64 long long
+#endif // BIT64
+
+#define __int32 int
+#define __int16 short int
+#define __int8 char // assumes char is signed
+#endif
// ---------------------------------------------------
// Init Methods
#else // __i386__
#define __stdcall
#endif // !__i386__
+
+#ifdef BIT64
+#define __int64 long
+#else // BIT64
+#define __int64 long long
+#endif // BIT64
+
+#define __int32 int
+#define __int16 short int
+#define __int8 char // assumes char is signed
+
#endif // !defined(_MSC_VER)
#if defined(_MSC_VER)
#else
#define MCC_API extern "C" __attribute__((visibility("default")))
#define WINAPI
+#ifdef BIT64
+#define __int64 long
+#else // BIT64
+#define __int64 long long
+#endif // BIT64
+
+#define __int32 int
+#define __int16 short int
+#define __int8 char // assumes char is signed
+
#endif
// ---------------------------------
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-#if defined(__clang__)
+#if defined(__GNUC__)
#define EXPORT_API extern "C" __attribute__((visibility("default")))
#elif defined(_MSC_VER)
#define EXPORT_API extern "C" __declspec(dllexport)