unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
blob fccb79d43292bfe0c1e6b7b60a0d52c5f3f4a614 3604 bytes (raw)
name: gnu/packages/patches/ragel-specify-char-signedness.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
 
Ragel assumes C and C++'s "char" type is signed by default but this is not
true for every architecture gcc supports.  Prevent build failures of dependent
packages (on architectures such as AArch64 where "char" is normally unsigned)
by making explicit Ragel's assumption of character signedness.

This is functionally very similar to upstream commit e2650a7, "common: Fix
ambiguous CHAR_MIN/MAX definition", which is also meant to address this issue.
However this patch applies to Ragel version 6 and it removes altogether the
ambiguous "char" type from generated C code, causing Ragel to instead specify
"signed char" or "unsigned char" as appropriate.

diff --git a/ragel/common.cpp b/ragel/common.cpp
index 8e9f8ed0..649f388c 100644
--- a/ragel/common.cpp
+++ b/ragel/common.cpp
@@ -27,7 +27,7 @@
 
 HostType hostTypesC[] =
 {
-	{ "char",     0,       "char",    true,   true,  false,  CHAR_MIN,  CHAR_MAX,   0, 0,              sizeof(char) },
+	{ "signed",   "char",  "char",    true,   true,  false,  SCHAR_MIN, SCHAR_MAX,  0, 0,              sizeof(signed char) },
 	{ "unsigned", "char",  "uchar",   false,  true,  false,  0, 0,                  0,     UCHAR_MAX,  sizeof(unsigned char) },
 	{ "short",    0,       "short",   true,   true,  false,  SHRT_MIN,  SHRT_MAX,   0, 0,              sizeof(short) },
 	{ "unsigned", "short", "ushort",  false,  true,  false,  0, 0,                  0,     USHRT_MAX,  sizeof(unsigned short) },
@@ -66,7 +66,7 @@ HostType hostTypesC[] =
 
 HostType hostTypesD[] =
 {
-	{ "byte",    0,  "byte",    true,   true,  false,  CHAR_MIN,  CHAR_MAX,    0, 0,                   1 },
+	{ "byte",    0,  "byte",    true,   true,  false,  SCHAR_MIN, SCHAR_MAX,   0, 0,                   1 },
 	{ "ubyte",   0,  "ubyte",   false,  true,  false,  0, 0,                   0,         UCHAR_MAX,   1 },
 	{ "char",    0,  "char",    false,  true,  false,  0, 0,                   0,         UCHAR_MAX,   1 },
 	{ "short",   0,  "short",   true,   true,  false,  SHRT_MIN,  SHRT_MAX,    0, 0,                   2 },
@@ -93,7 +93,7 @@ HostType hostTypesGo[] =
 
 HostType hostTypesJava[] = 
 {
-	{ "byte",    0,  "byte",   true,   true,  false,  CHAR_MIN,  CHAR_MAX,    0, 0,                   1 },
+	{ "byte",    0,  "byte",   true,   true,  false,  SCHAR_MIN, SCHAR_MAX,   0, 0,                   1 },
 	{ "short",   0,  "short",  true,   true,  false,  SHRT_MIN,  SHRT_MAX,    0, 0,                   2 },
 	{ "char",    0,  "char",   false,  true,  false,  0, 0,                   0,         USHRT_MAX,   2 },
 	{ "int",     0,  "int",    true,   true,  false,  INT_MIN,   INT_MAX,     0, 0,                   4 },
@@ -102,13 +102,13 @@ HostType hostTypesJava[] =
 /* What are the appropriate types for ruby? */
 HostType hostTypesRuby[] = 
 {
-	{ "char",    0,  "char",   true,   true,  false,  CHAR_MIN,  CHAR_MAX,    0, 0, 1 },
+	{ "char",    0,  "char",   true,   true,  false,  SCHAR_MIN, SCHAR_MAX,   0, 0, 1 },
 	{ "int",     0,  "int",    true,   true,  false,  INT_MIN,   INT_MAX,     0, 0, 4 },
 };
 
 HostType hostTypesCSharp[] =
 {
-	{ "sbyte",   0,  "sbyte",   true,   true,  false,  CHAR_MIN,  CHAR_MAX,    0, 0,                   1 },
+	{ "sbyte",   0,  "sbyte",   true,   true,  false,  SCHAR_MIN, SCHAR_MAX,   0, 0,                   1 },
 	{ "byte",    0,  "byte",    false,  true,  false,  0, 0,                   0,         UCHAR_MAX,   1 },
 	{ "short",   0,  "short",   true,   true,  false,  SHRT_MIN,  SHRT_MAX,    0, 0,                   2 },
 	{ "ushort",  0,  "ushort",  false,  true,  false,  0, 0,                   0,         USHRT_MAX,   2 },

debug log:

solving fccb79d432 ...
found fccb79d432 in https://yhetil.org/guix-patches/8d3c7556a41b12a899c52181a5f6689111f036b4.1634402642.git.simon@simonsouth.net/

applying [1/1] https://yhetil.org/guix-patches/8d3c7556a41b12a899c52181a5f6689111f036b4.1634402642.git.simon@simonsouth.net/
diff --git a/gnu/packages/patches/ragel-specify-char-signedness.patch b/gnu/packages/patches/ragel-specify-char-signedness.patch
new file mode 100644
index 0000000000..fccb79d432

1:23: trailing whitespace.
 
1:28: space before tab in indent.
 	{ "unsigned", "char",  "uchar",   false,  true,  false,  0, 0,                  0,     UCHAR_MAX,  sizeof(unsigned char) },
1:29: space before tab in indent.
 	{ "short",    0,       "short",   true,   true,  false,  SHRT_MIN,  SHRT_MAX,   0, 0,              sizeof(short) },
1:30: space before tab in indent.
 	{ "unsigned", "short", "ushort",  false,  true,  false,  0, 0,                  0,     USHRT_MAX,  sizeof(unsigned short) },
1:32: trailing whitespace.
 
Checking patch gnu/packages/patches/ragel-specify-char-signedness.patch...
Applied patch gnu/packages/patches/ragel-specify-char-signedness.patch cleanly.
warning: squelched 14 whitespace errors
warning: 19 lines add whitespace errors.

index at:
100644 fccb79d43292bfe0c1e6b7b60a0d52c5f3f4a614	gnu/packages/patches/ragel-specify-char-signedness.patch

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).