tar: make it build with nvhpc (#22853)

Co-authored-by: Scott McMillan <smcmillan@nvidia.com>
This commit is contained in:
Scott McMillan 2021-04-08 03:57:05 -05:00 committed by GitHub
parent 2a7f588612
commit 30153b1064
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 58 additions and 1 deletions

View File

@ -0,0 +1,35 @@
--- a/gnu/xalloc-oversized.h
+++ b/gnu/xalloc-oversized.h
@@ -41,10 +41,10 @@
positive and N must be nonnegative. This is a macro, not a
function, so that it works correctly even when SIZE_MAX < N. */
-#if 7 <= __GNUC__ && !defined __clang__
+#if 7 <= __GNUC__ && !defined __clang__ && !defined __NVCOMPILER
# define xalloc_oversized(n, s) \
__builtin_mul_overflow_p (n, s, (__xalloc_count_type) 1)
-#elif 5 <= __GNUC__ && !defined __ICC && !__STRICT_ANSI__
+#elif 5 <= __GNUC__ && !defined __ICC && !__STRICT_ANSI__ && !defined __NVCOMPILER
# define xalloc_oversized(n, s) \
(__builtin_constant_p (n) && __builtin_constant_p (s) \
? __xalloc_oversized (n, s) \
--- a/gnu/intprops.h
+++ b/gnu/intprops.h
@@ -228,7 +228,7 @@
(A, B, P) work when P is non-null. */
/* __builtin_{add,sub}_overflow exists but is not reliable in GCC 5.x and 6.x,
see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98269>. */
-#if 7 <= __GNUC__ && !defined __ICC
+#if 7 <= __GNUC__ && !defined __ICC && !defined __NVCOMPILER
# define _GL_HAS_BUILTIN_ADD_OVERFLOW 1
#elif defined __has_builtin
# define _GL_HAS_BUILTIN_ADD_OVERFLOW __has_builtin (__builtin_add_overflow)
@@ -246,7 +246,7 @@
/* True if __builtin_add_overflow_p (A, B, C) works, and similarly for
__builtin_sub_overflow_p and __builtin_mul_overflow_p. */
-#if defined __clang__ || defined __ICC
+#if defined __clang__ || defined __ICC || defined __NVCOMPILER
/* Clang 11 lacks __builtin_mul_overflow_p, and even if it did it
would presumably run afoul of Clang bug 16404. ICC 2021.1's
__builtin_add_overflow_p etc. are not treated as integral constant

View File

@ -0,0 +1,17 @@
--- a/gnu/regex_internal.h 2020-08-21 09:14:20.039942370 -0700
+++ b/gnu/regex_internal.h 2020-08-21 10:06:57.840331452 -0700
@@ -35,6 +35,14 @@
#include <intprops.h>
#include <verify.h>
+#ifndef __LONG_WIDTH__
+#if LONG_WIDTH
+#define __LONG_WIDTH__ LONG_WIDTH
+#else
+#define __LONG_WIDTH__ __WORDSIZE
+#endif
+#endif
+
#if defined DEBUG && DEBUG != 0
# include <assert.h>
# define DEBUG_ASSERT(x) assert (x)

View File

@ -31,7 +31,12 @@ class Tar(AutotoolsPackage, GNUMirrorPackage):
patch('se-selinux.patch', when='@:1.29') patch('se-selinux.patch', when='@:1.29')
patch('argp-pgi.patch', when='@:1.29') patch('argp-pgi.patch', when='@:1.29')
patch('gnutar-configure-xattrs.patch', when='@1.28') patch('gnutar-configure-xattrs.patch', when='@1.28')
patch('nvhpc.patch', when='%nvhpc') # The NVIDIA compilers do not currently support some GNU builtins.
# Detect this case and use the fallback path.
patch('nvhpc-1.30.patch', when='@1.30:1.32 %nvhpc')
patch('nvhpc-1.34.patch', when='@1.34 %nvhpc')
# Workaround bug where __LONG_WIDTH__ is not defined
patch('nvhpc-long-width.patch', when='@1.34 %nvhpc')
@classmethod @classmethod
def determine_version(cls, exe): def determine_version(cls, exe):