[LLVMbugs] [Bug 7617] New: Message accuracy and change request

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Jul 10 16:57:58 PDT 2010


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

           Summary: Message accuracy and change request
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: echristo at gmail.com
                CC: llvmbugs at cs.uiuc.edu


>From Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>:

I just stumbled across a typo in a header file of a heavily modified
flashrom codebase which looked like this:

int write_sector_jedec_common(struct flashchip *flash, uint8_t *src, int start,
int len, unsigned int mask)
/* m29f400bt.c */
int probe_m29f400bt(struct flashchip *flash);


Note the missing semicolon for the write_sector_jedec_common prototype.

gcc (4.2.1) has this diagnostic:
jedec.c: In function ‘write_sector_jedec_common’:
jedec.c:35: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’
token
jedec.c:42: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’
token
jedec.c:62: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’
token
jedec.c:74: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’
token
jedec.c:79: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’
token
jedec.c:96: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’
token
jedec.c:104: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’
token
jedec.c:204: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’
token
jedec.c:234: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’
token
jedec.c:263: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’
token
jedec.c:293: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’
token
jedec.c:322: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’
token
jedec.c:341: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’
token
jedec.c:379: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’
token
jedec.c:399: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’
token
jedec.c:417: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’
token
jedec.c:428: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’
token
jedec.c:441: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’
token
jedec.c:449: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’
token
jedec.c:457: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’
token
jedec.c:465: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’
token
jedec.c:470: error: old-style parameter declarations in prototyped function
definition
jedec.c:470: error: expected ‘{’ at end of input
cc1: warnings being treated as errors
jedec.c:470: warning: no return statement in function returning non-void


clang (llvm-clang-2.6.99svn97231) has this diagnostic:
In file included from jedec.c:26:
./chipdrivers.h:83:1: error: expected function body after function declarator
int probe_m29f400bt(struct flashchip *flash);
^
1 diagnostic generated.


While the clang diagnostic was a lot more helpful in pinpointing the
actual error because it complained about the header instead of the
source file including it, the diagnostic could be improved a bit by the
following:
- Change the wording from "error: expected function body after function
declarator" to "error: expected function body or semicolon after
function declarator/prototype".
- Print the preceding code line as well because that's where the
semicolon is missing.

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