Skip to content

Extern/dolphin headers are not included in m2c context #1785

Description

@r-burns

Extern/dolphin headers are not included by our m2ctx script, so m2c is unaware of low-level structs and functions it should know. This gives suboptimal output for code that calls into dolphin functions.

It should be possible to fix m2ctx with something like this, but last time I tried this it caused failures in some of our CI jobs:

--- a/tools/m2ctx/m2ctx.py
+++ b/tools/m2ctx/m2ctx.py
@@ -10,6 +10,8 @@ from typing import List
 here = Path(__file__).parent
 root = (here / "../../").resolve()
 src = root / "src"
+extern_dolphin_include = root / "extern" / "dolphin" / "include"
+extern_dolphin = root / "extern" / "dolphin" / "include" / "dolphin"
 build = root / "build"
 header_path = build / "ctx.h"
 source_path = build / "ctx.c"
@@ -80,7 +82,8 @@ PCPP_FLAGS = [
 
 
 def write_header(path: Path):
-    files = sorted({f"#include <{file.relative_to(src)}>" for file in src.rglob("*.h")})
+    files = [f"#include <{file.relative_to(src)}>" for file in src.rglob("*.h")]
+    files += [f"#include <{file.relative_to(extern_dolphin_include)}>" for file in extern_dolphin.rglob("*.h")]
     path.write_text("\n".join(files), encoding="utf-8")
 
 

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions