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

Keith Whitwell keithw at vmware.com
Thu Sep 16 07:21:45 PDT 2010

I saw these warnings also on scons builds.  Vinson - if you set "quiet=no", scons will print out the full gcc invocation, there may be a clue there what's causing this.

From: mesa-dev-bounces+keithw=vmware.com at lists.freedesktop.org [mesa-dev-bounces+keithw=vmware.com at lists.freedesktop.org] On Behalf Of Ian Romanick [idr at freedesktop.org]
Sent: Thursday, September 16, 2010 2:31 PM
To: mesa-dev at lists.freedesktop.org
Subject: Re: [Mesa-dev] Mesa (master): glsl: Fix '      format not a string literal and no format arguments' warning.

Hash: SHA1

Vinson Lee wrote:
> Module: Mesa
> Branch: master
> Commit: f20f2cc3306310f6fc4c338f91cfac10f98335d3
> URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f20f2cc3306310f6fc4c338f91cfac10f98335d3
> Author: Vinson Lee <vlee at vmware.com>
> Date:   Wed Sep 15 05:17:57 2010 -0700
> glsl: Fix 'format not a string literal and no format arguments' warning.
> Fix the following GCC warning.
> loop_controls.cpp: In function 'int calculate_iterations(ir_rvalue*, ir_rvalue*, ir_rvalue*, ir_expression_operation)':
> loop_controls.cpp:88: warning: format not a string literal and no format arguments
> ---
>  src/glsl/loop_controls.cpp |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> diff --git a/src/glsl/loop_controls.cpp b/src/glsl/loop_controls.cpp
> index 9619d8a..2ef3d30 100644
> --- a/src/glsl/loop_controls.cpp
> +++ b/src/glsl/loop_controls.cpp
> @@ -85,7 +85,7 @@ int
>  calculate_iterations(ir_rvalue *from, ir_rvalue *to, ir_rvalue *increment,
>                    enum ir_expression_operation op)
>  {
> -   void *mem_ctx = talloc_init(__func__);
> +   void *mem_ctx = talloc_init("%s", __func__);

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.  Is
this  a case where we're wrapping __func__ for Visual Studio and
something is going wrong (since this is GCC)?  I also find this odd
because I don't get this warning on my builds... and I enable a lot of
extra warning flags.

>     ir_expression *const sub =
>        new(mem_ctx) ir_expression(ir_binop_sub, from->type, to, from);

Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

mesa-dev mailing list
mesa-dev at lists.freedesktop.org

More information about the mesa-dev mailing list