diff --git a/nimterop/toastlib/ast2.nim b/nimterop/toastlib/ast2.nim index 5769893..dc4d220 100644 --- a/nimterop/toastlib/ast2.nim +++ b/nimterop/toastlib/ast2.nim @@ -1703,8 +1703,9 @@ proc addDef(gState: State, node: TSNode) = let start = getStartAtom(node) commentNodes = gState.getCommentNodes(node) + fdecl = node[start+1].firstChildInTree("function_declarator") - if node[start+1].getName() == "function_declarator": + if not fdecl.isNil: if not gState.noHeader: gState.addProc(node[start+1], node[start], commentNodes) else: diff --git a/nimterop/toastlib/getters.nim b/nimterop/toastlib/getters.nim index 3a71c78..08ba604 100644 --- a/nimterop/toastlib/getters.nim +++ b/nimterop/toastlib/getters.nim @@ -307,7 +307,7 @@ proc getPreprocessor*(gState: State, fullpath: string) = # Remove gcc special calls # https://github.com/tree-sitter/tree-sitter-c/issues/43 - args.add @["-D__attribute__(x)=", "-D__restrict=", "-D__extension__=", "-D__inline__=inline", + args.add @["-D__attribute__(x)=", "-D__restrict=", "-D__restrict__=", "-D__extension__=", "-D__inline__=inline", "-D__inline=inline", "-D_Noreturn=", &"{fullpath.sanitizePath}"] # Include content only from file