[Mesa-dev] Mesa (master): glsl: Fix 'format not a string literal and no format arguments' warning.

Nick Bowler nbowler at draconx.ca
Thu Sep 16 10:05:02 PDT 2010


On Thu, 16 Sep 2010 15:31:42 +0200, Ian Romanick wrote:
> If __func__ is not showing up as a string literal, something else is
> wrong.  This is supposed to be a #define generated by the compiler.

Actually, C99's __func__ is neither a macro nor a string literal:

  6.4.2.2#1:
    The identifier __func__ shall be implicitly declared by the translator
    as if, immediately following the opening brace of each function
    definition, the declaration
  
      static const char __func__[] = "function-name"
  
    appeared, where function-name is the name of the lexically-enclosing
    function.

Thus, the compiler is not lying.  However, since a function name cannot
contain a '%' character, and the string cannot be modified (as it is
defined const) the warning is really just noise.



More information about the mesa-dev mailing list