This is an automated email from the ASF dual-hosted git repository.

sjanc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new a40ddf1cf compiler: Add COMPILER_WERROR setting
a40ddf1cf is described below

commit a40ddf1cf03c458c20aa08c183886630b8b5a3f2
Author: Szymon Janc <[email protected]>
AuthorDate: Thu Oct 15 00:00:33 2026 +0200

    compiler: Add COMPILER_WERROR setting
    
    All compiler packages force -Werror, so new compiler warnings (e.g.
    from a newer toolchain or external code) break the build with no way
    to opt out from target configuration.
    
    Add COMPILER_WERROR syscfg setting (enabled by default) to each
    compiler that uses -Werror and make the flag conditional on it.
    Setting it to 0 in target syscfg keeps -Wall warnings but no longer
    fails the build.
    
    arm-none-eabi-m0 now defines compiler.flags.base like other
    compilers; resulting flags are unchanged.
    
    This requires newt with syscfg support in compiler.yml conditionals.
    Older newt versions ignore the condition and build without -Werror.
    
    Assisted-by: Claude:claude-opus-5-5
---
 compiler/arm-none-eabi-m0/compiler.yml                         | 10 ++++++----
 compiler/{arm-none-eabi-m33 => arm-none-eabi-m0}/syscfg.yml    | 10 ++++++----
 compiler/arm-none-eabi-m3/compiler.yml                         |  3 ++-
 compiler/arm-none-eabi-m3/syscfg.yml                           |  6 ++++++
 compiler/arm-none-eabi-m33/compiler.yml                        |  3 ++-
 compiler/arm-none-eabi-m33/syscfg.yml                          |  5 +++++
 compiler/arm-none-eabi-m4/compiler.yml                         |  3 ++-
 compiler/arm-none-eabi-m4/syscfg.yml                           |  5 +++++
 compiler/arm-none-eabi-m7/compiler.yml                         |  3 ++-
 compiler/arm-none-eabi-m7/syscfg.yml                           |  5 +++++
 compiler/riscv-none-embed/compiler.yml                         |  3 ++-
 compiler/{arm-none-eabi-m33 => riscv-none-embed}/syscfg.yml    | 10 ++++++----
 compiler/riscv64-unknown-elf-sifive/compiler.yml               |  3 ++-
 .../syscfg.yml                                                 | 10 ++++++----
 compiler/sim-armv7/compiler.yml                                |  3 ++-
 compiler/{arm-none-eabi-m33 => sim-armv7}/syscfg.yml           | 10 ++++++----
 compiler/sim/compiler.yml                                      |  3 ++-
 compiler/{arm-none-eabi-m33 => sim}/syscfg.yml                 | 10 ++++++----
 18 files changed, 73 insertions(+), 32 deletions(-)

diff --git a/compiler/arm-none-eabi-m0/compiler.yml 
b/compiler/arm-none-eabi-m0/compiler.yml
index 7583b3dc1..12704b6e1 100644
--- a/compiler/arm-none-eabi-m0/compiler.yml
+++ b/compiler/arm-none-eabi-m0/compiler.yml
@@ -25,10 +25,12 @@ compiler.path.objdump: arm-none-eabi-objdump
 compiler.path.objsize: arm-none-eabi-size
 compiler.path.objcopy: arm-none-eabi-objcopy
 
-compiler.flags.default: [-march=armv6s-m, -mcpu=cortex-m0, -mthumb-interwork, 
-mthumb, -Wall, -Werror, -fno-exceptions, -fomit-frame-pointer, 
-ffunction-sections, -fdata-sections, -DCMSIS_VECTAB_VIRTUAL, 
-DCMSIS_VECTAB_VIRTUAL_HEADER_FILE="mynewt_cm0_vectab.h", -fno-common]
-compiler.flags.optimized: [compiler.flags.default, -Os, -ggdb]
-compiler.flags.speed: [compiler.flags.default, -O3, -ggdb]
-compiler.flags.debug: [compiler.flags.default, -Og, -ggdb]
+compiler.flags.base: [-march=armv6s-m, -mcpu=cortex-m0, -mthumb-interwork, 
-mthumb, -Wall, -fno-exceptions, -fomit-frame-pointer, -ffunction-sections, 
-fdata-sections, -DCMSIS_VECTAB_VIRTUAL, 
-DCMSIS_VECTAB_VIRTUAL_HEADER_FILE="mynewt_cm0_vectab.h", -fno-common]
+compiler.flags.base.COMPILER_WERROR: [-Werror]
+compiler.flags.default: [compiler.flags.base]
+compiler.flags.optimized: [compiler.flags.base, -Os, -ggdb]
+compiler.flags.speed: [compiler.flags.base, -O3, -ggdb]
+compiler.flags.debug: [compiler.flags.base, -Og, -ggdb]
 
 compiler.as.flags: [-x, assembler-with-cpp]
 
