[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] file-has-acl: avoid warning from bleeding-edge GCC
|
From: |
Jim Meyering |
|
Subject: |
[PATCH] file-has-acl: avoid warning from bleeding-edge GCC |
|
Date: |
Sun, 28 May 2023 09:46:22 -0700 |
FYI, just pushed, to avoid this:
lib/file-has-acl.c: In function 'have_xattr':
lib/file-has-acl.c:54:1: error: function might be candidate for attribute
'pure' if it is known to return normally [-Werror=suggest-attribute=pure]
54 | have_xattr (char const *attr, char const *listbuf, ssize_t listsize)
>From 2bd4c8dc13de3121d76dad755a255c8e92fd46a7 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@fb.com>
Date: Sun, 28 May 2023 09:41:08 -0700
Subject: [PATCH] file-has-acl: avoid warning from bleeding-edge GCC
* lib/file-has-acl.c: Include attribute.h.
(have_xattr): Declare with ATTRIBUTE_PURE,
to avoid new warning from GCC14-to-be.
* modules/file-has-acl (Depends-on): Add attribute.
Spotted while building coreutils with this:
gcc version 14.0.0 20230526 (experimental)
---
ChangeLog | 10 ++++++++++
lib/file-has-acl.c | 4 ++--
modules/file-has-acl | 1 +
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e3a2507c47..93682f526b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2023-05-28 Jim Meyering <meyering@fb.com>
+
+ file-has-acl: avoid warning from bleeding-edge GCC
+ * lib/file-has-acl.c: Include attribute.h.
+ (have_xattr): Declare with ATTRIBUTE_PURE,
+ to avoid new warning from GCC14-to-be.
+ * modules/file-has-acl (Depends-on): Add attribute.
+ Spotted while building coreutils with this:
+ gcc version 14.0.0 20230526 (experimental)
+
2023-05-28 Bruno Haible <bruno@clisp.org>
error: Avoid -Wint-in-bool-context warning.
diff --git a/lib/file-has-acl.c b/lib/file-has-acl.c
index 4cddc80bd1..13f08c3055 100644
--- a/lib/file-has-acl.c
+++ b/lib/file-has-acl.c
@@ -28,7 +28,7 @@
#include "acl.h"
#include "acl-internal.h"
-
+#include "attribute.h"
#include "minmax.h"
#if USE_ACL && HAVE_LINUX_XATTR_H && HAVE_LISTXATTR
@@ -50,7 +50,7 @@ enum {
/* Return true if ATTR is in the set represented by the NUL-terminated
strings in LISTBUF, which is of size LISTSIZE. */
-static bool
+ATTRIBUTE_PURE static bool
have_xattr (char const *attr, char const *listbuf, ssize_t listsize)
{
char const *blim = listbuf + listsize;
diff --git a/modules/file-has-acl b/modules/file-has-acl
index 199fccd6ca..ec93313dfd 100644
--- a/modules/file-has-acl
+++ b/modules/file-has-acl
@@ -8,6 +8,7 @@ m4/acl.m4
Depends-on:
acl-permissions
+attribute
extern-inline
minmax
free-posix
--
2.41.0.rc2
- [PATCH] file-has-acl: avoid warning from bleeding-edge GCC,
Jim Meyering <=