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

Vinson Lee vlee at vmware.com
Thu Sep 16 11:44:47 PDT 2010


I undid the change locally and rebuilt. I get the warning with both make and SCons.


$ make
...
g++ -c `pkg-config --cflags talloc` -I. -I../mesa -I../mapi -I../../include  -Wall -Wpointer-arith -O3 -g -fPIC -m32 -mmmx -msse -msse2 -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE -DPTHREADS -DUSE_XSHM -DHAVE_POSIX_MEMALIGN   -I/usr/X11R6/include -fno-strict-aliasing -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE -DPTHREADS -DUSE_XSHM -DHAVE_POSIX_MEMALIGN   loop_controls.cpp -o loop_controls.o
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


$ scons quiet=no
...
g++ -o build/linux-x86-debug/glsl/loop_controls.os -c -O0 -g3 -m32 -mstackrealign -mmmx -msse -msse2 -Wall -Wno-long-long -ffast-math -fmessage-length=0 -Wmissing-field-initializers -Werror=pointer-arith -fPIC -DHAVE_LLVM=0x0207 -DDEBUG -DNDEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE -DPTHREADS -DHAVE_POSIX_MEMALIGN -Isrc/mapi -Isrc/mesa -Iinclude -Isrc/gallium/include -Isrc/gallium/auxiliary -Isrc/gallium/drivers -Isrc/gallium/winsys src/glsl/loop_controls.cpp
src/glsl/loop_controls.cpp: In function ‘int calculate_iterations(ir_rvalue*, ir_rvalue*, ir_rvalue*, ir_expression_operation)’:
src/glsl/loop_controls.cpp:88: warning: format not a string literal and no format arguments


$ g++ --version
g++ (Ubuntu 4.4.3-4ubuntu5) 4.4.3


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

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.

Keith
________________________________________
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.

-----BEGIN PGP SIGNED MESSAGE-----
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);

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

iEYEARECAAYFAkySHDsACgkQX1gOwKyEAw/n/ACePdgvPa0xwSs02PqSQdnTF1pr
HekAn07NDlPtU2bvUGQSf1W0tFLtOWa1
=R3UQ
-----END PGP SIGNATURE-----
_______________________________________________
mesa-dev mailing list
mesa-dev at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
mesa-dev mailing list
mesa-dev at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list