diff options
| author | setser <[email protected]> | 2022-02-10 16:46:31 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:46:31 +0300 | 
| commit | 3b2241461d41d41ba1a706b0750c4f0f55c344f6 (patch) | |
| tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /contrib/libs/cxxsupp/libcxxrt | |
| parent | a4aba79bef18ab7f150044a7e4f0f29c88a76513 (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/cxxsupp/libcxxrt')
| -rw-r--r-- | contrib/libs/cxxsupp/libcxxrt/.yandex_meta/devtools.copyrights.report | 144 | ||||
| -rw-r--r-- | contrib/libs/cxxsupp/libcxxrt/.yandex_meta/licenses.list.txt | 4 | ||||
| -rw-r--r-- | contrib/libs/cxxsupp/libcxxrt/auxhelper.cc | 40 | ||||
| -rw-r--r-- | contrib/libs/cxxsupp/libcxxrt/exception.cc | 222 | ||||
| -rw-r--r-- | contrib/libs/cxxsupp/libcxxrt/memory.cc | 136 | ||||
| -rw-r--r-- | contrib/libs/cxxsupp/libcxxrt/unwind.h | 22 | ||||
| -rw-r--r-- | contrib/libs/cxxsupp/libcxxrt/ya.make | 36 | 
7 files changed, 302 insertions, 302 deletions
diff --git a/contrib/libs/cxxsupp/libcxxrt/.yandex_meta/devtools.copyrights.report b/contrib/libs/cxxsupp/libcxxrt/.yandex_meta/devtools.copyrights.report index d2dcb543f32..648d4044da6 100644 --- a/contrib/libs/cxxsupp/libcxxrt/.yandex_meta/devtools.copyrights.report +++ b/contrib/libs/cxxsupp/libcxxrt/.yandex_meta/devtools.copyrights.report @@ -1,72 +1,72 @@ -# File format ($ symbol means the beginning of a line):  -#  -# $ # this message  -# $ # =======================  -# $     # comments (all commentaries should starts with some number of spaces and # symbol)  -# ${action} {license id} {license text hash}  -# $BELONGS ./ya/make/file/relative/path/1/ya.make ./ya/make/2/ya.make  -# ${all_file_action} filename  -# $ # user commentaries (many lines)  -# $ generated description - files with this license, license text... (some number of lines that starts with some number of spaces, do not modify)  -# ${action} {license spdx} {license text hash}  -# $BELONGS ./ya/make/file/relative/path/3/ya.make  -# ${all_file_action} filename  -# $    #    user commentaries  -# $ generated description  -# $ ...  -#  -# You can modify action, all_file_action and add commentaries  -# Available actions:  -# keep - keep license in contrib and use in credits  -# skip - skip license  -# remove - remove all files with this license  -# rename - save license text/links into licenses texts file, but not store SPDX into LINCENSE macro. You should store correct license id into devtools.license.spdx.txt file  -#  -# {all file action} records will be generated when license text contains filename that exists on filesystem (in contrib directory)  -# We suppose that that files can contain some license info  -# Available all file actions:  -# FILE_IGNORE - ignore file (do nothing)  -# FILE_INCLUDE - include all file data into licenses text file  -# =======================  -  -KEEP     COPYRIGHT_SERVICE_LABEL 1d5ea88b15cad450fcd61657e1cf38f0  -BELONGS ya.make  -    License text:  -         * Copyright 2010-2011 PathScale, Inc. All rights reserved.  -    Scancode info:  -        Original SPDX id: COPYRIGHT_SERVICE_LABEL  -        Score           : 100.00  -        Match type      : COPYRIGHT  -    Files with this license:  -        LICENSE [3:3]  -        auxhelper.cc [2:2]  -        dwarf_eh.h [2:2]  -        dynamic_cast.cc [2:2]  -        exception.cc [2:2]  -        memory.cc [2:2]  -        stdexcept.cc [2:2]  -        stdexcept.h [2:2]  -        typeinfo.h [2:2]  -  -KEEP     COPYRIGHT_SERVICE_LABEL 5efdfd987a88b455d2c1b8018df2035e  -BELONGS ya.make  -    License text:  -         * Copyright 2012 David Chisnall. All rights reserved.  -    Scancode info:  -        Original SPDX id: COPYRIGHT_SERVICE_LABEL  -        Score           : 100.00  -        Match type      : COPYRIGHT  -    Files with this license:  -        cxxabi.h [2:2]  -  -KEEP     COPYRIGHT_SERVICE_LABEL 69053d6417df98873c8a8b466c648c78  -BELONGS ya.make  -    License text:  -         * Copyright 2010-2012 PathScale, Inc. All rights reserved.  -    Scancode info:  -        Original SPDX id: COPYRIGHT_SERVICE_LABEL  -        Score           : 100.00  -        Match type      : COPYRIGHT  -    Files with this license:  -        guard.cc [2:2]  -        typeinfo.cc [2:2]  +# File format ($ symbol means the beginning of a line): +# +# $ # this message +# $ # ======================= +# $     # comments (all commentaries should starts with some number of spaces and # symbol) +# ${action} {license id} {license text hash} +# $BELONGS ./ya/make/file/relative/path/1/ya.make ./ya/make/2/ya.make +# ${all_file_action} filename +# $ # user commentaries (many lines) +# $ generated description - files with this license, license text... (some number of lines that starts with some number of spaces, do not modify) +# ${action} {license spdx} {license text hash} +# $BELONGS ./ya/make/file/relative/path/3/ya.make +# ${all_file_action} filename +# $    #    user commentaries +# $ generated description +# $ ... +# +# You can modify action, all_file_action and add commentaries +# Available actions: +# keep - keep license in contrib and use in credits +# skip - skip license +# remove - remove all files with this license +# rename - save license text/links into licenses texts file, but not store SPDX into LINCENSE macro. You should store correct license id into devtools.license.spdx.txt file +# +# {all file action} records will be generated when license text contains filename that exists on filesystem (in contrib directory) +# We suppose that that files can contain some license info +# Available all file actions: +# FILE_IGNORE - ignore file (do nothing) +# FILE_INCLUDE - include all file data into licenses text file +# ======================= + +KEEP     COPYRIGHT_SERVICE_LABEL 1d5ea88b15cad450fcd61657e1cf38f0 +BELONGS ya.make +    License text: +         * Copyright 2010-2011 PathScale, Inc. All rights reserved. +    Scancode info: +        Original SPDX id: COPYRIGHT_SERVICE_LABEL +        Score           : 100.00 +        Match type      : COPYRIGHT +    Files with this license: +        LICENSE [3:3] +        auxhelper.cc [2:2] +        dwarf_eh.h [2:2] +        dynamic_cast.cc [2:2] +        exception.cc [2:2] +        memory.cc [2:2] +        stdexcept.cc [2:2] +        stdexcept.h [2:2] +        typeinfo.h [2:2] + +KEEP     COPYRIGHT_SERVICE_LABEL 5efdfd987a88b455d2c1b8018df2035e +BELONGS ya.make +    License text: +         * Copyright 2012 David Chisnall. All rights reserved. +    Scancode info: +        Original SPDX id: COPYRIGHT_SERVICE_LABEL +        Score           : 100.00 +        Match type      : COPYRIGHT +    Files with this license: +        cxxabi.h [2:2] + +KEEP     COPYRIGHT_SERVICE_LABEL 69053d6417df98873c8a8b466c648c78 +BELONGS ya.make +    License text: +         * Copyright 2010-2012 PathScale, Inc. All rights reserved. +    Scancode info: +        Original SPDX id: COPYRIGHT_SERVICE_LABEL +        Score           : 100.00 +        Match type      : COPYRIGHT +    Files with this license: +        guard.cc [2:2] +        typeinfo.cc [2:2] diff --git a/contrib/libs/cxxsupp/libcxxrt/.yandex_meta/licenses.list.txt b/contrib/libs/cxxsupp/libcxxrt/.yandex_meta/licenses.list.txt index b21e76bd1e3..a88ae308f88 100644 --- a/contrib/libs/cxxsupp/libcxxrt/.yandex_meta/licenses.list.txt +++ b/contrib/libs/cxxsupp/libcxxrt/.yandex_meta/licenses.list.txt @@ -51,12 +51,12 @@ The BSD License   * Copyright 2012 David Chisnall. All rights reserved. -====================File: AUTHORS====================  +====================File: AUTHORS====================  David Chisnall  PathScale engineers -====================File: COPYRIGHT====================  +====================File: COPYRIGHT====================  PathScale Inc  NetBSD Foundation  FreeBSD Foundation diff --git a/contrib/libs/cxxsupp/libcxxrt/auxhelper.cc b/contrib/libs/cxxsupp/libcxxrt/auxhelper.cc index a5a63ec52e6..74b998eef24 100644 --- a/contrib/libs/cxxsupp/libcxxrt/auxhelper.cc +++ b/contrib/libs/cxxsupp/libcxxrt/auxhelper.cc @@ -34,21 +34,21 @@  #include <stdlib.h>  #include "stdexcept.h" -namespace {  -	/**  -	 * Throw an exception if we're compiling with exceptions, otherwise abort.  -	 */  -	template<typename T>  -	void throw_exception()  -	{  -#if !defined(_CXXRT_NO_EXCEPTIONS)  -		throw T();  -#else  -		abort();  -#endif  -	}  -}  -  +namespace { +	/** +	 * Throw an exception if we're compiling with exceptions, otherwise abort. +	 */ +	template<typename T> +	void throw_exception() +	{ +#if !defined(_CXXRT_NO_EXCEPTIONS) +		throw T(); +#else +		abort(); +#endif +	} +} +  /**   * Called to generate a bad cast exception.  This function is intended to allow   * compilers to insert code generating this exception without needing to @@ -56,7 +56,7 @@ namespace {   */  extern "C" void __cxa_bad_cast()  { -	throw_exception<std::bad_cast>();  +	throw_exception<std::bad_cast>();  }  /** @@ -66,7 +66,7 @@ extern "C" void __cxa_bad_cast()   */  extern "C" void __cxa_bad_typeid()  { -	throw_exception<std::bad_typeid>();  +	throw_exception<std::bad_typeid>();  }  /** @@ -77,7 +77,7 @@ extern "C" void __cxa_bad_typeid()   */  extern "C" void __cxa_pure_virtual()  { -	abort();  +	abort();  }  /** @@ -88,10 +88,10 @@ extern "C" void __cxa_pure_virtual()   */  extern "C" void __cxa_deleted_virtual()  { -	abort();  +	abort();  }  extern "C" void __cxa_throw_bad_array_new_length()  { -	throw_exception<std::bad_array_new_length>();  +	throw_exception<std::bad_array_new_length>();  } diff --git a/contrib/libs/cxxsupp/libcxxrt/exception.cc b/contrib/libs/cxxsupp/libcxxrt/exception.cc index e1588ad6397..6baf428eadf 100644 --- a/contrib/libs/cxxsupp/libcxxrt/exception.cc +++ b/contrib/libs/cxxsupp/libcxxrt/exception.cc @@ -1,4 +1,4 @@ -/*   +/*    * Copyright 2010-2011 PathScale, Inc. All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -10,7 +10,7 @@   * 2. Redistributions in binary form must reproduce the above copyright notice,   *    this list of conditions and the following disclaimer in the documentation   *    and/or other materials provided with the distribution. - *   + *    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS   * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,   * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR @@ -56,7 +56,7 @@ static void saveLandingPad(struct _Unwind_Context *context,  	ucb->barrier_cache.bitpattern[3] = reinterpret_cast<uint32_t>(landingPad);  #endif  	// Cache the results for the phase 2 unwind, if we found a handler -	// and this is not a foreign exception.    +	// and this is not a foreign exception.    	if (ex)  	{  		ex->handlerSwitchValue = selector; @@ -156,7 +156,7 @@ struct __cxa_thread_info  	 * caught if we have just caught an exception and rethrown if we are  	 * rethrowing it.  	 */ -	enum   +	enum   	{  		none,  		caught, @@ -169,7 +169,7 @@ struct __cxa_thread_info  	__cxa_eh_globals globals;  };  /** - * Dependent exception.  This   + * Dependent exception.  This    */  struct __cxa_dependent_exception  { @@ -177,7 +177,7 @@ struct __cxa_dependent_exception  	void *primaryException;  #endif  	std::type_info *exceptionType; -	void (*exceptionDestructor) (void *);   +	void (*exceptionDestructor) (void *);   	unexpected_handler unexpectedHandler;  	terminate_handler terminateHandler;  	__cxa_exception *nextException; @@ -222,10 +222,10 @@ static const uint64_t exception_class =  #ifdef _YNDX_LIBUNWIND_ENABLE_EXCEPTION_BACKTRACE      _YNDX_LIBUNWIND_EXCEPTION_BACKTRACE_PRIMARY_CLASS;  #else -	EXCEPTION_CLASS('G', 'N', 'U', 'C', 'C', '+', '+', '\0');  +	EXCEPTION_CLASS('G', 'N', 'U', 'C', 'C', '+', '+', '\0');  #endif  /** - * Class used for dependent exceptions.    + * Class used for dependent exceptions.     */  static const uint64_t dependent_exception_class =  #ifdef _YNDX_LIBUNWIND_ENABLE_EXCEPTION_BACKTRACE @@ -239,7 +239,7 @@ static const uint64_t dependent_exception_class =   * if we change our exception class, to allow this library and libsupc++ to be   * linked to the same executable and both to interoperate.   */ -static const uint32_t abi_exception_class =   +static const uint32_t abi_exception_class =   	GENERIC_EXCEPTION_CLASS('C', '+', '+', '\0');  static bool isCXXException(uint64_t cls) @@ -268,7 +268,7 @@ namespace std  {  	// Forward declaration of standard library terminate() function used to  	// abort execution. -	void terminate(void) noexcept;  +	void terminate(void) noexcept;  }  using namespace ABI_NAMESPACE; @@ -347,20 +347,20 @@ static pthread_key_t eh_key;   * Cleanup function, allowing foreign exception handlers to correctly destroy   * this exception if they catch it.   */ -static void exception_cleanup(_Unwind_Reason_Code reason,   +static void exception_cleanup(_Unwind_Reason_Code reason,                                 struct _Unwind_Exception *ex)  { -	// Exception layout:  -	// [__cxa_exception [_Unwind_Exception]] [exception object]  -	//  -	// __cxa_free_exception expects a pointer to the exception object  -	__cxa_free_exception(static_cast<void*>(ex + 1));  +	// Exception layout: +	// [__cxa_exception [_Unwind_Exception]] [exception object] +	// +	// __cxa_free_exception expects a pointer to the exception object +	__cxa_free_exception(static_cast<void*>(ex + 1));  } -static void dependent_exception_cleanup(_Unwind_Reason_Code reason,   +static void dependent_exception_cleanup(_Unwind_Reason_Code reason,                                 struct _Unwind_Exception *ex)  { -	__cxa_free_dependent_exception(static_cast<void*>(ex + 1));  +	__cxa_free_dependent_exception(static_cast<void*>(ex + 1));  }  /** @@ -428,8 +428,8 @@ static void thread_cleanup(void* thread_info)  		if (info->foreign_exception_state != __cxa_thread_info::none)  		{  			_Unwind_Exception *e = reinterpret_cast<_Unwind_Exception*>(info->globals.caughtExceptions); -			if (e->exception_cleanup)  -				e->exception_cleanup(_URC_FOREIGN_EXCEPTION_CAUGHT, e);  +			if (e->exception_cleanup) +				e->exception_cleanup(_URC_FOREIGN_EXCEPTION_CAUGHT, e);  		}  		else  		{ @@ -451,9 +451,9 @@ static void init_key(void)  {  	pthread_key_create(&eh_key, thread_cleanup);  	pthread_setspecific(eh_key, reinterpret_cast<void *>(0x42)); -   if (pthread_getspecific(eh_key) != reinterpret_cast<void *>(0x42)) {  -       abort();  -   }  +   if (pthread_getspecific(eh_key) != reinterpret_cast<void *>(0x42)) { +       abort(); +   }  	pthread_setspecific(eh_key, 0);  } @@ -464,17 +464,17 @@ static __thread __cxa_thread_info* THR_INFO = nullptr;   */  static __cxa_thread_info *thread_info()  { -	if (THR_INFO) {  -		return THR_INFO;  -   }  -   pthread_once(&once_control, init_key);  +	if (THR_INFO) { +		return THR_INFO; +   } +   pthread_once(&once_control, init_key);  	__cxa_thread_info *info = static_cast<__cxa_thread_info*>(pthread_getspecific(eh_key)); -	if (0 == info)  -	{  -       info = alloc_thread_info();  +	if (0 == info) +	{ +       info = alloc_thread_info();  		pthread_setspecific(eh_key, info);  	} -   THR_INFO = info;  +   THR_INFO = info;  	return info;  } @@ -491,9 +491,9 @@ static struct InitMainTls {   */  static __cxa_thread_info *thread_info_fast()  { -   if (THR_INFO) {  -   	return THR_INFO;  -   }  +   if (THR_INFO) { +   	return THR_INFO; +   }  	return static_cast<__cxa_thread_info*>(pthread_getspecific(eh_key));  }  /** @@ -601,7 +601,7 @@ static void emergency_malloc_free(char *ptr)  			break;  		}  	} -	assert(buffer >= 0 &&  +	assert(buffer >= 0 &&  	       "Trying to free something that is not an emergency buffer!");  	// emergency_malloc() is expected to return 0-initialized data.  We don't  	// zero the buffer when allocating it, because the static buffers will @@ -628,7 +628,7 @@ static char *alloc_or_die(size_t size)  	{  		buffer = emergency_malloc(size);  		// This is only reached if the allocation is greater than 1KB, and -		// anyone throwing objects that big really should know better.    +		// anyone throwing objects that big really should know better.    		if (0 == buffer)  		{  			fprintf(stderr, "Out of memory attempting to allocate exception\n"); @@ -641,7 +641,7 @@ static void free_exception(char *e)  {  	// If this allocation is within the address range of the emergency buffer,  	// don't call free() because it was not allocated with malloc() -	if ((e >= emergency_buffer) &&  +	if ((e >= emergency_buffer) &&  	    (e < (emergency_buffer + sizeof(emergency_buffer))))  	{  		emergency_malloc_free(e); @@ -778,36 +778,36 @@ static void report_failure(_Unwind_Reason_Code err, __cxa_exception *thrown_exce  		case _URC_END_OF_STACK:  			__cxa_begin_catch (&(thrown_exception->unwindHeader));   			std::terminate(); -			fprintf(stderr, "uncaught exception:\n    address -> %p\n",   -					static_cast<void*>(thrown_exception));  -			thrown_exception = realExceptionFromException(thrown_exception);  -			static const __class_type_info *e_ti =  -				static_cast<const __class_type_info*>(&typeid(std::exception));  -			const __class_type_info *throw_ti =  -				dynamic_cast<const __class_type_info*>(thrown_exception->exceptionType);  -			if (throw_ti)  -			{  -				std::exception *e =  -					static_cast<std::exception*>(e_ti->cast_to(static_cast<void*>(thrown_exception+1),  -							throw_ti));  -				if (e)  -				{  -					fprintf(stderr, " what() -> \"%s\"\n", e->what());  -				}  -			}  -  -			size_t bufferSize = 128;  -			char *demangled = static_cast<char*>(malloc(bufferSize));  -			const char *mangled = thrown_exception->exceptionType->name();  -			int status;  -			demangled = __cxa_demangle(mangled, demangled, &bufferSize, &status);  -			fprintf(stderr, "    type -> %s\n",   -				status == 0 ? demangled : mangled);  -			if (status == 0) { free(demangled); }  -			// Print a back trace if no handler is found.  -			// TODO: Make this optional  -			_Unwind_Backtrace(trace, 0);  -  +			fprintf(stderr, "uncaught exception:\n    address -> %p\n",  +					static_cast<void*>(thrown_exception)); +			thrown_exception = realExceptionFromException(thrown_exception); +			static const __class_type_info *e_ti = +				static_cast<const __class_type_info*>(&typeid(std::exception)); +			const __class_type_info *throw_ti = +				dynamic_cast<const __class_type_info*>(thrown_exception->exceptionType); +			if (throw_ti) +			{ +				std::exception *e = +					static_cast<std::exception*>(e_ti->cast_to(static_cast<void*>(thrown_exception+1), +							throw_ti)); +				if (e) +				{ +					fprintf(stderr, " what() -> \"%s\"\n", e->what()); +				} +			} + +			size_t bufferSize = 128; +			char *demangled = static_cast<char*>(malloc(bufferSize)); +			const char *mangled = thrown_exception->exceptionType->name(); +			int status; +			demangled = __cxa_demangle(mangled, demangled, &bufferSize, &status); +			fprintf(stderr, "    type -> %s\n",  +				status == 0 ? demangled : mangled); +			if (status == 0) { free(demangled); } +			// Print a back trace if no handler is found. +			// TODO: Make this optional +			_Unwind_Backtrace(trace, 0); +  			// Just abort. No need to call std::terminate for the second time  			abort();  			break; @@ -859,9 +859,9 @@ extern "C" void __cxa_throw(void *thrown_exception,  	ex->referenceCount = 1;  	ex->exceptionType = tinfo; -	  +	  	ex->exceptionDestructor = dest; -	  +	  	ex->unwindHeader.exception_class = exception_class;  	ex->unwindHeader.exception_cleanup = exception_cleanup; @@ -972,16 +972,16 @@ extern "C" void __cxa_rethrow()  	assert(ex->handlerCount > 0 && "Rethrowing uncaught exception!"); -	// `globals->uncaughtExceptions` was decremented by `__cxa_begin_catch`.  -	// It's normally incremented by `throw_exception`, but this path invokes  -	// `_Unwind_Resume_or_Rethrow` directly to rethrow the exception.  -	// This path is only reachable if we're rethrowing a C++ exception -  -	// foreign exceptions don't adjust any of this state.  -	globals->uncaughtExceptions++;  -  +	// `globals->uncaughtExceptions` was decremented by `__cxa_begin_catch`. +	// It's normally incremented by `throw_exception`, but this path invokes +	// `_Unwind_Resume_or_Rethrow` directly to rethrow the exception. +	// This path is only reachable if we're rethrowing a C++ exception - +	// foreign exceptions don't adjust any of this state. +	globals->uncaughtExceptions++; +  	// ex->handlerCount will be decremented in __cxa_end_catch in enclosing  	// catch block -	  +	  	// Make handler count negative. This will tell __cxa_end_catch that  	// exception was rethrown and exception object should not be destroyed  	// when handler count become zero @@ -1003,7 +1003,7 @@ static std::type_info *get_type_info_entry(_Unwind_Context *context,                                             int filter)  {  	// Get the address of the record in the table. -	dw_eh_ptr_t record = lsda->type_table -   +	dw_eh_ptr_t record = lsda->type_table -   		dwarf_size_of_fixed_size_field(lsda->type_table_encoding)*filter;  	//record -= 4;  	dw_eh_ptr_t start = record; @@ -1090,7 +1090,7 @@ static handler_type check_action_record(_Unwind_Context *context,  		int filter = read_sleb128(&action_record);  		dw_eh_ptr_t action_record_offset_base = action_record;  		int displacement = read_sleb128(&action_record); -		action_record = displacement ?   +		action_record = displacement ?   			action_record_offset_base + displacement : 0;  		// We only check handler types for C++ exceptions - foreign exceptions  		// are only allowed for cleanups and catchalls. @@ -1218,7 +1218,7 @@ BEGIN_PERSONALITY_FUNCTION(__gxx_personality_v0)  	// These two variables define how the exception will be handled.  	dwarf_eh_action action = {0};  	unsigned long selector = 0; -	  +	  	// During the search phase, we do a complete lookup.  If we return  	// _URC_HANDLER_FOUND, then the phase 2 unwind will call this function with  	// a _UA_HANDLER_FRAME action, telling us to install the handler frame.  If @@ -1244,7 +1244,7 @@ BEGIN_PERSONALITY_FUNCTION(__gxx_personality_v0)  			// caught inside a cleanup (destructor).  We should call  			// terminate() in this case.  The catchTemp (landing pad) field of  			// exception object will contain null when personality function is -			// called with _UA_HANDLER_FRAME action for phase 2 unwinding.    +			// called with _UA_HANDLER_FRAME action for phase 2 unwinding.    			return _URC_HANDLER_FOUND;  		} @@ -1335,9 +1335,9 @@ extern "C" void *__cxa_begin_catch(void *e)  	if (isCXXException(exceptionObject->exception_class))  	{ -		// Only exceptions thrown with a C++ exception throwing function will  -		// increment this, so don't decrement it here.  -		globals->uncaughtExceptions--;  +		// Only exceptions thrown with a C++ exception throwing function will +		// increment this, so don't decrement it here. +		globals->uncaughtExceptions--;  		__cxa_exception *ex =  exceptionFromPointer(exceptionObject);  		if (ex->handlerCount == 0) @@ -1355,7 +1355,7 @@ extern "C" void *__cxa_begin_catch(void *e)  			// Clear the rethrow flag (make value positive) - we are allowed  			// to delete this exception at the end of the catch block, as long  			// as it isn't thrown again later. -			  +			  			// Code pattern:  			//  			// try { @@ -1376,7 +1376,7 @@ extern "C" void *__cxa_begin_catch(void *e)  			ex->handlerCount++;  		}  		ti->foreign_exception_state = __cxa_thread_info::none; -		  +		  		return ex->adjustedPtr;  	}  	else @@ -1411,16 +1411,16 @@ extern "C" void __cxa_end_catch()  	__cxa_exception *ex = globals->caughtExceptions;  	assert(0 != ex && "Ending catch when no exception is on the stack!"); -	  +	  	if (ti->foreign_exception_state != __cxa_thread_info::none)  	{  		if (ti->foreign_exception_state != __cxa_thread_info::rethrown)  		{  			_Unwind_Exception *e = reinterpret_cast<_Unwind_Exception*>(ti->globals.caughtExceptions); -			if (e->exception_cleanup)  -				e->exception_cleanup(_URC_FOREIGN_EXCEPTION_CAUGHT, e);  +			if (e->exception_cleanup) +				e->exception_cleanup(_URC_FOREIGN_EXCEPTION_CAUGHT, e);  		} -		globals->caughtExceptions = 0;  +		globals->caughtExceptions = 0;  		ti->foreign_exception_state = __cxa_thread_info::none;  		return;  	} @@ -1444,7 +1444,7 @@ extern "C" void __cxa_end_catch()  		//     }  		// }  		// -		  +		  		ex->handlerCount++;  		deleteException = false;  	} @@ -1474,39 +1474,39 @@ extern "C" std::type_info *__cxa_current_exception_type()  }  /** - * Cleanup, ensures that `__cxa_end_catch` is called to balance an explicit  - * `__cxa_begin_catch` call.  - */  -static void end_catch(char *)  -{  -	__cxa_end_catch();  -}  -/**  + * Cleanup, ensures that `__cxa_end_catch` is called to balance an explicit + * `__cxa_begin_catch` call. + */ +static void end_catch(char *) +{ +	__cxa_end_catch(); +} +/**   * ABI function, called when an exception specification is violated.   *   * This function does not return.   */ -extern "C" void __cxa_call_unexpected(void*exception)   +extern "C" void __cxa_call_unexpected(void*exception)   {  	_Unwind_Exception *exceptionObject = static_cast<_Unwind_Exception*>(exception); -	// Wrap the call to the unexpected handler in calls to `__cxa_begin_catch`  -	// and `__cxa_end_catch` so that we correctly update exception counts if  -	// the unexpected handler throws an exception.  -	__cxa_begin_catch(exceptionObject);  -	__attribute__((cleanup(end_catch)))  -	char unused;  +	// Wrap the call to the unexpected handler in calls to `__cxa_begin_catch` +	// and `__cxa_end_catch` so that we correctly update exception counts if +	// the unexpected handler throws an exception. +	__cxa_begin_catch(exceptionObject); +	__attribute__((cleanup(end_catch))) +	char unused;  	if (exceptionObject->exception_class == exception_class)  	{  		__cxa_exception *ex =  exceptionFromPointer(exceptionObject);  		if (ex->unexpectedHandler)  		{  			ex->unexpectedHandler(); -			// Should not be reached.    +			// Should not be reached.    			abort();  		}  	}  	std::unexpected(); -	// Should not be reached.    +	// Should not be reached.    	abort();  } @@ -1536,7 +1536,7 @@ namespace pathscale  		thread_local_handlers = flag;  	}  	/** -	 * Sets a thread-local unexpected handler.    +	 * Sets a thread-local unexpected handler.    	 */  	unexpected_handler set_unexpected(unexpected_handler f) noexcept  	{ @@ -1546,7 +1546,7 @@ namespace pathscale  		return old;  	}  	/** -	 * Sets a thread-local terminate handler.    +	 * Sets a thread-local terminate handler.    	 */  	terminate_handler set_terminate(terminate_handler f) noexcept  	{ @@ -1582,7 +1582,7 @@ namespace std  	 * Terminates the program, calling a custom terminate implementation if  	 * required.  	 */ -	void terminate() noexcept  +	void terminate() noexcept  	{  		static __cxa_thread_info *info = thread_info();  		if (0 != info && 0 != info->terminateHandler) diff --git a/contrib/libs/cxxsupp/libcxxrt/memory.cc b/contrib/libs/cxxsupp/libcxxrt/memory.cc index 6d08c59bd60..694c5d5037e 100644 --- a/contrib/libs/cxxsupp/libcxxrt/memory.cc +++ b/contrib/libs/cxxsupp/libcxxrt/memory.cc @@ -71,43 +71,43 @@ namespace std  } -#if __cplusplus < 201103L  -#define NOEXCEPT noexcept  -#define BADALLOC throw(std::bad_alloc)  -#else  -#define NOEXCEPT noexcept  -#define BADALLOC  -#endif  -  -namespace  -{  -	/**  -	 * Helper for forwarding from no-throw operators to versions that can  -	 * return nullptr.  Catches any exception and converts it into a nullptr  -	 * return.  -	 */  -	template<void*(New)(size_t)>  -	void *noexcept_new(size_t size)  -	{  -#if !defined(_CXXRT_NO_EXCEPTIONS)  -	try  -	{  -		return New(size);  -	} catch (...)  -	{  -		// nothrow operator new should return NULL in case of  -		// std::bad_alloc exception in new handler  -		return nullptr;  -	}  -#else  -	return New(size);  -#endif  -	}  -}  -  -  +#if __cplusplus < 201103L +#define NOEXCEPT noexcept +#define BADALLOC throw(std::bad_alloc) +#else +#define NOEXCEPT noexcept +#define BADALLOC +#endif + +namespace +{ +	/** +	 * Helper for forwarding from no-throw operators to versions that can +	 * return nullptr.  Catches any exception and converts it into a nullptr +	 * return. +	 */ +	template<void*(New)(size_t)> +	void *noexcept_new(size_t size) +	{ +#if !defined(_CXXRT_NO_EXCEPTIONS) +	try +	{ +		return New(size); +	} catch (...) +	{ +		// nothrow operator new should return NULL in case of +		// std::bad_alloc exception in new handler +		return nullptr; +	} +#else +	return New(size); +#endif +	} +} + +  __attribute__((weak)) -void* operator new(size_t size) BADALLOC  +void* operator new(size_t size) BADALLOC  {  	if (0 == size)  	{ @@ -123,11 +123,11 @@ void* operator new(size_t size) BADALLOC  		}  		else  		{ -#if !defined(_CXXRT_NO_EXCEPTIONS)  -			throw std::bad_alloc();  -#else  -			break;  -#endif  +#if !defined(_CXXRT_NO_EXCEPTIONS) +			throw std::bad_alloc(); +#else +			break; +#endif  		}  		mem = malloc(size);  	} @@ -135,56 +135,56 @@ void* operator new(size_t size) BADALLOC  	return mem;  } -  +  __attribute__((weak)) -void* operator new(size_t size, const std::nothrow_t &) NOEXCEPT  +void* operator new(size_t size, const std::nothrow_t &) NOEXCEPT  { -	return noexcept_new<(::operator new)>(size);  +	return noexcept_new<(::operator new)>(size);  }  __attribute__((weak)) -void operator delete(void * ptr) NOEXCEPT  +void operator delete(void * ptr) NOEXCEPT  {  	free(ptr);  }  __attribute__((weak)) -void * operator new[](size_t size) BADALLOC  +void * operator new[](size_t size) BADALLOC  {  	return ::operator new(size);  }  __attribute__((weak)) -void * operator new[](size_t size, const std::nothrow_t &) NOEXCEPT  +void * operator new[](size_t size, const std::nothrow_t &) NOEXCEPT +{ +	return noexcept_new<(::operator new[])>(size); +} + + +__attribute__((weak)) +void operator delete[](void * ptr) NOEXCEPT  { -	return noexcept_new<(::operator new[])>(size);  +	::operator delete(ptr);  } +// C++14 additional delete operators + +#if __cplusplus >= 201402L  __attribute__((weak)) -void operator delete[](void * ptr) NOEXCEPT  +void operator delete(void * ptr, size_t) NOEXCEPT  {  	::operator delete(ptr);  } -  -// C++14 additional delete operators  -  -#if __cplusplus >= 201402L  -  -__attribute__((weak))  -void operator delete(void * ptr, size_t) NOEXCEPT  -{  -	::operator delete(ptr);  -}  -  -  -__attribute__((weak))  -void operator delete[](void * ptr, size_t) NOEXCEPT  -{  -	::operator delete(ptr);  -}  -  -#endif  + + +__attribute__((weak)) +void operator delete[](void * ptr, size_t) NOEXCEPT +{ +	::operator delete(ptr); +} + +#endif diff --git a/contrib/libs/cxxsupp/libcxxrt/unwind.h b/contrib/libs/cxxsupp/libcxxrt/unwind.h index d1b774cc390..cd163ddfdc7 100644 --- a/contrib/libs/cxxsupp/libcxxrt/unwind.h +++ b/contrib/libs/cxxsupp/libcxxrt/unwind.h @@ -3,18 +3,18 @@  #include <contrib/libs/libunwind/include/unwind.h>  #define DECLARE_PERSONALITY_FUNCTION(name) \ -	_Unwind_Reason_Code name(int version,\  -			_Unwind_Action actions,\  -			uint64_t exceptionClass,\  -			struct _Unwind_Exception *exceptionObject,\  -			struct _Unwind_Context *context);  +	_Unwind_Reason_Code name(int version,\ +			_Unwind_Action actions,\ +			uint64_t exceptionClass,\ +			struct _Unwind_Exception *exceptionObject,\ +			struct _Unwind_Context *context);  #define BEGIN_PERSONALITY_FUNCTION(name) \ -	_Unwind_Reason_Code name(int version,\  -			_Unwind_Action actions,\  -			uint64_t exceptionClass,\  -			struct _Unwind_Exception *exceptionObject,\  -			struct _Unwind_Context *context)\  +	_Unwind_Reason_Code name(int version,\ +			_Unwind_Action actions,\ +			uint64_t exceptionClass,\ +			struct _Unwind_Exception *exceptionObject,\ +			struct _Unwind_Context *context)\  {  #define CALL_PERSONALITY_FUNCTION(name) name(version, actions, exceptionClass, exceptionObject, context) -  + diff --git a/contrib/libs/cxxsupp/libcxxrt/ya.make b/contrib/libs/cxxsupp/libcxxrt/ya.make index 68dc7e3e9f6..12dccbd505a 100644 --- a/contrib/libs/cxxsupp/libcxxrt/ya.make +++ b/contrib/libs/cxxsupp/libcxxrt/ya.make @@ -1,5 +1,5 @@ -# Generated by devtools/yamaker from nixpkgs 9ee8bd188933750be0584f285daf9a295d0c8930.  -  +# Generated by devtools/yamaker from nixpkgs 9ee8bd188933750be0584f285daf9a295d0c8930. +  LIBRARY()  LICENSE( @@ -12,27 +12,27 @@ LICENSE(  LICENSE_TEXTS(.yandex_meta/licenses.list.txt)  OWNER( -    pg  -    setser  -    somov  +    pg +    setser +    somov      g:cpp-committee      g:cpp-contrib  ) -VERSION(2021-09-08-14bf5d5526056ae1cc16f03b7b8e96108a1e38d0)  +VERSION(2021-09-08-14bf5d5526056ae1cc16f03b7b8e96108a1e38d0) + +ORIGINAL_SOURCE(https://github.com/libcxxrt/libcxxrt/archive/14bf5d5526056ae1cc16f03b7b8e96108a1e38d0.tar.gz) -ORIGINAL_SOURCE(https://github.com/libcxxrt/libcxxrt/archive/14bf5d5526056ae1cc16f03b7b8e96108a1e38d0.tar.gz)  -   ADDINCL(      contrib/libs/cxxsupp/libcxxrt  ) -  -NO_COMPILER_WARNINGS()  -  -NO_RUNTIME()  -  -CXXFLAGS(-nostdinc++)  -  + +NO_COMPILER_WARNINGS() + +NO_RUNTIME() + +CXXFLAGS(-nostdinc++) +  IF (CXX_UNWIND == "glibcxx_dynamic" OR ARCH_PPC64LE)      LDFLAGS(-lgcc_s)  ELSE() @@ -48,11 +48,11 @@ ENDIF()  SRCS(      auxhelper.cc -    dynamic_cast.cc  +    dynamic_cast.cc      exception.cc      guard.cc -    memory.cc  -    stdexcept.cc  +    memory.cc +    stdexcept.cc      typeinfo.cc  )  | 
