diff options
author | orivej <orivej@yandex-team.ru> | 2022-02-10 16:45:01 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:01 +0300 |
commit | 2d37894b1b037cf24231090eda8589bbb44fb6fc (patch) | |
tree | be835aa92c6248212e705f25388ebafcf84bc7a1 /contrib/libs/cxxsupp/builtins | |
parent | 718c552901d703c502ccbefdfc3c9028d608b947 (diff) | |
download | ydb-2d37894b1b037cf24231090eda8589bbb44fb6fc.tar.gz |
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/cxxsupp/builtins')
-rw-r--r-- | contrib/libs/cxxsupp/builtins/muloti4.c | 2 | ||||
-rw-r--r-- | contrib/libs/cxxsupp/builtins/os_version_check.c | 84 | ||||
-rw-r--r-- | contrib/libs/cxxsupp/builtins/ya.make | 40 |
3 files changed, 63 insertions, 63 deletions
diff --git a/contrib/libs/cxxsupp/builtins/muloti4.c b/contrib/libs/cxxsupp/builtins/muloti4.c index 1416a0fbd4..aef8207aaa 100644 --- a/contrib/libs/cxxsupp/builtins/muloti4.c +++ b/contrib/libs/cxxsupp/builtins/muloti4.c @@ -20,7 +20,7 @@ /* Effects: sets *overflow to 1 if a * b overflows */ -__attribute__((no_sanitize("undefined"))) +__attribute__((no_sanitize("undefined"))) COMPILER_RT_ABI ti_int __muloti4(ti_int a, ti_int b, int* overflow) { diff --git a/contrib/libs/cxxsupp/builtins/os_version_check.c b/contrib/libs/cxxsupp/builtins/os_version_check.c index 6df8ba3c5b..a3cb63886d 100644 --- a/contrib/libs/cxxsupp/builtins/os_version_check.c +++ b/contrib/libs/cxxsupp/builtins/os_version_check.c @@ -27,19 +27,19 @@ static int32_t GlobalMajor, GlobalMinor, GlobalSubminor; static dispatch_once_t DispatchOnceCounter; -// _availability_version_check darwin API support. -typedef uint32_t dyld_platform_t; - -typedef struct { - dyld_platform_t platform; - uint32_t version; -} dyld_build_version_t; - -typedef bool (*AvailabilityVersionCheckFuncTy)(uint32_t count, - dyld_build_version_t versions[]); - -static AvailabilityVersionCheckFuncTy AvailabilityVersionCheck; - +// _availability_version_check darwin API support. +typedef uint32_t dyld_platform_t; + +typedef struct { + dyld_platform_t platform; + uint32_t version; +} dyld_build_version_t; + +typedef bool (*AvailabilityVersionCheckFuncTy)(uint32_t count, + dyld_build_version_t versions[]); + +static AvailabilityVersionCheckFuncTy AvailabilityVersionCheck; + /* We can't include <CoreFoundation/CoreFoundation.h> directly from here, so * just forward declare everything that we need from it. */ @@ -88,15 +88,15 @@ typedef Boolean (*CFStringGetCStringFuncTy)(CFStringRef, char *, CFIndex, typedef void (*CFReleaseFuncTy)(CFTypeRef); /* Find and parse the SystemVersion.plist file. */ -static void initializeAvailabilityCheck(void *Unused) { +static void initializeAvailabilityCheck(void *Unused) { (void)Unused; - - // Use the new API if it's is available. Still load the PLIST to ensure that the - // existing calls to __isOSVersionAtLeast still work even with new - // compiler-rt and new OSes. - AvailabilityVersionCheck = (AvailabilityVersionCheckFuncTy)dlsym( - RTLD_DEFAULT, "_availability_version_check"); - + + // Use the new API if it's is available. Still load the PLIST to ensure that the + // existing calls to __isOSVersionAtLeast still work even with new + // compiler-rt and new OSes. + AvailabilityVersionCheck = (AvailabilityVersionCheckFuncTy)dlsym( + RTLD_DEFAULT, "_availability_version_check"); + /* Load CoreFoundation dynamically */ const void *NullAllocator = dlsym(RTLD_DEFAULT, "kCFAllocatorNull"); if (!NullAllocator) @@ -223,12 +223,12 @@ Fail: fclose(PropertyList); } -// This old API entry point is no longer used by Clang. We still need to keep it -// around to ensure that object files that reference it are still usable when -// linked with new compiler-rt. +// This old API entry point is no longer used by Clang. We still need to keep it +// around to ensure that object files that reference it are still usable when +// linked with new compiler-rt. int32_t __isOSVersionAtLeast(int32_t Major, int32_t Minor, int32_t Subminor) { /* Populate the global version variables, if they haven't already. */ - dispatch_once_f(&DispatchOnceCounter, NULL, initializeAvailabilityCheck); + dispatch_once_f(&DispatchOnceCounter, NULL, initializeAvailabilityCheck); if (Major < GlobalMajor) return 1; @@ -241,23 +241,23 @@ int32_t __isOSVersionAtLeast(int32_t Major, int32_t Minor, int32_t Subminor) { return Subminor <= GlobalSubminor; } -static inline uint32_t ConstructVersion(uint32_t Major, uint32_t Minor, - uint32_t Subminor) { - return ((Major & 0xffff) << 16) | ((Minor & 0xff) << 8) | (Subminor & 0xff); -} - -int32_t __isPlatformVersionAtLeast(uint32_t Platform, uint32_t Major, - uint32_t Minor, uint32_t Subminor) { - dispatch_once_f(&DispatchOnceCounter, NULL, initializeAvailabilityCheck); - - if (!AvailabilityVersionCheck) { - return __isOSVersionAtLeast(Major, Minor, Subminor); - } - dyld_build_version_t Versions[] = { - {Platform, ConstructVersion(Major, Minor, Subminor)}}; - return AvailabilityVersionCheck(1, Versions); -} - +static inline uint32_t ConstructVersion(uint32_t Major, uint32_t Minor, + uint32_t Subminor) { + return ((Major & 0xffff) << 16) | ((Minor & 0xff) << 8) | (Subminor & 0xff); +} + +int32_t __isPlatformVersionAtLeast(uint32_t Platform, uint32_t Major, + uint32_t Minor, uint32_t Subminor) { + dispatch_once_f(&DispatchOnceCounter, NULL, initializeAvailabilityCheck); + + if (!AvailabilityVersionCheck) { + return __isOSVersionAtLeast(Major, Minor, Subminor); + } + dyld_build_version_t Versions[] = { + {Platform, ConstructVersion(Major, Minor, Subminor)}}; + return AvailabilityVersionCheck(1, Versions); +} + #else /* Silence an empty translation unit warning. */ diff --git a/contrib/libs/cxxsupp/builtins/ya.make b/contrib/libs/cxxsupp/builtins/ya.make index a72eec50d3..d2c319c927 100644 --- a/contrib/libs/cxxsupp/builtins/ya.make +++ b/contrib/libs/cxxsupp/builtins/ya.make @@ -29,20 +29,20 @@ OWNER( g:cpp-contrib ) -# Check MUSL before NO_PLATFORM() disables it. -IF (MUSL) - # We use C headers despite NO_PLATFORM, but we do not propagate - # them with ADDINCL GLOBAL because we do not have an API, and we - # can not propagate them because libcxx has to put its own - # includes before musl includes for its include_next to work. - ADDINCL( - contrib/libs/musl/arch/x86_64 - contrib/libs/musl/arch/generic - contrib/libs/musl/include - contrib/libs/musl/extra - ) -ENDIF() - +# Check MUSL before NO_PLATFORM() disables it. +IF (MUSL) + # We use C headers despite NO_PLATFORM, but we do not propagate + # them with ADDINCL GLOBAL because we do not have an API, and we + # can not propagate them because libcxx has to put its own + # includes before musl includes for its include_next to work. + ADDINCL( + contrib/libs/musl/arch/x86_64 + contrib/libs/musl/arch/generic + contrib/libs/musl/include + contrib/libs/musl/extra + ) +ENDIF() + NO_UTIL() NO_RUNTIME() @@ -64,7 +64,7 @@ ENDIF() SRCS( addtf3.c - ashlti3.c + ashlti3.c clzti2.c comparetf2.c divdc3.c @@ -78,9 +78,9 @@ SRCS( fixsfti.c fixtfdi.c fixtfsi.c - fixunsdfti.c - fixunssfti.c - fixunstfdi.c + fixunsdfti.c + fixunssfti.c + fixunstfdi.c fixunstfsi.c fixunstfti.c fixunsxfti.c @@ -90,11 +90,11 @@ SRCS( floattisf.c floatunditf.c floatunsitf.c - floatuntidf.c + floatuntidf.c floatuntisf.c gcc_personality_v0.c int_util.c - lshrti3.c + lshrti3.c modti3.c muldc3.c muloti4.c |