Skip to content

Commit

Permalink
Treat build-time warnings as errors (#72)
Browse files Browse the repository at this point in the history
* Extend project configuration and defines, using `get` is a bug

* Error out on missing `remove_components`

* Enable all compiler warnings

* Include OpenThread logging header in multipan `app.c`

* Update src/ot-rcp/app.c
  • Loading branch information
puddly authored Jun 21, 2024
1 parent f8c797f commit 50c3d29
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
#include "em_cmu.h"
#include "em_wdog.h"
#include "em_rmu.h"
#include "sli_cpc_timer.h"
#include "sl_component_catalog.h"

void nc_enable_watchdog(void);
void nc_periodic_timer(sli_cpc_timer_handle_t *handle, void *data);
void nc_poke_watchdog(void);
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void nc_enable_watchdog(void)
}


void nc_poke_watchdog()
void nc_poke_watchdog(void)
{
CORE_DECLARE_IRQ_STATE;
CORE_ENTER_ATOMIC();
Expand Down
1 change: 1 addition & 0 deletions src/rcp-uart-802154/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <openthread/ncp.h>
#include <openthread/diag.h>
#include <openthread/tasklet.h>
#include <openthread/logging.h>

#include "openthread-system.h"
#include "app.h"
Expand Down
25 changes: 22 additions & 3 deletions tools/build_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,18 @@ def main():
LOGGER.warning(
"Component %s is not present in manifest, cannot remove", component
)
sys.exit(1)

# Extend configuration and C defines
for input_config, output_config in [
(manifest.get("configuration", {}), output_project.get("configuration", [])),
(manifest.get("slcp_defines", {}), output_project.get("define", [])),
(
manifest.get("configuration", {}),
output_project.setdefault("configuration", []),
),
(
manifest.get("slcp_defines", {}),
output_project.setdefault("define", []),
),
]:
for name, value in input_config.items():
# Values are always strings
Expand Down Expand Up @@ -542,6 +549,18 @@ def main():
LOGGER.error("Defines were unused, aborting: %s", unused_defines)
sys.exit(1)

# Fix Gecko SDK bugs
sl_rail_util_pti_config_h = args.build_dir / "config/sl_rail_util_pti_config.h"

# PTI seemingly cannot be excluded, even if it is disabled
if sl_rail_util_pti_config_h.exists():
sl_rail_util_pti_config_h.write_text(
sl_rail_util_pti_config_h.read_text().replace(
'#warning "RAIL PTI peripheral not configured"\n',
'// #warning "RAIL PTI peripheral not configured"\n',
)
)

# Remove absolute paths from the build for reproducibility
extra_compiler_flags = [
f"-ffile-prefix-map={str(src.absolute())}={dst}"
Expand All @@ -550,7 +569,7 @@ def main():
args.build_dir: "/src",
toolchain: "/toolchain",
}.items()
]
] + ["-Wall", "-Wextra", "-Werror"]

output_artifact = (args.build_dir / "build/debug" / base_project_name).with_suffix(
".gbl"
Expand Down

0 comments on commit 50c3d29

Please sign in to comment.