[LLVMbugs] [Bug 11796] New: Incorrect diagnostic implicitly declaring library function in C89 mode

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jan 18 17:13:46 PST 2012


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

             Bug #: 11796
           Summary: Incorrect diagnostic implicitly declaring library
                    function in C89 mode
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: sharparrow1 at yahoo.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Testcase (compile with clang -std=c89 -pedantic-errors):

int f() { return strcmp("foo", "bar"); }

Output:


<stdin>:1:18: error: implicitly declaring C library function 'strcmp' with type
'int (const char *, const char *)' [-Werror]
int f() { return strcmp("foo", "bar"); }
                 ^
<stdin>:1:18: note: please include the header <string.h> or explicitly provide
a declaration for 'strcmp'
1 error generated.

This code is valid in C89, so we shouldn't give an error.  (Granted, I wouldn't
suggest writing code like this.)

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