aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/patches
diff options
context:
space:
mode:
authorDavid Elsing <david.elsing@posteo.net>2022-10-13 21:04:12 +0000
committerLiliana Marie Prikler <liliana.prikler@gmail.com>2022-10-15 12:01:34 +0200
commite34bf9b63423f5846fa3b03be0c970cb3d33ac33 (patch)
tree47a26196070bbc312065d108a511c751224e1f95 /gnu/packages/patches
parentc1529021917b28905349d888eb89b461c9ad0fcc (diff)
downloadguix-e34bf9b63423f5846fa3b03be0c970cb3d33ac33.tar
guix-e34bf9b63423f5846fa3b03be0c970cb3d33ac33.tar.gz
gnu: Add sajson.
* gnu/packages/cpp.scm (sajson): New variable. Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r--gnu/packages/patches/sajson-build-with-gcc10.patch45
1 files changed, 45 insertions, 0 deletions
diff --git a/gnu/packages/patches/sajson-build-with-gcc10.patch b/gnu/packages/patches/sajson-build-with-gcc10.patch
new file mode 100644
index 0000000000..878706dc79
--- /dev/null
+++ b/gnu/packages/patches/sajson-build-with-gcc10.patch
@@ -0,0 +1,45 @@
+This patch is from the upstream pull request
+https://github.com/chadaustin/sajson/pull/54.
+It fixes linking with GCC.
+
+diff --git a/include/sajson.h b/include/sajson.h
+index 8b4e05a..1bd045b 100644
+--- a/include/sajson.h
++++ b/include/sajson.h
+@@ -138,12 +138,17 @@ constexpr inline size_t make_element(tag t, size_t value) {
+ // header. This trick courtesy of Rich Geldreich's Purple JSON parser.
+ template <typename unused = void>
+ struct globals_struct {
++ static const unsigned char parse_flags[256];
++};
++typedef globals_struct<> globals;
++
+ // clang-format off
+
+ // bit 0 (1) - set if: plain ASCII string character
+ // bit 1 (2) - set if: whitespace
+ // bit 4 (0x10) - set if: 0-9 e E .
+- constexpr static const uint8_t parse_flags[256] = {
++ template <typename unused>
++ const unsigned char globals_struct<unused>::parse_flags[256] = {
+ // 0 1 2 3 4 5 6 7 8 9 A B C D E F
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 2, 0, 0, // 0
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1
+@@ -162,15 +167,13 @@ struct globals_struct {
+ };
+
+ // clang-format on
+-};
+-typedef globals_struct<> globals;
+
+-constexpr inline bool is_plain_string_character(char c) {
++inline bool is_plain_string_character(char c) {
+ // return c >= 0x20 && c <= 0x7f && c != 0x22 && c != 0x5c;
+ return (globals::parse_flags[static_cast<unsigned char>(c)] & 1) != 0;
+ }
+
+-constexpr inline bool is_whitespace(char c) {
++inline bool is_whitespace(char c) {
+ // return c == '\r' || c == '\n' || c == '\t' || c == ' ';
+ return (globals::parse_flags[static_cast<unsigned char>(c)] & 2) != 0;
+ }