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
This commit is contained in:
parent
70ebe46d74
commit
0e2286f226
19 changed files with 71 additions and 35 deletions
43
apps/main.c
43
apps/main.c
|
@ -20,6 +20,7 @@
|
|||
****************************************************************************/
|
||||
#include "config.h"
|
||||
|
||||
#include "gcc_extensions.h"
|
||||
#include "storage.h"
|
||||
#include "disk.h"
|
||||
#include "fat.h"
|
||||
|
@ -112,35 +113,41 @@
|
|||
#include "m5636.h"
|
||||
#endif
|
||||
|
||||
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
||||
#define MAIN_NORETURN_ATTR NORETURN_ATTR
|
||||
#else
|
||||
/* gcc adds an implicit 'return 0;' at the end of main(), causing a warning
|
||||
* with noreturn attribute */
|
||||
#define MAIN_NORETURN_ATTR
|
||||
#endif
|
||||
|
||||
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
|
||||
#include "sim_tasks.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SDL
|
||||
#if (CONFIG_PLATFORM & PLATFORM_SDL)
|
||||
#include "system-sdl.h"
|
||||
#define HAVE_ARGV_MAIN
|
||||
/* Don't use SDL_main on windows -> no more stdio redirection */
|
||||
#if defined(WIN32)
|
||||
#undef main
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*#define AUTOROCK*/ /* define this to check for "autostart.rock" on boot */
|
||||
|
||||
static void init(void);
|
||||
|
||||
#ifdef HAVE_SDL
|
||||
#if defined(WIN32) && defined(main)
|
||||
/* Don't use SDL_main on windows -> no more stdio redirection */
|
||||
#undef main
|
||||
#endif
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifdef APPLICATION
|
||||
paths_init();
|
||||
#endif
|
||||
sys_handle_argv(argc, argv);
|
||||
#else
|
||||
/* main(), and various functions called by main() and init() may be
|
||||
* be INIT_ATTR. These functions must not be called after the final call
|
||||
* to root_menu() at the end of main()
|
||||
* see definition of INIT_ATTR in config.h */
|
||||
int main(void) INIT_ATTR __attribute__((noreturn));
|
||||
#ifdef HAVE_ARGV_MAIN
|
||||
int main(int argc, char *argv[]) INIT_ATTR MAIN_NORETURN_ATTR ;
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
sys_handle_argv(argc, argv);
|
||||
#else
|
||||
int main(void) INIT_ATTR MAIN_NORETURN_ATTR;
|
||||
int main(void)
|
||||
{
|
||||
#endif
|
||||
|
@ -328,6 +335,9 @@ static void init_tagcache(void)
|
|||
|
||||
static void init(void)
|
||||
{
|
||||
#ifdef APPLICATION
|
||||
paths_init();
|
||||
#endif
|
||||
system_init();
|
||||
kernel_init();
|
||||
buffer_init();
|
||||
|
@ -707,7 +717,8 @@ static void init(void)
|
|||
}
|
||||
|
||||
#ifdef CPU_PP
|
||||
void __attribute__((noreturn)) cop_main(void)
|
||||
void cop_main(void) MAIN_NORETURN_ATTR;
|
||||
void cop_main(void)
|
||||
{
|
||||
/* This is the entry point for the coprocessor
|
||||
Anyone not running an upgraded bootloader will never reach this point,
|
||||
|
|
|
@ -553,7 +553,7 @@ void os_display_char (zchar);
|
|||
void os_display_string (const zchar *);
|
||||
void os_draw_picture (int, int, int);
|
||||
void os_erase_area (int, int, int, int);
|
||||
void os_fatal (const char *) __attribute__((noreturn));
|
||||
void os_fatal (const char *) NORETURN_ATTR;
|
||||
void os_finish_with_sample (int);
|
||||
int os_font_data (int, int *, int *);
|
||||
void os_init_screen (void);
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include "gcc_extensions.h"
|
||||
#include "pcm_record.h"
|
||||
#include "system.h"
|
||||
#include "kernel.h"
|
||||
|
@ -1458,7 +1461,7 @@ static void pcmrec_resume(void)
|
|||
logf("pcmrec_resume done");
|
||||
} /* pcmrec_resume */
|
||||
|
||||
static void pcmrec_thread(void) __attribute__((noreturn));
|
||||
static void pcmrec_thread(void) NORETURN_ATTR;
|
||||
static void pcmrec_thread(void)
|
||||
{
|
||||
struct queue_event ev;
|
||||
|
|
|
@ -18,11 +18,13 @@
|
|||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
#include "config.h"
|
||||
#ifndef __ROOT_MENU_H__
|
||||
#define __ROOT_MENU_H__
|
||||
|
||||
void root_menu(void) __attribute__((noreturn));
|
||||
#include "config.h"
|
||||
#include "gcc_extensions.h"
|
||||
|
||||
void root_menu(void) NORETURN_ATTR;
|
||||
|
||||
enum {
|
||||
/* from old menu api, but still required*/
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "system.h"
|
||||
#include <stdio.h>
|
||||
#include "kernel.h"
|
||||
#include "gcc_extensions.h"
|
||||
#include "string.h"
|
||||
#include "adc.h"
|
||||
#include "powermgmt.h"
|
||||
|
@ -296,7 +297,7 @@ static void handle_untar(void)
|
|||
}
|
||||
|
||||
/* Try to load the firmware and run it */
|
||||
static void __attribute__((noreturn)) handle_firmware_load(void)
|
||||
static void NORETURN_ATTR handle_firmware_load(void)
|
||||
{
|
||||
int rc = load_firmware(load_buf, BOOTFILE,
|
||||
load_buf_size);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <system.h>
|
||||
#include <inttypes.h>
|
||||
#include "config.h"
|
||||
#include "gcc_extensions.h"
|
||||
#include "lcd.h"
|
||||
#ifdef USE_ROCKBOX_USB
|
||||
#include "usb.h"
|
||||
|
@ -70,7 +71,7 @@ static void usb_mode(void)
|
|||
}
|
||||
#endif /* USE_ROCKBOX_USB */
|
||||
|
||||
void main(void) __attribute__((noreturn));
|
||||
void main(void) NORETURN_ATTR;
|
||||
void main(void)
|
||||
{
|
||||
unsigned char* loadbuffer;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <inttypes.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "gcc_extensions.h"
|
||||
|
||||
/* Priority scheduling (when enabled with HAVE_PRIORITY_SCHEDULING) works
|
||||
* by giving high priority threads more CPU time than lower priority threads
|
||||
|
@ -385,7 +386,7 @@ void thread_thaw(unsigned int thread_id);
|
|||
/* Wait for a thread to exit */
|
||||
void thread_wait(unsigned int thread_id);
|
||||
/* Exit the current thread */
|
||||
void thread_exit(void) __attribute__((noreturn));
|
||||
void thread_exit(void) NORETURN_ATTR;
|
||||
#if defined(DEBUG) || defined(ROCKBOX_HAS_LOGF)
|
||||
#define ALLOW_REMOVE_THREAD
|
||||
/* Remove a thread from the scheduler */
|
||||
|
|
|
@ -43,4 +43,11 @@
|
|||
#endif
|
||||
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 3 || \
|
||||
(__GNUC__ >= 2 && __GNUC_MINOR__ >= 5))
|
||||
#define NORETURN_ATTR __attribute__((noreturn))
|
||||
#else
|
||||
#define NORETURN_ATTR
|
||||
#endif
|
||||
|
||||
#endif /* _GCC_EXTENSIONS_H_ */
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
#include "config.h"
|
||||
#include "gcc_extensions.h"
|
||||
#include "cpu.h"
|
||||
#include "kernel.h"
|
||||
#include "thread.h"
|
||||
|
@ -257,7 +258,7 @@ static bool scroll_process_message(int delay)
|
|||
}
|
||||
#endif /* HAVE_REMOTE_LCD */
|
||||
|
||||
static void scroll_thread(void) __attribute__((noreturn));
|
||||
static void scroll_thread(void) NORETURN_ATTR;
|
||||
#ifdef HAVE_REMOTE_LCD
|
||||
|
||||
static void scroll_thread(void)
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "gcc_extensions.h"
|
||||
#include "as3525.h"
|
||||
#include "pl180.h" /* SD controller */
|
||||
#include "pl081.h" /* DMA controller */
|
||||
|
@ -432,7 +433,7 @@ static int sd_init_card(const int drive)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void sd_thread(void) __attribute__((noreturn));
|
||||
static void sd_thread(void) NORETURN_ATTR;
|
||||
static void sd_thread(void)
|
||||
{
|
||||
struct queue_event ev;
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "config.h" /* for HAVE_MULTIVOLUME */
|
||||
#include "fat.h"
|
||||
#include "thread.h"
|
||||
#include "gcc_extensions.h"
|
||||
#include "led.h"
|
||||
#include "sdmmc.h"
|
||||
#include "system.h"
|
||||
|
@ -616,7 +617,7 @@ static int sd_init_card(const int drive)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void sd_thread(void) __attribute__((noreturn));
|
||||
static void sd_thread(void) NORETURN_ATTR;
|
||||
static void sd_thread(void)
|
||||
{
|
||||
struct queue_event ev;
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "config.h" /* for HAVE_MULTIDRIVE */
|
||||
#include "fat.h"
|
||||
#include "sdmmc.h"
|
||||
#include "gcc_extensions.h"
|
||||
#ifdef HAVE_HOTSWAP
|
||||
#include "sd-pp-target.h"
|
||||
#endif
|
||||
|
@ -1105,7 +1106,7 @@ sd_write_error:
|
|||
}
|
||||
}
|
||||
|
||||
static void sd_thread(void) __attribute__((noreturn));
|
||||
static void sd_thread(void) NORETURN_ATTR;
|
||||
static void sd_thread(void)
|
||||
{
|
||||
struct queue_event ev;
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "kernel.h"
|
||||
#include "system.h"
|
||||
#include "gcc_extensions.h"
|
||||
#include "panic.h"
|
||||
#include "avic-imx31.h"
|
||||
#include "gpio-imx31.h"
|
||||
|
@ -219,9 +220,9 @@ void system_prepare_fw_start(void)
|
|||
|
||||
#ifndef BOOTLOADER
|
||||
void rolo_restart_firmware(const unsigned char *source, unsigned char *dest,
|
||||
int length) __attribute__((noreturn));
|
||||
int length) NORETURN_ATTR;
|
||||
|
||||
void __attribute__((noreturn))
|
||||
void NORETURN_ATTR
|
||||
rolo_restart(const unsigned char *source, unsigned char *dest, int length)
|
||||
{
|
||||
/* Some housekeeping tasks must be performed for a safe changeover */
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
/****************************************************************************
|
||||
* void rolo_restart_firmware(const unsigned char* source, unsigned char* dest,
|
||||
* int length) __attribute__((noreturn));
|
||||
* int length) NORETURN_ATTR;
|
||||
*/
|
||||
.section .text, "ax", %progbits
|
||||
.align 2
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "sd.h"
|
||||
#include "system.h"
|
||||
#include <string.h>
|
||||
#include "gcc_extensions.h"
|
||||
#include "thread.h"
|
||||
#include "panic.h"
|
||||
|
||||
|
@ -575,7 +576,7 @@ bool sd_removable(IF_MD_NONVOID(int card_no))
|
|||
#endif /* HAVE_HOTSWAP */
|
||||
/*****************************************************************************/
|
||||
|
||||
static void sd_thread(void) __attribute__((noreturn));
|
||||
static void sd_thread(void) NORETURN_ATTR;
|
||||
static void sd_thread(void)
|
||||
{
|
||||
struct queue_event ev;
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <stdio.h>
|
||||
#include "lcd.h"
|
||||
#include "font.h"
|
||||
#include "gcc_extensions.h"
|
||||
|
||||
static const char* const uiename[] = {
|
||||
"Undefined instruction",
|
||||
|
@ -34,7 +35,7 @@ static const char* const uiename[] = {
|
|||
/* Unexpected Interrupt or Exception handler. Currently only deals with
|
||||
exceptions, but will deal with interrupts later.
|
||||
*/
|
||||
void __attribute__((noreturn)) UIE(unsigned int pc, unsigned int num)
|
||||
void NORETURN_ATTR UIE(unsigned int pc, unsigned int num)
|
||||
{
|
||||
#if LCD_DEPTH > 1
|
||||
lcd_set_backdrop(NULL);
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "sd.h"
|
||||
#include "system.h"
|
||||
#include <string.h>
|
||||
#include "gcc_extensions.h"
|
||||
#include "sdmmc.h"
|
||||
#include "storage.h"
|
||||
#include "led.h"
|
||||
|
@ -642,7 +643,7 @@ sd_write_error:
|
|||
}
|
||||
}
|
||||
|
||||
static void sd_thread(void) __attribute__((noreturn));
|
||||
static void sd_thread(void) NORETURN_ATTR;
|
||||
static void sd_thread(void)
|
||||
{
|
||||
struct queue_event ev;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
****************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include "config.h"
|
||||
#include "gcc_extensions.h"
|
||||
#include "adc.h"
|
||||
#include "system.h"
|
||||
#include "lcd.h"
|
||||
|
@ -200,7 +201,7 @@ static void system_display_exception_info(unsigned long format,
|
|||
reliable. The system restarts, but boot often fails with ata error -42. */
|
||||
}
|
||||
|
||||
static void UIE(void) __attribute__ ((noreturn));
|
||||
static void UIE(void) NORETURN_ATTR;
|
||||
static void UIE(void)
|
||||
{
|
||||
asm volatile("subq.l #4,%sp"); /* phony return address - never used */
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include "gcc_extensions.h"
|
||||
#include "jz4740.h"
|
||||
#include "ata.h"
|
||||
#include "ata_idle_notify.h"
|
||||
|
@ -47,7 +48,7 @@ static const char sd_thread_name[] = "ata/sd";
|
|||
static struct event_queue sd_queue;
|
||||
static struct mutex sd_mtx;
|
||||
static struct wakeup sd_wakeup;
|
||||
static void sd_thread(void) __attribute__((noreturn));
|
||||
static void sd_thread(void) NORETURN_ATTR;
|
||||
|
||||
static int use_4bit;
|
||||
static int num_6;
|
||||
|
|
Loading…
Reference in a new issue