Skip to content

Commit

Permalink
add fixed m4
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-kan committed Jan 14, 2024
1 parent 6c5beb8 commit 08db746
Show file tree
Hide file tree
Showing 14 changed files with 515 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1.4
ARG BASE_IMAGE=debian:bookworm-slim
ARG BASE_IMAGE=ubuntu:noble
FROM ${BASE_IMAGE}
ARG SCC_OPT=/opt
WORKDIR ${SCC_OPT}
Expand All @@ -9,8 +9,8 @@ RUN <<EOF
apt-get update -y
apt-get upgrade -y
apt-get install --no-install-recommends -y \
python3 patch tar gzip unzip bzip2 xz-utils \
file ca-certificates make bash clang-14
python3 patch \
file ca-certificates make bash clang-17
apt-get autoremove -y
apt-get clean -y
rm -rf /var/lib/apt/lists/*
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
最小化配置一个可以使用的 spack,需要的软件依赖可以参考 [Dockerfile](./Dockerfile)

```bash
git clone https://github.com/SYSU-SCC/sysu-scc-spack-repo
git clone https://github.com/SYSU-SCC/sysu-scc-spack-repo --depth=1

# 只依赖这一个环境变量,可以放进 ~/.bashrc
export SCC_SETUP_ENV=$(realpath sysu-scc-spack-repo/share/sysu-scc-spack-repo/setup-env.sh)
Expand Down
27 changes: 27 additions & 0 deletions packages/m4/checks-198.sysval.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From a1354086d92efa06f5866b008a019f6d801367ca Mon Sep 17 00:00:00 2001
From: Eric Blake <[email protected]>
Date: Sat, 29 May 2021 06:51:53 -0500
Subject: doc: Minor formatting tweak.

* doc/m4.texi (Sysval): Fix overfull /hbox.
---
doc/m4.texi | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/doc/m4.texi b/doc/m4.texi
index 94ac851d..247f2be5 100644
--- a/doc/m4.texi
+++ b/doc/m4.texi
@@ -6756,7 +6756,8 @@ ifdef(`__unix__', ,
')m4exit(`77')')dnl
changequote(`[', `]')
@result{}
-syscmd([/bin/sh -c 'kill -9 $$'; st=$?; test $st = 137 || test $st = 265])
+syscmd([/bin/sh -c 'kill -9 $$'; st=$?;
+test $st = 137 || test $st = 265])
@result{}
ifelse(sysval, [0], , [errprint([ skipping: shell does not send signal 9
])m4exit([77])])dnl
--
cgit v1.2.1

31 changes: 31 additions & 0 deletions packages/m4/checks-198.sysval.2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
From cd7f4d153ccccf601751e9fa82424412f6ecfc96 Mon Sep 17 00:00:00 2001
From: Eric Blake <[email protected]>
Date: Tue, 1 Jun 2021 08:10:51 -0500
Subject: tests: Fix 198.sysval

In my attempt to avoid test failures on Haiku, I caused test failures
on platforms where sh is noisy when reporting a killed sub-process.

* doc/m4.texi (Sysval): Avoid stderr noise during test.
Fixes: 17011ea76a (tests: Skip signal detection on Haiku)
Fixes: https://lists.gnu.org/archive/html/bug-m4/2021-05/msg00029.html
---
doc/m4.texi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/m4.texi b/doc/m4.texi
index 247f2be5..3b833b2a 100644
--- a/doc/m4.texi
+++ b/doc/m4.texi
@@ -6756,7 +6756,7 @@ ifdef(`__unix__', ,
')m4exit(`77')')dnl
changequote(`[', `]')
@result{}
-syscmd([/bin/sh -c 'kill -9 $$'; st=$?;
+syscmd([@{ /bin/sh -c 'kill -9 $$'; @} 2>/dev/null; st=$?;
test $st = 137 || test $st = 265])
@result{}
ifelse(sysval, [0], , [errprint([ skipping: shell does not send signal 9
--
cgit v1.2.1

195 changes: 195 additions & 0 deletions packages/m4/gnulib-pgi.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
Port to PGI 16.10 x86-64

This patch fixes one real bug in gl_anylinked_list2.h, along with some minor
glitches that are not bugs. It does not silence PGI's thousands of bogus
warnings when compiling test-intprops.c. Fortunately, the warnings do not
cause a failure.

* lib/c-ctype.h (_C_CTYPE_LOWER_A_THRU_F_N, _C_CTYPE_LOWER_N): Rename parameter
to avoid PGI warning about '#define f(n) 'n''. My goodness, PGI goes back a
long ways - this predates C89!
* lib/gl_anylinked_list2.h (ASYNCSAFE): Fix bug caught by PGI. For example,
ASYNCSAFE (const void *) should expand to 'const void *volatile', not to
'volatile const void *'.
* lib/spawn.in.h (POSIX_SPAWN_USEVFORK): Don't define if already defined.
* lib/verify.h (verify) [!__GNUC__]: Use shorter albeit meaningless string to
bypass silly compiler limits.
* tests/infinity.h (Infinityf, Infinityd, Infinityl) [__PGI]:
* tests/nan.h (NaNf, NaNd, NaNl): Use static functions to avoid misguided
compiler diagnostics. Is there some reason we don’t use static functions
on all platforms?

diff --git a/lib/c-ctype.h b/lib/c-ctype.h
index bdca1f1..ec6a3a0 100644
--- a/lib/c-ctype.h
+++ b/lib/c-ctype.h
@@ -115,16 +115,16 @@ extern "C" {

/* Cases for lowercase hex letters, and lowercase letters, all offset by N. */

