From 58f559cdb0de5c88f75b397f9ed7229bec898034 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Tue, 30 May 2023 00:14:43 -0400 Subject: [PATCH] gperf: fix build with clang 16 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clang 16 defaults to C++17, which does not allow the `register` storage class specifier. This is fixed upstream, but the change doesn’t apply cleanly to the 3.1 release. Fortunately, the fix is trivial (remove the disallowed keyword). --- pkgs/development/tools/misc/gperf/default.nix | 5 +++++ .../tools/misc/gperf/gperf-c++17-register-fix.patch | 13 +++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 pkgs/development/tools/misc/gperf/gperf-c++17-register-fix.patch diff --git a/pkgs/development/tools/misc/gperf/default.nix b/pkgs/development/tools/misc/gperf/default.nix index d836e5a973aef..c6b6e89495c0a 100644 --- a/pkgs/development/tools/misc/gperf/default.nix +++ b/pkgs/development/tools/misc/gperf/default.nix @@ -9,6 +9,11 @@ stdenv.mkDerivation rec { sha256 = "1qispg6i508rq8pkajh26cznwimbnj06wq9sd85vg95v8nwld1aq"; }; + patches = [ + # Clang 16 defaults to C++17, which does not allow `register` as a storage class specifier. + ./gperf-c++17-register-fix.patch + ]; + enableParallelBuilding = true; meta = { diff --git a/pkgs/development/tools/misc/gperf/gperf-c++17-register-fix.patch b/pkgs/development/tools/misc/gperf/gperf-c++17-register-fix.patch new file mode 100644 index 0000000000000..bb8c414a1a26c --- /dev/null +++ b/pkgs/development/tools/misc/gperf/gperf-c++17-register-fix.patch @@ -0,0 +1,13 @@ +diff --git a/lib/getline.cc b/lib/getline.cc +index c57c633..0984a7c 100644 +--- 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)