Re: {PATCH] New C++ warning -Wcatch-value

2017-06-05 Thread Jason Merrill
On Mon, Jun 5, 2017 at 6:55 AM, Volker Reichelt wrote: > On 15 May, Martin Sebor wrote: >>> So how about the following then? I stayed with the catch part and added >>> a parameter to the warning to let the user decide on the warnings she/he >>> wants to get: -Wcatch-value=n. >>> -Wcatch-value=1 on

Re: {PATCH] New C++ warning -Wcatch-value

2017-06-05 Thread Volker Reichelt
On 15 May, Martin Sebor wrote: >> So how about the following then? I stayed with the catch part and added >> a parameter to the warning to let the user decide on the warnings she/he >> wants to get: -Wcatch-value=n. >> -Wcatch-value=1 only warns for polymorphic classes that are caught by >> value (

Re: {PATCH] New C++ warning -Wcatch-value

2017-05-31 Thread Jason Merrill
On Tue, May 30, 2017 at 2:14 AM, Volker Reichelt wrote: > On 24 May, Jason Merrill wrote: >> On Mon, May 15, 2017 at 3:58 PM, Martin Sebor wrote: So how about the following then? I stayed with the catch part and added a parameter to the warning to let the user decide on the warnings she

Re: {PATCH] New C++ warning -Wcatch-value

2017-05-29 Thread Volker Reichelt
On 24 May, Jason Merrill wrote: > On Mon, May 15, 2017 at 3:58 PM, Martin Sebor wrote: >>> So how about the following then? I stayed with the catch part and added >>> a parameter to the warning to let the user decide on the warnings she/he >>> wants to get: -Wcatch-value=n. >>> -Wcatch-value=1 onl

Re: {PATCH] New C++ warning -Wcatch-value

2017-05-24 Thread Jason Merrill
On Mon, May 15, 2017 at 3:58 PM, Martin Sebor wrote: >> So how about the following then? I stayed with the catch part and added >> a parameter to the warning to let the user decide on the warnings she/he >> wants to get: -Wcatch-value=n. >> -Wcatch-value=1 only warns for polymorphic classes that a

Re: {PATCH] New C++ warning -Wcatch-value

2017-05-15 Thread Martin Sebor
So how about the following then? I stayed with the catch part and added a parameter to the warning to let the user decide on the warnings she/he wants to get: -Wcatch-value=n. -Wcatch-value=1 only warns for polymorphic classes that are caught by value (to avoid slicing), -Wcatch-value=2 warns for

Re: {PATCH] New C++ warning -Wcatch-value

2017-05-14 Thread Volker Reichelt
On 7 May, Martin Sebor wrote: > On 05/07/2017 02:03 PM, Volker Reichelt wrote: >> On 2 May, Martin Sebor wrote: >>> On 05/01/2017 02:38 AM, Volker Reichelt wrote: Hi, catching exceptions by value is a bad thing, as it may cause slicing, i.e. a) a superfluous copy b) which

Re: {PATCH] New C++ warning -Wcatch-value

2017-05-08 Thread Jason Merrill via gcc-patches
On Sun, May 7, 2017 at 8:05 PM, Martin Sebor wrote: > On 05/07/2017 02:03 PM, Volker Reichelt wrote: >> >> On 2 May, Martin Sebor wrote: >>> >>> On 05/01/2017 02:38 AM, Volker Reichelt wrote: Hi, catching exceptions by value is a bad thing, as it may cause slicing, i.e. >

Re: {PATCH] New C++ warning -Wcatch-value

2017-05-07 Thread Martin Sebor
On 05/07/2017 02:03 PM, Volker Reichelt wrote: On 2 May, Martin Sebor wrote: On 05/01/2017 02:38 AM, Volker Reichelt wrote: Hi, catching exceptions by value is a bad thing, as it may cause slicing, i.e. a) a superfluous copy b) which is only partial. See also https://github.com/isocpp/CppCor

Re: {PATCH] New C++ warning -Wcatch-value

2017-05-07 Thread Volker Reichelt
On 2 May, Martin Sebor wrote: > On 05/01/2017 02:38 AM, Volker Reichelt wrote: >> Hi, >> >> catching exceptions by value is a bad thing, as it may cause slicing, i.e. >> a) a superfluous copy >> b) which is only partial. >> See also >> https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCo

Re: {PATCH] New C++ warning -Wcatch-value

2017-05-02 Thread Martin Sebor
On 05/01/2017 02:38 AM, Volker Reichelt wrote: Hi, catching exceptions by value is a bad thing, as it may cause slicing, i.e. a) a superfluous copy b) which is only partial. See also https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#e15-catch-exceptions-from-a-hierarc

{PATCH] New C++ warning -Wcatch-value

2017-05-01 Thread Volker Reichelt
Hi, catching exceptions by value is a bad thing, as it may cause slicing, i.e. a) a superfluous copy b) which is only partial. See also https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#e15-catch-exceptions-from-a-hierarchy-by-reference To warn the user about catch han