[LLVMbugs] [Bug 13747] New: [linux kernel] -Wunused-value should not warn about unused statement expression result expanded from a macro

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Aug 31 15:28:10 PDT 2012


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

             Bug #: 13747
           Summary: [linux kernel] -Wunused-value should not warn about
                    unused statement expression result expanded from a
                    macro
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: clattner at apple.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


The linux kernel uses something logically equivalent to:

$ cat t.c
void stuff(int,int,int);
#define memset(x,y,z) ({ stuff(x,y,z); x; })

void foo(int a, int b, int c) {
  memset(a,b,c);
}

... which causes tons and tons of -Wunused-value warnings to be produced:

$ clang t.c -fsyntax-only
t.c:5:10: warning: expression result unused [-Wunused-value]
  memset(a,b,c);
  ~~~~~~~^~~~~~
t.c:2:40: note: expanded from macro 'memset'
#define memset(x,y,z) ({ stuff(x,y,z); x; })
                                       ^

This is clearly not useful.  We should disable this warning when the unused
value is a statement expression expanded from a macro.

-- 
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