From a138e528da024f6f731cac161cbc3081e5f37242 Mon Sep 17 00:00:00 2001 From: Michal Gorecki Date: Wed, 26 Jul 2023 17:54:33 +0200 Subject: [PATCH] compiler: Fix pkg.source_files compiler flags This fixes the issue: https://github.com/apache/mynewt-newt/issues/517 --- newt/toolchain/compiler.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/newt/toolchain/compiler.go b/newt/toolchain/compiler.go index 010839565..9354206d0 100644 --- a/newt/toolchain/compiler.go +++ b/newt/toolchain/compiler.go @@ -471,6 +471,15 @@ func (c *Compiler) includesStrings() []string { func (c *Compiler) cflagsStrings() []string { cflags := util.SortFields(c.info.Cflags...) + + for _, lclinfo_flag := range util.SortFields(c.lclInfo.Cflags...) { + for _, info_flag := range cflags { + if lclinfo_flag == info_flag { + continue + } + } + cflags = append(cflags, lclinfo_flag) + } return cflags }