~michel-slm/coreutils

f07f5b008f180a8b44f8007f7ef8fb7ba47fd7ce — Samuel Tardieu 8 months ago a966dcd
maint: add attributes to two functions without side effects

* src/date.c (res_width): This function computes its result solely
from the value of its parameter and qualifies for the const attribute.
* src/tee.c (get_next_out): This function has no side effect and
qualifies for the pure attribute.
* THANKS.in: Remove duplicate now that author has a commit in the repo.

Those two functions were flagged by GCC 12.3.0,
though not by GCC 13.2.1.
3 files changed, 2 insertions(+), 1 deletions(-)

M THANKS.in
M src/date.c
M src/tee.c
M THANKS.in => THANKS.in +0 -1
@@ 566,7 566,6 @@ Rudolf Kastl                        rkastl@redhat.com
Sahil Amoli                         sahilamoli@gmail.com
Sami Farin                          sfarin@ratol.fi
Samuel Neves                        sneves@dei.uc.pt
Samuel Tardieu                      sam@rfc1149.net
Samuel Thibault                     samuel.thibault@ens-lyon.org
Samuli Karkkainen                   Samuli.Karkkainen@hut.fi
Sander van Malssen                  svm@kozmix.ow.nl

M src/date.c => src/date.c +1 -0
@@ 294,6 294,7 @@ Show the local time for 9AM next Friday on the west coast of the US\n\
/* Yield the number of decimal digits needed to output a time with the
   nanosecond resolution RES, without losing information.  */

ATTRIBUTE_CONST
static int
res_width (long int res)
{

M src/tee.c => src/tee.c +1 -0
@@ 185,6 185,7 @@ main (int argc, char **argv)
/* Return the index of the first non-null descriptor after idx,
   or -1 if all are null.  */

ATTRIBUTE_PURE
static int
get_next_out (FILE **descriptors, int nfiles, int idx)
{