opensourcerouting / c-capnproto

C library/compiler for the Cap'n Proto serialization/RPC protocol
MIT License
118 stars 40 forks source link

only generate '#include' for imports that are used #53

Closed cbrune closed 1 year ago

cbrune commented 2 years ago

This patch modifies the code generator to only generate C-language #include <imported_schema.h> lines for imports that are actually used.

Imagine this transitive import scenario: schema A imports a definition from schema B. However, the definition imported from schema B was itself imported from schema C.

In this case, the code generated for schema A need not include the header file for schema B, as it only needs definitions from schema C.