[LLVMbugs] [Bug 17340] New: Spurious -Wunneeded-internal-declaration warnings for separate compilation

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Sep 24 05:43:41 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=17340

            Bug ID: 17340
           Summary: Spurious -Wunneeded-internal-declaration warnings for
                    separate compilation
           Product: clang
           Version: 3.3
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: akim.demaille at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

In the following example, I get a warning with separate compilation, although
the function will be useful where the type foo is really instantiated.

$ cat foo.cc
#include <cstdlib>

static int debug_level()
{
  return !!getenv("DEBUG");
};

template <typename T>
struct foo
{
  foo() : debug_(debug_level()) {}
  int debug_;
};
$ clang++-mp-3.3 -Wall /tmp/foo.cc -c
/tmp/foo.cc:3:12: warning: function 'debug_level' is not needed and will not be
emitted
      [-Wunneeded-internal-declaration]
static int debug_level()
           ^
1 warning generated.
$ clang++-mp-3.3 --version
clang version 3.3 (tags/RELEASE_33/final)
Target: x86_64-apple-darwin12.5.0
Thread model: posix

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130924/8df2fcf4/attachment.html>


More information about the llvm-bugs mailing list