Unverified Commit 846127fe authored by Ozan Tezcan's avatar Ozan Tezcan Committed by GitHub
Browse files

Add #include stddef.h to raft.h for size_t (#110)

parent 03e2f294
......@@ -10,6 +10,8 @@
#ifndef RAFT_H_
#define RAFT_H_
#include <stddef.h>
#include "raft_types.h"
typedef enum {
......
import argparse
import os
import subprocess
import cffi
def load(fname):
return '\n'.join(
[line for line in subprocess.check_output(
["gcc", "-E", fname]).decode('utf-8').split('\n')])
tmpfile = 'tests/raft_cffi_tmp.h'
# Strip C standard library headers as cffi cannot parse them
with open(fname, "r") as f:
lines = f.readlines()
with open(tmpfile, "w+") as f:
for line in lines:
if '#include <std' not in line:
f.write(line)
output = subprocess.check_output(["gcc", "-Iinclude/", "-E", tmpfile])
os.unlink(tmpfile)
return '\n'.join([line for line in output.decode('utf-8').split('\n')])
if __name__ == '__main__':
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--libdir', type=str, default='.')
parser.add_argument('--libname', type=str, default='raft')
......@@ -48,8 +59,7 @@ if __name__ == '__main__':
include_dirs=[args.includedir],
extra_compile_args=["-UNDEBUG"],
extra_link_args=["-L{}".format(args.libdir)]
)
)
ffibuilder.cdef('void *malloc(size_t __size);')
ffibuilder.cdef(load('include/raft.h'))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment