diff options
author | Khem Raj <raj.khem@gmail.com> | 2022-09-01 16:06:03 -0700 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2022-09-05 22:49:34 -0700 |
commit | 2922f01139ff47c8f4f2096f1def69f55cc79c32 (patch) | |
tree | e3b8bae7e5708bef09e7b070f3ef4c2a77edce49 | |
parent | fe07cb13e20ad40fc7a0b7f5784c989715e235b9 (diff) | |
download | meta-openembedded-2922f01139ff47c8f4f2096f1def69f55cc79c32.tar.gz |
libcereal: Do not use uniform_int_distribution<char> template
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r-- | meta-oe/recipes-support/libcereal/files/0001-sandbox-Do-not-use-int8_t-in-std-uniform_int_distrib.patch | 54 | ||||
-rw-r--r-- | meta-oe/recipes-support/libcereal/libcereal_1.3.2.bb | 1 |
2 files changed, 55 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/libcereal/files/0001-sandbox-Do-not-use-int8_t-in-std-uniform_int_distrib.patch b/meta-oe/recipes-support/libcereal/files/0001-sandbox-Do-not-use-int8_t-in-std-uniform_int_distrib.patch new file mode 100644 index 0000000000..26a8223d19 --- /dev/null +++ b/meta-oe/recipes-support/libcereal/files/0001-sandbox-Do-not-use-int8_t-in-std-uniform_int_distrib.patch | |||
@@ -0,0 +1,54 @@ | |||
1 | From 36054278304945c6aef7d44e58788ca882c67d05 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Thu, 1 Sep 2022 15:54:13 -0700 | ||
4 | Subject: [PATCH] sandbox: Do not use int8_t in std::uniform_int_distribution | ||
5 | |||
6 | Newer versions of libc++ has dropped supporting this usecase since its | ||
7 | an UB see. | ||
8 | |||
9 | https://reviews.llvm.org/D114920?id=400571 | ||
10 | |||
11 | Fixes | ||
12 | |||
13 | uniform_int_distribution.h:162:5: error: static assertion failed due to requirement '__libcpp_random_is_valid_inttype<char>::value': IntType must be a supported integer type | ||
14 | static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be a supported integer type"); | ||
15 | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
16 | /mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/libcereal/1.3.2+gitAUTOINC+ebef1e9298-r0/git/sandbox/performance.cpp:261:9: note: in instantiation of template class 'std::uniform_int_distribution<char>' requested here | ||
17 | c = std::uniform_int_distribution<char>(' ', '~')(gen); | ||
18 | ^ | ||
19 | /mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/libcereal/1.3.2+gitAUTOINC+ebef1e9298-r0/git/sandbox/performance.cpp:261:9: error: type 'std::uniform_int_distribution<char>' does not provide a call operator | ||
20 | c = std::uniform_int_distribution<char>(' ', '~')(gen); | ||
21 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
22 | 2 errors generated. | ||
23 | |||
24 | Upstream-Status: Submitted [https://github.com/USCiLab/cereal/pull/764] | ||
25 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
26 | --- | ||
27 | sandbox/performance.cpp | 4 ++-- | ||
28 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
29 | |||
30 | diff --git a/sandbox/performance.cpp b/sandbox/performance.cpp | ||
31 | index f9307870..aca8c78c 100644 | ||
32 | --- a/sandbox/performance.cpp | ||
33 | +++ b/sandbox/performance.cpp | ||
34 | @@ -258,7 +258,7 @@ random_value(std::mt19937 & gen) | ||
35 | { | ||
36 | std::string s(std::uniform_int_distribution<int>(3, 30)(gen), ' '); | ||
37 | for(char & c : s) | ||
38 | - c = std::uniform_int_distribution<char>(' ', '~')(gen); | ||
39 | + c = static_cast<char>( std::uniform_int_distribution<int>(' ', '~')(gen) ); | ||
40 | return s; | ||
41 | } | ||
42 | |||
43 | @@ -277,7 +277,7 @@ std::string random_binary_string(std::mt19937 & gen) | ||
44 | { | ||
45 | std::string s(N, ' '); | ||
46 | for(auto & c : s ) | ||
47 | - c = std::uniform_int_distribution<char>('0', '1')(gen); | ||
48 | + c = static_cast<char>( std::uniform_int_distribution<int>( '0', '1' )(gen) ); | ||
49 | return s; | ||
50 | } | ||
51 | |||
52 | -- | ||
53 | 2.37.3 | ||
54 | |||
diff --git a/meta-oe/recipes-support/libcereal/libcereal_1.3.2.bb b/meta-oe/recipes-support/libcereal/libcereal_1.3.2.bb index 80c962ead4..5248b1e288 100644 --- a/meta-oe/recipes-support/libcereal/libcereal_1.3.2.bb +++ b/meta-oe/recipes-support/libcereal/libcereal_1.3.2.bb | |||
@@ -19,6 +19,7 @@ PROVIDES += "${PN}-dev" | |||
19 | PV .= "+git${SRCPV}" | 19 | PV .= "+git${SRCPV}" |
20 | SRCREV = "ebef1e929807629befafbb2918ea1a08c7194554" | 20 | SRCREV = "ebef1e929807629befafbb2918ea1a08c7194554" |
21 | SRC_URI = "git://github.com/USCiLab/cereal.git;branch=master;protocol=https \ | 21 | SRC_URI = "git://github.com/USCiLab/cereal.git;branch=master;protocol=https \ |
22 | file://0001-sandbox-Do-not-use-int8_t-in-std-uniform_int_distrib.patch \ | ||
22 | file://run-ptest \ | 23 | file://run-ptest \ |
23 | " | 24 | " |
24 | 25 | ||