-#define _C_CTYPE_LOWER_A_THRU_F_N(n) \
- case 'a' + (n): case 'b' + (n): case 'c' + (n): case 'd' + (n): \
- case 'e' + (n): case 'f' + (n)
-#define _C_CTYPE_LOWER_N(n) \
- _C_CTYPE_LOWER_A_THRU_F_N(n): \
- case 'g' + (n): case 'h' + (n): case 'i' + (n): case 'j' + (n): \
- case 'k' + (n): case 'l' + (n): case 'm' + (n): case 'n' + (n): \
- case 'o' + (n): case 'p' + (n): case 'q' + (n): case 'r' + (n): \
- case 's' + (n): case 't' + (n): case 'u' + (n): case 'v' + (n): \
- case 'w' + (n): case 'x' + (n): case 'y' + (n): case 'z' + (n)
+#define _C_CTYPE_LOWER_A_THRU_F_N(N) \
+ case 'a' + (N): case 'b' + (N): case 'c' + (N): case 'd' + (N): \
+ case 'e' + (N): case 'f' + (N)
+#define _C_CTYPE_LOWER_N(N) \
+ _C_CTYPE_LOWER_A_THRU_F_N(N): \
+ case 'g' + (N): case 'h' + (N): case 'i' + (N): case 'j' + (N): \
+ case 'k' + (N): case 'l' + (N): case 'm' + (N): case 'n' + (N): \
+ case 'o' + (N): case 'p' + (N): case 'q' + (N): case 'r' + (N): \
+ case 's' + (N): case 't' + (N): case 'u' + (N): case 'v' + (N): \
+ case 'w' + (N): case 'x' + (N): case 'y' + (N): case 'z' + (N)

/* Cases for hex letters, digits, lower, punct, and upper. */

