Re: [Bug c/39026] New: Gcc accepts invalid code

2009-01-29 Thread Joseph S. Myers
On Thu, 29 Jan 2009, hjl dot tools at gmail dot com wrote:

> inline void foo ();
> 
> int
> main ()
> {
>   foo ();
>   return 0;
> }
> [...@gnu-6 gcc]$ gcc  /tmp/i.i  -S

If you use -std=c99 -pedantic-errors you get an error, as expected.  
You're compiling in gnu89 mode.

If you use -std=c99 without -pedantic-errors you get a duplicate warning:

t.c:1: warning: inline function 'foo' declared but never defined
t.c:1: warning: inline function 'foo' declared but never defined

-- 
Joseph S. Myers
jos...@codesourcery.com


[Bug c/39026] New: Gcc accepts invalid code

2009-01-29 Thread hjl dot tools at gmail dot com
+++ This bug was initially created as a clone of Bug #39013 +++

[...@gnu-6 gcc]$ cat /tmp/i.i
inline void foo ();

int
main ()
{
  foo ();
  return 0;
}
[...@gnu-6 gcc]$ gcc  /tmp/i.i  -S

Is this valid C code? From

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39013#c10

--
IMHO this is invalid.  6.7.4/6

"... If a function is declared with an inline function specifier, then it
shall also be defined in the same translation unit."
--


-- 
   Summary: Gcc accepts invalid code
   Product: gcc
   Version: 4.4.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: hjl dot tools at gmail dot com
 BugsThisDependsOn: 39013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39026