diff --git a/compiler/arm-none-eabi-m33/syscfg.yml 
b/compiler/arm-none-eabi-m0/syscfg.yml
similarity index 77%
copy from compiler/arm-none-eabi-m33/syscfg.yml
copy to compiler/arm-none-eabi-m0/syscfg.yml
index eb7893617..1bfc44c5a 100644
--- a/compiler/arm-none-eabi-m33/syscfg.yml
+++ b/compiler/arm-none-eabi-m0/syscfg.yml
@@ -17,9 +17,11 @@
 # under the License.
 #
 
-# Package: compiler/arm-none-eabi-m33
+# Package: compiler/arm-none-eabi-m0
 
 syscfg.defs:
-   HARDFLOAT:
-       description: 'Use hardware FPU'
-       value: 1
+    COMPILER_WERROR:
+        description: >
+            Treat compiler warnings as errors (-Werror). Set to 0 to have
+            warnings reported without failing the build.
+        value: 1
diff --git a/compiler/arm-none-eabi-m3/compiler.yml 
b/compiler/arm-none-eabi-m3/compiler.yml
index 466fa13e3..b75bd9b87 100644
--- a/compiler/arm-none-eabi-m3/compiler.yml
+++ b/compiler/arm-none-eabi-m3/compiler.yml
@@ -25,7 +25,8 @@ compiler.path.objdump: arm-none-eabi-objdump
 compiler.path.objsize: arm-none-eabi-size
 compiler.path.objcopy: arm-none-eabi-objcopy
 
-compiler.flags.base: [-mcpu=cortex-m3, -mthumb-interwork, -mthumb, -Wall, 
-Werror, -fno-exceptions, -ffunction-sections, -fdata-sections, -fno-common]
+compiler.flags.base: [-mcpu=cortex-m3, -mthumb-interwork, -mthumb, -Wall, 
-fno-exceptions, -ffunction-sections, -fdata-sections, -fno-common]
+compiler.flags.base.COMPILER_WERROR: [-Werror]
 compiler.flags.default: [compiler.flags.base, -O1, -ggdb]
 compiler.flags.optimized: [compiler.flags.base, -Os, -ggdb]
 compiler.flags.speed: [compiler.flags.base, -O3, -ggdb]
diff --git a/compiler/arm-none-eabi-m3/syscfg.yml 
b/compiler/arm-none-eabi-m3/syscfg.yml
index eae4e3b61..e6fd1b9f8 100644
--- a/compiler/arm-none-eabi-m3/syscfg.yml
+++ b/compiler/arm-none-eabi-m3/syscfg.yml
@@ -17,3 +17,9 @@
 # under the License.
 #
 
+syscfg.defs:
+    COMPILER_WERROR:
+        description: >
+            Treat compiler warnings as errors (-Werror). Set to 0 to have
+            warnings reported without failing the build.
+        value: 1
diff --git a/compiler/arm-none-eabi-m33/compiler.yml 
b/compiler/arm-none-eabi-m33/compiler.yml
index 4fd085fc8..55156f997 100644
--- a/compiler/arm-none-eabi-m33/compiler.yml
+++ b/compiler/arm-none-eabi-m33/compiler.yml
@@ -25,7 +25,8 @@ compiler.path.objdump: arm-none-eabi-objdump
 compiler.path.objsize: arm-none-eabi-size
 compiler.path.objcopy: arm-none-eabi-objcopy
 
