p4lang-p4c-nightly:hanw/struct-in-header

Last commit made on 2018-12-05
Get this branch:
git clone -b hanw/struct-in-header https://git.launchpad.net/p4lang-p4c-nightly

Branch merges

Branch information

Name:
hanw/struct-in-header
Repository:
lp:p4lang-p4c-nightly

Recent commits

220220e... by Han Wang <email address hidden>

allow struct in header

68dea2b... by Jed Liu <email address hidden>

Added support for free-form annotations (#1614)

This adds support for free-form annotations, wherein annotation bodies may be any sequence of tokens containing balanced parentheses. At the same time, this introduces annotation checking, to ensure predefined annotations are used correctly. Backwards compatibility with P4₁₄-style pragmas is also added as an experimental feature.

On the initial parsing pass, annotation bodies are parsed as a sequence of tokens in a new field, `Annotation::body`. After the initial parse, `Annotation::expr` and `Annotation::kv` are empty. P4₁₄-style pragmas are translated by the parser into P4₁₆ annotations: `@pragma name body` is translated into `@name(body)`.

Early in the front end, a rewriting pass parses the bodies of spec-defined annotations, converting them into an expression list (which populates `Annotation::expr`) or a key-value list (`Annotation::kv`). This has the new side-effect of rejecting annotations with mismatched bodies. For instance, having an expression list where a key-value list is expected, or having a no-argument annotation with a non-empty body.

As of v1.0.0-draft of the spec, annotations are as follows:
  * `@optional` with an empty body (§18.2.1)
  * `@tableonly` with an empty body (§18.2.2)
  * `@defaultonly` with an empty body (§18.2.2)
  * `@name` with a string literal (§18.2.3)
  * `@hidden` with an empty body (§18.2.3)
  * `@atomic` with an empty body (§18.2.4)
  * `@pkginfo` with a key-value list (§18.3)

The front end also supports some annotations used by the tests, but not mentioned in the spec:
  * `@length` takes an expression, and
  * `@deprecated` takes a string literal; this is a candidate language feature: p4lang/p4-spec#655.

Unrecognized annotations are left untouched. For any target-specific annotations, back ends may do a similar rewriting pass as needed. For instance, the BMv2 back end additionally supports the following annotations:

  * `@metadata` has no body,
  * `@alias` takes a string literal,
  * `@priority` takes an integer constant.

The P4 Runtime serializer uses a `@controller_header` annotation that takes a string literal and an `@id` annotation that takes an integer constant. The GTest uses `@diagnostic` (takes an expression list) and `@my_anno` (takes a string literal).

027098c... by Antonin Bas <email address hidden>

Update P4Runtime version to v1.0.0-rc4 and support action ref scope

bf2c697... by Chris Dodd <email address hidden>

Fix non-unified build

975c15b... by Mihai Budiu <email address hidden>

Support lookahead in ebpf backend (#1602)

355499a... by Jed Liu <email address hidden>

Fixed a typo (#1612)

ab1ebc5... by Antonin Bas <email address hidden>

Small refactor of ArchHandlerIface in P4Runtime serializer

New symbols cannot be added to the symbol table in the postCollect pass
because the table has already been created by then and cannot really be
mutated. A new virtual method (collectExtra) is added to let
architectures add symbols while the table can still be mutated.

d26ae14... by Mihai Budiu <email address hidden>

Fix for issue #1607 (#1611)

22a5a13... by Mihai Budiu <email address hidden>

Fix for issue #562 (#1605)

* Fix for issue #562

d21be88... by Chris Dodd <email address hidden>

Logging fixes/improvements

- fix indentation control and locking for multithreaded (if its turned
  on -- off by default)
- support for per file output control to different log files.