plotutils: fix build with clang 16

Clang defaults to C++, which disallows the register storage class
specifier. This causes the build to fail. Remove the specifier to allow
clang 16 to build plotutils.

+48 -1
+44
pkgs/tools/graphics/plotutils/c++17-register-usage-fix.patch
···
··· 1 + diff -ur a/pic2plot/gram.cc b/pic2plot/gram.cc 2 + --- a/pic2plot/gram.cc 2000-06-28 00:23:21.000000000 -0400 3 + +++ b/pic2plot/gram.cc 2023-09-07 22:59:47.004460065 -0400 4 + @@ -1229,9 +1229,9 @@ 5 + char *from; 6 + unsigned int count; 7 + { 8 + - register char *f = from; 9 + - register char *t = to; 10 + - register int i = count; 11 + + char *f = from; 12 + + char *t = to; 13 + + int i = count; 14 + 15 + while (i-- > 0) 16 + *t++ = *f++; 17 + @@ -1244,9 +1244,9 @@ 18 + static void 19 + __yy_memcpy (char *to, char *from, unsigned int count) 20 + { 21 + - register char *t = to; 22 + - register char *f = from; 23 + - register int i = count; 24 + + char *t = to; 25 + + char *f = from; 26 + + int i = count; 27 + 28 + while (i-- > 0) 29 + *t++ = *f++; 30 + @@ -1289,10 +1289,10 @@ 31 + yyparse(YYPARSE_PARAM_ARG) 32 + YYPARSE_PARAM_DECL 33 + { 34 + - register int yystate; 35 + - register int yyn; 36 + - register short *yyssp; 37 + - register YYSTYPE *yyvsp; 38 + + int yystate; 39 + + int yyn; 40 + + short *yyssp; 41 + + YYSTYPE *yyvsp; 42 + int yyerrstatus; /* number of tokens to shift before error messages enabled */ 43 + int yychar1 = 0; /* lookahead token as an internal (translated) token number */ 44 +
+4 -1
pkgs/tools/graphics/plotutils/default.nix
··· 16 17 nativeBuildInputs = [ autoreconfHook ]; 18 buildInputs = [ libpng ]; 19 - patches = map fetchurl (import ./debian-patches.nix); 20 21 preBuild = '' 22 # Fix parallel building.
··· 16 17 nativeBuildInputs = [ autoreconfHook ]; 18 buildInputs = [ libpng ]; 19 + patches = map fetchurl (import ./debian-patches.nix) 20 + # `pic2plot/gram.cc` uses the register storage class specifier, which is not supported in C++17. 21 + # This prevents clang 16 from building plotutils because it defaults to C++17. 22 + ++ [ ./c++17-register-usage-fix.patch ]; 23 24 preBuild = '' 25 # Fix parallel building.