Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Sep 2021 16:05:28 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 9553c6af881e - main - <linux/overflow.h>: Don't use __has_builtin().
Message-ID:  <202109151605.18FG5SHQ086428@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=9553c6af881e1f869cecb11b4476279e0ed6c4e0

commit 9553c6af881e1f869cecb11b4476279e0ed6c4e0
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2021-09-15 16:03:17 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2021-09-15 16:03:17 +0000

    <linux/overflow.h>: Don't use __has_builtin().
    
    GCC only added support for __has_builtin in GCC 10.  However, all
    supported versions of GCC and clang include these builtins so just use
    them unconditionally.
    
    This fixes the build with GCC 9.
    
    Reviewed by:    manu, hselasky, imp
    Differential Revision:  https://reviews.freebsd.org/D31942
---
 sys/compat/linuxkpi/common/include/linux/overflow.h | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/overflow.h b/sys/compat/linuxkpi/common/include/linux/overflow.h
index 6f53f0b59384..2d540796cd43 100644
--- a/sys/compat/linuxkpi/common/include/linux/overflow.h
+++ b/sys/compat/linuxkpi/common/include/linux/overflow.h
@@ -34,18 +34,9 @@
 #include <sys/stdint.h>
 #include <sys/types.h>
 
-#ifndef	__has_builtin
-#define	__has_builtin(x)	0
-#endif
-
-#if __has_builtin(__builtin_add_overflow)
 #define check_add_overflow(a, b, c)		\
 	__builtin_add_overflow(a, b, c)
-#else
-#error "Compiler does not support __builtin_add_overflow"
-#endif
 
-#if __has_builtin(__builtin_mul_overflow)
 #define check_mul_overflow(a, b, c)	\
 	__builtin_mul_overflow(a, b, c)
 
@@ -58,8 +49,5 @@ array_size(size_t x, size_t y)
 		retval = SIZE_MAX;
 	return (retval);
 }
-#else
-#error "Compiler does not support __builtin_mul_overflow"
-#endif
 
 #endif	/* __LINUX_OVERFLOW_H__ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109151605.18FG5SHQ086428>