[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

@@ -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]);
}
}
}