From 44a5ca633e186c5836010366c515a4017836121b Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 29 Apr 2022 09:15:41 +0200 Subject: pkg/ast, pkg/compiler: support per-file metadata We have a bunch of hacks in syz-extract, syz-sysgen and syz-check with respect to description files unsupported on some arches, or that must not be part of make extract. Add 2 meta attribtues to files: meta noextract Tells `make extract` to not extract constants for this file. Though, `syz-extract` can still be invoked manually on this file. meta arches["arch1", "arch2"] Restricts this file only to the given set of architectures. `make extract` and ``make generate` will not use it on other architectures. Later we can potentially use meta attributes to specify git tree/commit that must be used for extraction. Maybe something else. Fixes #2754 --- pkg/compiler/testdata/all.txt | 3 +++ pkg/compiler/testdata/errors.txt | 5 +++++ 2 files changed, 8 insertions(+) (limited to 'pkg/compiler/testdata') diff --git a/pkg/compiler/testdata/all.txt b/pkg/compiler/testdata/all.txt index c9a02f592..d03e35def 100644 --- a/pkg/compiler/testdata/all.txt +++ b/pkg/compiler/testdata/all.txt @@ -1,6 +1,9 @@ # Copyright 2018 syzkaller project authors. All rights reserved. # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. +meta noextract +meta arches["32_shmem", "32_fork_shmem", "64", "64_fork"] + foo_0(a int8) foo_1(a int8[C1:C2]) foo_2(a ptr[out, array[int32]]) diff --git a/pkg/compiler/testdata/errors.txt b/pkg/compiler/testdata/errors.txt index 6d258cf50..1201fa361 100644 --- a/pkg/compiler/testdata/errors.txt +++ b/pkg/compiler/testdata/errors.txt @@ -3,6 +3,11 @@ # Errors that happen during type checking phase. +meta foobar ### unknown type foobar +meta noextract["foo"] ### wrong number of arguments for type noextract, expect no arguments +meta "foobar" ### unexpected string "foobar", expect type +meta arches["z80"] ### unknown arch z80 + #include "something" ### confusing comment faking a directive (rephrase if it's intentional) #define FOO BAR ### confusing comment faking a directive (rephrase if it's intentional) # include "something" ### confusing comment faking a directive (rephrase if it's intentional) -- cgit mrf-deployment