This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]