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

Jose Fonseca jfonseca at vmware.com
Thu Sep 16 14:21:30 PDT 2010


I see. So the problem is the __attribute__ ((format (__printf__, 1, 2))); stuff interacting with __func__.

I don't know if __FUNCTION__ will avoid this.

Otherwise, putting talloc_init("%s", __func__) is the right thing to do IMHO -- it's not that it will be any slower: one way or the other, talloc_init will parse the first argument for printf format.

Jose
________________________________________
From: Vinson Lee
Sent: Thursday, September 16, 2010 21:07
To: Jose Fonseca
Cc: Keith Whitwell; 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.

build/linux-x86-debug/glsl/loop_controls.I
...
 17644  void *talloc_init(const char *fmt, ...) __attribute__ ((format (__printf__, 1, 2)));
...
 20411  int
 20412  calculate_iterations(ir_rvalue *from, ir_rvalue *to, ir_rvalue *increment,
 20413         enum ir_expression_operation op)
 20414  {
 20415     void *mem_ctx = talloc_init(__func__);
 20416

________________________________________
From: José Fonseca [jfonseca at vmware.com]
Sent: Thursday, September 16, 2010 12:12 PM
To: Vinson Lee
Cc: Keith Whitwell; 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.

On Thu, 2010-09-16 at 11:44 -0700, Vinson Lee wrote:
> 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
>
>

Could you repeat the command line, but with

  g++ -o build/linux-x86-debug/glsl/loop_controls.I -E ...

instead of

  g++ -o build/linux-x86-debug/glsl/loop_controls.os -c

and look for the code in question in loop_controls.I and see how it
looks?

Jose



More information about the mesa-dev mailing list