[llvm-bugs] [Bug 45394] New: __attribute__((warn_result_unused)) broken for GNU C asm statement

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Apr 1 17:43:12 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=45394

            Bug ID: 45394
           Summary: __attribute__((warn_result_unused)) broken for GNU C
                    asm statement
           Product: clang
           Version: trunk
          Hardware: PC
               URL: https://github.com/ClangBuiltLinux/linux/issues/968
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ndesaulniers at google.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk
            Blocks: 4068

__attribute__((warn_unused_result))
static inline int foo(void) {
    return 42;
}

#define bar() ({\
  foo(); \
})

void baz(void) {
    bar();
}
warns in GCC (-Wunused-result), but not in Clang. Note that if bar() calls
foo() twice, Clang will warn for the first, but still not the return value.


Referenced Bugs:

https://bugs.llvm.org/show_bug.cgi?id=4068
[Bug 4068] [Meta] Compiling the Linux kernel with clang
-- 
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/20200402/c60a93b6/attachment.html>


More information about the llvm-bugs mailing list