This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Attribute for unused warning for variables of non-trivial types


On Fri, Nov 9, 2012 at 5:08 AM, Florian Weimer <fweimer@redhat.com> wrote:
> On 11/08/2012 08:43 PM, Lubos Lunak wrote:
>
>>   The patch implements an attribute for marking types for which gcc cannot
>> on
>> its own issue warnings about unused variables (e.g. because the ctor is
>> external), but for which such a warning might be useful anyway (e.g.
>> std::string).
>
>
> I'm not sure if the default shouldn't be "warn".  RAII-only classes which
> are used purely for constructor/destructor side effects are pretty rare,
> AFAICT.
>
> To make this useful with containers, we'd need further annotations to tell
> read and write accesses apart.  (A vector might be append-only, and the
> elements might be ignored.)
>
> --
> Florian Weimer / Red Hat Product Security Team

I am also concerned that an idiomatic standard C++ program would need
obscure annotations to silence GCC.

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]