p4lang / p4-hlir

Apache License 2.0
32 stars 40 forks source link

cpp: do not use system-specific defines or headers #35

Closed liujed closed 3 years ago

liujed commented 6 years ago

This prevents inadvertent rewrites of tokens such as "linux" due to the system having an implicit #define linux 1.

liujed commented 6 years ago

I agree that just -undef is sufficient. I included -nostdinc at @vgurevich's suggestion, but I don't think it's really necessary.

liujed commented 6 years ago

Oh, I should also mention that p4c's call to cpp also includes -nostdinc: https://github.com/p4lang/p4c/blob/80f8970b5ec8e57c4a3611da343461b5b0a8dda3/frontends/common/options.cpp#L292. I think the two really ought to be consistent.