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: [wwwdocs] Some stuff for porting to


On Tue, 10 Feb 2015, Marek Polacek wrote:

> +<p>Several new warnings have been added to the C front end.  One of the new
> +warnings is that GCC now warns about non-standard predefined macros with the
> +<code>-Wpedantic</code> option.  For instance:</p>
> +
> +<pre><code>
> +  void
> +  foo (void)
> +  {
> +    const char *s = __FUNCTION__;
> +  }
> +</code></pre>
> +
> +<pre>
> +<b>q.c:4:19:</b> <b style='color:magenta'>warning:</b> ISO C does not support <b>'__FUNCTION__'</b> predefined identifier [-Wpedantic]
> +  const char *s = __FUNCTION__;
> +                  <b style='color:lime'>^</b>
> +</pre>
> +
> +<p>The fix is either to use the standard predefined macro <code>__func__</code>
> +(since C99), or to use the <code>__extension__</code> keyword:<p/>

__FUNCTION__ and __func__ aren't macros (essentially they're built-in 
variables).

-- 
Joseph S. Myers
joseph@codesourcery.com


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