Re: C++ PATCH to deal with trivial but non-callable [cd]tors

2014-01-20 Thread Eric Botcazou
2013-10-31 Eric Botcazou ebotca...@adacore.com c-family/ * c-ada-spec.h (cpp_operation): Add IS_TRIVIAL. (dump_ada_specs): Adjust prototype of second callback. It turns out that adjusting (constifying) the prototype of the second callback was a gratuitous change and future

Re: C++ PATCH to deal with trivial but non-callable [cd]tors

2013-10-31 Thread Jason Merrill
On 10/25/2013 03:04 PM, Jason Merrill wrote: In C++ all classes have destructors, but we try to defer building the implicit declaration. My patch causes us to build those implicit declarations more often, which is probably a bit of a memory regression, We can still avoid doing this in C++98

Re: C++ PATCH to deal with trivial but non-callable [cd]tors

2013-10-31 Thread Eric Botcazou
I think a good way to check for any non-trivial methods would be to check trivial_type_p in the front end and then see if there are any !DECL_ARTIFICIAL decls in TYPE_METHODS. Revised patch attached, tested on x86-64/Linux. 2013-10-31 Eric Botcazou ebotca...@adacore.com c-family/

Re: C++ PATCH to deal with trivial but non-callable [cd]tors

2013-10-31 Thread Jason Merrill
On 10/31/2013 10:47 AM, Eric Botcazou wrote: I think a good way to check for any non-trivial methods would be to check trivial_type_p in the front end and then see if there are any !DECL_ARTIFICIAL decls in TYPE_METHODS. Revised patch attached, tested on x86-64/Linux. Looks good. Jason

Re: C++ PATCH to deal with trivial but non-callable [cd]tors

2013-10-30 Thread Eric Botcazou
In C++ all classes have destructors, but we try to defer building the implicit declaration. My patch causes us to build those implicit declarations more often, which is probably a bit of a memory regression, but it would be good for your code to handle the dtor being declared. OK, patch

Re: C++ PATCH to deal with trivial but non-callable [cd]tors

2013-10-30 Thread Jason Merrill
On 10/30/2013 06:14 AM, Eric Botcazou wrote: +/* Return whether DECL, a method of a C++ TYPE, is trivial, that is to say + doesn't do anything for the objects of TYPE. */ + +static bool +is_trivial_method (const_tree decl, const_tree type) +{ + if (cpp_check (decl, IS_CONSTRUCTOR)

Re: C++ PATCH to deal with trivial but non-callable [cd]tors

2013-10-30 Thread Eric Botcazou
+/* Return whether DECL, a method of a C++ TYPE, is trivial, that is to say + doesn't do anything for the objects of TYPE. */ + +static bool +is_trivial_method (const_tree decl, const_tree type) +{ + if (cpp_check (decl, IS_CONSTRUCTOR) !TYPE_NEEDS_CONSTRUCTING (type)) +

Re: C++ PATCH to deal with trivial but non-callable [cd]tors

2013-10-25 Thread Eric Botcazou
Late in the C++11 process it was decided that a constructor or destructor can be trivial but not callable; as a result, everywhere that assumed that a call to a trivial function didn't need any processing needed to be updated. This patch does that. This has introduced a problem for the

Re: C++ PATCH to deal with trivial but non-callable [cd]tors

2013-10-25 Thread Jason Merrill
On 10/25/2013 01:53 PM, Eric Botcazou wrote: This has introduced a problem for the -fdump-ada-spec machinery, which boils down to the TYPE_METHODS field of the following structure: struct _outer { struct _inner { int x; } inner; } outer; Previously it was empty, now it

C++ PATCH to deal with trivial but non-callable [cd]tors

2013-10-23 Thread Jason Merrill
Late in the C++11 process it was decided that a constructor or destructor can be trivial but not callable; as a result, everywhere that assumed that a call to a trivial function didn't need any processing needed to be updated. This patch does that. Tested x86_64-pc-linux-gnu, applying to

Re: C++ PATCH to deal with trivial but non-callable [cd]tors

2013-10-23 Thread Paolo Carlini
On 10/23/2013 08:05 PM, Jason Merrill wrote: @@ -4674,15 +4674,8 @@ deduce_noexcept_on_destructors (tree t) if (!CLASSTYPE_METHOD_VEC (t)) return; - bool saved_nontrivial_dtor = TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t); - - /* Avoid early exit from synthesized_method_walk (c++/57645).