Re: Unused parameter warnings

2020-10-11 Thread Jeffrey Walton
On Sun, Oct 11, 2020 at 7:11 PM Paul Eggert wrote: > > > -static size_t > > +static size_t _GL_ATTRIBUTE_PURE > > gl_tree_size (gl_list_t list) > > Although changes like these don't break anything, I generally don't bother > doing > them if only older GCCs warn about a missing attribute, under t

Re: Unused parameter warnings

2020-10-11 Thread Paul Eggert
-static size_t +static size_t _GL_ATTRIBUTE_PURE gl_tree_size (gl_list_t list) Although changes like these don't break anything, I generally don't bother doing them if only older GCCs warn about a missing attribute, under the theory that people stuck with older compilers can build with --disa

Re: Unused parameter warnings

2020-10-10 Thread Bruno Haible
Paul Eggert wrote: > I installed the attached commentary changes. OK, with these definitions of 'pure' and 'const', I can make the change Marc requested - and some more. 2020-10-10 Bruno Haible *-list, *-oset, *-omap: Avoid possible compiler warnings. Reported by Marc Nieper-

Re: Unused parameter warnings

2020-10-10 Thread Bruno Haible
Marc Nieper-Wißkirchen wrote: > so that the code is compilable with -Werror -Wall -Wextra. Note that Gnulib does not guarantee this. Especially for -Wsign-compare and -Wunused-parameter (but also some other warning types) we have no intention to fix them; the cure would be often worse than the pro

Re: Unused parameter warnings

2020-10-10 Thread Paul Eggert
On 10/10/20 8:00 AM, Marc Nieper-Wißkirchen wrote: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97364 Looking at that bug report and related material (particularly Richard Biener's 2012 comment ) the GCC folks seem to have decided long a

Re: Unused parameter warnings

2020-10-10 Thread Marc Nieper-Wißkirchen
Am Sa., 10. Okt. 2020 um 16:39 Uhr schrieb Bruno Haible : > > Hi Marc, > > > I can ask for a better description of "pure" in the GCC manual. > > Yes, please. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97364

Re: Unused parameter warnings

2020-10-10 Thread Bruno Haible
Hi Marc, > I can ask for a better description of "pure" in the GCC manual. Yes, please. > Anyway, the function gl_linked_iterator_from_to in Gnulib should > probably be fixed independently by adding the "pure" attribute so that > the code is compilable with -Werror -Wall -Wextra. I don't think

Re: Unused parameter warnings

2020-10-10 Thread Marc Nieper-Wißkirchen
I can ask for a better description of "pure" in the GCC manual. In any case, if a function doesn't return at all due to a function call marked with _Noreturn, it does not affect the observable state locally and GCC can avoid "emitting some calls in repeated invocations of the function with the same

Re: Unused parameter warnings

2020-10-10 Thread Bruno Haible
Marc Nieper-Wißkirchen wrote: > > And a function that may invoke abort () does "affect observable state". > > This description of the a pure function does not seem to be accurate. > When a function calls another function like abort that is marked with > _Noreturn in a pure context, for the compile

Re: Unused parameter warnings

2020-10-06 Thread Marc Nieper-Wißkirchen
Am Di., 6. Okt. 2020 um 23:06 Uhr schrieb Bruno Haible : > Marc Nieper-Wißkirchen wrote: > > In file included from lib/gl_linked_list.c:29: > > lib/gl_linked_list.c: In function 'gl_linked_iterator_from_to': > > lib/gl_anylinked_list2.h:938:1: error: function might be candidate for > > attribute '

Re: Unused parameter warnings

2020-10-06 Thread Bruno Haible
Marc Nieper-Wißkirchen wrote: > In file included from lib/gl_linked_list.c:29: > lib/gl_linked_list.c: In function 'gl_linked_iterator_from_to': > lib/gl_anylinked_list2.h:938:1: error: function might be candidate for > attribute 'pure' if it is known to return normally > [-Werror=suggest-attribute

Re: Unused parameter warnings

2020-10-05 Thread Marc Nieper-Wißkirchen
Thank you! This works perfectly now. In the meantime, my GCC has reported another warning here. In file included from lib/gl_linked_list.c:29: lib/gl_linked_list.c: In function 'gl_linked_iterator_from_to': lib/gl_anylinked_list2.h:938:1: error: function might be candidate for attribute 'pure' if

Re: Unused parameter warnings

2020-10-04 Thread Bruno Haible
Hi Marc, Marc Nieper-Wißkirchen wrote: > When compiling Gnulib with -Wunused-parameter, I get the following > report from GCC: > > lib/localename.c: In function 'gl_locale_name_thread_unsafe': > lib/localename.c:3117:57: error: unused parameter 'categoryname' > [-Werror=unused-parameter] > 3117

Re: "unused parameter" warnings

2008-10-18 Thread Bruno Haible
Jim Meyering wrote: > This is a good change. So I applied it, > Whether to replace all existing __attribute__ ((__attribute__)) > uses with _UNUSED_PARAMETER_ is a harder call. There's no immediate need to do so. Bruno

Re: "unused parameter" warnings

2008-10-18 Thread Jim Meyering
Bruno Haible <[EMAIL PROTECTED]> wrote: > Jim Meyering wrote: >> However, it would be good to accept patches (at least for gnulib's .h >> files) that mark each unused parameter with __attribute__ ((__unused__)). >> Then, a project that requires use of -Wunused-parameter can use gnulib's >> headers

Re: "unused parameter" warnings

2008-10-18 Thread Bruno Haible
Jim Meyering wrote: > However, it would be good to accept patches (at least for gnulib's .h > files) that mark each unused parameter with __attribute__ ((__unused__)). > Then, a project that requires use of -Wunused-parameter can use gnulib's > headers without having to relax their standards. I ag

Re: "unused parameter" warnings

2008-10-18 Thread Jim Meyering
Bruno Haible <[EMAIL PROTECTED]> wrote: > Reuben Thomas wrote: >> gl_anylinked_list2.h: In function ‘gl_linked_node_value’: >> gl_anylinked_list2.h:124: warning: unused parameter ‘list’ >> gl_anylinked_list2.h: In function ‘gl_linked_node_set_value’: >> gl_anylinked_list2.h:130: warning: unused par

Re: "unused parameter" warnings

2008-10-18 Thread Bruno Haible
Reuben Thomas wrote: > gl_anylinked_list2.h: In function ‘gl_linked_node_value’: > gl_anylinked_list2.h:124: warning: unused parameter ‘list’ > gl_anylinked_list2.h: In function ‘gl_linked_node_set_value’: > gl_anylinked_list2.h:130: warning: unused parameter ‘list’ > gl_anylinked_list2.h: In funct