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: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to