On 06/30/2013 04:21 AM, Lubos Lunak wrote:
Are you sure this should be covered by -Wunused-but-set-variable rather than
plain -Wunused-variable? While strictly technically speaking the variable is
set by the ctor, it's conceptually confusing (is "string s;" really set from
the developer's point of view?), and it's inconsistent with basic types:
$ echo "void f() { int a = 1; } " | g++ -x c++ -fsyntax-only -Wall -
<stdin>: In function ‘void f()’:
<stdin>:1:16: warning: unused variable ‘a’ [-Wunused-variable]
Ah, I didn't realize that we warn about unused variables with
initializers. OK, then.
+ { "warn_unused", 0, 0, false, false, false,
+ handle_warn_unused_attribute, false },
Was it a deliberate decision to put this in the c-common attributes
rather than the C++-specific ones? I'm not saying it's wrong, just
interested in your thinking.
+ || lookup_attribute ("warn_unused", TYPE_ATTRIBUTES (TREE_TYPE
(decl)))))
Line longer than 80 characters.
+ if( !lookup_attribute ("warn_unused", TYPE_ATTRIBUTES (type)))
Space before paren, not after.
And your patch is missing a ChangeLog entry.
It looks like you don't have a copyright assignment on file with the
FSF; this patch is small enough not to need one, but we should take care
of that so that future patches don't get blocked.
Jason