|
From: Piotr J. <p.j...@gm...> - 2011-03-28 14:13:12
|
Hello, the valgrind.h header imported from the project causes set but not used warnings with gcc 4.6.0 when NVALGRIND is defined. The culprit are VALGRIND_MALLOCLIKE_BLOCK, VALGRIND_FREELIKE_BLOCK and similar macros: error: variable ‘_qzz_res’ set but not used [-Werror=unused-but-set-variable] I think the proper solution is to add __attribute__((unused)) to _qzz_res. What do you think? For reference gcc docs on unused: unused - This attribute, attached to a variable, means that the variable is meant to be possibly unused. GCC will not produce a warning for this variable. -- Best Regards Piotr Jaroszyński |
|
From: Julian S. <js...@ac...> - 2011-03-28 16:38:33
|
On Monday, March 28, 2011, Piotr Jaroszyński wrote: > I think the proper solution is to add __attribute__((unused)) to > _qzz_res. What do you think? Yes. I just committed exactly such cleanups (r11673). Could you try it, to see if that also makes your compiles quiet again? J |
|
From: Piotr J. <p.j...@gm...> - 2011-03-28 17:47:03
|
2011/3/28 Julian Seward <js...@ac...>: > On Monday, March 28, 2011, Piotr Jaroszyński wrote: >> I think the proper solution is to add __attribute__((unused)) to >> _qzz_res. What do you think? > > Yes. I just committed exactly such cleanups (r11673). Could > you try it, to see if that also makes your compiles quiet again? I'm after warnings that I get in a third party project having imported valgrind.h header (to avoid a harddep on valgrind) and using the VALGRIND_MALLOCLIKE_BLOCK, VALGRIND_FREELIKE_BLOCK etc macros to teach valgrind how our allocator works. We can of course fix it in our repo (and we did for now), but we would prefer to avoid differences like that. -- Best Regards Piotr Jaroszyński |
|
From: Bart V. A. <bva...@ac...> - 2011-03-28 17:53:45
|
On Mon, Mar 28, 2011 at 6:32 PM, Julian Seward <js...@ac...> wrote: > > On Monday, March 28, 2011, Piotr Jaroszyński wrote: > > I think the proper solution is to add __attribute__((unused)) to > > _qzz_res. What do you think? > > Yes. I just committed exactly such cleanups (r11673). Could > you try it, to see if that also makes your compiles quiet again? Strange - I still see such warnings with r11673 while building the regression tests: [ ... ] custom_alloc.c: In function 'custom_alloc': custom_alloc.c:47:4: warning: variable '_qzz_res' set but not used [-Wunused-but-set-variable] [ ... ] Bart. |
|
From: Julian S. <js...@ac...> - 2011-03-28 18:44:05
|
On Monday, March 28, 2011, Bart Van Assche wrote: > On Mon, Mar 28, 2011 at 6:32 PM, Julian Seward <js...@ac...> wrote: > > On Monday, March 28, 2011, Piotr Jaroszyński wrote: > > > I think the proper solution is to add __attribute__((unused)) to > > > _qzz_res. What do you think? > > > > Yes. I just committed exactly such cleanups (r11673). Could > > you try it, to see if that also makes your compiles quiet again? > > Strange - I still see such warnings with r11673 while building the > regression tests: > [ ... ] > custom_alloc.c: In function 'custom_alloc': > custom_alloc.c:47:4: warning: variable '_qzz_res' set but not used > [-Wunused-but-set-variable] > [ ... ] There's more cleaning up to do, and I haven't started on the regression tests yet. J |
|
From: Julian S. <js...@ac...> - 2011-03-28 21:20:42
|
On Monday, March 28, 2011, Bart Van Assche wrote: > On Mon, Mar 28, 2011 at 6:32 PM, Julian Seward <js...@ac...> wrote: > > On Monday, March 28, 2011, Piotr Jaroszyński wrote: > > > I think the proper solution is to add __attribute__((unused)) to > > > _qzz_res. What do you think? > > > > Yes. I just committed exactly such cleanups (r11673). Could > > you try it, to see if that also makes your compiles quiet again? > > Strange - I still see such warnings with r11673 while building the > regression tests: Should be considerably improved, although not perfect, when building the regtests now. (at r 11675). |
|
From: Bart V. A. <bva...@ac...> - 2011-03-29 10:24:39
|
On Mon, Mar 28, 2011 at 11:14 PM, Julian Seward <js...@ac...> wrote: > On Monday, March 28, 2011, Bart Van Assche wrote: >> On Mon, Mar 28, 2011 at 6:32 PM, Julian Seward <js...@ac...> wrote: >> > On Monday, March 28, 2011, Piotr Jaroszyński wrote: >> > > I think the proper solution is to add __attribute__((unused)) to >> > > _qzz_res. What do you think? >> > >> > Yes. I just committed exactly such cleanups (r11673). Could >> > you try it, to see if that also makes your compiles quiet again? >> >> Strange - I still see such warnings with r11673 while building the >> regression tests: > > Should be considerably improved, although not perfect, when building > the regtests now. (at r 11675). The approach followed so far -- adding __attribute__((unused)) to unused variables used to store client request results -- has an important benefit, that is that the API for invoking client requests is preserved. Has the following already been considered: - Define a new facility for invoking client requests, e.g. VALGRIND_DO_CLIENT_REQUEST_E(), in such a way that it yields the result value of the client request instead of assigning that result value to a variable. It's not yet clear to me whether such a facility should be defined as a macro that uses a statement expression or as an inline function. - Redefine the existing macro VALGRIND_DO_CLIENT_REQUEST() such that it uses the new facility. - Replace invocations of VALGRIND_DO_CLIENT_REQUEST() in tools by VALGRIND_DO_CLIENT_REQUEST_E(). This transformation will allow to eliminate unused "res" variables instead of having to annotate them with __attribute__((unused)). Bart. |
|
From: Bart V. A. <bva...@ac...> - 2011-03-30 17:45:28
|
On Tue, Mar 29, 2011 at 12:24 PM, Bart Van Assche <bva...@ac...> wrote: > > On Mon, Mar 28, 2011 at 11:14 PM, Julian Seward <js...@ac...> wrote: > > On Monday, March 28, 2011, Bart Van Assche wrote: > >> On Mon, Mar 28, 2011 at 6:32 PM, Julian Seward <js...@ac...> wrote: > >> > On Monday, March 28, 2011, Piotr Jaroszyński wrote: > >> > > I think the proper solution is to add __attribute__((unused)) to > >> > > _qzz_res. What do you think? > >> > > >> > Yes. I just committed exactly such cleanups (r11673). Could > >> > you try it, to see if that also makes your compiles quiet again? > >> > >> Strange - I still see such warnings with r11673 while building the > >> regression tests: > > > > Should be considerably improved, although not perfect, when building > > the regtests now. (at r 11675). > > The approach followed so far -- adding __attribute__((unused)) to > unused variables used to store client request results -- has an > important benefit, that is that the API for invoking client requests > is preserved. Has the following already been considered: > - Define a new facility for invoking client requests, e.g. > VALGRIND_DO_CLIENT_REQUEST_E(), in such a way that it yields the > result value of the client request instead of assigning that result > value to a variable. It's not yet clear to me whether such a facility > should be defined as a macro that uses a statement expression or as an > inline function. > - Redefine the existing macro VALGRIND_DO_CLIENT_REQUEST() such that > it uses the new facility. > - Replace invocations of VALGRIND_DO_CLIENT_REQUEST() in tools by > VALGRIND_DO_CLIENT_REQUEST_E(). This transformation will allow to > eliminate unused "res" variables instead of having to annotate them > with __attribute__((unused)). A patch that implements the above is available here: https://bugs.kde.org/show_bug.cgi?id=269778. Suggestions for how to get rid of the new "value computed is not used" warnings are welcome. Bart. |