aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/compiler/consts_test.go
Commit message (Collapse)AuthorAgeFilesLines
* pkg/compiler: support if[expr] attributesAleksandr Nogikh2024-02-191-1/+1
| | | | | | | | | | | | | | | | | | | The expression may either include integers/consts or reference other fields in the structure via value[field1:field2:field3]. The fields on this path must all belong to structures and must not have any if conditions themselves. For unions, mandate that the last field has no conditions (it will be the default one). For structs, convert conditional fields into fields of a union type of the following form: anonymous_union [ value T (if[expression]) void void ]
* sys: refactor const extractionAleksandr Nogikh2023-10-041-2/+6
| | | | | 1) Make FabricateSyscallConsts() operate on ConstFile. 2) Expose Pos inside ConstInfo.
* all: ioutil is deprecated in go1.19 (#3718)Taras Madan2023-02-231-2/+2
|
* sys/targets: add OS/Arch name constsDmitry Vyukov2020-10-261-2/+2
| | | | | | | | | | | | We use strings to identify OS/Arch. These strings are duplicated throughout the code base massively. golangci-lint points to possiblity of typos and duplication. We already had to define these names in pkg/csource and disable checking for prog package. A future change triggers such warnings in another package. Add OS/Arch name consts to sys/targets so that they can be used to refer to OS/Arch. Use the consts everywhere.
* pkg/compiler: add tests for generation phaseDmitry Vyukov2020-03-171-2/+2
| | | | | | Add errors3.txt with tests for errors that are produced during generation phase. Refactor tests to reduce duplication. Tidy struct/union size errors: better locations and make testable.
* prog, pkg/compiler: alignment for integer rangesPaul Chaignon2019-10-251-1/+2
| | | | | | | | | Enables the syntax intN[start:end, alignment] for integer ranges. For instance, int32[0:10, 2] represents even 32-bit numbers between 0 and 10 included. With this change, two NEED tags in syscall descriptions can be addressed. Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
* pkg/compiler: check for unused declarationsDmitry Vyukov2018-06-301-1/+1
| | | | | Error on unused structs/unions/resources/flags. Finds tons of bugs.
* pkg/compiler: add size attribute for structsDmitry Vyukov2018-03-051-0/+1
| | | | The size attribute allows to pad a struct up to the specified size.
* pkg/compiler: support type templatesDmitry Vyukov2018-01-131-6/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Netlink descriptions contain tons of code duplication, and need much more for proper descriptions. Introduce type templates to simplify writing such descriptions and remove code duplication. Note: type templates are experimental, have poor error handling and are subject to change. Type templates can be declared as follows: ``` type buffer[DIR] ptr[DIR, array[int8]] type fileoff[BASE] BASE type nlattr[TYPE, PAYLOAD] { nla_len len[parent, int16] nla_type const[TYPE, int16] payload PAYLOAD } [align_4] ``` and later used as follows: ``` syscall(a buffer[in], b fileoff[int64], c ptr[in, nlattr[FOO, int32]]) ```
* sys/syz-extract: support fuchsiaDmitry Vyukov2017-09-251-2/+5
|
* pkg/compiler: more static error checkingDmitry Vyukov2017-08-271-0/+61
Update #217