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