Some versions of linux have probably marked fwrite(3) as

__attribute__((__warn_unused_result__)) and the __builtin_expect()
use here is an attempt to silence the warning. This does not work
if the second argument of __builtin_expect() is not a constant,
but we are not linux, so instead of going through the
__builtin_constant_p() dance to correct this, just disable it for
non linux OS's.
This commit is contained in:
christos 2011-09-13 19:07:44 +00:00
parent 351c7b7b28
commit 71faa8a7e1

View File

@ -1,4 +1,4 @@
/* $NetBSD: util.h,v 1.5 2011/09/11 18:55:42 christos Exp $ */
/* $NetBSD: util.h,v 1.6 2011/09/13 19:07:44 christos Exp $ */
/*
* Copyright (C) 2004-2007, 2010, 2011 Internet Systems Consortium, Inc. ("ISC")
@ -240,7 +240,7 @@
/*%
* Prevent Linux spurious warnings
*/
#if defined(__GNUC__) && (__GNUC__ > 3)
#if defined(__linux__) && defined(__GNUC__) && (__GNUC__ > 3)
#define isc_util_fwrite(a, b, c, d) \
__builtin_expect(fwrite((a), (b), (c), (d)), (c))
#else