gcc/ada/
* exp_ch4.adb (User_Defined_Primitive_Equality_Op): Refine type
of a local variable.
* exp_dbug.adb (Scope_Contains): Refine all types from Node_Id
to Entity_Id; rename parameters to match those of the
Scope_Within routine (which is similar but not the same); also,
simplify an OR ELSE into a membership test.
gcc/ada/
* exp_ch4.adb (Variant_Is_Unconstrained_UU): Remove redundant
check for empty list.
* exp_disp.adb (Find_Entry_Index): Simplify by removing
redundant check and counting from zero; fix type of a local
variable.
* sem_ch12.adb (Save_Global_Descendant): Remove an unnecessary
special-case for empty lists.
gcc/ada/
* sem_ch5.adb (Analyze_Assignment): Do not emit the warning that
a previous value of the target object is useless if the
right-hand side of the assignment includes target names.
gcc/ada/
* exp_imgv.adb: Add with/use clauses for Targparm.
(Build_Enumeration_Image_Tables): Set type of Threshold to Nat and
initialize it to Nat'Last if the type is local and the target does
not support descriptors. Adjust Threshold_For_Size similarly.
(Expand_Value_Attribute): Minor tweaks.
gcc/ada/
* exp_imgv.adb (Is_User_Defined_Enumeration_Type): Delete.
(Expand_Image_Attribute): Move inline expansion into normal flow of
control, move down declarations and remove superfluous processing.
gcc/ada/
* sem_ch3.adb (Find_Type_Of_Object): When In_Spec_Expression is
set and the object declaration generates a subtype indication,
build the corresponding subtype declaration and place it in tree
without the use of Insert_Actions, which is disabled in this
context.
gcc/ada/
* debug.adb (d_x): Document extended usage.
* exp_imgv.adb (Expand_Standard_Boolean_Image): New procedure.
(Expand_Image_Attribute): Call it to expand in line the attribute
for standard boolean by default.
gcc/ada/
* debug.adb (d_x): Document new usage.
* exp_imgv.adb (Expand_User_Defined_Enumeration_Image): Add Typ
parameter and use it throughout the processing.
(Expand_Image_Attribute): Retrieve the underlying type of the
prefix and use the inline expansion for user-defined enumeration
types with a literal string by default.
gcc/ada/
* exp_imgv.ads (Build_Enumeration_Image_Tables): Adjust comment.
* exp_imgv.adb (Build_Enumeration_Image_Tables): Add the
declaration nodes of the 4 tables to the declaration list of the
function body.
gcc/ada/
* Makefile.rtl (GNATRTL_NONTASKING_OBJS): Add s-imagen, s-imen16,
s-imen32, s-imenu8, s-pehage, s-valuen, s-vaen16, s-vaen32 and
s-vaenu8. Remove s-imenne, s-imgenu and s-valenu.
* debug.adb (d_h): Document new usage.
* einfo.ads (Lit_Hash): New attribute for enumeration types.
(Set_Lit_Hash): Declare.
* einfo.adb (Lit_Hash): New function.
(Set_Lit_Hash): New procedure.
(Write_Field21_Name): Print Lit_Hash for Enumeration_Kind.
* exp_imgv.ads (Build_Enumeration_Image_Tables): Fix description
and document the hash function and its tables.
* exp_imgv.adb: Add with/use clauses for Debug. Add with clause
for System.Perfect_Hash_Generators.
(Append_Table_To): New helper routine.
(Build_Enumeration_Image_Tables): Call it to build the tables.
In the main unit, register the literals with the hash generator.
If they are sufficiently many and -gnatd_h is not passed, generate
a perfect hash function and its tables; otherwise, generate a dummy
hash function. For the other units, generate only the declaration.
In all cases, set Lit_Hash to the entity of the function, if any.
(Expand_Value_Attribute): Pass the 'Unrestricted_Access of Lit_Hash,
if any, as third argument to the Value_Enumeration_NN function.
* gnat1drv.adb (Adjust_Global_Switches): force simpler implementation
of 'Value in CodePeer_Mode.
* lib.ads (Synchronize_Serial_Number): Add SN parameter.
* lib.adb (Synchronize_Serial_Number): Assert that it is larger than
the serial number of the current unit and set the latter to it only
in this case.
* rtsfind.ads (RTU_Id): Add System_Img_Enum_8, System_Img_Enum_16,
System_Img_Enum_32, System_Val_Enum_8, System_Val_Enum_16 and
System_Val_Enum_32. Remove System_Img_Enum, System_Img_Enum_New
and System_Val_Enum.
* sem_attr.adb (Analyze_Access_Attribute): Do not flag a compiler
generated Unrestricted_Access attribute as illegal in a declare
expression.
(RE_Unit_Table): Adjust to above changes.
* libgnat/g-heasor.ads: Add pragma Compiler_Unit_Warning.
* libgnat/g-table.ads: Likewise.
* libgnat/g-pehage.ads: Add with clause and local renaming for
System.Perfect_Hash_Generators.
(Optimization): Turn into derived type.
(Verbose): Turn into renaming.
(Too_Many_Tries): Likewise.
(Table_Name): Move to System.Perfect_Hash_Generators.
(Define): Likewise.
(Value): Likewise.
* libgnat/g-pehage.adb: Remove with clause for Ada.Directories,
GNAT.Heap_Sort_G and GNAT.Table. Move bulk of implementation
to System.Perfect_Hash_Generators, only keep the output part.
* libgnat/s-imagen.ads: New generic unit.
* libgnat/s-imagen.adb: New body.
* libgnat/s-imen16.ads: New unit.
* libgnat/s-imen32.ads: Likewise.
* libgnat/s-imenu8.ads: Likewise.
* libgnat/s-imenne.ads: Adjust description.
* libgnat/s-imgenu.ads: Delete.
* libgnat/s-imgenu.adb: Likewise.
* libgnat/s-pehage.ads: New unit from GNAT.Perfect_Hash_Generators.
* libgnat/s-pehage.adb: New body from GNAT.Perfect_Hash_Generators.
* libgnat/s-valuen.ads: New generic unit.
* libgnat/s-valuen.adb: New body.
* libgnat/s-vaen16.ads: New unit.
* libgnat/s-vaen32.ads: Likewise.
* libgnat/s-vaenu8.ads: Likewise.
* libgnat/s-valenu.ads: Delete.
* libgnat/s-valenu.adb: Likewise.
* gcc-interface/Make-lang.in (GNAT_ADA_OBJS): Add s-pehage.o.
(GNATBIND_OBJS): Remove s-imgenu.o.
gcc/ada/
* sem_util.ads (Apply_Compile_Time_Constraint_Error): Remove
parameter Rep from the function spec and "and if the flag Rep is
set" from the comment.
* sem_util.adb (Apply_Compile_Time_Constraint_Error): Remove
parameter Rep.
gcc/ada/
* sem_aggr.adb (Resolve_Indexed_Aggregate): For indexed
aggregates with component associations verify that if there is
more than one component association then all the choices are
static, that the set of choices define a continuous sequence of
values, and that if loop specfications appear, they do not
include iterator filters or key expressions.
gcc/ada/
* Makefile.rtl (GNATRTL_NONTASKING_OBJS): Add s-dourea, s-imager,
s-imgflt, s-imglfl and s-imgllf.
(LIBGNAT_TARGET_PAIRS) [PowerPC/VxWorks]: Use s-dorepr__fma.adb.
(LIBGNAT_TARGET_PAIRS) [PowerPC/VxWorksAE]: Likewise.
(LIBGNAT_TARGET_PAIRS) [Aarch64/VxWorks]: Likewise.
(LIBGNAT_TARGET_PAIRS) [Aarch64/QNX]: Likewise.
(LIBGNAT_TARGET_PAIRS) [Aarch64/FreeBSD]: Likewise.
(LIBGNAT_TARGET_PAIRS) [PowerPC/Linux]: Likewise.
(LIBGNAT_TARGET_PAIRS) [Aarch64/Linux]: Likewise.
(LIBGNAT_TARGET_PAIRS) [IA-64/Linux]: Likewise.
(LIBGNAT_TARGET_PAIRS) [IA-64/HP-UX]: Likewise.
(LIBGNAT_TARGET_PAIRS) [RISC-V/Linux]: Likewise.
(LIBGNAT_TARGET_PAIRS) [PowerPC/Darwin]: Likewise.
* exp_attr.adb (Expand_N_Attribute_Reference) [Attribute_Fore]: Use
Fixed suffix and Long_Float type.
* exp_imgv.adb (Expand_Image_Attribute): For floating-point types,
use the routine of the corresponding root type. For ordinary fixed
point types, use Fixed suffix and Long_Float type.
(Expand_Value_Attribute): Revert latest change for Long_Long_Float.
* gcc-interface/Make-lang.in (GNAT_ADA_OBJS): Remove libgnat units
g-hesora.o and s-imgenu.o, add g-heasor.o, g-table.o and s-pehage.o.
(GNATBIND_OBJS): Remove libgnat unit s-imgenu.o.
* rtsfind.ads (RTU_Id): Add System_Img_Flt, System_Img_LFlt and
System_Img_LLF. Remove System_Img_Real.
(RE_Id): Rename RE_Fore_Real to RE_Fore_Fixed. Add RE_Image_Float,
RE_Image_Long_Float and RE_Image_Long_Long_Float. Rename
RE_Image_Ordinary_Fixed_Point to RE_Image_Fixed.
(RE_Unit_Table): Adjust to above changes.
* libgnat/a-nbnbre.adb (Fixed_Conversions): Use Long_Float instead
of Long_Long_Float.
* libgnat/a-textio.ads (Field): Remove obsolete comment.
* libgnat/a-ticoau.ads (Aux): Adjust ancestor package.
* libgnat/a-ticoau.adb: Remove with/use clause for System.Img_Real.
(Puts): Call Aux.Set_Image instead of Set_Image_Real.
* libgnat/a-ticoio.adb: Add with/use clauses for System.Img_Flt,
System.Img_LFlt and System.Img_LLF.
(Scalar_Float): Add third actual parameter.
(Scalar_Long_Float): Likewise.
(Scalar_Long_Long_Float): Likewise.
* libgnat/a-tifiio.adb: Add with/use clauses for System.Img_LFlt
and System.Val_LFlt. Remove the one for System.Val_LLF. Replace
Long_Long_Float with Long_Float throughout.
* libgnat/a-tifiio__128.adb: Likewise.
* libgnat/a-tiflau.ads: Add Set_Image formal parameter.
* libgnat/a-tiflau.adb: Add with/use clause for System.Img_Util,
remove the one for System.Img_Real.
(Put): Call Set_Image instead of Set_Image_Real.
(Puts): Likewise.
* libgnat/a-tiflio.adb: Add with/use clause for System.Img_Flt,
System.Img_LFlt and System.Img_LLF.
(Aux_Float): Add third actual parameter.
(Aux_Long_Float): Likewise.
(Aux_Long_Long_Float): Likewise.
* libgnat/a-witeio.ads (Field): Remove obsolete comment.
* libgnat/a-wtcoau.ads (Aux): Adjust ancestor package.
* libgnat/a-wtcoau.adb: Remove with/use clause for System.Img_Real.
(Puts): Call Aux.Set_Image instead of Set_Image_Real.
* libgnat/a-wtcoio.adb: Add with/use clauses for System.Img_Flt,
System.Img_LFlt and System.Img_LLF.
(Scalar_Float): Add third actual parameter.
(Scalar_Long_Float): Likewise.
(Scalar_Long_Long_Float): Likewise.
* libgnat/a-wtfiio.adb: Add with/use clauses for System.Img_LFlt
and System.Val_LFlt. Remove the one for System.Val_LLF. Replace
Long_Long_Float with Long_Float throughout.
* libgnat/a-wtfiio__128.adb: Likewise.
* libgnat/a-wtflau.ads: Add Set_Image formal parameter.
* libgnat/a-wtflau.adb: Add with/use clause for System.Img_Util,
remove the one for System.Img_Real.
(Put): Call Set_Image instead of Set_Image_Real.
(Puts): Likewise.
* libgnat/a-wtflio.adb: Add with/use clause for System.Img_Flt,
System.Img_LFlt and System.Img_LLF.
(Aux_Float): Add third actual parameter.
(Aux_Long_Float): Likewise.
(Aux_Long_Long_Float): Likewise.
* libgnat/a-ztexio.ads (Field): Remove obsolete comment.
* libgnat/a-ztcoau.ads (Aux): Adjust ancestor package.
* libgnat/a-ztcoau.adb: Remove with/use clause for System.Img_Real.
(Puts): Call Aux.Set_Image instead of Set_Image_Real.
* libgnat/a-ztcoio.adb: Add with/use clauses for System.Img_Flt,
System.Img_LFlt and System.Img_LLF.
(Scalar_Float): Add third actual parameter.
(Scalar_Long_Float): Likewise.
(Scalar_Long_Long_Float): Likewise.
* libgnat/a-ztfiio.adb: Add with/use clauses for System.Img_LFlt
and System.Val_LFlt. Remove the one for System.Val_LLF. Replace
Long_Long_Float with Long_Float throughout.
* libgnat/a-ztfiio__128.adb: Likewise.
* libgnat/a-ztflau.ads: Add Set_Image formal parameter.
* libgnat/a-ztflau.adb: Add with/use clause for System.Img_Util,
remove the one for System.Img_Real.
(Put): Call Set_Image instead of Set_Image_Real.
(Puts): Likewise.
* libgnat/a-ztflio.adb: Add with/use clause for System.Img_Flt,
System.Img_LFlt and System.Img_LLF.
(Aux_Float): Add third actual parameter.
(Aux_Long_Float): Likewise.
(Aux_Long_Long_Float): Likewise.
* libgnat/s-dorepr.adb: New file.
* libgnat/s-dorepr__fma.adb: Likewise.
* libgnat/s-dourea.ads: Likewise.
* libgnat/s-dourea.adb: Likewise.
* libgnat/s-forrea.ads (Fore_Real): Rename into...
(Fore_Fixed): ...this and take Long_Float parameters.
* libgnat/s-forrea.adb (Fore_Real): Likewise.
(Fore_Fixed): Likewise.
* libgnat/s-imgrea.ads: Move to...
(Set_Image_Real): Turn into mere renaming.
* libgnat/s-imager.ads: ...here.
(Image_Ordinary_Fixed_Point): Turn into...
(Image_Fixed_Point): ...this.
* libgnat/s-imgrea.adb: Add pragma No_Body. Move to...
* libgnat/s-imager.adb: ...here.
(Image_Ordinary_Fixed_Point): Turn into...
(Image_Fixed_Point): ...this.
(Is_Negative): Replace Long_Long_Float with Num.
(Set_Image_Real): Likewise. Use Double_T instead of single Num
throughout the algorithm.
* libgnat/s-imgflt.ads: New file.
* libgnat/s-imglfl.ads: Likewise.
* libgnat/s-imgllf.ads: Likewise.
* libgnat/s-imagef.ads: Adjust comment.
* libgnat/s-imguti.ads (Max_Real_Image_Length): New named number.
* libgnat/s-powflt.ads (Maxpow): Adjust.
(Powten): Turn into an exact table of double Float.
* libgnat/s-powlfl.ads (Maxpow): Adjust.
(Powten): Turn into an exact table of double Long_Float.
* libgnat/s-powllf.ads (Maxpow): Adjust.
(Powten): Turn into an exact table of double Long_Long_Float.
* libgnat/s-valrea.ads: Change order of formal parameters.
* libgnat/s-valrea.adb: Add with clause for System.Double_Real.
(Double_Real): New instantiation.
(Fast2Sum): Delete.
(Large_Powten): New function.
(Integer_to_Real): Use Quick_Two_Sum instead of Fast2Sum. Convert
the value to Double_T. Do the scaling in Double_T for base 10.
* libgnat/s-valflt.ads: Remove with/use clasue for Interfaces,
add it for System.Unsigned_Types. Use Unsigned.
* libgnat/s-vallfl.ads: Remove with/use clasue for Interfaces,
add it for System.Unsigned_Types. Use Long_Unsigned.
* libgnat/s-valllf.ads: Remove with/use clasue for Interfaces,
add it for System.Unsigned_Types. Use Long_Long_Unsigned.
gcc/ada/
* sem_eval.adb (Eval_Arithmetic_Op): Call
Set_Raises_Constraint_Error on real division by zero just like
it is called for integer division by zero earlier in this
routine.
gcc/ada/
* pprint.adb (Expr_Name): Introduce local constants to make the
code more readable and avoid repeated calls to Next to reach the
ELSE part of an if-expression.
This makes sure to follow SSA edges when folding eliminated stmts.
This reaps the same benefit as forwprop folding all stmts, not
waiting for one to produce copysign in the new testcase.
2021-05-04 Richard Biener <rguenther@suse.de>
PR tree-optimization/79333
* tree-ssa-sccvn.c (eliminate_dom_walker::eliminate_stmt):
Fold stmt following SSA edges.
* gcc.dg/tree-ssa/ssa-fre-94.c: New testcase.
* gcc.dg/graphite/fuse-1.c: Adjust.
* gcc.dg/pr43864-4.c: Likewise.
There is -fdelete-dead-exceptions now and we're tracking
nothrow and const/pure bits separately and I do remember that
const or pure does _not_ imply nothrow.
Now, in the light of the PR100382 fix which added a
stmt_unremovable_because_of_non_call_eh_p guard to DSEs "DCE"
I wondered how -fdelete-dead-exceptions applies to calls and
whether stmt_unremovable_because_of_non_call_eh_p doing
return (fun->can_throw_non_call_exceptions
&& !fun->can_delete_dead_exceptions
&& stmt_could_throw_p (fun, stmt));
really should conditionalize itself on
fun->can_throw_non_call_exceptions. In fact DCE happily elides
pure function calls that throw without a LHS (probably a
consistency bug). The following testcase shows this:
int x, y;
int __attribute__((pure,noinline)) foo () { if (x) throw 1; return y; }
int main()
{
int a[2];
x = 1;
try {
int res = foo ();
a[0] = res;
} catch (...) {
return 0;
}
return 1;
}
note that if you wrap foo () into another noinline
wrap_foo () { foo (); return 1; } function then we need to make
sure to not DCE this call either even though it only throws
externally.
2021-05-03 Richard Biener <rguenther@suse.de>
PR middle-end/100394
* calls.c (expand_call): Preserve possibly throwing calls.
* cfgexpand.c (expand_call_stmt): When a call can throw signal
RTL expansion there are side-effects.
* tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Simplify,
mark all possibly throwing stmts necessary unless we can elide
dead EH.
* tree-ssa-dse.c (pass_dse::execute): Preserve exceptions unless
-fdelete-dead-exceptions.
* tree.h (DECL_PURE_P): Add note about exceptions.
* g++.dg/torture/pr100382.C: New testcase.
This is a trivial change to libcc1 to avoid an explicit call to c_str.
Passing by const reference is slightly less wordy.
libcc1
* compiler.cc (make_regexp): Take const std::string.
(cc1_plugin::compiler_triplet_regexp::find): Update.
PR c/94669 points out that a couple of spots in libcc1 take a
std::string where a reference would do. This changes these spots to
take a const char *, to reduce the number of copies.
libcc1
PR c/94669
* compiler.hh (compiler_driver_filename): Take const char *.
(compiler_triplet_regexp): Likewise.
This patch completes the transition of libcc1 from the use of separate
template functions for different arities to the use of variadic
functions. This is how I had wanted it to work from the very
beginning, and is possible now with C++11.
I had thought that variadic callbacks required C++17, but it turns out
that the approach taken here is basically equivalent to std::apply --
just a bit wordier.
libcc1
* rpc.hh (argument_wrapper) <get>: Replace cast operator.
(argument_wrapper<T *>) <get>: Likewise.
(unmarshall): Add std::tuple overloads.
(callback): Remove.
(class invoker): New.
* libcp1plugin.cc (plugin_init): Update.
* libcp1.cc (libcp1::add_callbacks): Update.
* libcc1plugin.cc (plugin_init): Update.
* libcc1.cc (libcc1::add_callbacks): Update.
* connection.cc (cc1_plugin::connection::do_wait): Update.
libcc1 has a memory leak when calling fork_exec -- it allocates a new
vector of arguments, but then does not free it anywhere. This patch
changes this code to use std::vector instead.
Note that the previous code tried to avoid bad_alloc. I don't believe
this is very important. For one thing, plenty of other allocations do
not bother with this.
libcc1
* gdbctx.hh (do_compile): Use std::vector.
Both the C and C++ side of the GDB plugin in libcc1 share a lot of
code relating to the base GCC interface. It was all copy-and-pasted,
but is essentially identical between the two. This is by design, as
the base GCC API is intended to be shared.
This patch merges the implementations into base_gdb_plugin, which was
introduced earlier for this purpose.
libcc1
* libcp1.cc (libcp1): Change parameters. Update.
(libcp1_set_verbose, libcp1_set_arguments)
(libcp1_set_triplet_regexp, libcp1_set_driver_filename)
(libcp1_set_source_file, libcp1_set_print_callback, fork_exec)
(libcp1_compile, libcp1_destroy, vtable): Remove.
(libcp1::add_callbacks): New method, extracted from
libcp1_compile.
(gcc_c_fe_context): Update.
* libcc1.cc (libcc1): Change parameters. Update.
(libcc1_set_verbose, libcc1_set_arguments)
(libcc1_set_triplet_regexp, libcc1_set_driver_filename)
(libcc1_set_source_file, libcc1_set_print_callback, fork_exec)
(libcc1_compile, libcc1_destroy, vtable): Remove.
(libcc1::add_callbacks): New method, extracted from
libcc1_compile.
(gcc_c_fe_context): Update.
* gdbctx.hh (base_gdb_plugin): Change parameters.
(~base_gdb_plugin): New.
<add_callbacks>: New virtual method.
<plugin_name, fe_version, compiler_name, vtable>: New members.
(get_self, do_set_verbose, do_set_arguments)
(do_set_triplet_regexp, do_set_driver_filename)
(do_set_arguments_v0, do_set_source_file, do_set_print_callback)
(fork_exec, do_compile, do_compile_v0, do_destroy): New methods.
The C++ plugin defaults to version 0 of the base compiler API.
However, this is a mistake -- version 1 was introduced before the C++
API was even implemented. This switches the default to version 1.
Note that the compiler-side plugin will accept this version, so it
should remain compatible.
libcc1
* libcp1.cc (vtable): Use GCC_FE_VERSION_1.
The two GDB plugins in libcc1 share a fair amount of code. This was
done by copy-and-paste, though in reality the underlying code is
nearly identical.
libcc1
* libcp1.cc (struct libcp1): Derive from base_gdb_plugin. Remove
shared code.
(class libcp1_connection): Remove.
(rpc): Remove.
(libcp1_set_verbose, libcp1_compile): Update.
(cp_call_binding_oracle, cp_call_symbol_address)
(cp_call_enter_scope, cp_call_leave_scope): Update.
* libcc1.cc (struct libcc1): Derive from base_gdb_plugin. Remove
shared code.
(class libcc1_connection): Remove.
(c_call_binding_oracle, c_call_symbol_address): Update.
(rpc): Remove.
(libcc1_set_verbose, libcc1_compile): Update.
* gdbctx.hh: New file.
Both plugins in libcc1 share a fair amount of boilerplate. They both
share error-emission code, context management code, and tree GC code.
This patch unifies these two bodies of code, avoiding needless
duplication.
libcc1
* libcc1plugin.cc: Move code to context.cc.
* libcp1plugin.cc: Move code to context.cc.
* context.hh: New file.
* context.cc: New file.
* Makefile.in: Rebuild.
* Makefile.am (AM_CPPFLAGS): Add more gcc flags.
(CPPFLAGS_FOR_C, CPPFLAGS_FOR_CXX): Update.
(libcc1plugin_la_SOURCES): Add context.hh, context.cc.
(libcp1plugin_la_SOURCES): Likewise.
This changes libcc1 to ues foreach in a couple of spots.
libcc1
* libcp1plugin.cc (plugin_context::mark): Use foreach.
* libcc1plugin.cc (plugin_context::mark): Use foreach.
Both libcc1 plugins have nearly identical copies of code to find the
underlying compiler. This seemed wasteful to me, so this patch
unifies the copies.
Two minor API changes were needed.
First, the old code used a back-link from the compiler object to the
plugin object to check the 'verbose' setting. This patch adds a
'verbose' setting directly to the compiler object instead.
Second, the 'find' method implicitly knew which compiler base name
("gcc" or "g++") to use. This patch makes this a parameter that is
passed in by the plugin.
libcc1
* libcp1.cc (compiler, compiler_triplet_regexp)
(compiler_driver_filename): Remove.
(libcp1::libcp1): Update.
(make_regexp, libcp1::compiler::find)
(libcp1::compiler_triplet_regexp::find)
(libcp1::compiler_driver_filename::find): Remove.
(libcp1_set_verbose, libcp1_set_arguments)
(libcp1_set_triplet_regexp, libcp1_set_driver_filename): Update.
* libcc1.cc (compiler, compiler_triplet_regexp)
(compiler_driver_filename): Remove.
(libcc1::libcc1): Update.
(make_regexp, libcc1::compiler::find)
(libcc1::compiler_triplet_regexp::find)
(libcc1::compiler_driver_filename::find): Remove.
(libcc1_set_verbose, libcc1_set_arguments)
(libcc1_set_triplet_regexp, libcc1_set_driver_filename): Update.
* compiler.cc: New file.
* compiler.hh: New file.
* Makefile.in: Rebuild.
* Makefile.am (libcc1_la_SOURCES): Add compiler.hh, compiler.cc.
This changes libcc1 to use unique_ptr in a few more places, removing
some manual memory management.
libcc1
* libcp1.cc (struct libcp1) <connection, compilerp>: Use
unique_ptr.
(~libcp1): Remove.
(libcp1_compile, libcp1_set_triplet_regexp)
(libcp1_set_driver_filename): Update.
* libcc1.cc (struct libcc1) <connection, compilerp>: Use
unique_ptr.
(~libcc1): Remove.
(libcc1_set_triplet_regexp, libcc1_set_driver_filename)
(libcc1_compile): Update.
This changes libcc1 to use the 'deleter' template in a few more
places. The template and basic specializations are moved to a new
header, then some unmarshall functions are changed to use this code.
This change avoids the need to repeat cleanup code in the
unmarshallers.
libcc1
* rpc.hh (deleter): Move template and some specializations to
deleter.hh.
(argument_wrapper<const T *>): Use cc1_plugin::unique_ptr.
* marshall.cc (cc1_plugin::unmarshall): Use
cc1_plugin::unique_ptr.
* marshall-cp.hh (deleter): New specializations.
(unmarshall): Use cc1_plugin::unique_ptr.
* deleter.hh: New file.
This adds deleter objects for various kinds of protocol pointers to
libcc1. Existing specializations of argument_wrapper are then
replaced with a single specialization that handles all pointer types
via the appropriate deleter. The result here is a bit nicer because
the argument_wrapper boilerplate code is completely shared, leaving
just the memory-management detail to the particular specializations.
libcc1
* rpc.hh (struct deleter): New template class and
specializations.
(argument_wrapper): Remove specializations. Add specialization
for any pointer type.
This changes libcc1 to use std::vector in the code that builds
function types. This avoids some explicit memory management.
libcc1
* libcp1plugin.cc (plugin_build_function_type): Use std::vector.
* libcc1plugin.cc (plugin_build_function_type): Use std::vector.