summaryrefslogtreecommitdiff
path: root/firmware/include
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2010-07-25 14:44:29 +0000
committerRafaël Carré <rafael.carre@gmail.com>2010-07-25 14:44:29 +0000
commita72aa856bdcc23dab64af83757830e1d2e1618c8 (patch)
tree64aa0b5dbace189447607c9522fe82883b1febe4 /firmware/include
parent1828a753a8a62a8ad94fdf32b7c4406eb43bb608 (diff)
downloadrockbox-a72aa856bdcc23dab64af83757830e1d2e1618c8.tar.gz
rockbox-a72aa856bdcc23dab64af83757830e1d2e1618c8.zip
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
Diffstat (limited to 'firmware/include')
-rw-r--r--firmware/include/_ansi.h11
-rw-r--r--firmware/include/file.h2
-rw-r--r--firmware/include/gcc_extensions.h46
3 files changed, 47 insertions, 12 deletions
diff --git a/firmware/include/_ansi.h b/firmware/include/_ansi.h
index 17d8e6f1a4..5f0ce211ed 100644
--- a/firmware/include/_ansi.h
+++ b/firmware/include/_ansi.h
@@ -64,15 +64,4 @@
64#endif 64#endif
65#endif 65#endif
66 66
67/* Support gcc's __attribute__ facility. */
68
69#ifdef __GNUC__
70#define _ATTRIBUTE(attrs) __attribute__ (attrs)
71#else
72#define _ATTRIBUTE(attrs)
73#endif
74
75#define ATTRIBUTE_PRINTF(fmt, arg1) _ATTRIBUTE( ( format( printf, fmt, arg1 ) ) )
76#define ATTRIBUTE_SCANF(fmt, arg1) _ATTRIBUTE( ( format( scanf, fmt, arg1 ) ) )
77
78#endif /* _ANSIDECL_H_ */ 67#endif /* _ANSIDECL_H_ */
diff --git a/firmware/include/file.h b/firmware/include/file.h
index 9502f5999a..91b701d6d2 100644
--- a/firmware/include/file.h
+++ b/firmware/include/file.h
@@ -27,7 +27,7 @@
27 27
28#include <sys/types.h> 28#include <sys/types.h>
29#include "config.h" 29#include "config.h"
30#include "_ansi.h" 30#include "gcc_extensions.h"
31 31
32#define MAX_OPEN_FILES 11 32#define MAX_OPEN_FILES 11
33 33
diff --git a/firmware/include/gcc_extensions.h b/firmware/include/gcc_extensions.h
new file mode 100644
index 0000000000..a58c2e7e45
--- /dev/null
+++ b/firmware/include/gcc_extensions.h
@@ -0,0 +1,46 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright © 2010 Rafaël Carré
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
15 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
20
21#ifndef _GCC_EXTENSIONS_H_
22#define _GCC_EXTENSIONS_H_
23
24/* Support for some GCC extensions */
25
26/* Compile time check of format for printf/scanf like functions */
27#ifdef __GNUC__
28#define ATTRIBUTE_PRINTF(fmt, arg1) __attribute__( ( format( printf, fmt, arg1 ) ) )
29#define ATTRIBUTE_SCANF(fmt, arg1) __attribute__( ( format( scanf, fmt, arg1 ) ) )
30#else
31#define ATTRIBUTE_PRINTF(fmt, arg1)
32#define ATTRIBUTE_SCANF(fmt, arg1)
33#endif
34
35
36/* Use to give gcc hints on which branch is most likely taken */
37#if defined(__GNUC__) && __GNUC__ >= 3
38#define LIKELY(x) __builtin_expect(!!(x), 1)
39#define UNLIKELY(x) __builtin_expect(!!(x), 0)
40#else
41#define LIKELY(x) (x)
42#define UNLIKELY(x) (x)
43#endif
44
45
46#endif /* _GCC_EXTENSIONS_H_ */