xref: /OK3568_Linux_fs/buildroot/package/dieharder/0004-Add-static-to-inline-functions.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From 9c71a211dcf20f53f747326f5bc3fee9fabe3f52 Mon Sep 17 00:00:00 2001
2From: Julien Viard de Galbert <julien@vdg.name>
3Date: Tue, 27 Jun 2017 00:16:11 +0200
4Subject: [PATCH] Add static to inline functions
5
6This is needed to avoid a link error where the inline functions appear
7missing at link time.
8From c99 standard inline function should either be declared static or
9have an extern instance in a c file for linking.
10This fix is necessary to build with gcc 7; for some reason it was not
11trigerred before.
12
13Signed-off-by: Julien Viard de Galbert <julien@vdg.name>
14---
15 libdieharder/dab_filltree.c  | 4 ++--
16 libdieharder/dab_filltree2.c | 4 ++--
17 2 files changed, 4 insertions(+), 4 deletions(-)
18
19diff --git a/libdieharder/dab_filltree.c b/libdieharder/dab_filltree.c
20index 9cc5ce7..a377c3d 100644
21--- a/libdieharder/dab_filltree.c
22+++ b/libdieharder/dab_filltree.c
23@@ -34,7 +34,7 @@ static double targetData[] = {
24 0.0, 0.0, 0.0, 0.0, 0.13333333, 0.20000000, 0.20634921, 0.17857143, 0.13007085, 0.08183633, 0.04338395, 0.01851828, 0.00617270, 0.00151193, 0.00023520, 0.00001680, 0.00000000, 0.00000000, 0.00000000, 0.00000000
25 };
26
27-inline int insert(double x, double *array, unsigned int startVal);
28+static inline int insert(double x, double *array, unsigned int startVal);
29
30 int dab_filltree(Test **test,int irun) {
31  int size = (ntuple == 0) ? 32 : ntuple;
32@@ -105,7 +105,7 @@ int dab_filltree(Test **test,int irun) {
33 }
34
35
36-inline int insert(double x, double *array, unsigned int startVal) {
37+static inline int insert(double x, double *array, unsigned int startVal) {
38  uint d = (startVal + 1) / 2;
39  uint i = startVal;
40  while (d > 0) {
41diff --git a/libdieharder/dab_filltree2.c b/libdieharder/dab_filltree2.c
42index 1e33af2..59cbd52 100644
43--- a/libdieharder/dab_filltree2.c
44+++ b/libdieharder/dab_filltree2.c
45@@ -92,7 +92,7 @@ static double targetData[128] = {  // size=128, generated from 6e9 samples
46 0.00000000000e+00,0.00000000000e+00,0.00000000000e+00,0.00000000000e+00,
47 };
48
49-inline int insertBit(uint x, uchar *array, uint *i, uint *d);
50+static inline int insertBit(uint x, uchar *array, uint *i, uint *d);
51
52 int dab_filltree2(Test **test, int irun) {
53  int size = (ntuple == 0) ? 128 : ntuple;
54@@ -181,7 +181,7 @@ int dab_filltree2(Test **test, int irun) {
55  * The function returns >= 0 if the path went too deep; the
56  * returned value is the last position of the path.
57  */
58-inline int insertBit(uint x, uchar *array, uint *i, uint *d) {
59+static inline int insertBit(uint x, uchar *array, uint *i, uint *d) {
60  if (x != 0) {
61    *i += *d;
62  } else {
63--
642.13.2
65
66