A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd

misc: Clean up a large pile of -Wexpansion-to-defined warnings

And re-enable the warning (applies with GCC 7+)

Change-Id: I406ce796ebd06bad53cab911e17a28265a79b420

+21 -18
+1 -1
apps/plugin.c
··· 412 412 storage_sleep, 413 413 STORAGE_FUNCTION(spin), 414 414 STORAGE_FUNCTION(spindown), 415 - #if USING_STORAGE_CALLBACK 415 + #ifdef USING_STORAGE_CALLBACK 416 416 register_storage_idle_func, 417 417 unregister_storage_idle_func, 418 418 #endif /* USING_STORAGE_CALLBACK */
+1 -1
apps/plugin.h
··· 474 474 void (*storage_sleep)(void); 475 475 void (*storage_spin)(void); 476 476 void (*storage_spindown)(int seconds); 477 - #if USING_STORAGE_CALLBACK 477 + #ifdef USING_STORAGE_CALLBACK 478 478 void (*register_storage_idle_func)(void (*function)(void)); 479 479 void (*unregister_storage_idle_func)(void (*function)(void), bool run); 480 480 #endif /* USING_STORAGE_CALLBACK */
+2 -2
apps/plugins/battery_bench.c
··· 458 458 bat[buf_idx].flags = charge_state(); 459 459 #endif 460 460 buf_idx++; 461 - #if USING_STORAGE_CALLBACK 461 + #ifdef USING_STORAGE_CALLBACK 462 462 rb->register_storage_idle_func(flush_buffer); 463 463 #endif 464 464 } ··· 497 497 } 498 498 } 499 499 500 - #if USING_STORAGE_CALLBACK 500 + #ifdef USING_STORAGE_CALLBACK 501 501 /* unregister flush callback and flush to disk */ 502 502 rb->unregister_storage_idle_func(flush_buffer, true); 503 503 #else
+5 -5
firmware/ata_idle_notify.c
··· 25 25 #include "kernel.h" 26 26 #include "string.h" 27 27 28 - #if USING_STORAGE_CALLBACK 28 + #if defined(USING_STORAGE_CALLBACK) 29 29 static void wrapper(unsigned short id, void *ev_data, void *user_data) 30 30 { 31 31 (void)id; ··· 37 37 38 38 void register_storage_idle_func(void (*function)(void)) 39 39 { 40 - #if USING_STORAGE_CALLBACK 40 + #if defined(USING_STORAGE_CALLBACK) 41 41 add_event_ex(DISK_EVENT_SPINUP, true, wrapper, function); 42 42 #else 43 43 function(); /* just call the function now */ ··· 47 47 #endif 48 48 } 49 49 50 - #if USING_STORAGE_CALLBACK 50 + #if defined(USING_STORAGE_CALLBACK) 51 51 void unregister_storage_idle_func(void (*func)(void), bool run) 52 52 { 53 53 remove_event_ex(DISK_EVENT_SPINUP, wrapper, func); 54 - 54 + 55 55 if (run) 56 56 func(); 57 57 } ··· 68 68 lock_until = current_tick + 30*HZ; 69 69 70 70 send_event(DISK_EVENT_SPINUP, NULL); 71 - 71 + 72 72 return true; 73 73 } 74 74 #endif
+5 -3
firmware/export/ata_idle_notify.h
··· 27 27 28 28 /* 29 29 NOTE: storage_idle_notify usage notes.. 30 - 30 + 31 31 1) The callbacks are called in the ata thread, not main/your thread. 32 32 2) Asynchronous callbacks (like the buffer refill) should be avoided. 33 33 If you must use an async callback, remember to check storage_is_active() before ··· 46 46 /* Enable storage callbacks everywhere except for bootloaders. Both 47 47 * hosted and native targets need this. 48 48 */ 49 - #define USING_STORAGE_CALLBACK !defined(BOOTLOADER) && !defined(APPLICATION) && !defined(__PCTOOL__) 49 + #if !defined(BOOTLOADER) && !defined(APPLICATION) && !defined(__PCTOOL__) 50 + #define USING_STORAGE_CALLBACK 51 + #endif 50 52 51 53 extern void register_storage_idle_func(void (*function)(void)); 52 - #if USING_STORAGE_CALLBACK 54 + #ifdef USING_STORAGE_CALLBACK 53 55 extern void unregister_storage_idle_func(void (*function)(void), bool run); 54 56 extern bool call_storage_idle_notifys(bool force); 55 57 #else
+6 -5
firmware/powermgmt.c
··· 131 131 /* Time estimation requires 64 bit math so don't use it in the bootloader. 132 132 * Also we need to be able to measure current, and not have a better time 133 133 * estimate source available. */ 134 - #define HAVE_TIME_ESTIMATION \ 135 - (!defined(BOOTLOADER) && !(CONFIG_BATTERY_MEASURE & TIME_MEASURE) && \ 134 + #if (!defined(BOOTLOADER) && !(CONFIG_BATTERY_MEASURE & TIME_MEASURE) && \ 136 135 (defined(CURRENT_NORMAL) || (CONFIG_BATTERY_MEASURE & CURRENT_MEASURE))) 136 + #define HAVE_TIME_ESTIMATION 137 + #endif 137 138 138 139 #if !(CONFIG_BATTERY_MEASURE & PERCENTAGE_MEASURE) 139 140 int _battery_level(void) { return -1; } ··· 146 147 static int time_now; /* Cached to avoid polling too often */ 147 148 #endif 148 149 149 - #if HAVE_TIME_ESTIMATION 150 + #ifdef HAVE_TIME_ESTIMATION 150 151 static int time_now; /* reported time in minutes */ 151 152 static int64_t time_cnt; /* reported time in seconds */ 152 153 static int64_t time_err; /* error... it's complicated */ ··· 186 187 * on the battery level and the actual current usage. */ 187 188 int battery_time(void) 188 189 { 189 - #if (CONFIG_BATTERY_MEASURE & TIME_MEASURE) || HAVE_TIME_ESTIMATION 190 + #if (CONFIG_BATTERY_MEASURE & TIME_MEASURE) || defined(HAVE_TIME_ESTIMATION) 190 191 return time_now; 191 192 #else 192 193 return -1; ··· 401 402 402 403 #if CONFIG_BATTERY_MEASURE & TIME_MEASURE 403 404 time_now = _battery_time(); 404 - #elif HAVE_TIME_ESTIMATION 405 + #elif defined(HAVE_TIME_ESTIMATION) 405 406 /* TODO: This is essentially a bad version of coloumb counting, 406 407 * so in theory using coloumb counters when they are available 407 408 * should provide a more accurate result. Also note that this
+1 -1
tools/configure
··· 4614 4614 4615 4615 if test "$gccnum" -ge "700"; then 4616 4616 # gcc 7 spews a bunch of warnings by default 4617 - GCCOPTS="$GCCOPTS -Wno-expansion-to-defined -Wimplicit-fallthrough=0" 4617 + GCCOPTS="$GCCOPTS -Wimplicit-fallthrough=0" 4618 4618 fi 4619 4619 4620 4620 case "$GCCOPTS" in