hc
2023-12-04 f33f61bdb7ca6d5ebe7a78f9d8694b91360279ac
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
59
60
61
62
63
64
From 9c71a211dcf20f53f747326f5bc3fee9fabe3f52 Mon Sep 17 00:00:00 2001
From: Julien Viard de Galbert <julien@vdg.name>
Date: Tue, 27 Jun 2017 00:16:11 +0200
Subject: [PATCH] Add static to inline functions
 
This is needed to avoid a link error where the inline functions appear
missing at link time.
From c99 standard inline function should either be declared static or
have an extern instance in a c file for linking.
This fix is necessary to build with gcc 7; for some reason it was not
trigerred before.
 
Signed-off-by: Julien Viard de Galbert <julien@vdg.name>
---
 libdieharder/dab_filltree.c  | 4 ++--
 libdieharder/dab_filltree2.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
 
diff --git a/libdieharder/dab_filltree.c b/libdieharder/dab_filltree.c
index 9cc5ce7..a377c3d 100644
--- a/libdieharder/dab_filltree.c
+++ b/libdieharder/dab_filltree.c
@@ -34,7 +34,7 @@ static double targetData[] = {
 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
 };
 
-inline int insert(double x, double *array, unsigned int startVal);
+static inline int insert(double x, double *array, unsigned int startVal);
 
 int dab_filltree(Test **test,int irun) {
  int size = (ntuple == 0) ? 32 : ntuple;
@@ -105,7 +105,7 @@ int dab_filltree(Test **test,int irun) {
 }
 
 
-inline int insert(double x, double *array, unsigned int startVal) {
+static inline int insert(double x, double *array, unsigned int startVal) {
  uint d = (startVal + 1) / 2;
  uint i = startVal;
  while (d > 0) {
diff --git a/libdieharder/dab_filltree2.c b/libdieharder/dab_filltree2.c
index 1e33af2..59cbd52 100644
--- a/libdieharder/dab_filltree2.c
+++ b/libdieharder/dab_filltree2.c
@@ -92,7 +92,7 @@ static double targetData[128] = {  // size=128, generated from 6e9 samples
 0.00000000000e+00,0.00000000000e+00,0.00000000000e+00,0.00000000000e+00,
 };
 
-inline int insertBit(uint x, uchar *array, uint *i, uint *d);
+static inline int insertBit(uint x, uchar *array, uint *i, uint *d);
 
 int dab_filltree2(Test **test, int irun) {
  int size = (ntuple == 0) ? 128 : ntuple;
@@ -181,7 +181,7 @@ int dab_filltree2(Test **test, int irun) {
  * The function returns >= 0 if the path went too deep; the
  * returned value is the last position of the path.
  */
-inline int insertBit(uint x, uchar *array, uint *i, uint *d) {
+static inline int insertBit(uint x, uchar *array, uint *i, uint *d) {
  if (x != 0) {
    *i += *d;
  } else {
-- 
2.13.2