Ver código fonte

Fixes for `-Wundef`

Willy-JL 1 ano atrás
pai
commit
e2962d9619

+ 2 - 2
chess/chess/smallchesslib.h

@@ -52,7 +52,7 @@
 
 typedef uint8_t (*SCL_RandomFunction)(void);
 
-#if SCL_COUNT_EVALUATED_POSITIONS
+#if defined(SCL_COUNT_EVALUATED_POSITIONS) && SCL_COUNT_EVALUATED_POSITIONS
 uint32_t SCL_positionsEvaluated = 0; /**< If enabled by 
                                             SCL_COUNT_EVALUATED_POSITIONS, this
                                             will increment with every
@@ -2565,7 +2565,7 @@ int16_t _SCL_boardEvaluateDynamic(
     int8_t depth,
     int16_t alphaBeta,
     int8_t takenSquare) {
-#if SCL_COUNT_EVALUATED_POSITIONS
+#if defined(SCL_COUNT_EVALUATED_POSITIONS) && SCL_COUNT_EVALUATED_POSITIONS
     SCL_positionsEvaluated++;
 #endif
 

+ 1 - 1
esp_flasher/lib/esp-serial-flasher/include/esp_loader.h

@@ -284,7 +284,7 @@ esp_loader_error_t esp_loader_change_transmission_rate(uint32_t transmission_rat
   *     - ESP_LOADER_ERROR_INVALID_RESPONSE Internal error
   *     - ESP_LOADER_ERROR_UNSUPPORTED_FUNC Unsupported on the target
   */
-#if MD5_ENABLED
+#if defined(MD5_ENABLED) && MD5_ENABLED
 esp_loader_error_t esp_loader_flash_verify(void);
 #endif
 /**

+ 1 - 0
flipbip/lib/crypto/ed25519_donna/ed25519_donna_impl_base.c

@@ -1,6 +1,7 @@
 #include <assert.h>
 #include "ed25519_donna.h"
 #include "../memzero.h"
+#include "options.h"
 
 /* sqrt(x) is such an integer y that 0 <= y <= p - 1, y % 2 = 0, and y^2 = x (mod p). */
 /* d = -121665 / 121666 */

+ 2 - 0
flipbip/lib/crypto/monero/base58.c

@@ -31,6 +31,8 @@
 // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote
 // developers
 
+#include "options.h"
+
 #if USE_MONERO
 
 #include "base58.h"

+ 2 - 0
flipbip/lib/crypto/monero/serialize.c

@@ -2,6 +2,8 @@
 // Created by Dusan Klinec on 02/05/2018.
 //
 
+#include "options.h"
+
 #if USE_MONERO
 
 #include "serialize.h"

+ 2 - 0
flipbip/lib/crypto/monero/xmr.c

@@ -2,6 +2,8 @@
 // Created by Dusan Klinec on 10/05/2018.
 //
 
+#include "options.h"
+
 #if USE_MONERO
 
 #include "xmr.h"

+ 5 - 5
oscilloscope/scenes/scope_scene_run.c

