summaryrefslogtreecommitdiff
path: root/gl
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2021-10-31 22:30:38 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2021-10-31 22:36:46 -0700
commit389e7663671e6dbd5644f6381d23f46f6d341339 (patch)
tree1f1ffc9e4029cb55bc9895ee6dcf6c906024d68e /gl
parentbafff0019cad471b69036ab0d6d1a80c9285583d (diff)
downloadcoreutils-389e7663671e6dbd5644f6381d23f46f6d341339.tar.gz
maint: prefer attribute.h in .c files
This will help us make the transition to C2x, where some attributes must come at the start of function decls. Leave the attributes alone in .h files for now, as the Gnulib tradition is to not expose attribute.h to users. * bootstrap.conf (gnulib_modules): Add ‘attribute’. * gl/lib/randperm.c, src/make-prime-list.c, src/system.h: Include attribute.h. * gl/lib/strnumcmp.c (strnumcmp): Remove _GL_ATTRIBUTE_PURE here, as this belongs in the .h file. * gl/lib/strnumcmp.h (strnumcmp): Add _GL_ATTRIBUTE_PURE here. * src/sort.c (human_numcompare, numcompare): Now ATTRIBUTE_PURE; discovered due to strnumcmp.h change. * gl/lib/randperm.c, src/copy.c, src/dd.c, src/df.c, src/digest.c: * src/env.c, src/expr.c, src/factor.c, src/ls.c: * src/make-prime-list.c, src/numfmt.c, src/od.c, src/pathchk.c: * src/pinky.c, src/pr.c, src/ptx.c, src/realpath.c, src/relpath.c: * src/seq.c, src/sort.c, src/stat.c, src/stty.c, src/system.h: * src/tr.c, src/uniq.c, src/wc.c: In .c files, crefer ATTRIBUTE_CONST to _GL_ATTRIBUTE_CONST, and similarly for ATTRIBUTE_FORMAT and ATTRIBUTE_PURE. * src/system.h (FALLTHROUGH): Remove; attribute.h defines it.
Diffstat (limited to 'gl')
-rw-r--r--gl/lib/randperm.c3
-rw-r--r--gl/lib/strnumcmp.c2
-rw-r--r--gl/lib/strnumcmp.h2
3 files changed, 4 insertions, 3 deletions
diff --git a/gl/lib/randperm.c b/gl/lib/randperm.c
index c01c29608..bce7a2daf 100644
--- a/gl/lib/randperm.c
+++ b/gl/lib/randperm.c
@@ -25,6 +25,7 @@
#include <stdint.h>
#include <stdlib.h>
+#include "attribute.h"
#include "count-leading-zeros.h"
#include "hash.h"
#include "verify.h"
@@ -32,7 +33,7 @@
/* Return the floor of the log base 2 of N. If N is zero, return -1. */
-static int _GL_ATTRIBUTE_CONST
+ATTRIBUTE_CONST static int
floor_lg (size_t n)
{
verify (SIZE_WIDTH <= ULLONG_WIDTH);
diff --git a/gl/lib/strnumcmp.c b/gl/lib/strnumcmp.c
index 4af160b33..36f7332b7 100644
--- a/gl/lib/strnumcmp.c
+++ b/gl/lib/strnumcmp.c
@@ -23,7 +23,7 @@
/* Externally-visible name for numcompare. */
-int _GL_ATTRIBUTE_PURE
+int
strnumcmp (char const *a, char const *b,
int decimal_point, int thousands_sep)
{
diff --git a/gl/lib/strnumcmp.h b/gl/lib/strnumcmp.h
index 4deef82bd..d7f273326 100644
--- a/gl/lib/strnumcmp.h
+++ b/gl/lib/strnumcmp.h
@@ -1,2 +1,2 @@
int strintcmp (char const *, char const *) _GL_ATTRIBUTE_PURE;
-int strnumcmp (char const *, char const *, int, int);
+int strnumcmp (char const *, char const *, int, int) _GL_ATTRIBUTE_PURE;