Skip to content

Commit 380ec2a

Browse files
hedgerskotopes
andauthored
Added -Wundef to compiler options (#3815)
* fbt: added -Wundef to compiler options; libs: various small fixes for missing defines; desktop: proper access to current RTOS config * apps: fixes for FURI_DEBUG handling * rpc: unified definition checks * Cleanup various defines use * Cleanup configs and move SVCall ISR priority configuration to furi_hal_interrupts Co-authored-by: Aleksandr Kutuzov <[email protected]>
1 parent afc4e29 commit 380ec2a

File tree

14 files changed

+36
-29
lines changed

14 files changed

+36
-29
lines changed

applications/services/cli/cli_commands.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ void cli_command_sysctl_heap_track(Cli* cli, FuriString* args, void* context) {
260260
} else if(!furi_string_cmp(args, "main")) {
261261
furi_hal_rtc_set_heap_track_mode(FuriHalRtcHeapTrackModeMain);
262262
printf("Heap tracking enabled for application main thread");
263-
#if FURI_DEBUG
263+
#ifdef FURI_DEBUG
264264
} else if(!furi_string_cmp(args, "tree")) {
265265
furi_hal_rtc_set_heap_track_mode(FuriHalRtcHeapTrackModeTree);
266266
printf("Heap tracking enabled for application main and child threads");
@@ -279,7 +279,7 @@ void cli_command_sysctl_print_usage(void) {
279279
printf("Cmd list:\r\n");
280280

281281
printf("\tdebug <0|1>\t - Enable or disable system debug\r\n");
282-
#if FURI_DEBUG
282+
#ifdef FURI_DEBUG
283283
printf("\theap_track <none|main|tree|all>\t - Set heap allocation tracking mode\r\n");
284284
#else
285285
printf("\theap_track <none|main>\t - Set heap allocation tracking mode\r\n");

applications/services/desktop/views/desktop_view_locked.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
#include <projdefs.h>
2-
#include <stdint.h>
31
#include <furi.h>
2+
43
#include <gui/elements.h>
54
#include <gui/icon.h>
65
#include <gui/view.h>
6+
77
#include <assets_icons.h>
88

9-
#include <desktop/desktop_settings.h>
109
#include "../desktop_i.h"
1110
#include "desktop_view_locked.h"
1211

applications/services/desktop/views/desktop_view_pin_timeout.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
21
#include <furi.h>
3-
#include <stdint.h>
4-
#include <stdio.h>
5-
#include <projdefs.h>
6-
#include <input/input.h>
2+
73
#include <gui/canvas.h>
84
#include <gui/view.h>
95

applications/services/rpc/rpc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ bool rpc_pb_stream_read(pb_istream_t* istream, pb_byte_t* buf, size_t count) {
228228
}
229229
}
230230

231-
#if SRV_RPC_DEBUG
231+
#ifdef SRV_RPC_DEBUG
232232
rpc_debug_print_data("INPUT", buf, bytes_received);
233233
#endif
234234

@@ -268,7 +268,7 @@ static int32_t rpc_session_worker(void* context) {
268268
bool message_decode_failed = false;
269269

270270
if(pb_decode_ex(&istream, &PB_Main_msg, session->decoded_message, PB_DECODE_DELIMITED)) {
271-
#if SRV_RPC_DEBUG
271+
#ifdef SRV_RPC_DEBUG
272272
FURI_LOG_I(TAG, "INPUT:");
273273
rpc_debug_print_message(session->decoded_message);
274274
#endif
@@ -452,7 +452,7 @@ void rpc_send(RpcSession* session, PB_Main* message) {
452452

453453
pb_ostream_t ostream = PB_OSTREAM_SIZING;
454454

455-
#if SRV_RPC_DEBUG
455+
#ifdef SRV_RPC_DEBUG
456456
FURI_LOG_I(TAG, "OUTPUT:");
457457
rpc_debug_print_message(message);
458458
#endif
@@ -465,7 +465,7 @@ void rpc_send(RpcSession* session, PB_Main* message) {
465465

466466
pb_encode_ex(&ostream, &PB_Main_msg, message, PB_ENCODE_DELIMITED);
467467

468-
#if SRV_RPC_DEBUG
468+
#ifdef SRV_RPC_DEBUG
469469
rpc_debug_print_data("OUTPUT", buffer, ostream.bytes_written);
470470
#endif
471471

applications/settings/system/system_settings.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static void debug_changed(VariableItem* item) {
9292
const char* const heap_trace_mode_text[] = {
9393
"None",
9494
"Main",
95-
#if FURI_DEBUG
95+
#ifdef FURI_DEBUG
9696
"Tree",
9797
"All",
9898
#endif
@@ -101,7 +101,7 @@ const char* const heap_trace_mode_text[] = {
101101
const uint32_t heap_trace_mode_value[] = {
102102
FuriHalRtcHeapTrackModeNone,
103103
FuriHalRtcHeapTrackModeMain,
104-
#if FURI_DEBUG
104+
#ifdef FURI_DEBUG
105105
FuriHalRtcHeapTrackModeTree,
106106
FuriHalRtcHeapTrackModeAll,
107107
#endif

furi/furi.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,6 @@ void furi_run(void) {
1515
furi_check(!furi_kernel_is_irq_or_masked());
1616
furi_check(xTaskGetSchedulerState() == taskSCHEDULER_NOT_STARTED);
1717

18-
#if(__ARM_ARCH_7A__ == 0U)
19-
/* Service Call interrupt might be configured before kernel start */
20-
/* and when its priority is lower or equal to BASEPRI, svc instruction */
21-
/* causes a Hard Fault. */
22-
NVIC_SetPriority(SVCall_IRQn, 0U);
23-
#endif
24-
2518
/* Start the kernel scheduler */
2619
vTaskStartScheduler();
2720
}

furi/furi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
#include <stdlib.h>
44

5-
#include "core/check.h"
65
#include "core/common_defines.h"
6+
#include "core/check.h"
77
#include "core/event_loop.h"
88
#include "core/event_loop_timer.h"
99
#include "core/event_flag.h"

lib/drivers/bq25896_reg.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
#include <stdbool.h>
44
#include <stdint.h>
55

6-
#if BITS_BIG_ENDIAN == 1
7-
#error Bit structures defined in this file is not portable to BE
6+
#if defined(BITS_BIG_ENDIAN) && BITS_BIG_ENDIAN == 1
7+
#error Bit structures defined in this file are not portable to BE
88
#endif
99

1010
#define BQ25896_ADDRESS 0xD6

lib/drivers/lp5562_reg.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22

3-
#if BITS_BIG_ENDIAN == 1
4-
#error Bit structures defined in this file is not portable to BE
3+
#if defined(BITS_BIG_ENDIAN) && BITS_BIG_ENDIAN == 1
4+
#error Bit structures defined in this file are not portable to BE
55
#endif
66

77
#define LP5562_ADDRESS 0x60

site_scons/cc.scons

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ ENV.AppendUnique(
2828
"-Wno-address-of-packed-member",
2929
"-Wredundant-decls",
3030
"-Wdouble-promotion",
31+
"-Wundef",
3132
"-fdata-sections",
3233
"-ffunction-sections",
3334
"-fsingle-precision-constant",

0 commit comments

Comments
 (0)