[llvm-bugs] [Bug 51228] New: warn_unused_result and cast to void

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 27 10:25:12 PDT 2021


            Bug ID: 51228
           Summary: warn_unused_result and cast to void
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ndesaulniers at google.com
                CC: aaron at aaronballman.com, blitzrakete at gmail.com,
                    dgregor at apple.com, erik.pilkington at gmail.com,
                    isanbard at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

$ cat foo.c
int foo(void);

void bar(void) {
    (void)foo(); // cast result to void

$ gcc foo.c
warning: ignoring return value of 'foo' declared with attribute
'warn_unused_result' [-Wunused-result]
    9 |     (void)foo(); // cast result to void
      |           ^~~~~

$ clang foo.c

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/20210727/7554cc18/attachment.html>

More information about the llvm-bugs mailing list