diff --git a/panda/python/core/create_panda_datatypes.py b/panda/python/core/create_panda_datatypes.py index 5d7f1b1e501..92725213997 100755 --- a/panda/python/core/create_panda_datatypes.py +++ b/panda/python/core/create_panda_datatypes.py @@ -96,6 +96,9 @@ def copy_ppp_header(filename): subcontents = trim_pypanda(contents) for line in subcontents.split("\n"): # now add void ppp_add_cb_{cb_name}({cb_name}_t); + forbidden = ["#if", "#endif", "#define "] + if any(i in line for i in forbidden): + continue m = reg.match(line) if m: ret_type = m.groups(1)[0] @@ -203,6 +206,8 @@ def define_clean_header(ffi, fname): r = open(fname).read() for line in r.split("\n"): assert("extern \"C\" {" not in line), "Externs unsupported by CFFI. Change {} to a single line without braces".format(r) + forbidden = ["#if", "#endif"] + r = "\n".join([l for l in r.split("\n") if any(f in l for f in forbidden)]) r = r.replace("extern \"C\" ", "") # This allows inline externs like 'extern "C" void foo(...)' reg = ppp_cb_typedef_regex() @@ -229,6 +234,7 @@ def expand_ppp_def(line): ffi.cdef("typedef int target_pid_t;") ffi.cdef("typedef uint"+str(bits)+"_t target_ulong;") + ffi.cdef("typedef uint"+str(bits)+"_t target_ptr_t;") ffi.cdef("typedef int"+str(bits)+"_t target_long;") # PPP Headers