Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Introduce NORETURN_ATTR wrapper for __attribute__((noreturn)), using this and a bit further cleanup in main gets rid of a warning when compiling for android.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27788 a1c6a512-1295-4272-9138-f99709370657

+71 -35
+27 -16
apps/main.c
··· 20 20 ****************************************************************************/ 21 21 #include "config.h" 22 22 23 + #include "gcc_extensions.h" 23 24 #include "storage.h" 24 25 #include "disk.h" 25 26 #include "fat.h" ··· 112 113 #include "m5636.h" 113 114 #endif 114 115 116 + #if (CONFIG_PLATFORM & PLATFORM_NATIVE) 117 + #define MAIN_NORETURN_ATTR NORETURN_ATTR 118 + #else 119 + /* gcc adds an implicit 'return 0;' at the end of main(), causing a warning 120 + * with noreturn attribute */ 121 + #define MAIN_NORETURN_ATTR 122 + #endif 123 + 115 124 #if (CONFIG_PLATFORM & PLATFORM_HOSTED) 116 125 #include "sim_tasks.h" 117 126 #endif 118 127 119 - #ifdef HAVE_SDL 128 + #if (CONFIG_PLATFORM & PLATFORM_SDL) 120 129 #include "system-sdl.h" 130 + #define HAVE_ARGV_MAIN 131 + /* Don't use SDL_main on windows -> no more stdio redirection */ 132 + #if defined(WIN32) 133 + #undef main 134 + #endif 121 135 #endif 122 136 123 137 /*#define AUTOROCK*/ /* define this to check for "autostart.rock" on boot */ 124 138 125 139 static void init(void); 126 - 127 - #ifdef HAVE_SDL 128 - #if defined(WIN32) && defined(main) 129 - /* Don't use SDL_main on windows -> no more stdio redirection */ 130 - #undef main 131 - #endif 132 - int main(int argc, char *argv[]) 133 - { 134 - #ifdef APPLICATION 135 - paths_init(); 136 - #endif 137 - sys_handle_argv(argc, argv); 138 - #else 139 140 /* main(), and various functions called by main() and init() may be 140 141 * be INIT_ATTR. These functions must not be called after the final call 141 142 * to root_menu() at the end of main() 142 143 * see definition of INIT_ATTR in config.h */ 143 - int main(void) INIT_ATTR __attribute__((noreturn)); 144 + #ifdef HAVE_ARGV_MAIN 145 + int main(int argc, char *argv[]) INIT_ATTR MAIN_NORETURN_ATTR ; 146 + int main(int argc, char *argv[]) 147 + { 148 + sys_handle_argv(argc, argv); 149 + #else 150 + int main(void) INIT_ATTR MAIN_NORETURN_ATTR; 144 151 int main(void) 145 152 { 146 153 #endif ··· 328 335 329 336 static void init(void) 330 337 { 338 + #ifdef APPLICATION 339 + paths_init(); 340 + #endif 331 341 system_init(); 332 342 kernel_init(); 333 343 buffer_init(); ··· 707 717 } 708 718 709 719 #ifdef CPU_PP 710 - void __attribute__((noreturn)) cop_main(void) 720 + void cop_main(void) MAIN_NORETURN_ATTR; 721 + void cop_main(void) 711 722 { 712 723 /* This is the entry point for the coprocessor 713 724 Anyone not running an upgraded bootloader will never reach this point,
+1 -1
apps/plugins/frotz/frotz.h
··· 553 553 void os_display_string (const zchar *); 554 554 void os_draw_picture (int, int, int); 555 555 void os_erase_area (int, int, int, int); 556 - void os_fatal (const char *) __attribute__((noreturn)); 556 + void os_fatal (const char *) NORETURN_ATTR; 557 557 void os_finish_with_sample (int); 558 558 int os_font_data (int, int *, int *); 559 559 void os_init_screen (void);
+4 -1
apps/recorder/pcm_record.c
··· 18 18 * KIND, either express or implied. 19 19 * 20 20 ****************************************************************************/ 21 + 22 + #include "config.h" 23 + #include "gcc_extensions.h" 21 24 #include "pcm_record.h" 22 25 #include "system.h" 23 26 #include "kernel.h" ··· 1458 1461 logf("pcmrec_resume done"); 1459 1462 } /* pcmrec_resume */ 1460 1463 1461 - static void pcmrec_thread(void) __attribute__((noreturn)); 1464 + static void pcmrec_thread(void) NORETURN_ATTR; 1462 1465 static void pcmrec_thread(void) 1463 1466 { 1464 1467 struct queue_event ev;
+4 -2
apps/root_menu.h
··· 18 18 * KIND, either express or implied. 19 19 * 20 20 ****************************************************************************/ 21 - #include "config.h" 22 21 #ifndef __ROOT_MENU_H__ 23 22 #define __ROOT_MENU_H__ 24 23 25 - void root_menu(void) __attribute__((noreturn)); 24 + #include "config.h" 25 + #include "gcc_extensions.h" 26 + 27 + void root_menu(void) NORETURN_ATTR; 26 28 27 29 enum { 28 30 /* from old menu api, but still required*/
+2 -1
bootloader/gigabeat-s.c
··· 22 22 #include "system.h" 23 23 #include <stdio.h> 24 24 #include "kernel.h" 25 + #include "gcc_extensions.h" 25 26 #include "string.h" 26 27 #include "adc.h" 27 28 #include "powermgmt.h" ··· 296 297 } 297 298 298 299 /* Try to load the firmware and run it */ 299 - static void __attribute__((noreturn)) handle_firmware_load(void) 300 + static void NORETURN_ATTR handle_firmware_load(void) 300 301 { 301 302 int rc = load_firmware(load_buf, BOOTFILE, 302 303 load_buf_size);
+2 -1
bootloader/sansa_as3525.c
··· 26 26 #include <system.h> 27 27 #include <inttypes.h> 28 28 #include "config.h" 29 + #include "gcc_extensions.h" 29 30 #include "lcd.h" 30 31 #ifdef USE_ROCKBOX_USB 31 32 #include "usb.h" ··· 70 71 } 71 72 #endif /* USE_ROCKBOX_USB */ 72 73 73 - void main(void) __attribute__((noreturn)); 74 + void main(void) NORETURN_ATTR; 74 75 void main(void) 75 76 { 76 77 unsigned char* loadbuffer;
+2 -1
firmware/export/thread.h
··· 25 25 #include <inttypes.h> 26 26 #include <stddef.h> 27 27 #include <stdbool.h> 28 + #include "gcc_extensions.h" 28 29 29 30 /* Priority scheduling (when enabled with HAVE_PRIORITY_SCHEDULING) works 30 31 * by giving high priority threads more CPU time than lower priority threads ··· 385 386 /* Wait for a thread to exit */ 386 387 void thread_wait(unsigned int thread_id); 387 388 /* Exit the current thread */ 388 - void thread_exit(void) __attribute__((noreturn)); 389 + void thread_exit(void) NORETURN_ATTR; 389 390 #if defined(DEBUG) || defined(ROCKBOX_HAS_LOGF) 390 391 #define ALLOW_REMOVE_THREAD 391 392 /* Remove a thread from the scheduler */
+7
firmware/include/gcc_extensions.h
··· 43 43 #endif 44 44 45 45 46 + #if defined(__GNUC__) && (__GNUC__ >= 3 || \ 47 + (__GNUC__ >= 2 && __GNUC_MINOR__ >= 5)) 48 + #define NORETURN_ATTR __attribute__((noreturn)) 49 + #else 50 + #define NORETURN_ATTR 51 + #endif 52 + 46 53 #endif /* _GCC_EXTENSIONS_H_ */
+2 -1
firmware/scroll_engine.c
··· 23 23 * 24 24 ****************************************************************************/ 25 25 #include "config.h" 26 + #include "gcc_extensions.h" 26 27 #include "cpu.h" 27 28 #include "kernel.h" 28 29 #include "thread.h" ··· 257 258 } 258 259 #endif /* HAVE_REMOTE_LCD */ 259 260 260 - static void scroll_thread(void) __attribute__((noreturn)); 261 + static void scroll_thread(void) NORETURN_ATTR; 261 262 #ifdef HAVE_REMOTE_LCD 262 263 263 264 static void scroll_thread(void)
+2 -1
firmware/target/arm/as3525/sd-as3525.c
··· 32 32 #include <stdio.h> 33 33 #include <stdlib.h> 34 34 #include <string.h> 35 + #include "gcc_extensions.h" 35 36 #include "as3525.h" 36 37 #include "pl180.h" /* SD controller */ 37 38 #include "pl081.h" /* DMA controller */ ··· 432 433 return 0; 433 434 } 434 435 435 - static void sd_thread(void) __attribute__((noreturn)); 436 + static void sd_thread(void) NORETURN_ATTR; 436 437 static void sd_thread(void) 437 438 { 438 439 struct queue_event ev;
+2 -1
firmware/target/arm/as3525/sd-as3525v2.c
··· 23 23 #include "config.h" /* for HAVE_MULTIVOLUME */ 24 24 #include "fat.h" 25 25 #include "thread.h" 26 + #include "gcc_extensions.h" 26 27 #include "led.h" 27 28 #include "sdmmc.h" 28 29 #include "system.h" ··· 616 617 return 0; 617 618 } 618 619 619 - static void sd_thread(void) __attribute__((noreturn)); 620 + static void sd_thread(void) NORETURN_ATTR; 620 621 static void sd_thread(void) 621 622 { 622 623 struct queue_event ev;
+2 -1
firmware/target/arm/ata-sd-pp.c
··· 21 21 #include "config.h" /* for HAVE_MULTIDRIVE */ 22 22 #include "fat.h" 23 23 #include "sdmmc.h" 24 + #include "gcc_extensions.h" 24 25 #ifdef HAVE_HOTSWAP 25 26 #include "sd-pp-target.h" 26 27 #endif ··· 1105 1106 } 1106 1107 } 1107 1108 1108 - static void sd_thread(void) __attribute__((noreturn)); 1109 + static void sd_thread(void) NORETURN_ATTR; 1109 1110 static void sd_thread(void) 1110 1111 { 1111 1112 struct queue_event ev;
+3 -2
firmware/target/arm/imx31/gigabeat-s/system-gigabeat-s.c
··· 21 21 22 22 #include "kernel.h" 23 23 #include "system.h" 24 + #include "gcc_extensions.h" 24 25 #include "panic.h" 25 26 #include "avic-imx31.h" 26 27 #include "gpio-imx31.h" ··· 219 220 220 221 #ifndef BOOTLOADER 221 222 void rolo_restart_firmware(const unsigned char *source, unsigned char *dest, 222 - int length) __attribute__((noreturn)); 223 + int length) NORETURN_ATTR; 223 224 224 - void __attribute__((noreturn)) 225 + void NORETURN_ATTR 225 226 rolo_restart(const unsigned char *source, unsigned char *dest, int length) 226 227 { 227 228 /* Some housekeeping tasks must be performed for a safe changeover */
+1 -1
firmware/target/arm/imx31/rolo_restart_firmware.S
··· 25 25 26 26 /**************************************************************************** 27 27 * void rolo_restart_firmware(const unsigned char* source, unsigned char* dest, 28 - * int length) __attribute__((noreturn)); 28 + * int length) NORETURN_ATTR; 29 29 */ 30 30 .section .text, "ax", %progbits 31 31 .align 2
+2 -1
firmware/target/arm/s3c2440/sd-s3c2440.c
··· 24 24 #include "sd.h" 25 25 #include "system.h" 26 26 #include <string.h> 27 + #include "gcc_extensions.h" 27 28 #include "thread.h" 28 29 #include "panic.h" 29 30 ··· 575 576 #endif /* HAVE_HOTSWAP */ 576 577 /*****************************************************************************/ 577 578 578 - static void sd_thread(void) __attribute__((noreturn)); 579 + static void sd_thread(void) NORETURN_ATTR; 579 580 static void sd_thread(void) 580 581 { 581 582 struct queue_event ev;
+2 -1
firmware/target/arm/system-arm.c
··· 23 23 #include <stdio.h> 24 24 #include "lcd.h" 25 25 #include "font.h" 26 + #include "gcc_extensions.h" 26 27 27 28 static const char* const uiename[] = { 28 29 "Undefined instruction", ··· 34 35 /* Unexpected Interrupt or Exception handler. Currently only deals with 35 36 exceptions, but will deal with interrupts later. 36 37 */ 37 - void __attribute__((noreturn)) UIE(unsigned int pc, unsigned int num) 38 + void NORETURN_ATTR UIE(unsigned int pc, unsigned int num) 38 39 { 39 40 #if LCD_DEPTH > 1 40 41 lcd_set_backdrop(NULL);
+2 -1
firmware/target/arm/tcc780x/sd-tcc780x.c
··· 22 22 #include "sd.h" 23 23 #include "system.h" 24 24 #include <string.h> 25 + #include "gcc_extensions.h" 25 26 #include "sdmmc.h" 26 27 #include "storage.h" 27 28 #include "led.h" ··· 642 643 } 643 644 } 644 645 645 - static void sd_thread(void) __attribute__((noreturn)); 646 + static void sd_thread(void) NORETURN_ATTR; 646 647 static void sd_thread(void) 647 648 { 648 649 struct queue_event ev;
+2 -1
firmware/target/coldfire/system-coldfire.c
··· 20 20 ****************************************************************************/ 21 21 #include <stdio.h> 22 22 #include "config.h" 23 + #include "gcc_extensions.h" 23 24 #include "adc.h" 24 25 #include "system.h" 25 26 #include "lcd.h" ··· 200 201 reliable. The system restarts, but boot often fails with ata error -42. */ 201 202 } 202 203 203 - static void UIE(void) __attribute__ ((noreturn)); 204 + static void UIE(void) NORETURN_ATTR; 204 205 static void UIE(void) 205 206 { 206 207 asm volatile("subq.l #4,%sp"); /* phony return address - never used */
+2 -1
firmware/target/mips/ingenic_jz47xx/ata-sd-jz4740.c
··· 20 20 ****************************************************************************/ 21 21 22 22 #include "config.h" 23 + #include "gcc_extensions.h" 23 24 #include "jz4740.h" 24 25 #include "ata.h" 25 26 #include "ata_idle_notify.h" ··· 47 48 static struct event_queue sd_queue; 48 49 static struct mutex sd_mtx; 49 50 static struct wakeup sd_wakeup; 50 - static void sd_thread(void) __attribute__((noreturn)); 51 + static void sd_thread(void) NORETURN_ATTR; 51 52 52 53 static int use_4bit; 53 54 static int num_6;