@@ -294,7 +294,7 @@ void AdcDmaTransferHalf_Callback() {
 
 void Activate_ADC(void) {
     __IO uint32_t wait_loop_index = 0U;
-#if(USE_TIMEOUT == 1)
+#if defined(USE_TIMEOUT) && (USE_TIMEOUT == 1)
     uint32_t Timeout = 0U; /* Variable used for timeout management */
 #endif /* USE_TIMEOUT */
     if(LL_ADC_IsEnabled(ADC1) == 0) {
@@ -307,12 +307,12 @@ void Activate_ADC(void) {
         }
         LL_ADC_StartCalibration(ADC1, LL_ADC_SINGLE_ENDED);
 
-#if(USE_TIMEOUT == 1)
+#if defined(USE_TIMEOUT) && (USE_TIMEOUT == 1)
         Timeout = ADC_CALIBRATION_TIMEOUT_MS;
 #endif /* USE_TIMEOUT */
 
         while(LL_ADC_IsCalibrationOnGoing(ADC1) != 0) {
-#if(USE_TIMEOUT == 1)
+#if defined(USE_TIMEOUT) && (USE_TIMEOUT == 1)
             if(LL_SYSTICK_IsActiveCounterFlag()) {
                 if(Timeout-- == 0) {
                 }
@@ -324,11 +324,11 @@ void Activate_ADC(void) {
             wait_loop_index--;
         }
         LL_ADC_Enable(ADC1);
-#if(USE_TIMEOUT == 1)
+#if defined(USE_TIMEOUT) && (USE_TIMEOUT == 1)
         Timeout = ADC_ENABLE_TIMEOUT_MS;
 #endif /* USE_TIMEOUT */
         while(LL_ADC_IsActiveFlag_ADRDY(ADC1) == 0) {
-#if(USE_TIMEOUT == 1)
+#if defined(USE_TIMEOUT) && (USE_TIMEOUT == 1)
             /* Check Systick counter flag to decrement the time-out value */
             if(LL_SYSTICK_IsActiveCounterFlag()) {
                 if(Timeout-- == 0) {

+ 2 - 2
rootoflife/roots_of_life_game.c

@@ -454,7 +454,7 @@ static void draw_active_root(Canvas* canvas, GameState* state) {
     }
 }
 
-#if DRAW_DEBUG
+#if defined(DRAW_DEBUG) && DRAW_DEBUG
 static void draw_generated_root(Canvas* canvas, GameState* state) {
     bool isHidden = (state->tick % BLINK_PERIOD) < BLINK_HIDE_FRAMES;
 
@@ -598,7 +598,7 @@ static void roots_draw_callback(Canvas* const canvas, void* ctx) {
 
     case StageRun:
         draw_active_root(canvas, state);
-#if DRAW_DEBUG
+#if defined(DRAW_DEBUG) && DRAW_DEBUG
         draw_generated_root(canvas, state);
 #endif
         break;

+ 1 - 1
seader/lib/asn1/asn_internal.h

@@ -42,7 +42,7 @@ int get_asn1c_environment_version(void);	/* Run-time version */
  * You may enable or override it.
  */
 #ifndef	ASN_DEBUG	/* If debugging code is not defined elsewhere... */
-#if	ASN_EMIT_DEBUG == 1	/* And it was asked to emit this code... */
+#if	defined(ASN_EMIT_DEBUG) && ASN_EMIT_DEBUG == 1	/* And it was asked to emit this code... */
 #if __STDC_VERSION__ >= 199901L
 #ifdef	ASN_THREAD_SAFE
 /* Thread safety requires sacrifice in output indentation:

+ 2 - 2
subghz_bruteforcer/helpers/subbrute_worker.c

@@ -235,7 +235,7 @@ bool subbrute_worker_transmit_current_key(SubBruteWorker* instance, uint64_t ste
 
     uint32_t ticks = furi_get_tick();
     if((ticks - instance->last_time_tx_data) < SUBBRUTE_MANUAL_TRANSMIT_INTERVAL) {
-#if FURI_DEBUG
+#ifdef FURI_DEBUG
         FURI_LOG_D(TAG, "Need to wait, current: %ld", ticks - instance->last_time_tx_data);
 #endif
         return false;
@@ -269,7 +269,7 @@ bool subbrute_worker_transmit_current_key(SubBruteWorker* instance, uint64_t ste
     subbrute_worker_subghz_transmit(instance, flipper_format);
 
     result = true;
-#if FURI_DEBUG
+#ifdef FURI_DEBUG
     FURI_LOG_D(TAG, "Manual transmit done");
 #endif
 

+ 1 - 1
subghz_bruteforcer/subbrute_device.c

@@ -335,7 +335,7 @@ uint8_t subbrute_device_load_from_file(SubBruteDevice* instance, const char* fil
         for(size_t i = 0; i < sizeof(uint64_t); i++) {
             data = (data << 8) | key_data[i];
         }
-#if FURI_DEBUG
+#ifdef FURI_DEBUG
         FURI_LOG_D(TAG, "Key: %.16llX", data);
 #endif
         instance->key_from_file = data;

+ 1 - 1
subghz_remote/helpers/subrem_custom_event.h

@@ -13,7 +13,7 @@ typedef enum {
     SubmenuIndexSubRemOpenMapFile = 0,
     SubmenuIndexSubRemEditMapFile,
     SubmenuIndexSubRemNewMapFile,
-#if FURI_DEBUG
+#ifdef FURI_DEBUG
     SubmenuIndexSubRemRemoteView,
 #endif
     // SubmenuIndexSubRemAbout,

+ 1 - 1
subghz_remote/helpers/subrem_presets.c

@@ -181,7 +181,7 @@ SubRemLoadSubState subrem_sub_preset_load(
 
         ret = SubRemLoadSubStateOK;
 
-#if FURI_DEBUG
+#ifdef FURI_DEBUG
         FURI_LOG_I(TAG, "%-16s - protocol Loaded", furi_string_get_cstr(sub_preset->label));
 #endif
     } while(false);

+ 2 - 2
subghz_remote/scenes/subrem_scene_start.c

@@ -19,7 +19,7 @@ void subrem_scene_start_on_enter(void* context) {
         SubmenuIndexSubRemOpenMapFile,
         subrem_scene_start_submenu_callback,
         app);
-#if FURI_DEBUG
+#ifdef FURI_DEBUG
     submenu_add_item(
         submenu,
         "Remote_Debug",
@@ -66,7 +66,7 @@ bool subrem_scene_start_on_event(void* context, SceneManagerEvent event) {
             scene_manager_next_scene(app->scene_manager, SubRemSceneOpenMapFile);
             consumed = true;
         }
-#if FURI_DEBUG
+#ifdef FURI_DEBUG
         else if(event.event == SubmenuIndexSubRemRemoteView) {
             scene_manager_next_scene(app->scene_manager, SubRemSceneRemote);
             consumed = true;

+ 4 - 4
subghz_remote/subghz_remote_app_i.c

@@ -77,7 +77,7 @@ static bool subrem_map_preset_load(SubRemMapPreset* map_preset, FlipperFormat* f
         sub_preset = map_preset->subs_preset[i];
         if(!flipper_format_read_string(
                fff_data_file, map_file_labels[i][0], sub_preset->file_path)) {
-#if FURI_DEBUG
+#ifdef FURI_DEBUG
             FURI_LOG_W(TAG, "No file patch for %s", map_file_labels[i][0]);
 #endif
             sub_preset->type = SubGhzProtocolTypeUnknown;
@@ -88,7 +88,7 @@ static bool subrem_map_preset_load(SubRemMapPreset* map_preset, FlipperFormat* f
             // Rewind error
         } else if(!flipper_format_read_string(
                       fff_data_file, map_file_labels[i][1], sub_preset->label)) {
-#if FURI_DEBUG
+#ifdef FURI_DEBUG
             FURI_LOG_W(TAG, "No Label for %s", map_file_labels[i][0]);
 #endif
             ret = true;
@@ -114,13 +114,13 @@ static bool subrem_map_preset_load(SubRemMapPreset* map_preset, FlipperFormat* f
 SubRemLoadMapState subrem_map_file_load(SubGhzRemoteApp* app, const char* file_path) {
     furi_assert(app);
     furi_assert(file_path);
-#if FURI_DEBUG
+#ifdef FURI_DEBUG
     FURI_LOG_I(TAG, "Load Map File Start");
 #endif
     Storage* storage = furi_record_open(RECORD_STORAGE);
     FlipperFormat* fff_data_file = flipper_format_file_alloc(storage);
     SubRemLoadMapState ret = SubRemLoadMapStateErrorOpenError;
-#if FURI_DEBUG
+#ifdef FURI_DEBUG
     FURI_LOG_I(TAG, "Open Map File..");
 #endif
     subrem_map_preset_reset(app->map_preset);

+ 2 - 0
unitemp/interfaces/endianness.h

@@ -5,6 +5,8 @@
 #ifndef FLIPPERZERO_FIRMWARE_ENDIANNESS_H
 #define FLIPPERZERO_FIRMWARE_ENDIANNESS_H
 
+#include <machine/endian.h>
+
 inline static void store16(uint8_t* b, uint16_t i) {
     memcpy(b, &i, 2);
 }

+ 2 - 2
wiiec/wii_anal_ec.c

@@ -41,12 +41,12 @@ bool evWiiEC(const eventMsg_t* const msg, state_t* const state) {
             break;
         }
         INFO(
-            "WIIP : %s '%c' = %d",
+            "WIIP : %s '%c' = %ld",
             s,
             (isprint((int)msg->wiiEc.in) ? msg->wiiEc.in : '_'),
             msg->wiiEc.val);
         if((msg->wiiEc.type == WIIEC_CONN) || (msg->wiiEc.type == WIIEC_DISCONN))
-            INFO("...%d=\"%s\"", msg->wiiEc.val, ecId[msg->wiiEc.val].name);
+            INFO("...%ld=\"%s\"", msg->wiiEc.val, ecId[msg->wiiEc.val].name);
     }
 #endif
 

+ 2 - 0
wiiec/wii_ec.h

@@ -9,6 +9,8 @@
 #include "wii_ec_classic.h"
 #include "wii_ec_udraw.h"
 
+#include "bc_logging.h"
+
 //----------------------------------------------------------------------------- ----------------------------------------
 // Crypto key (PSK),      base register : {0x40..0x4F}[2][8]
 #define ENC_LEN (2 * 8)