[LLVMbugs] [Bug 4860] New: Clang doesn' t honour -Wno-attributes when applying __attribute__(( __warn_unused_result__)) to variables.

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Sep 1 20:11:45 PDT 2009


           Summary: Clang doesn't honour -Wno-attributes when applying
                    __attribute__((__warn_unused_result__)) to variables.
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Solaris
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: jpihlaja at cc.helsinki.fi
                CC: llvmbugs at cs.uiuc.edu, eocallaghan at auroraux.org

The following program solicits a warning when the __warn_unused_result__
attribute is applied to a variable. gcc >= 4.1 does not emit a warning with

$ cat >wnoattr-var.c
__attribute__((__warn_unused_result__)) int x;

$ /opt/clang/bin/clang -c -Wall -Wno-attributes wnoattr-var.c 
wnoattr-var.c:1:16: warning: '__warn_unused_result__' attribute only applies to
function types
__attribute__((__warn_unused_result__)) int x;
1 diagnostic generated.

$ /opt/clang/bin/clang -v
clang version 1.0 (http://llvm.org/svn/llvm-project/cfe/trunk 80665)
Target: i386-pc-solaris2.11
Thread model: posix

$ uname -a
SunOS hydra 5.11 snv_110 i86pc i386 i86pc

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