#define EXTERN_C extern
#endif // __cplusplus
#endif // EXTERN_C
+
+#ifndef TYPEOF
+#ifdef __cplusplus
+#define TYPEOF decltype
+#else
+#define TYPEOF __typeof
+#endif // __cplusplus
+#endif // TYPEOF
entrypoints.c
)
+if (MSVC)
+ set_source_files_properties(${NATIVEGLOBALIZATION_SOURCES} PROPERTIES LANGUAGE CXX)
+endif()
+
include_directories("../Common")
if (GEN_SHARED_LIB)
#include "pal_icushim.h"
// Define pointers to all the used ICU functions
-#define PER_FUNCTION_BLOCK(fn, lib) __typeof(fn)* fn##_ptr;
+#define PER_FUNCTION_BLOCK(fn, lib) TYPEOF(fn)* fn##_ptr;
FOR_ALL_ICU_FUNCTIONS
#undef PER_FUNCTION_BLOCK
#define PER_FUNCTION_BLOCK(fn, lib) \
c_static_assert_msg((sizeof(#fn) + MaxICUVersionStringWithSuffixLength + 1) <= sizeof(symbolName), "The symbolName is too small for symbol " #fn); \
sprintf(symbolName, #fn "%s", symbolVersion); \
- fn##_ptr = (__typeof(fn)*)dlsym(lib, symbolName); \
+ fn##_ptr = (TYPEOF(fn)*)dlsym(lib, symbolName); \
if (fn##_ptr == NULL) { fprintf(stderr, "Cannot get symbol %s from " #lib "\nError: %s\n", symbolName, dlerror()); abort(); }
static int FindSymbolVersion(int majorVer, int minorVer, int subVer, char* symbolName, char* symbolVersion, char* suffix)
#define PER_FUNCTION_BLOCK(fn, lib) \
sprintf_s(symbolName, SYMBOL_NAME_SIZE, #fn "%s", symbolVersion); \
- fn##_ptr = (__typeof(fn)*)GetProcAddress((HMODULE)lib, symbolName); \
+ fn##_ptr = (TYPEOF(fn)*)GetProcAddress((HMODULE)lib, symbolName); \
if (fn##_ptr == NULL) { fprintf(stderr, "Cannot get symbol %s from " #lib "\nError: %u\n", symbolName, GetLastError()); abort(); }
static int FindICULibs()
#include "icu.h"
-#ifndef __typeof
-#define __typeof decltype
-#endif
-
#define HAVE_SET_MAX_VARIABLE 1
#define UDAT_STANDALONE_SHORTER_WEEKDAYS 1
FOR_ALL_OS_CONDITIONAL_ICU_FUNCTIONS
// Declare pointers to all the used ICU functions
-#define PER_FUNCTION_BLOCK(fn, lib) EXTERN_C __typeof(fn)* fn##_ptr;
+#define PER_FUNCTION_BLOCK(fn, lib) EXTERN_C TYPEOF(fn)* fn##_ptr;
FOR_ALL_ICU_FUNCTIONS
#undef PER_FUNCTION_BLOCK
return -1;
}
- __typeof(systemStats.icps_inhist[0])* inHist = systemStats.icps_inhist;
- __typeof(systemStats.icps_outhist[0])* outHist = systemStats.icps_outhist;
+ TYPEOF(systemStats.icps_inhist[0])* inHist = systemStats.icps_inhist;
+ TYPEOF(systemStats.icps_outhist[0])* outHist = systemStats.icps_outhist;
retStats->AddressMaskRepliesReceived = inHist[ICMP_MASKREPLY];
retStats->AddressMaskRepliesSent = outHist[ICMP_MASKREPLY];
#include "opensslshim.h"
// Define pointers to all the used OpenSSL functions
-#define REQUIRED_FUNCTION(fn) __typeof(fn) fn##_ptr;
-#define NEW_REQUIRED_FUNCTION(fn) __typeof(fn) fn##_ptr;
-#define LIGHTUP_FUNCTION(fn) __typeof(fn) fn##_ptr;
-#define FALLBACK_FUNCTION(fn) __typeof(fn) fn##_ptr;
-#define RENAMED_FUNCTION(fn,oldfn) __typeof(fn) fn##_ptr;
-#define LEGACY_FUNCTION(fn) __typeof(fn) fn##_ptr;
+#define REQUIRED_FUNCTION(fn) TYPEOF(fn) fn##_ptr;
+#define NEW_REQUIRED_FUNCTION(fn) TYPEOF(fn) fn##_ptr;
+#define LIGHTUP_FUNCTION(fn) TYPEOF(fn) fn##_ptr;
+#define FALLBACK_FUNCTION(fn) TYPEOF(fn) fn##_ptr;
+#define RENAMED_FUNCTION(fn,oldfn) TYPEOF(fn) fn##_ptr;
+#define LEGACY_FUNCTION(fn) TYPEOF(fn) fn##_ptr;
FOR_ALL_OPENSSL_FUNCTIONS
#undef LEGACY_FUNCTION
#undef RENAMED_FUNCTION
// Get pointers to all the functions that are needed
#define REQUIRED_FUNCTION(fn) \
- if (!(fn##_ptr = (__typeof(fn))(dlsym(libssl, #fn)))) { fprintf(stderr, "Cannot get required symbol " #fn " from libssl\n"); abort(); }
+ if (!(fn##_ptr = (TYPEOF(fn))(dlsym(libssl, #fn)))) { fprintf(stderr, "Cannot get required symbol " #fn " from libssl\n"); abort(); }
#define NEW_REQUIRED_FUNCTION(fn) \
- if (!v1_0_sentinel && !(fn##_ptr = (__typeof(fn))(dlsym(libssl, #fn)))) { fprintf(stderr, "Cannot get required symbol " #fn " from libssl\n"); abort(); }
+ if (!v1_0_sentinel && !(fn##_ptr = (TYPEOF(fn))(dlsym(libssl, #fn)))) { fprintf(stderr, "Cannot get required symbol " #fn " from libssl\n"); abort(); }
#define LIGHTUP_FUNCTION(fn) \
- fn##_ptr = (__typeof(fn))(dlsym(libssl, #fn));
+ fn##_ptr = (TYPEOF(fn))(dlsym(libssl, #fn));
#define FALLBACK_FUNCTION(fn) \
- if (!(fn##_ptr = (__typeof(fn))(dlsym(libssl, #fn)))) { fn##_ptr = (__typeof(fn))local_##fn; }
+ if (!(fn##_ptr = (TYPEOF(fn))(dlsym(libssl, #fn)))) { fn##_ptr = (TYPEOF(fn))local_##fn; }
#define RENAMED_FUNCTION(fn,oldfn) \
- if (!v1_0_sentinel && !(fn##_ptr = (__typeof(fn))(dlsym(libssl, #fn)))) { fprintf(stderr, "Cannot get required symbol " #fn " from libssl\n"); abort(); } \
- if (v1_0_sentinel && !(fn##_ptr = (__typeof(fn))(dlsym(libssl, #oldfn)))) { fprintf(stderr, "Cannot get required symbol " #oldfn " from libssl\n"); abort(); }
+ if (!v1_0_sentinel && !(fn##_ptr = (TYPEOF(fn))(dlsym(libssl, #fn)))) { fprintf(stderr, "Cannot get required symbol " #fn " from libssl\n"); abort(); } \
+ if (v1_0_sentinel && !(fn##_ptr = (TYPEOF(fn))(dlsym(libssl, #oldfn)))) { fprintf(stderr, "Cannot get required symbol " #oldfn " from libssl\n"); abort(); }
#define LEGACY_FUNCTION(fn) \
- if (v1_0_sentinel && !(fn##_ptr = (__typeof(fn))(dlsym(libssl, #fn)))) { fprintf(stderr, "Cannot get required symbol " #fn " from libssl\n"); abort(); }
+ if (v1_0_sentinel && !(fn##_ptr = (TYPEOF(fn))(dlsym(libssl, #fn)))) { fprintf(stderr, "Cannot get required symbol " #fn " from libssl\n"); abort(); }
FOR_ALL_OPENSSL_FUNCTIONS
#undef LEGACY_FUNCTION
#include <openssl/x509v3.h>
#include "pal_crypto_config.h"
+#include "pal_compiler.h"
#define OPENSSL_VERSION_1_1_1_RTM 0x10101000L
#define OPENSSL_VERSION_1_1_0_RTM 0x10100000L
#define OPENSSL_VERSION_1_0_2_RTM 0x10002000L
LIGHTUP_FUNCTION(EC_POINT_set_affine_coordinates_GF2m) \
// Declare pointers to all the used OpenSSL functions
-#define REQUIRED_FUNCTION(fn) extern __typeof(fn)* fn##_ptr;
-#define NEW_REQUIRED_FUNCTION(fn) extern __typeof(fn)* fn##_ptr;
-#define LIGHTUP_FUNCTION(fn) extern __typeof(fn)* fn##_ptr;
-#define FALLBACK_FUNCTION(fn) extern __typeof(fn)* fn##_ptr;
-#define RENAMED_FUNCTION(fn,oldfn) extern __typeof(fn)* fn##_ptr;
-#define LEGACY_FUNCTION(fn) extern __typeof(fn)* fn##_ptr;
+#define REQUIRED_FUNCTION(fn) extern TYPEOF(fn)* fn##_ptr;
+#define NEW_REQUIRED_FUNCTION(fn) extern TYPEOF(fn)* fn##_ptr;
+#define LIGHTUP_FUNCTION(fn) extern TYPEOF(fn)* fn##_ptr;
+#define FALLBACK_FUNCTION(fn) extern TYPEOF(fn)* fn##_ptr;
+#define RENAMED_FUNCTION(fn,oldfn) extern TYPEOF(fn)* fn##_ptr;
+#define LEGACY_FUNCTION(fn) extern TYPEOF(fn)* fn##_ptr;
FOR_ALL_OPENSSL_FUNCTIONS
#undef LEGACY_FUNCTION
#undef RENAMED_FUNCTION