-
Notifications
You must be signed in to change notification settings - Fork 4
Description
P4 doesn't really have a standard build system (to my knowledge), but to properly handle preprocessors like #include and conditionals + macros, a specific compiling context has to be assumed. Clangd (using C++ LSP tool as an example because many other languages don't have to deal with the complexities of complicated preprocessors) solves this problem by standardizing a compilation database (more context here), and integrating with common build systems to generate it automatically. I wonder if something similar is needed for p4analyzer?
Some p4c compiler options that are particularly relevant are the following (similar to C/C++):
-Dcan be used to define a macro to be used by the preprocessor.-Ican be used to add directory to include search path.
These could change how a P4 code should be interpreted. For example, when doing "jump to definition", the definition might be in a #if branch pending on a macro supplied from -D.