github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/syz-sysgen/check.go (about) 1 // Copyright 2023 syzkaller project authors. All rights reserved. 2 // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. 3 4 package main 5 6 import ( 7 "fmt" 8 9 "github.com/google/syzkaller/pkg/ast" 10 "github.com/google/syzkaller/pkg/compiler" 11 ) 12 13 // constsAreAllDefined() ensures that for every const there's at least one arch that defines it. 14 func constsAreAllDefined(consts *compiler.ConstFile, constInfo map[string]*compiler.ConstInfo, 15 eh ast.ErrorHandler) { 16 // We cannot perform this check inside pkg/compiler because it's 17 // given a const slice for only one architecture. 18 for _, info := range constInfo { 19 for _, def := range info.Consts { 20 if consts.ExistsAny(def.Name) { 21 continue 22 } 23 eh(def.Pos, fmt.Sprintf("%s is defined for none of the arches", def.Name)) 24 } 25 } 26 }