From b04b3aed9e9fcd4364e5ece81605f5184e69f061 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <39388941+boomanaiden154@users.noreply.github.com>
Date: Tue, 18 Jul 2023 23:28:57 -0700
Subject: gperf: patch usage of register keyword (#38893)

gperf still uses the register keyword in one place which makes
compilation fail with c++17. This patch adds in a patch file to remove
the usage of the reigster keyword so that it compiles properly.
---
 var/spack/repos/builtin/packages/gperf/package.py     |  6 ++++++
 var/spack/repos/builtin/packages/gperf/register.patch | 13 +++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 var/spack/repos/builtin/packages/gperf/register.patch

(limited to 'var')

diff --git a/var/spack/repos/builtin/packages/gperf/package.py b/var/spack/repos/builtin/packages/gperf/package.py
index 29c9556373..51ddf0f2ea 100644
--- a/var/spack/repos/builtin/packages/gperf/package.py
+++ b/var/spack/repos/builtin/packages/gperf/package.py
@@ -20,4 +20,10 @@ class Gperf(AutotoolsPackage, GNUMirrorPackage):
     version("3.1", sha256="588546b945bba4b70b6a3a616e80b4ab466e3f33024a352fc2198112cdbb3ae2")
     version("3.0.4", sha256="767112a204407e62dbc3106647cf839ed544f3cf5d0f0523aaa2508623aad63e")
 
+    # This patch removes all instances of the register keyword within gperf
+    # which is necessary to build gperf with recent compilers that default to
+    # c++17 where using the register keyword results in a compile-time error.
+    # This has no impact on correctness.
+    patch("register.patch")
+
     # NOTE: `make check` is known to fail tests
diff --git a/var/spack/repos/builtin/packages/gperf/register.patch b/var/spack/repos/builtin/packages/gperf/register.patch
new file mode 100644
index 0000000000..8af66429eb
--- /dev/null
+++ b/var/spack/repos/builtin/packages/gperf/register.patch
@@ -0,0 +1,13 @@
+diff --git a/lib/getline.cc b/lib/getline.cc
+index ecc3e85..2d97644 100644 (file)
+--- a/lib/getline.cc
++++ b/lib/getline.cc
+@@ -55,7 +55,7 @@ getstr (char **lineptr, size_t *n, FILE *stream, char terminator, size_t offset)
+ 
+   for (;;)
+     {
+-      register int c = getc (stream);
++      int c = getc (stream);
+ 
+       /* We always want at least one char left in the buffer, since we
+          always (unless we get an error while reading the first char)
-- 
cgit v1.2.3-70-g09d2