diff --git a/lib/gl_anylinked_list2.h b/lib/gl_anylinked_list2.h
index c249f31..4545da9 100644
--- a/lib/gl_anylinked_list2.h
+++ b/lib/gl_anylinked_list2.h
@@ -29,7 +29,7 @@
and we use 'volatile' assignments to prevent the compiler from reordering
such assignments. */
#ifdef SIGNAL_SAFE_LIST
-# define ASYNCSAFE(type) *(volatile type *)&
+# define ASYNCSAFE(type) *(type volatile *)&
#else
# define ASYNCSAFE(type)
#endif
diff --git a/lib/spawn.in.h b/lib/spawn.in.h
index e8116f9..b4b9197 100644
--- a/lib/spawn.in.h
+++ b/lib/spawn.in.h
@@ -142,7 +142,8 @@ typedef struct
# endif
#endif
/* A GNU extension. Use the next free bit position. */
-#define POSIX_SPAWN_USEVFORK \
+#ifndef POSIX_SPAWN_USEVFORK
+# define POSIX_SPAWN_USEVFORK \
((POSIX_SPAWN_RESETIDS | (POSIX_SPAWN_RESETIDS - 1) \
| POSIX_SPAWN_SETPGROUP | (POSIX_SPAWN_SETPGROUP - 1) \
| POSIX_SPAWN_SETSIGDEF | (POSIX_SPAWN_SETSIGDEF - 1) \
@@ -152,6 +153,7 @@ typedef struct
| POSIX_SPAWN_SETSCHEDULER \
| (POSIX_SPAWN_SETSCHEDULER > 0 ? POSIX_SPAWN_SETSCHEDULER - 1 : 0)) \
+ 1)
+#endif
#if !GNULIB_defined_verify_POSIX_SPAWN_USEVFORK_no_overlap
typedef int verify_POSIX_SPAWN_USEVFORK_no_overlap
[(((POSIX_SPAWN_RESETIDS | POSIX_SPAWN_SETPGROUP
diff --git a/lib/verify.h b/lib/verify.h
index dcaf7ca..dcba9c8 100644
--- a/lib/verify.h
+++ b/lib/verify.h
@@ -248,7 +248,12 @@ template <int w>
/* Verify requirement R at compile-time, as a declaration without a
trailing ';'. */

-#define verify(R) _GL_VERIFY (R, "verify (" #R ")")
+#ifdef __GNUC__
+# define verify(R) _GL_VERIFY (R, "verify (" #R ")")
+#else
+/* PGI barfs if R is long. Play it safe. */
+# define verify(R) _GL_VERIFY (R, "verify (...)")
+#endif

#ifndef __has_builtin
# define __has_builtin(x) 0
diff --git a/tests/infinity.h b/tests/infinity.h
index 431f700..ef5d3bd 100644
--- a/tests/infinity.h
+++ b/tests/infinity.h
@@ -18,8 +18,9 @@
/* Infinityf () returns a 'float' +Infinity. */

/* The Microsoft MSVC 9 compiler chokes on the expression 1.0f / 0.0f.
- The IBM XL C compiler on z/OS complains. */
-#if defined _MSC_VER || (defined __MVS__ && defined __IBMC__)
+ The IBM XL C compiler on z/OS complains.
+ PGI 16.10 complains. */
+#if defined _MSC_VER || (defined __MVS__ && defined __IBMC__) || defined __PGI
static float
Infinityf ()
{
@@ -34,8 +35,9 @@ Infinityf ()
/* Infinityd () returns a 'double' +Infinity. */

/* The Microsoft MSVC 9 compiler chokes on the expression 1.0 / 0.0.
- The IBM XL C compiler on z/OS complains. */
-#if defined _MSC_VER || (defined __MVS__ && defined __IBMC__)
+ The IBM XL C compiler on z/OS complains.
+ PGI 16.10 complains. */
+#if defined _MSC_VER || (defined __MVS__ && defined __IBMC__) || defined __PGI
static double
Infinityd ()
{
@@ -50,8 +52,9 @@ Infinityd ()
/* Infinityl () returns a 'long double' +Infinity. */

/* The Microsoft MSVC 9 compiler chokes on the expression 1.0L / 0.0L.
- The IBM XL C compiler on z/OS complains. */
-#if defined _MSC_VER || (defined __MVS__ && defined __IBMC__)
+ The IBM XL C compiler on z/OS complains.
+ PGI 16.10 complains. */
+#if defined _MSC_VER || (defined __MVS__ && defined __IBMC__) || defined __PGI
static long double
Infinityl ()
{
diff --git a/tests/nan.h b/tests/nan.h
index 48236b5..b5a0f29 100644
--- a/tests/nan.h
+++ b/tests/nan.h
@@ -25,8 +25,11 @@
/* NaNf () returns a 'float' not-a-number. */

/* The Compaq (ex-DEC) C 6.4 compiler and the Microsoft MSVC 9 compiler choke
- on the expression 0.0 / 0.0. The IBM XL C compiler on z/OS complains. */
-#if defined __DECC || defined _MSC_VER || (defined __MVS__ && defined __IBMC__)
+ on the expression 0.0 / 0.0. The IBM XL C compiler on z/OS complains.
+ PGI 16.10 complains. */
+#if (defined __DECC || defined _MSC_VER \
+ || (defined __MVS__ && defined __IBMC__) \
+ || defined __PGI)
static float
NaNf ()
{
@@ -41,8 +44,11 @@ NaNf ()
/* NaNd () returns a 'double' not-a-number. */

/* The Compaq (ex-DEC) C 6.4 compiler and the Microsoft MSVC 9 compiler choke
- on the expression 0.0 / 0.0. The IBM XL C compiler on z/OS complains. */
-#if defined __DECC || defined _MSC_VER || (defined __MVS__ && defined __IBMC__)
+ on the expression 0.0 / 0.0. The IBM XL C compiler on z/OS complains.
+ PGI 16.10 complains. */
+#if (defined __DECC || defined _MSC_VER \
+ || (defined __MVS__ && defined __IBMC__) \
+ || defined __PGI)
static double
NaNd ()
{
@@ -59,14 +65,15 @@ NaNd ()
/* On Irix 6.5, gcc 3.4.3 can't compute compile-time NaN, and needs the
runtime type conversion.
The Microsoft MSVC 9 compiler chokes on the expression 0.0L / 0.0L.
- The IBM XL C compiler on z/OS complains. */
+ The IBM XL C compiler on z/OS complains.
+ PGI 16.10 complains. */
#ifdef __sgi
static long double NaNl ()
{
double zero = 0.0;
return zero / zero;
}
-#elif defined _MSC_VER || (defined __MVS__ && defined __IBMC__)
+#elif defined _MSC_VER || (defined __MVS__ && defined __IBMC__) || defined __PGI
static long double
NaNl ()
{
14 changes: 14 additions & 0 deletions packages/m4/nvhpc-1.4.19.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--- a/lib/intprops.h
+++ b/lib/intprops.h
@@ -232,9 +232,9 @@
(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
+#elif defined __has_builtin && !defined __NVCOMPILER
# define _GL_HAS_BUILTIN_ADD_OVERFLOW __has_builtin (__builtin_add_overflow)
#else
# define _GL_HAS_BUILTIN_ADD_OVERFLOW 0
17 changes: 17 additions & 0 deletions packages/m4/nvhpc-long-width.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--- a/lib/regex_internal.h
+++ b/lib/regex_internal.h
@@ -39,6 +39,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)
34 changes: 34 additions & 0 deletions packages/m4/nvhpc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
--- a/lib/xalloc-oversized.h 2020-08-07 11:04:56.154698639 -0700
+++ b/lib/xalloc-oversized.h 2020-08-07 11:06:11.667997389 -0700
@@ -46,13 +46,13 @@
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__ || __has_builtin (__builtin_add_overflow_p)
+#if ((7 <= __GNUC__ || __has_builtin (__builtin_add_overflow_p)) && !defined __NVCOMPILER)
# define xalloc_oversized(n, s) \
__builtin_mul_overflow_p (n, s, (__xalloc_count_type) 1)
#elif ((5 <= __GNUC__ \
|| (__has_builtin (__builtin_mul_overflow) \
&& __has_builtin (__builtin_constant_p))) \
- && !__STRICT_ANSI__)
+ && !__STRICT_ANSI__ && !defined __NVCOMPILER)
# define xalloc_oversized(n, s) \
(__builtin_constant_p (n) && __builtin_constant_p (s) \
? __xalloc_oversized (n, s) \
--- a/lib/intprops.h 2020-08-07 11:06:15.508012580 -0700
+++ b/lib/intprops.h 2020-08-07 11:07:54.379403731 -0700
@@ -242,11 +242,11 @@

/* True if __builtin_add_overflow (A, B, P) works when P is non-null. */
#define _GL_HAS_BUILTIN_OVERFLOW \
- (5 <= __GNUC__ || __has_builtin (__builtin_add_overflow))
+ ((5 <= __GNUC__ || __has_builtin (__builtin_add_overflow)) && !defined __NVCOMPILER)

/* True if __builtin_add_overflow_p (A, B, C) works. */
#define _GL_HAS_BUILTIN_OVERFLOW_P \
- (7 <= __GNUC__ || __has_builtin (__builtin_add_overflow_p))
+ ((7 <= __GNUC__ || __has_builtin (__builtin_add_overflow_p)) && !defined __NVCOMPILER)

/* The _GL*_OVERFLOW macros have the same restrictions as the
*_RANGE_OVERFLOW macros, except that they do not assume that operands
18 changes: 18 additions & 0 deletions packages/m4/oneapi.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--- a/lib/xalloc-oversized.h 2020-08-07 11:04:56.154698639 -0700
+++ b/lib/xalloc-oversized.h 2020-08-07 11:06:11.667997389 -0700
@@ -46,13 +46,13 @@
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__ || __has_builtin (__builtin_add_overflow_p)
+#if ((7 <= __GNUC__ || __has_builtin (__builtin_add_overflow_p)) && !defined __INTEL_LLVM_COMPILER)
# define xalloc_oversized(n, s) \
__builtin_mul_overflow_p (n, s, (__xalloc_count_type) 1)
#elif ((5 <= __GNUC__ \
|| (__has_builtin (__builtin_mul_overflow) \
&& __has_builtin (__builtin_constant_p))) \
- && !__STRICT_ANSI__)
+ && !__STRICT_ANSI__ && !defined __INTEL_LLVM_COMPILER)
# define xalloc_oversized(n, s) \
(__builtin_constant_p (n) && __builtin_constant_p (s) \
? __xalloc_oversized (n, s) \
Loading

0 comments on commit 08db746

Please sign in to comment.