Bug 37940 - no error detected for semicolon in C function declaration
Summary: no error detected for semicolon in C function declaration
Status: RESOLVED DUPLICATE of bug 23144
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.0.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2008-10-28 18:34 UTC by Janis Johnson
Modified: 2008-10-28 20:25 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Janis Johnson 2008-10-28 18:34:58 UTC
The following code has an extra semi-colon at the end of the function prototype declaring bad_func1:

  void bad_func1 (unsigned long long arg1, const char *arg2 ; );

  void bad_func2 ()
  {
    const char *foo = "foo";
    bad_func1 (0, foo);
  }

GCC 3.4 reports an error:

elm3b187% /home/janis/tools/gcc-3.4-anonsvn/bin/gcc -c bug.c
bug.c:1: error: parameter "arg1" has just a forward declaration
bug.c:1: error: parameter "arg2" has just a forward declaration

GCC 4.0 and later (including current mainline) accept the code with no error or warning, even with -Wall, and generate code as if the prototype did not exist rather than generating code as if the semicolon did not exist.
Comment 1 Joseph S. Myers 2008-10-28 20:25:38 UTC

*** This bug has been marked as a duplicate of 23144 ***