You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2019/12/18 00:04:46 UTC
[mynewt-newt] 04/05: Print warnings on YCfg parse error
This is an automated email from the ASF dual-hosted git repository.
ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git
commit 8dcb858a52371e7f9592c2bdf2f565df64bb648e
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Thu Nov 7 11:43:59 2019 -0800
Print warnings on YCfg parse error
See <https://github.com/apache/mynewt-newt/pull/350> for more
information.
---
newt/builder/buildpackage.go | 26 +++++++++++++++++--------
newt/cli/target_cmds.go | 12 ++++++++----
newt/cli/vars.go | 3 ++-
newt/downloader/downloader.go | 3 ++-
newt/logcfg/logcfg.go | 3 ++-
newt/manifest/manifest.go | 3 ++-
newt/mfg/decode.go | 12 ++++++++----
newt/pkg/bsp_package.go | 22 +++++++++++++++-------
newt/pkg/localpackage.go | 44 ++++++++++++++++++++++++++++++-------------
newt/project/project.go | 12 ++++++++----
newt/repo/repo.go | 6 ++++--
newt/repo/version.go | 3 ++-
newt/syscfg/syscfg.go | 9 ++++++---
newt/target/target.go | 24 ++++++++++++++++-------
newt/toolchain/compiler.go | 43 ++++++++++++++++++++++++++++++------------
15 files changed, 156 insertions(+), 69 deletions(-)
diff --git a/newt/builder/buildpackage.go b/newt/builder/buildpackage.go
index 8e93c75..750c1d7 100644
--- a/newt/builder/buildpackage.go
+++ b/newt/builder/buildpackage.go
@@ -124,7 +124,8 @@ func expandFlags(flags []string) {
func (bpkg *BuildPackage) BuildProfile(b *Builder) string {
settings := b.cfg.AllSettingsForLpkg(bpkg.rpkg.Lpkg)
- profile, _ := bpkg.rpkg.Lpkg.PkgY.GetValString("pkg.build_profile", settings)
+ profile, err := bpkg.rpkg.Lpkg.PkgY.GetValString("pkg.build_profile", settings)
+ util.OneTimeWarningError(err)
return profile
}
@@ -141,18 +142,24 @@ func (bpkg *BuildPackage) CompilerInfo(
ci := toolchain.NewCompilerInfo()
settings := b.cfg.AllSettingsForLpkg(bpkg.rpkg.Lpkg)
+ var err error
+
// Read each set of flags and expand repo designators ("@<repo-name>") into
// paths.
- ci.Cflags, _ = bpkg.rpkg.Lpkg.PkgY.GetValStringSlice("pkg.cflags", settings)
+ ci.Cflags, err = bpkg.rpkg.Lpkg.PkgY.GetValStringSlice("pkg.cflags", settings)
+ util.OneTimeWarningError(err)
expandFlags(ci.Cflags)
- ci.CXXflags, _ = bpkg.rpkg.Lpkg.PkgY.GetValStringSlice("pkg.cxxflags", settings)
+ ci.CXXflags, err = bpkg.rpkg.Lpkg.PkgY.GetValStringSlice("pkg.cxxflags", settings)
+ util.OneTimeWarningError(err)
expandFlags(ci.CXXflags)
- ci.Lflags, _ = bpkg.rpkg.Lpkg.PkgY.GetValStringSlice("pkg.lflags", settings)
+ ci.Lflags, err = bpkg.rpkg.Lpkg.PkgY.GetValStringSlice("pkg.lflags", settings)
+ util.OneTimeWarningError(err)
expandFlags(ci.Lflags)
- ci.Aflags, _ = bpkg.rpkg.Lpkg.PkgY.GetValStringSlice("pkg.aflags", settings)
+ ci.Aflags, err = bpkg.rpkg.Lpkg.PkgY.GetValStringSlice("pkg.aflags", settings)
+ util.OneTimeWarningError(err)
expandFlags(ci.Aflags)
// Package-specific injected settings get specified as C flags on the
@@ -163,8 +170,9 @@ func (bpkg *BuildPackage) CompilerInfo(
ci.IgnoreFiles = []*regexp.Regexp{}
- ignPats, _ := bpkg.rpkg.Lpkg.PkgY.GetValStringSlice(
+ ignPats, err := bpkg.rpkg.Lpkg.PkgY.GetValStringSlice(
"pkg.ign_files", settings)
+ util.OneTimeWarningError(err)
for _, str := range ignPats {
re, err := regexp.Compile(str)
@@ -177,8 +185,9 @@ func (bpkg *BuildPackage) CompilerInfo(
ci.IgnoreDirs = []*regexp.Regexp{}
- ignPats, _ = bpkg.rpkg.Lpkg.PkgY.GetValStringSlice(
+ ignPats, err = bpkg.rpkg.Lpkg.PkgY.GetValStringSlice(
"pkg.ign_dirs", settings)
+ util.OneTimeWarningError(err)
for _, str := range ignPats {
re, err := regexp.Compile(str)
@@ -189,8 +198,9 @@ func (bpkg *BuildPackage) CompilerInfo(
ci.IgnoreDirs = append(ci.IgnoreDirs, re)
}
- bpkg.SourceDirectories, _ = bpkg.rpkg.Lpkg.PkgY.GetValStringSlice(
+ bpkg.SourceDirectories, err = bpkg.rpkg.Lpkg.PkgY.GetValStringSlice(
"pkg.src_dirs", settings)
+ util.OneTimeWarningError(err)
includePaths, err := bpkg.recursiveIncludePaths(b)
if err != nil {
diff --git a/newt/cli/target_cmds.go b/newt/cli/target_cmds.go
index 11f3000..acafd01 100644
--- a/newt/cli/target_cmds.go
+++ b/newt/cli/target_cmds.go
@@ -79,7 +79,8 @@ func targetContainsUserFiles(t *target.Target) (bool, error) {
}
func pkgVarSliceString(pack *pkg.LocalPackage, key string) string {
- vals, _ := pack.PkgY.GetValStringSlice(key, nil)
+ vals, err := pack.PkgY.GetValStringSlice(key, nil)
+ util.OneTimeWarningError(err)
sort.Strings(vals)
var buffer bytes.Buffer
@@ -93,7 +94,8 @@ func pkgVarSliceString(pack *pkg.LocalPackage, key string) string {
//Process amend command for syscfg target variable
func amendSysCfg(value string, t *target.Target) error {
// Get the current syscfg.vals name-value pairs
- sysVals, _ := t.Package().SyscfgY.GetValStringMapString("syscfg.vals", nil)
+ sysVals, err := t.Package().SyscfgY.GetValStringMapString("syscfg.vals", nil)
+ util.OneTimeWarningError(err)
// Convert the input syscfg into name-value pairs
amendSysVals, err := syscfg.KeyValueFromStr(value)
@@ -127,7 +129,8 @@ func amendSysCfg(value string, t *target.Target) error {
func amendBuildFlags(kv []string, t *target.Target) error {
pkgVar := "pkg." + kv[0]
- curFlags, _ := t.Package().PkgY.GetValStringSlice(pkgVar, nil)
+ curFlags, err := t.Package().PkgY.GetValStringSlice(pkgVar, nil)
+ util.OneTimeWarningError(err)
amendFlags := strings.Fields(kv[1])
@@ -220,8 +223,9 @@ func targetShowCmd(cmd *cobra.Command, args []string) {
}
// A few variables come from the base package rather than the target.
- scfg, _ := target.Package().SyscfgY.GetValStringMapString(
+ scfg, err := target.Package().SyscfgY.GetValStringMapString(
"syscfg.vals", nil)
+ util.OneTimeWarningError(err)
kvPairs["syscfg"] = syscfg.KeyValueToStr(scfg)
kvPairs["cflags"] = pkgVarSliceString(target.Package(), "pkg.cflags")
diff --git a/newt/cli/vars.go b/newt/cli/vars.go
index 79098ce..252e994 100644
--- a/newt/cli/vars.go
+++ b/newt/cli/vars.go
@@ -58,8 +58,9 @@ func settingValues(settingName string) ([]string, error) {
packs := project.GetProject().PackagesOfType(-1)
for _, pack := range packs {
- settings, _ :=
+ settings, err :=
pack.(*pkg.LocalPackage).PkgY.GetValStringSlice(settingName, nil)
+ util.OneTimeWarningError(err)
for _, setting := range settings {
settingMap[setting] = struct{}{}
diff --git a/newt/downloader/downloader.go b/newt/downloader/downloader.go
index 375ba3e..6f4a7bd 100644
--- a/newt/downloader/downloader.go
+++ b/newt/downloader/downloader.go
@@ -1055,7 +1055,8 @@ func LoadDownloader(repoName string, repoVars map[string]string) (
// Alternatively, the user can put security material in
// $HOME/.newt/repos.yml.
newtrc := settings.Newtrc()
- privRepo, _ := newtrc.GetValStringMapString("repository."+repoName, nil)
+ privRepo, err := newtrc.GetValStringMapString("repository."+repoName, nil)
+ util.OneTimeWarningError(err)
if privRepo != nil {
if gd.Login == "" {
gd.Login = privRepo["login"]
diff --git a/newt/logcfg/logcfg.go b/newt/logcfg/logcfg.go
index 1516732..a650a1d 100644
--- a/newt/logcfg/logcfg.go
+++ b/newt/logcfg/logcfg.go
@@ -157,7 +157,8 @@ func parseOneLog(name string, lpkg *pkg.LocalPackage, logMapItf interface{},
// are read from the `syscfg.logs` map in the package's `syscfg.yml` file.
func (lcfg *LCfg) readOnePkg(lpkg *pkg.LocalPackage, cfg *syscfg.Cfg) {
lsettings := cfg.AllSettingsForLpkg(lpkg)
- logMaps, _ := lpkg.SyscfgY.GetValStringMap("syscfg.logs", lsettings)
+ logMaps, err := lpkg.SyscfgY.GetValStringMap("syscfg.logs", lsettings)
+ util.OneTimeWarningError(err)
for name, logMapItf := range logMaps {
cl, err := parseOneLog(name, lpkg, logMapItf, cfg)
diff --git a/newt/manifest/manifest.go b/newt/manifest/manifest.go
index d0311fc..adb1299 100644
--- a/newt/manifest/manifest.go
+++ b/newt/manifest/manifest.go
@@ -303,8 +303,9 @@ func CreateManifest(opts ManifestCreateOpts) (manifest.Manifest, error) {
for _, k := range keys {
m.TgtVars = append(m.TgtVars, k+"="+vars[k])
}
- syscfgKV, _ := t.GetTarget().Package().SyscfgY.GetValStringMapString(
+ syscfgKV, err := t.GetTarget().Package().SyscfgY.GetValStringMapString(
"syscfg.vals", nil)
+ util.OneTimeWarningError(err)
if len(syscfgKV) > 0 {
tgtSyscfg := fmt.Sprintf("target.syscfg=%s",
diff --git a/newt/mfg/decode.go b/newt/mfg/decode.go
index 9e33fa2..bcbb94d 100644
--- a/newt/mfg/decode.go
+++ b/newt/mfg/decode.go
@@ -326,7 +326,8 @@ func decodeMeta(
func decodeMfg(yc ycfg.YCfg) (DecodedMfg, error) {
dm := DecodedMfg{}
- yamlTargets, _ := yc.GetValSlice("mfg.targets", nil)
+ yamlTargets, err := yc.GetValSlice("mfg.targets", nil)
+ util.OneTimeWarningError(err)
if yamlTargets != nil {
for _, yamlTarget := range yamlTargets {
@@ -339,14 +340,16 @@ func decodeMfg(yc ycfg.YCfg) (DecodedMfg, error) {
}
}
- dm.Bsp, _ = yc.GetValString("mfg.bsp", nil)
+ dm.Bsp, err = yc.GetValString("mfg.bsp", nil)
+ util.OneTimeWarningError(err)
if len(dm.Targets) == 0 && dm.Bsp == "" {
return dm, util.FmtNewtError(
"\"mfg.bsp\" field required for mfg images without any targets")
}
- itf, _ := yc.GetValSlice("mfg.raw", nil)
+ itf, err := yc.GetValSlice("mfg.raw", nil)
+ util.OneTimeWarningError(err)
slice := cast.ToSlice(itf)
if slice != nil {
@@ -360,7 +363,8 @@ func decodeMfg(yc ycfg.YCfg) (DecodedMfg, error) {
}
}
- yamlMeta, _ := yc.GetValStringMap("mfg.meta", nil)
+ yamlMeta, err := yc.GetValStringMap("mfg.meta", nil)
+ util.OneTimeWarningError(err)
if yamlMeta != nil {
meta, err := decodeMeta(yamlMeta)
diff --git a/newt/pkg/bsp_package.go b/newt/pkg/bsp_package.go
index bb06346..55dd902 100644
--- a/newt/pkg/bsp_package.go
+++ b/newt/pkg/bsp_package.go
@@ -57,7 +57,8 @@ func (bsp *BspPackage) resolvePathSetting(
proj := interfaces.GetProject()
- val, _ := bsp.BspV.GetValString(key, settings)
+ val, err := bsp.BspV.GetValString(key, settings)
+ util.OneTimeWarningError(err)
if val == "" {
return "", nil
}
@@ -78,7 +79,8 @@ func (bsp *BspPackage) resolveLinkerScriptSetting(
paths := []string{}
// Assume config file specifies a list of scripts.
- vals, _ := bsp.BspV.GetValStringSlice(key, settings)
+ vals, err := bsp.BspV.GetValStringSlice(key, settings)
+ util.OneTimeWarningError(err)
if vals == nil {
// Couldn't read a list of scripts; try to interpret setting as a
// single script.
@@ -125,12 +127,17 @@ func (bsp *BspPackage) Reload(settings map[string]string) error {
}
bsp.AddCfgFilename(bsp.BspYamlPath())
- bsp.CompilerName, _ = bsp.BspV.GetValString("bsp.compiler", settings)
- bsp.Arch, _ = bsp.BspV.GetValString("bsp.arch", settings)
+ bsp.CompilerName, err = bsp.BspV.GetValString("bsp.compiler", settings)
+ util.OneTimeWarningError(err)
- bsp.ImageOffset, _ = bsp.BspV.GetValInt("bsp.image_offset", settings)
+ bsp.Arch, err = bsp.BspV.GetValString("bsp.arch", settings)
+ util.OneTimeWarningError(err)
- bsp.ImagePad, _ = bsp.BspV.GetValInt("bsp.image_pad", settings)
+ bsp.ImageOffset, err = bsp.BspV.GetValInt("bsp.image_offset", settings)
+ util.OneTimeWarningError(err)
+
+ bsp.ImagePad, err = bsp.BspV.GetValInt("bsp.image_pad", settings)
+ util.OneTimeWarningError(err)
bsp.LinkerScripts, err = bsp.resolveLinkerScriptSetting(
settings, "bsp.linkerscript")
@@ -167,7 +174,8 @@ func (bsp *BspPackage) Reload(settings map[string]string) error {
"(bsp.arch)")
}
- ymlFlashMap, _ := bsp.BspV.GetValStringMap("bsp.flash_map", settings)
+ ymlFlashMap, err := bsp.BspV.GetValStringMap("bsp.flash_map", settings)
+ util.OneTimeWarningError(err)
if ymlFlashMap == nil {
return util.NewNewtError("BSP does not specify a flash map " +
"(bsp.flash_map)")
diff --git a/newt/pkg/localpackage.go b/newt/pkg/localpackage.go
index 034c310..47a52a4 100644
--- a/newt/pkg/localpackage.go
+++ b/newt/pkg/localpackage.go
@@ -200,10 +200,19 @@ func (pkg *LocalPackage) AddCfgFilename(cfgFilename string) {
func (pkg *LocalPackage) readDesc(yc ycfg.YCfg) (*PackageDesc, error) {
pdesc := &PackageDesc{}
- pdesc.Author, _ = yc.GetValString("pkg.author", nil)
- pdesc.Homepage, _ = yc.GetValString("pkg.homepage", nil)
- pdesc.Description, _ = yc.GetValString("pkg.description", nil)
- pdesc.Keywords, _ = yc.GetValStringSlice("pkg.keywords", nil)
+ var err error
+
+ pdesc.Author, err = yc.GetValString("pkg.author", nil)
+ util.OneTimeWarningError(err)
+
+ pdesc.Homepage, err = yc.GetValString("pkg.homepage", nil)
+ util.OneTimeWarningError(err)
+
+ pdesc.Description, err = yc.GetValString("pkg.description", nil)
+ util.OneTimeWarningError(err)
+
+ pdesc.Keywords, err = yc.GetValStringSlice("pkg.keywords", nil)
+ util.OneTimeWarningError(err)
return pdesc, nil
}
@@ -211,7 +220,8 @@ func (pkg *LocalPackage) readDesc(yc ycfg.YCfg) (*PackageDesc, error) {
func (pkg *LocalPackage) sequenceString(key string) string {
var buffer bytes.Buffer
- vals, _ := pkg.PkgY.GetValStringSlice(key, nil)
+ vals, err := pkg.PkgY.GetValStringSlice(key, nil)
+ util.OneTimeWarningError(err)
for _, f := range vals {
buffer.WriteString(" - " + yaml.EscapeString(f) + "\n")
}
@@ -300,7 +310,8 @@ func (pkg *LocalPackage) Load() error {
pkg.AddCfgFilename(pkg.PkgYamlPath())
// Set package name from the package
- pkg.name, _ = pkg.PkgY.GetValString("pkg.name", nil)
+ pkg.name, err = pkg.PkgY.GetValString("pkg.name", nil)
+ util.OneTimeWarningError(err)
if pkg.name == "" {
return util.FmtNewtError(
"Package \"%s\" missing \"pkg.name\" field in its `pkg.yml` file",
@@ -313,7 +324,8 @@ func (pkg *LocalPackage) Load() error {
"`pkg.yml` file (pkg.name=%s)", pkg.basePath, pkg.name)
}
- typeString, _ := pkg.PkgY.GetValString("pkg.type", nil)
+ typeString, err := pkg.PkgY.GetValString("pkg.type", nil)
+ util.OneTimeWarningError(err)
pkg.packageType = PACKAGE_TYPE_LIB
if len(typeString) > 0 {
found := false
@@ -333,7 +345,8 @@ func (pkg *LocalPackage) Load() error {
}
if pkg.packageType == PACKAGE_TYPE_TRANSIENT {
- n, _ := pkg.PkgY.GetValString("pkg.link", nil)
+ n, err := pkg.PkgY.GetValString("pkg.link", nil)
+ util.OneTimeWarningError(err)
if len(n) == 0 {
return util.FmtNewtError(
"Transient package \"%s\" does not specify target "+
@@ -367,7 +380,8 @@ func (pkg *LocalPackage) Load() error {
func (pkg *LocalPackage) InitFuncs(
settings map[string]string) map[string]string {
- vals, _ := pkg.PkgY.GetValStringMapString("pkg.init", settings)
+ vals, err := pkg.PkgY.GetValStringMapString("pkg.init", settings)
+ util.OneTimeWarningError(err)
return vals
}
@@ -376,28 +390,32 @@ func (pkg *LocalPackage) InitFuncs(
func (pkg *LocalPackage) DownFuncs(
settings map[string]string) map[string]string {
- vals, _ := pkg.PkgY.GetValStringMapString("pkg.down", settings)
+ vals, err := pkg.PkgY.GetValStringMapString("pkg.down", settings)
+ util.OneTimeWarningError(err)
return vals
}
func (pkg *LocalPackage) PreBuildCmds(
settings map[string]string) map[string]string {
- vals, _ := pkg.PkgY.GetValStringMapString("pkg.pre_build_cmds", settings)
+ vals, err := pkg.PkgY.GetValStringMapString("pkg.pre_build_cmds", settings)
+ util.OneTimeWarningError(err)
return vals
}
func (pkg *LocalPackage) PreLinkCmds(
settings map[string]string) map[string]string {
- vals, _ := pkg.PkgY.GetValStringMapString("pkg.pre_link_cmds", settings)
+ vals, err := pkg.PkgY.GetValStringMapString("pkg.pre_link_cmds", settings)
+ util.OneTimeWarningError(err)
return vals
}
func (pkg *LocalPackage) PostLinkCmds(
settings map[string]string) map[string]string {
- vals, _ := pkg.PkgY.GetValStringMapString("pkg.post_link_cmds", settings)
+ vals, err := pkg.PkgY.GetValStringMapString("pkg.post_link_cmds", settings)
+ util.OneTimeWarningError(err)
return vals
}
diff --git a/newt/project/project.go b/newt/project/project.go
index 93d5a41..bd5925c 100644
--- a/newt/project/project.go
+++ b/newt/project/project.go
@@ -346,8 +346,9 @@ func (proj *Project) loadRepo(name string, fields map[string]string) (
}
func (proj *Project) checkNewtVer() error {
- compatSms, _ := proj.yc.GetValStringMapString(
+ compatSms, err := proj.yc.GetValStringMapString(
"project.newt_compatibility", nil)
+ util.OneTimeWarningError(err)
// If this project doesn't have a newt compatibility map, just assume there
// is no incompatibility.
@@ -517,7 +518,8 @@ func (proj *Project) loadConfig() error {
// we need to process it later.
proj.yc = yc
- proj.name, _ = yc.GetValString("project.name", nil)
+ proj.name, err = yc.GetValString("project.name", nil)
+ util.OneTimeWarningError(err)
// Local repository always included in initialization
r, err := repo.NewLocalRepo(proj.name)
@@ -536,7 +538,8 @@ func (proj *Project) loadConfig() error {
for k, _ := range yc.AllSettings() {
repoName := strings.TrimPrefix(k, "repository.")
if repoName != k {
- fields, _ := yc.GetValStringMapString(k, nil)
+ fields, err := yc.GetValStringMapString(k, nil)
+ util.OneTimeWarningError(err)
r, err := proj.loadRepo(repoName, fields)
if err != nil {
@@ -573,7 +576,8 @@ func (proj *Project) loadConfig() error {
return err
}
- ignoreDirs, _ := yc.GetValStringSlice("project.ignore_dirs", nil)
+ ignoreDirs, err := yc.GetValStringSlice("project.ignore_dirs", nil)
+ util.OneTimeWarningError(err)
for _, ignDir := range ignoreDirs {
repoName, dirName, err := newtutil.ParsePackageString(ignDir)
if err != nil {
diff --git a/newt/repo/repo.go b/newt/repo/repo.go
index 96a9d2b..4f13a7c 100644
--- a/newt/repo/repo.go
+++ b/newt/repo/repo.go
@@ -450,7 +450,8 @@ func parseRepoDepMap(depName string,
}
func (r *Repo) readDepRepos(yc ycfg.YCfg) error {
- depMap, _ := yc.GetValStringMap("repo.deps", nil)
+ depMap, err := yc.GetValStringMap("repo.deps", nil)
+ util.OneTimeWarningError(err)
for depName, repoMapYml := range depMap {
rdm, err := parseRepoDepMap(depName, repoMapYml)
@@ -478,7 +479,8 @@ func (r *Repo) Read() error {
return err
}
- versMap, _ := yc.GetValStringMapString("repo.versions", nil)
+ versMap, err := yc.GetValStringMapString("repo.versions", nil)
+ util.OneTimeWarningError(err)
for versStr, commit := range versMap {
log.Debugf("Printing version %s for remote repo %s", versStr, r.name)
diff --git a/newt/repo/version.go b/newt/repo/version.go
index 09660a4..e5a935c 100644
--- a/newt/repo/version.go
+++ b/newt/repo/version.go
@@ -315,7 +315,8 @@ func parseVersionYml(path string) (newtutil.RepoVersion, error) {
}
}
- verString, _ := yc.GetValString("repo.version", nil)
+ verString, err := yc.GetValString("repo.version", nil)
+ util.OneTimeWarningError(err)
if verString == "" {
return newtutil.RepoVersion{}, versionYmlBad
diff --git a/newt/syscfg/syscfg.go b/newt/syscfg/syscfg.go
index 4af4591..a8847ce 100644
--- a/newt/syscfg/syscfg.go
+++ b/newt/syscfg/syscfg.go
@@ -538,7 +538,8 @@ func (cfg *Cfg) readDefsOnce(lpkg *pkg.LocalPackage,
lsettings := cfg.settingsForLpkg(lpkg, settings)
- defs, _ := yc.GetValStringMap("syscfg.defs", lsettings)
+ defs, err := yc.GetValStringMap("syscfg.defs", lsettings)
+ util.OneTimeWarningError(err)
if defs != nil {
for k, v := range defs {
@@ -603,7 +604,8 @@ func (cfg *Cfg) readRestrictions(lpkg *pkg.LocalPackage,
yc := lpkg.SyscfgY
lsettings := cfg.settingsForLpkg(lpkg, settings)
- restrictionStrings, _ := yc.GetValStringSlice("syscfg.restrictions", lsettings)
+ restrictionStrings, err := yc.GetValStringSlice("syscfg.restrictions", lsettings)
+ util.OneTimeWarningError(err)
for _, rstring := range restrictionStrings {
r, err := readRestriction("", rstring)
@@ -623,7 +625,8 @@ func (cfg *Cfg) readValsOnce(lpkg *pkg.LocalPackage,
lsettings := cfg.settingsForLpkg(lpkg, settings)
- values, _ := yc.GetValStringMap("syscfg.vals", lsettings)
+ values, err := yc.GetValStringMap("syscfg.vals", lsettings)
+ util.OneTimeWarningError(err)
for k, v := range values {
switch v.(type) {
diff --git a/newt/target/target.go b/newt/target/target.go
index e2bf2e0..fae730a 100644
--- a/newt/target/target.go
+++ b/newt/target/target.go
@@ -88,18 +88,26 @@ func (target *Target) Load(basePkg *pkg.LocalPackage) error {
target.TargetY = yc
- target.BspName, _ = yc.GetValString("target.bsp", nil)
- target.AppName, _ = yc.GetValString("target.app", nil)
- target.LoaderName, _ = yc.GetValString("target.loader", nil)
+ target.BspName, err = yc.GetValString("target.bsp", nil)
+ util.OneTimeWarningError(err)
+
+ target.AppName, err = yc.GetValString("target.app", nil)
+ util.OneTimeWarningError(err)
+
+ target.LoaderName, err = yc.GetValString("target.loader", nil)
+ util.OneTimeWarningError(err)
+
+ target.BuildProfile, err = yc.GetValString("target.build_profile", nil)
+ util.OneTimeWarningError(err)
- target.BuildProfile, _ = yc.GetValString("target.build_profile", nil)
if target.BuildProfile == "" {
target.BuildProfile = DEFAULT_BUILD_PROFILE
}
target.HeaderSize = DEFAULT_HEADER_SIZE
- hsStr, _ := yc.GetValString("target.header_size", nil)
+ hsStr, err := yc.GetValString("target.header_size", nil)
+ util.OneTimeWarningError(err)
if hsStr != "" {
hs, err := strconv.ParseUint(hsStr, 0, 32)
if err == nil {
@@ -107,7 +115,8 @@ func (target *Target) Load(basePkg *pkg.LocalPackage) error {
}
}
- target.KeyFile, _ = yc.GetValString("target.key_file", nil)
+ target.KeyFile, err = yc.GetValString("target.key_file", nil)
+ util.OneTimeWarningError(err)
if target.KeyFile != "" {
proj := interfaces.GetProject()
@@ -117,8 +126,9 @@ func (target *Target) Load(basePkg *pkg.LocalPackage) error {
}
}
- target.PkgProfiles, _ = yc.GetValStringMapString(
+ target.PkgProfiles, err = yc.GetValStringMapString(
"target.package_profiles", nil)
+ util.OneTimeWarningError(err)
// Note: App not required in the case of unit tests.
diff --git a/newt/toolchain/compiler.go b/newt/toolchain/compiler.go
index 3c644f4..a1851e5 100644
--- a/newt/toolchain/compiler.go
+++ b/newt/toolchain/compiler.go
@@ -277,11 +277,13 @@ func NewCompiler(compilerDir string, dstDir string,
func loadFlags(yc ycfg.YCfg, settings map[string]string, key string) []string {
flags := []string{}
- rawFlags, _ := yc.GetValStringSlice(key, settings)
+ rawFlags, err := yc.GetValStringSlice(key, settings)
+ util.OneTimeWarningError(err)
for _, rawFlag := range rawFlags {
if strings.HasPrefix(rawFlag, key) {
- expandedFlags, _ := yc.GetValStringSlice(rawFlag, settings)
+ expandedFlags, err := yc.GetValStringSlice(rawFlag, settings)
+ util.OneTimeWarningError(err)
flags = append(flags, expandedFlags...)
} else {
@@ -303,24 +305,41 @@ func (c *Compiler) load(compilerDir string, buildProfile string) error {
strings.ToUpper(runtime.GOOS): "1",
}
- c.ccPath, _ = yc.GetValString("compiler.path.cc", settings)
- c.cppPath, _ = yc.GetValString("compiler.path.cpp", settings)
- c.asPath, _ = yc.GetValString("compiler.path.as", settings)
- c.arPath, _ = yc.GetValString("compiler.path.archive", settings)
- c.odPath, _ = yc.GetValString("compiler.path.objdump", settings)
- c.osPath, _ = yc.GetValString("compiler.path.objsize", settings)
- c.ocPath, _ = yc.GetValString("compiler.path.objcopy", settings)
+ c.ccPath, err = yc.GetValString("compiler.path.cc", settings)
+ util.OneTimeWarningError(err)
+
+ c.cppPath, err = yc.GetValString("compiler.path.cpp", settings)
+ util.OneTimeWarningError(err)
+
+ c.asPath, err = yc.GetValString("compiler.path.as", settings)
+ util.OneTimeWarningError(err)
+
+ c.arPath, err = yc.GetValString("compiler.path.archive", settings)
+ util.OneTimeWarningError(err)
+
+ c.odPath, err = yc.GetValString("compiler.path.objdump", settings)
+ util.OneTimeWarningError(err)
+
+ c.osPath, err = yc.GetValString("compiler.path.objsize", settings)
+ util.OneTimeWarningError(err)
+
+ c.ocPath, err = yc.GetValString("compiler.path.objcopy", settings)
+ util.OneTimeWarningError(err)
c.lclInfo.Cflags = loadFlags(yc, settings, "compiler.flags")
c.lclInfo.CXXflags = loadFlags(yc, settings, "compiler.cxx.flags")
c.lclInfo.Lflags = loadFlags(yc, settings, "compiler.ld.flags")
c.lclInfo.Aflags = loadFlags(yc, settings, "compiler.as.flags")
- c.ldResolveCircularDeps, _ = yc.GetValBool(
+ c.ldResolveCircularDeps, err = yc.GetValBool(
"compiler.ld.resolve_circular_deps", settings)
+ util.OneTimeWarningError(err)
+
+ c.ldMapFile, err = yc.GetValBool("compiler.ld.mapfile", settings)
+ util.OneTimeWarningError(err)
- c.ldMapFile, _ = yc.GetValBool("compiler.ld.mapfile", settings)
- c.ldBinFile, _ = yc.GetValBoolDflt("compiler.ld.binfile", settings, true)
+ c.ldBinFile, err = yc.GetValBoolDflt("compiler.ld.binfile", settings, true)
+ util.OneTimeWarningError(err)
if len(c.lclInfo.Cflags) == 0 {
// Assume no Cflags implies an unsupported build profile.