-compiler.flags.base: -mcpu=cortex-m33+nodsp -mthumb-interwork -mthumb -Wall 
-Werror -fno-exceptions -ffunction-sections -fdata-sections -fno-common
+compiler.flags.base: -mcpu=cortex-m33+nodsp -mthumb-interwork -mthumb -Wall 
-fno-exceptions -ffunction-sections -fdata-sections -fno-common
+compiler.flags.base.COMPILER_WERROR: [-Werror]
 compiler.flags.default: [compiler.flags.base, -O1, -ggdb]
 compiler.flags.optimized: [compiler.flags.base, -Os, -ggdb]
 compiler.flags.speed: [compiler.flags.base, -O3, -ggdb]
diff --git a/compiler/arm-none-eabi-m33/syscfg.yml 
b/compiler/arm-none-eabi-m33/syscfg.yml
index eb7893617..6e7e52d37 100644
--- a/compiler/arm-none-eabi-m33/syscfg.yml
+++ b/compiler/arm-none-eabi-m33/syscfg.yml
@@ -23,3 +23,8 @@ syscfg.defs:
    HARDFLOAT:
        description: 'Use hardware FPU'
        value: 1
+   COMPILER_WERROR:
+       description: >
+           Treat compiler warnings as errors (-Werror). Set to 0 to have
+           warnings reported without failing the build.
+       value: 1
diff --git a/compiler/arm-none-eabi-m4/compiler.yml 
b/compiler/arm-none-eabi-m4/compiler.yml
index dd4d08230..45ce57e6d 100644
--- a/compiler/arm-none-eabi-m4/compiler.yml
+++ b/compiler/arm-none-eabi-m4/compiler.yml
@@ -25,7 +25,8 @@ compiler.path.objdump: arm-none-eabi-objdump
 compiler.path.objsize: arm-none-eabi-size
 compiler.path.objcopy: arm-none-eabi-objcopy
 
-compiler.flags.base: [-mcpu=cortex-m4, -mthumb-interwork, -mthumb, -Wall, 
-Werror, -fno-exceptions, -ffunction-sections, -fdata-sections, -fno-common]
+compiler.flags.base: [-mcpu=cortex-m4, -mthumb-interwork, -mthumb, -Wall, 
-fno-exceptions, -ffunction-sections, -fdata-sections, -fno-common]
+compiler.flags.base.COMPILER_WERROR: [-Werror]
 compiler.flags.default: [compiler.flags.base, -O1, -ggdb]
 compiler.flags.optimized: [compiler.flags.base, -Os, -ggdb]
 compiler.flags.speed: [compiler.flags.base, -O3, -ggdb]
diff --git a/compiler/arm-none-eabi-m4/syscfg.yml 
b/compiler/arm-none-eabi-m4/syscfg.yml
index 2a941ac02..4a12553b2 100644
--- a/compiler/arm-none-eabi-m4/syscfg.yml
+++ b/compiler/arm-none-eabi-m4/syscfg.yml
@@ -21,3 +21,8 @@ syscfg.defs:
    HARDFLOAT:
        description: 'Use hardware FPU'
        value: 0
+   COMPILER_WERROR:
+       description: >
+           Treat compiler warnings as errors (-Werror). Set to 0 to have
+           warnings reported without failing the build.
+       value: 1
diff --git a/compiler/arm-none-eabi-m7/compiler.yml 
b/compiler/arm-none-eabi-m7/compiler.yml
index a0d40b848..c25bb8afe 100644
--- a/compiler/arm-none-eabi-m7/compiler.yml
+++ b/compiler/arm-none-eabi-m7/compiler.yml
@@ -25,7 +25,8 @@ compiler.path.objdump: arm-none-eabi-objdump
 compiler.path.objsize: arm-none-eabi-size
 compiler.path.objcopy: arm-none-eabi-objcopy
 
-compiler.flags.base: [-mcpu=cortex-m7, -mthumb-interwork, -mthumb, -Wall, 
-Werror, -fno-exceptions, -ffunction-sections, -fdata-sections, -fno-common]
+compiler.flags.base: [-mcpu=cortex-m7, -mthumb-interwork, -mthumb, -Wall, 
-fno-exceptions, -ffunction-sections, -fdata-sections, -fno-common]
+compiler.flags.base.COMPILER_WERROR: [-Werror]
 compiler.flags.default: [compiler.flags.base, -O1, -ggdb]
 compiler.flags.optimized: [compiler.flags.base, -Os, -ggdb]
 compiler.flags.speed: [compiler.flags.base, -O3, -ggdb]
