[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] build: ls.c: apply _GL_ATTRIBUTE_PURE to more functions
From: |
Jim Meyering |
Subject: |
[PATCH] build: ls.c: apply _GL_ATTRIBUTE_PURE to more functions |
Date: |
Fri, 27 Oct 2017 21:37:16 -0700 |
I noticed a new warning/error when building with git-latest gcc,
and propose to fix it with this:
>From f89c20bdf7ccc033cbc22662e932fae7761754fc Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Fri, 27 Oct 2017 21:14:37 -0700
Subject: [PATCH] build: ls.c: apply _GL_ATTRIBUTE_PURE to more functions
* src/ls.c (DEFINE_SORT_FUNCTIONS): Apply _GL_ATTRIBUTE_PURE
to each strcmp-derived function definition, since GCC8 with
-Wsuggest-attribute=pure now warns it is needed.
---
src/ls.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/ls.c b/src/ls.c
index 49e345aec..073e135e4 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -3603,25 +3603,25 @@ typedef int (*qsortFunc)(V a, V b);
/* direct, non-dirfirst versions */ \
static int xstrcoll_##key_name (V a, V b) \
{ return key_cmp_func (a, b, xstrcoll); } \
- static int strcmp_##key_name (V a, V b) \
+ static int _GL_ATTRIBUTE_PURE strcmp_##key_name (V a, V b) \
{ return key_cmp_func (a, b, strcmp); } \
\
/* reverse, non-dirfirst versions */ \
static int rev_xstrcoll_##key_name (V a, V b)
\
{ return key_cmp_func (b, a, xstrcoll); } \
- static int rev_strcmp_##key_name (V a, V b) \
+ static int _GL_ATTRIBUTE_PURE rev_strcmp_##key_name (V a, V b) \
{ return key_cmp_func (b, a, strcmp); } \
\
/* direct, dirfirst versions */ \
static int xstrcoll_df_##key_name (V a, V b) \
{ DIRFIRST_CHECK (a, b); return key_cmp_func (a, b, xstrcoll); } \
- static int strcmp_df_##key_name (V a, V b) \
+ static int _GL_ATTRIBUTE_PURE strcmp_df_##key_name (V a, V b)
\
{ DIRFIRST_CHECK (a, b); return key_cmp_func (a, b, strcmp); } \
\
/* reverse, dirfirst versions */ \
static int rev_xstrcoll_df_##key_name (V a, V b) \
{ DIRFIRST_CHECK (a, b); return key_cmp_func (b, a, xstrcoll); } \
- static int rev_strcmp_df_##key_name (V a, V b) \
+ static int _GL_ATTRIBUTE_PURE rev_strcmp_df_##key_name (V a, V b) \
{ DIRFIRST_CHECK (a, b); return key_cmp_func (b, a, strcmp); }
static inline int
--
2.14.1.729.g59c0ea183
- [PATCH] build: ls.c: apply _GL_ATTRIBUTE_PURE to more functions,
Jim Meyering <=