Skip to content

Commit

Permalink
change(build): add -Werror=return-type to default C and C++ flags (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
igrr authored Aug 22, 2024
1 parent 4098c53 commit 00b3941
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
8 changes: 6 additions & 2 deletions platform.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,14 @@ compiler.warning_flags.default=
compiler.warning_flags.more=-Wall
compiler.warning_flags.all=-Wall -Wextra

# Additional flags specific to Arduino (not based on IDF flags).
# Update tools/platformio-build.py when changing these flags.
compiler.common_werror_flags=-Werror=return-type

# Compile Flags
compiler.cpreprocessor.flags="@{compiler.sdk.path}/flags/defines" "-I{build.source.path}" -iprefix "{compiler.sdk.path}/include/" "@{compiler.sdk.path}/flags/includes" "-I{compiler.sdk.path}/{build.memory_type}/include"
compiler.c.flags="@{compiler.sdk.path}/flags/c_flags" {compiler.warning_flags} {compiler.optimization_flags}
compiler.cpp.flags="@{compiler.sdk.path}/flags/cpp_flags" {compiler.warning_flags} {compiler.optimization_flags}
compiler.c.flags="@{compiler.sdk.path}/flags/c_flags" {compiler.warning_flags} {compiler.optimization_flags} {compiler.common_werror_flags}
compiler.cpp.flags="@{compiler.sdk.path}/flags/cpp_flags" {compiler.warning_flags} {compiler.optimization_flags} {compiler.common_werror_flags}
compiler.S.flags="@{compiler.sdk.path}/flags/S_flags" {compiler.warning_flags} {compiler.optimization_flags}
compiler.c.elf.flags="@{compiler.sdk.path}/flags/ld_flags" "@{compiler.sdk.path}/flags/ld_scripts"
compiler.c.elf.libs="@{compiler.sdk.path}/flags/ld_libs"
Expand Down
9 changes: 9 additions & 0 deletions tools/platformio-build.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,15 @@ def add_tinyuf2_extra_image():
)
)

#
# Additional flags specific to Arduino core (not based on IDF)
#

env.Append(
CFLAGS=["-Werror=return-type"],
CXXFLAGS=["-Werror=return-type"],
)

#
# Target: Build Core Library
#
Expand Down

0 comments on commit 00b3941

Please sign in to comment.