summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-08-12 13:38:25 +0000
committerThomas Martitz <kugel@rockbox.org>2010-08-12 13:38:25 +0000
commit0e2286f226c8ce66adb846995eb1bf0b4d92a649 (patch)
treeae47cfb8e2440b0b220e57e4c894390b6c1efd7a /apps
parent70ebe46d74dbb10160a878cdb120c9b3e7a8e30c (diff)
downloadrockbox-0e2286f226c8ce66adb846995eb1bf0b4d92a649.tar.gz
rockbox-0e2286f226c8ce66adb846995eb1bf0b4d92a649.tar.bz2
rockbox-0e2286f226c8ce66adb846995eb1bf0b4d92a649.zip
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
Diffstat (limited to 'apps')
-rw-r--r--apps/main.c43
-rw-r--r--apps/plugins/frotz/frotz.h2
-rw-r--r--apps/recorder/pcm_record.c5
-rw-r--r--apps/root_menu.h6
4 files changed, 36 insertions, 20 deletions
diff --git a/apps/main.c b/apps/main.c
index 67cd6d2f0d..ceaa85f38f 100644
--- a/apps/main.c
+++ b/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,
diff --git a/apps/plugins/frotz/frotz.h b/apps/plugins/frotz/frotz.h
index bc8869cd24..ef3a39d2ce 100644
--- a/apps/plugins/frotz/frotz.h
+++ b/apps/plugins/frotz/frotz.h
@@ -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);
diff --git a/apps/recorder/pcm_record.c b/apps/recorder/pcm_record.c
index 704d859e57..0221963b2b 100644
--- a/apps/recorder/pcm_record.c
+++ b/apps/recorder/pcm_record.c
@@ -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;
diff --git a/apps/root_menu.h b/apps/root_menu.h
index 9674a73f50..739ec8c4e9 100644
--- a/apps/root_menu.h
+++ b/apps/root_menu.h
@@ -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*/