Move some gcc extensions to new gcc_extensions.h header

- Move ATTRIBUTE_PRINTF/ATTRIBUTE_SCANF from _ansi.h
  They are not related at all to this file, and this broke compilation
  with Code Sourcery GCC which ships its own _ansi.h
- Move LIKELY/UNLIKELY from system.h

There is likely a lot more GCC extensions used everywhere in the source,
conditionally on __GNUC__ or unconditionally

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27548 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Rafaël Carré 2010-07-25 14:44:29 +00:00
parent 1828a753a8
commit a72aa856bd
11 changed files with 58 additions and 28 deletions

View file

@ -25,6 +25,7 @@
#include "cpu.h"
#include "stdbool.h"
#include "kernel.h"
#include "gcc_extensions.h" /* for LIKELY/UNLIKELY */
extern void system_reboot (void);
/* Called from any UIE handler and panicf - wait for a key and return
@ -198,15 +199,6 @@ int get_cpu_boost_counter(void);
#define TYPE_FROM_MEMBER(type, memberptr, membername) \
((type *)((intptr_t)(memberptr) - OFFSETOF(type, membername)))
/* Use to give gcc hints on which branch is most likely taken */
#if defined(__GNUC__) && __GNUC__ >= 3
#define LIKELY(x) __builtin_expect(!!(x), 1)
#define UNLIKELY(x) __builtin_expect(!!(x), 0)
#else
#define LIKELY(x) (x)
#define UNLIKELY(x) (x)
#endif
/* returns index of first set bit or 32 if no bits are set */
int find_first_set_bit(uint32_t val);