diff --git a/compiler/arm-none-eabi-m7/syscfg.yml 
b/compiler/arm-none-eabi-m7/syscfg.yml
index 2a941ac02..4a12553b2 100644
--- a/compiler/arm-none-eabi-m7/syscfg.yml
+++ b/compiler/arm-none-eabi-m7/syscfg.yml
@@ -21,3 +21,8 @@ syscfg.defs:
    HARDFLOAT:
        description: 'Use hardware FPU'
        value: 0
+   COMPILER_WERROR:
+       description: >
+           Treat compiler warnings as errors (-Werror). Set to 0 to have
+           warnings reported without failing the build.
+       value: 1
diff --git a/compiler/riscv-none-embed/compiler.yml 
b/compiler/riscv-none-embed/compiler.yml
index 962e0be90..c558d59ac 100644
--- a/compiler/riscv-none-embed/compiler.yml
+++ b/compiler/riscv-none-embed/compiler.yml
@@ -25,7 +25,8 @@ compiler.path.objdump: "riscv-none-embed-objdump"
 compiler.path.objsize: "riscv-none-embed-size"
 compiler.path.objcopy: "riscv-none-embed-objcopy"
 
-compiler.flags.base: [-Wall, -Werror, -Wno-format-truncation, 
-ffunction-sections, -fdata-sections, -fno-builtin-printf, -fno-common]
+compiler.flags.base: [-Wall, -Wno-format-truncation, -ffunction-sections, 
-fdata-sections, -fno-builtin-printf, -fno-common]
+compiler.flags.base.COMPILER_WERROR: [-Werror]
 compiler.flags.default: [compiler.flags.base, -O1, -ggdb]
 compiler.flags.optimized: [compiler.flags.base, -Os, -ggdb]
 compiler.flags.speed: [compiler.flags.base, -Ofast, -ggdb]
diff --git a/compiler/arm-none-eabi-m33/syscfg.yml 
b/compiler/riscv-none-embed/syscfg.yml
similarity index 77%
copy from compiler/arm-none-eabi-m33/syscfg.yml
copy to compiler/riscv-none-embed/syscfg.yml
index eb7893617..96cc69173 100644
--- a/compiler/arm-none-eabi-m33/syscfg.yml
+++ b/compiler/riscv-none-embed/syscfg.yml
@@ -17,9 +17,11 @@
 # under the License.
 #
 
-# Package: compiler/arm-none-eabi-m33
+# Package: compiler/riscv-none-embed
 
 syscfg.defs:
-   HARDFLOAT:
-       description: 'Use hardware FPU'
-       value: 1
+    COMPILER_WERROR:
+        description: >
+            Treat compiler warnings as errors (-Werror). Set to 0 to have
+            warnings reported without failing the build.
+        value: 1
diff --git a/compiler/riscv64-unknown-elf-sifive/compiler.yml 
b/compiler/riscv64-unknown-elf-sifive/compiler.yml
index c52629acf..595f6a9e7 100644
--- a/compiler/riscv64-unknown-elf-sifive/compiler.yml
+++ b/compiler/riscv64-unknown-elf-sifive/compiler.yml
@@ -25,7 +25,8 @@ compiler.path.objdump: "riscv64-unknown-elf-objdump"
 compiler.path.objsize: "riscv64-unknown-elf-size"
 compiler.path.objcopy: "riscv64-unknown-elf-objcopy"
 
-compiler.flags.base: [-Wall, -Werror, -Wno-format-truncation, 
-ffunction-sections, -fdata-sections, -fno-builtin-printf, -fno-common]
+compiler.flags.base: [-Wall, -Wno-format-truncation, -ffunction-sections, 
-fdata-sections, -fno-builtin-printf, -fno-common]
+compiler.flags.base.COMPILER_WERROR: [-Werror]
 compiler.flags.default: [compiler.flags.base, -O1, -ggdb]
 compiler.flags.optimized: [compiler.flags.base, -Os, -ggdb]
 compiler.flags.speed: [compiler.flags.base, -Ofast, -ggdb]
