[LLVMbugs] [Bug 10642] New: Use of return in functions with noreturn

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Aug 11 09:18:50 PDT 2011


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

           Summary: Use of return in functions with noreturn
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: quality-of-implementation
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: joerg at NetBSD.org
                CC: llvmbugs at cs.uiuc.edu


Consider this:

#include <stdlib.h>

__attribute__((noreturn)) int foo(void)
{
    exit(1);
    return 0;
}

At the moment, this triggers:

warning: function 'foo' declared 'noreturn' should not return
[-Winvalid-noreturn]

I think this warning is bogus and misleading.

(1) The return is dead code, but might exist to help more stupid compilers that
can't figure out the noreturn property of exit.

(2) noreturn on a function with a return value other than void is questionable.
A warning for that would be nice.

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