[LLVMbugs] [Bug 7337] New: -Wunused-parameter

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jun 9 16:16:47 PDT 2010


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

           Summary: -Wunused-parameter
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: mattjomeara at gmail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


compiling unused_parameter_ifdef.cc (see below) with

   clang -Wunused-parameter unused_parameter_ifdef.cc

produces the following warning:

unused_parameter_ifdef.cc:3:14: warning: unused parameter 'x'
[-Wunused-paramet\
er]
  int a( int x ){
             ^
1 warning generated.


This warning should not appear as x will be used if the #ifdef USE_PARAMETER is
set.


-------------------------------------------------
file unused_parameter_ifdef.cc:
-------------------------------------------------
class abc {

  int a( int x ){
#ifdef USE_PARAMETER
    return x;
#else
    return 0;
#endif
  }
};

int main(int, char **){ return 0;}
--------------------------------------------------


$ clang -v
clang version 2.0 (trunk 105679)
Target: x86_64-unknown-linux-gnu
Thread model: posix

$ uname -a
Linux xxxxxxxx 2.6.32-22-generic #36-Ubuntu SMP Thu Jun 3 19:31:57 UTC 2010
x86_64 GNU/Linux

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list