diff --git a/compiler/arm-none-eabi-m33/syscfg.yml 
b/compiler/riscv64-unknown-elf-sifive/syscfg.yml
similarity index 77%
copy from compiler/arm-none-eabi-m33/syscfg.yml
copy to compiler/riscv64-unknown-elf-sifive/syscfg.yml
index eb7893617..644a8f9da 100644
--- a/compiler/arm-none-eabi-m33/syscfg.yml
+++ b/compiler/riscv64-unknown-elf-sifive/syscfg.yml
@@ -17,9 +17,11 @@
 # under the License.
 #
 
-# Package: compiler/arm-none-eabi-m33
+# Package: compiler/riscv64-unknown-elf-sifive
 
 syscfg.defs:
-   HARDFLOAT:
-       description: 'Use hardware FPU'
-       value: 1
+    COMPILER_WERROR:
+        description: >
+            Treat compiler warnings as errors (-Werror). Set to 0 to have
+            warnings reported without failing the build.
+        value: 1
diff --git a/compiler/sim-armv7/compiler.yml b/compiler/sim-armv7/compiler.yml
index c37eea665..d0f75ca41 100644
--- a/compiler/sim-armv7/compiler.yml
+++ b/compiler/sim-armv7/compiler.yml
@@ -26,7 +26,8 @@ compiler.path.objdump: "objdump"
 compiler.path.objsize: "size"
 compiler.path.objcopy: "objcopy"
 compiler.flags.base: >
-    -Wall -Werror -ggdb -DARCH_sim
+    -Wall -ggdb -DARCH_sim
+compiler.flags.base.COMPILER_WERROR: [-Werror]
 compiler.ld.resolve_circular_deps: true
 
 compiler.flags.default: [compiler.flags.base, -O1, -fno-common]
diff --git a/compiler/arm-none-eabi-m33/syscfg.yml 
b/compiler/sim-armv7/syscfg.yml
similarity index 78%
copy from compiler/arm-none-eabi-m33/syscfg.yml
copy to compiler/sim-armv7/syscfg.yml
index eb7893617..06c6bfb51 100644
--- a/compiler/arm-none-eabi-m33/syscfg.yml
+++ b/compiler/sim-armv7/syscfg.yml
@@ -17,9 +17,11 @@
 # under the License.
 #
 
-# Package: compiler/arm-none-eabi-m33
+# Package: compiler/sim-armv7
 
 syscfg.defs:
-   HARDFLOAT:
-       description: 'Use hardware FPU'
-       value: 1
+    COMPILER_WERROR:
+        description: >
+            Treat compiler warnings as errors (-Werror). Set to 0 to have
+            warnings reported without failing the build.
+        value: 1
diff --git a/compiler/sim/compiler.yml b/compiler/sim/compiler.yml
index 4b52b6b15..dbebc2c80 100644
--- a/compiler/sim/compiler.yml
+++ b/compiler/sim/compiler.yml
@@ -25,7 +25,8 @@ compiler.path.archive: "ar"
 compiler.path.objdump: "objdump"
 compiler.path.objsize: "size"
 compiler.path.objcopy: "objcopy"
-compiler.flags.base: [-Wall, -Werror, -ggdb, -ffunction-sections, 
-fdata-sections, -fno-common]
+compiler.flags.base: [-Wall, -ggdb, -ffunction-sections, -fdata-sections, 
-fno-common]
+compiler.flags.base.COMPILER_WERROR: [-Werror]
 compiler.ld.resolve_circular_deps: true
 
 compiler.flags.default: [compiler.flags.base, -O1]
diff --git a/compiler/arm-none-eabi-m33/syscfg.yml b/compiler/sim/syscfg.yml
similarity index 78%
copy from compiler/arm-none-eabi-m33/syscfg.yml
copy to compiler/sim/syscfg.yml
index eb7893617..f15fff0fe 100644
--- a/compiler/arm-none-eabi-m33/syscfg.yml
+++ b/compiler/sim/syscfg.yml
@@ -17,9 +17,11 @@
 # under the License.
 #
 
-# Package: compiler/arm-none-eabi-m33
+# Package: compiler/sim
 
 syscfg.defs:
-   HARDFLOAT:
-       description: 'Use hardware FPU'
-       value: 1
+    COMPILER_WERROR:
+        description: >
+            Treat compiler warnings as errors (-Werror). Set to 0 to have
+            warnings reported without failing the build.
+        value: 1

Reply via email to