This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C99 inline function diagnostics
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: gkeating at apple dot com (Geoffrey Keating)
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 4 May 2006 17:43:19 -0400 (EDT)
- Subject: Re: C99 inline function diagnostics
>
>
> This patch makes GCC's inline function support more like the C99
> support. To be precise, it implements 6.7.4 paragraph 3, which
> basically says that you shouldn't reference static variables or
> functions from an inline function definition that doesn't produce an
> externally visible copy.
>
> Note that although this patch implements the warning, the actual
> syntax for inline functions is different in GCC (especially in gnu89
> mode) and so the testcases are not valid C99. However, the semantics
> are equivalent.
>
> This patch only produces a pedwarn, not an error, since obviously the
> compiler can go ahead and generate code. However, it is on by
> default, for two reasons:
>
> - I can't think of a reason why you would do this intentionally
> as compared to having one copy of the variable or function; and
> - what GCC does for C is incompatible with C++.
>
> I am holding this patch for 4.3 since 4.2 is in stage3.
It does fix a PR though, PR 11377.
-- Pinski