Skip to content
Snippets Groups Projects
Commit 2d2b018d authored by Alexandre Oliva's avatar Alexandre Oliva Committed by Marc Poulhiès
Browse files

ada: Reduce footprint of C++ exception interoperation support

The initial C++ base-type exception interoperation support change
brought all of GNAT.CPP* along with raise-gcc, because of
[__gnat_]Convert_Caught_Object.  Move that private but pragma-exported
function to GNAT.CPP.Std.Type_Info, so that it can rely on the C++
virtual/dispatch calls that justified the introduction of the Ada
wrapper type, to avoid emulating virtual calls in C or bringing in a
dependency on the C++ compiler and runtime.

Drop the CharPtr package instantiation, that brought a huge amount of
unnecessary code, and use string and storage primitives instead, using
the strcmp builtin directly for the C string compares.

Move the conversion to Ada String in Name to the wrapper interface in
GNAT.CPP.Std, adjusting the private internal type to shave off a few
more bytes from the only unit that raise-gcc will still need.

Finally, disable heap finalization for Type_Info_Ptr, to avoid
dragging in all of the finalization code.  Thank to Eric Botcazou for
the suggestion.

gcc/ada/ChangeLog:

	* libgnat/g-cppexc.adb (Convert_Caught_Object): Move...
	* libgnat/g-cstyin.adb (Convert_Caught_Object):  ... here.
	Use object call notation.
	(strcmp): New.
	(Char_Arr, CharPtr, Char_Pointer, To_chars_ptr): Drop.  Do not
	import Interfaces.C.Pointers.
	(To_Pointer): Convert from System.Address.
	(Name_Starts_With_Asterisk): Rename local variable.
	(Name_Past_Asterisk): Rewrite with System.Address and strcmp.
	Import System.Storage_Elements.
	(Equals): Use strcmp.
	(Before): Fix logic error.  Use strcmp.
	(Name): Move conversion to String...
	* libgnat/g-cppstd.adb (Name): ... here.  Import
	Interfaces.C.Strings.
	* libgnat/g-cppstd.ads (Type_Info_Ptr): Disable heap
	finalization.
	* libgnat/g-cstyin.ads (Name): Change return type.
parent f49b098e
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment