p4lang / p4c

P4_16 reference compiler
https://p4.org/
Apache License 2.0
680 stars 444 forks source link

"extern name;" (P4_16) should be invalid but is accepted by the reference compiler #3223

Open apinski-cavium opened 2 years ago

apinski-cavium commented 2 years ago

The parser has:

    | optAnnotations EXTERN name ";" {
            // forward declaration;
            driver.structure->pushContainerType(*$3, true);
            driver.structure->pop();
            $$ = nullptr; }

But there is no reference to having a forward declaration for extern types anywhere in the specifications. It looks like it was added to support for P4_14 extern (aa88d998c3) but then never documented. Is this supposed to be supported and documented or can this be removed?

mihaibudiu commented 2 years ago

Some proprietary backends may depend on this. Not easy to check. @jafingerhut @vgurevich @ChrisDodd may know if we can remove this.