Skip to content

Unneeded-internal-declaration for variable that is used. #7

@GoogleCodeExporter

Description

@GoogleCodeExporter
What steps will reproduce the problem?
In some code if you have an internal variable that is used for a default 
argument, cppclean says it's not needed.  E.g.:

static const char foo[] = "blablabla";

void f(const char * cstr = foo){}

int main()
{  
  f();
  return 0;
}

What is the expected output? What do you see instead?
I expect cppclean to have no problems with this.  Instead it says:
clean_test.C:1: unused variable 'foo'

What version of the product are you using? On what operating system?
I am using cppclean 0.2.5, on Mac OSX 10.9.5.

Please provide any additional information below.
clang++ with -Wextra (but not with just -Wall) also complains that the variable 
is not needed.
It's possible I'm misunderstanding what the warning is trying to tell me.  I am 
interpreting "not needed" as "you could delete this line and it wouldn't break 
anything".  Clearly removing that line does break the code (I even tried it 
with clang++ just to be sure).


Original issue reported on code.google.com by [email protected] on 12 Nov 2014 at 11:27

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions