bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] file-has-acl: suppress a warning from gcc -Wsuggest-attribute=co


From: Jim Meyering
Subject: [PATCH] file-has-acl: suppress a warning from gcc -Wsuggest-attribute=const
Date: Thu, 02 Feb 2012 09:12:39 +0100

FYI,

>From 93f8bee70d1bc611bead8a826edf0a932c2b8999 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 2 Feb 2012 09:12:13 +0100
Subject: [PATCH] file-has-acl: suppress a warning from gcc
 -Wsuggest-attribute=const

* lib/file-has-acl.c (file_has_acl): This function (for some #ifdefs)
would evoke a new gcc warning.  Given all of the #ifdefs, it is better
not even to try to add the attribute.  Instead, add a pragma to suppress
the suggestion/warning.
---
 ChangeLog          |    8 ++++++++
 lib/file-has-acl.c |    6 ++++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f80c7dd..9c5a3cd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-02-02  Jim Meyering  <address@hidden>
+
+       file-has-acl: suppress a warning from gcc -Wsuggest-attribute=const
+       * lib/file-has-acl.c (file_has_acl): This function (for some #ifdefs)
+       would evoke a new gcc warning.  Given all of the #ifdefs, it is better
+       not even to try to add the attribute.  Instead, add a pragma to suppress
+       the suggestion/warning.
+
 2012-01-31  Karl Berry  <address@hidden>

        setstate doc: typo.
diff --git a/lib/file-has-acl.c b/lib/file-has-acl.c
index b7c1484..89a63a6 100644
--- a/lib/file-has-acl.c
+++ b/lib/file-has-acl.c
@@ -17,6 +17,12 @@

    Written by Paul Eggert, Andreas Grünbacher, and Bruno Haible.  */

+/* Without this pragma, gcc 4.7.0 20120126 may suggest that the
+   file_has_acl function might be candidate for attribute 'const'  */
+#if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__
+# pragma GCC diagnostic ignored "-Wsuggest-attribute=const"
+#endif
+
 #include <config.h>

 #include "acl.h"
--
1.7.9.49.g25388



reply via email to

[Prev in Thread] Current Thread [Next in Thread]