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: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


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

Reply via email to