... here is another one in lib/cdef.h occurring with a  MinGW build.

In file included from ../lib/libc-config.h:149:0,
                 from ../lib/glob.h:24,
                 from utils.c:35:
../lib/cdefs.h:298:6: warning: "__USE_FORTIFY_LEVEL" is not defined,
evaluates to 0 [-Wundef]
 # if __USE_FORTIFY_LEVEL > 0
      ^~~~~~~~~~~~~~~~~~~


With Best Regards, Tim



On 01/03/2018 02:27 AM, Jim Meyering wrote:
> On Tue, Jan 2, 2018 at 1:56 PM, Eric Blake <ebl...@redhat.com> wrote:
>> Commit 2c5d5587 causes warnings on non-Sun systems when compiled
>> under -Wunused-parameter; we've previously tweaked code in commit
>> 81eb8486 to avoid such warnings.  Prefer an attribute rather than
>> a cast to void (the attribute is always okay to apply; gcc
>> interprets it as 'may be unused', not 'must not be used', precisely
>> to cater to #if chains where determining whether or not the
>> parameter is used gets hairy).
>>
>> * lib/stat-time.h (get_stat_birthtime_ns, get_stat_birthtime):
>> Prefer attribute over cast-to-void.
>> (stat_time_normalize): Mark st as potentially unused.
> 
> Thanks. That sounds like the right approach. We have to hold
> user-included headers to a higher standard.
> 
> 
From 8706dfd2673acfd668a250a6942cc437f5636154 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tim=20R=C3=BChsen?= <tim.rueh...@gmx.de>
Date: Wed, 3 Jan 2018 11:50:07 +0100
Subject: [PATCH] Fix -Wundef in user-included header lib/cdef.h

---
 lib/cdefs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/cdefs.h b/lib/cdefs.h
index ec1fd4106..db72af433 100644
--- a/lib/cdefs.h
+++ b/lib/cdefs.h
@@ -295,7 +295,7 @@
 #if __GNUC_PREREQ (3,4)
 # define __attribute_warn_unused_result__ \
    __attribute__ ((__warn_unused_result__))
-# if __USE_FORTIFY_LEVEL > 0
+# if defined __USE_FORTIFY_LEVEL && __USE_FORTIFY_LEVEL > 0
 #  define __wur __attribute_warn_unused_result__
 # endif
 #else
-- 
2.15.1

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to