[FL-2870] Printf function attributes (#1841)

* Furi strings: printf attribute
* Logs: printf attribute
* Plugins: adapt
* Plugins: accommodate
* Unit tests: accommodate

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Sergey Gavrilov
2022-10-07 23:35:15 +10:00
committed by GitHub
parent 1f742b611a
commit 4000f0cac5
78 changed files with 187 additions and 156 deletions

View File

@@ -184,7 +184,7 @@ SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* pckt) {
if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagLock)) {
FURI_LOG_I(TAG, "Pass key request event. Pin: ******");
} else {
FURI_LOG_I(TAG, "Pass key request event. Pin: %06d", pin);
FURI_LOG_I(TAG, "Pass key request event. Pin: %06ld", pin);
}
GapEvent event = {.type = GapEventTypePinCodeShow, .data.pin_code = pin};
gap->on_event_cb(event, gap->context);
@@ -227,7 +227,7 @@ SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* pckt) {
case EVT_BLUE_GAP_NUMERIC_COMPARISON_VALUE: {
uint32_t pin =
((aci_gap_numeric_comparison_value_event_rp0*)(blue_evt->data))->Numeric_Value;
FURI_LOG_I(TAG, "Verify numeric comparison: %06d", pin);
FURI_LOG_I(TAG, "Verify numeric comparison: %06ld", pin);
GapEvent event = {.type = GapEventTypePinCodeVerify, .data.pin_code = pin};
bool result = gap->on_event_cb(event, gap->context);
aci_gap_numeric_comparison_value_confirm_yesno(gap->service.connection_handle, result);

View File

@@ -63,13 +63,13 @@ static SVCCTL_EvtAckStatus_t serial_svc_event_handler(void* event) {
.size = attribute_modified->Attr_Data_Length,
}};
uint32_t buff_free_size = serial_svc->callback(event, serial_svc->context);
FURI_LOG_D(TAG, "Available buff size: %d", buff_free_size);
FURI_LOG_D(TAG, "Available buff size: %ld", buff_free_size);
furi_check(furi_mutex_release(serial_svc->buff_size_mtx) == FuriStatusOk);
}
ret = SVCCTL_EvtAckFlowEnable;
}
} else if(blecore_evt->ecode == ACI_GATT_SERVER_CONFIRMATION_VSEVT_CODE) {
FURI_LOG_T(TAG, "Ack received", blecore_evt->ecode);
FURI_LOG_T(TAG, "Ack received");
if(serial_svc->callback) {
SerialServiceEvent event = {
.event = SerialServiceEventTypeDataSent,

View File

@@ -2,6 +2,7 @@
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
@@ -27,7 +28,7 @@ void furi_hal_console_tx_with_new_line(const uint8_t* buffer, size_t buffer_size
* @param format
* @param ...
*/
void furi_hal_console_printf(const char format[], ...);
void furi_hal_console_printf(const char format[], ...) _ATTRIBUTE((__format__(__printf__, 1, 2)));
void furi_hal_console_puts(const char* data);

View File

@@ -83,7 +83,7 @@ void furi_hal_flash_init() {
// WRITE_REG(FLASH->SR, FLASH_SR_OPTVERR);
/* Actually, reset all error flags on start */
if(READ_BIT(FLASH->SR, FURI_HAL_FLASH_SR_ERRORS)) {
FURI_LOG_E(TAG, "FLASH->SR 0x%08X", FLASH->SR);
FURI_LOG_E(TAG, "FLASH->SR 0x%08lX", FLASH->SR);
WRITE_REG(FLASH->SR, FURI_HAL_FLASH_SR_ERRORS);
}
}
@@ -514,10 +514,10 @@ bool furi_hal_flash_ob_set_word(size_t word_idx, const uint32_t value) {
FURI_LOG_W(
TAG,
"Setting OB reg %d for word %d (addr 0x%08X) to 0x%08X",
"Setting OB reg %d for word %d (addr 0x%08lX) to 0x%08lX",
reg_def->ob_reg,
word_idx,
reg_def->ob_register_address,
(uint32_t)reg_def->ob_register_address,
value);
/* 1. Clear OPTLOCK option lock bit with the clearing sequence */

View File

@@ -55,9 +55,9 @@ void furi_hal_memory_init() {
memory->region[SRAM_B].size = sram2b_unprotected_size;
FURI_LOG_I(
TAG, "SRAM2A: 0x%p, %d", memory->region[SRAM_A].start, memory->region[SRAM_A].size);
TAG, "SRAM2A: 0x%p, %ld", memory->region[SRAM_A].start, memory->region[SRAM_A].size);
FURI_LOG_I(
TAG, "SRAM2B: 0x%p, %d", memory->region[SRAM_B].start, memory->region[SRAM_B].size);
TAG, "SRAM2B: 0x%p, %ld", memory->region[SRAM_B].start, memory->region[SRAM_B].size);
if((memory->region[SRAM_A].size > 0) || (memory->region[SRAM_B].size > 0)) {
if((memory->region[SRAM_A].size > 0)) {

View File

@@ -569,13 +569,13 @@ void furi_hal_power_info_get(FuriHalPowerInfoCallback out, void* context) {
furi_string_printf(value, "%u", furi_hal_power_get_bat_health_pct());
out("battery_health", furi_string_get_cstr(value), false, context);
furi_string_printf(value, "%u", furi_hal_power_get_battery_remaining_capacity());
furi_string_printf(value, "%lu", furi_hal_power_get_battery_remaining_capacity());
out("capacity_remain", furi_string_get_cstr(value), false, context);
furi_string_printf(value, "%u", furi_hal_power_get_battery_full_capacity());
furi_string_printf(value, "%lu", furi_hal_power_get_battery_full_capacity());
out("capacity_full", furi_string_get_cstr(value), false, context);
furi_string_printf(value, "%u", furi_hal_power_get_battery_design_capacity());
furi_string_printf(value, "%lu", furi_hal_power_get_battery_design_capacity());
out("capacity_design", furi_string_get_cstr(value), true, context);
furi_string_free(value);

View File

@@ -173,7 +173,7 @@ void furi_hal_subghz_load_custom_preset(uint8_t* preset_data) {
i += 2;
}
for(uint8_t y = i; y < i + 10; y++) {
FURI_LOG_D(TAG, "PA[%lu]: %02X", y, preset_data[y]);
FURI_LOG_D(TAG, "PA[%u]: %02X", y, preset_data[y]);
}
}
}