Change UNUSED() macro to accept two arguments: type and name;
authoraleph <aleph@38d2e660-2303-0410-9eaa-f027e97ec537>
Sun, 27 Jun 2004 15:20:26 +0000 (15:20 +0000)
committeraleph <aleph@38d2e660-2303-0410-9eaa-f027e97ec537>
Sun, 27 Jun 2004 15:20:26 +0000 (15:20 +0000)
Add macro GNUC_PREREQ to detect GCC version during build;
Some spacing cleanups and typo fix

git-svn-id: https://src.develer.com/svnoss/bertos/trunk@40 38d2e660-2303-0410-9eaa-f027e97ec537

compiler.h
drv/kdebug.c
mware/sprintf.c

index 8f4a849a7740bc3363899d48d5e7531982e8dbce..dfb32207f20cec9d4967a801189f507470b5e41e 100755 (executable)
 
 /*
  * $Log$
+ * Revision 1.4  2004/06/27 15:20:26  aleph
+ * Change UNUSED() macro to accept two arguments: type and name;
+ * Add macro GNUC_PREREQ to detect GCC version during build;
+ * Some spacing cleanups and typo fix
+ *
  * Revision 1.3  2004/06/06 18:00:39  bernie
  * PP_CAT(): New macro.
  *
 
 #include "arch_config.h"
 
+
+#if defined __GNUC__ && defined __GNUC_MINOR__
+       #define GNUC_PREREQ(maj, min) \
+               ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
+#else
+       #define GNUC_PREREQ(maj, min) 0
+#endif
+
+
 #if defined(__IAR_SYSTEMS_ICC) || defined(__IAR_SYSTEMS_ICC__)
        #pragma language=extended
        #define INTERRUPT(x)    interrupt [x]
@@ -39,7 +53,7 @@
        /* GCC attributes */
        #define FORMAT(type,fmt,first) /* nothing */
        #define NORETURN               /* nothing */
-       #define UNUSED(arg)            arg
+       #define UNUSED(type,arg)       type arg
 
        /* Imported from <longjmp.h>. Unfortunately, we can't just include
         * this header because it typedefs jmp_buf to be an array of chars.
        /* GCC attributes */
        #define FORMAT(type,fmt,first) /* nothing */
        #define NORETURN               /* nothing */
-       #define UNUSED(arg)            arg
+       #define UNUSED(type,arg)       type arg
        #define INLINE static inline
 
        #ifdef __cplusplus
        /* GCC attributes */
        #define FORMAT(type,fmt,first)  __attribute__((__format__(type, fmt, first)))
        #define NORETURN                __attribute__((__noreturn__))
-       #define UNUSED(arg)             __attribute__((__unused__)) arg
+       #define UNUSED(type,arg)        __attribute__((__unused__)) type arg
        //FIXME #define INLINE static inline
        #define INLINE extern inline
 
                #include <stddef.h>
                #include <stdbool.h>
                #define FLASH           __attribute__((progmem))
-               #define REGISTER                /* nothing */
+               #define REGISTER    /* nothing */
 
                /* Missing printf-family functions in avr-libc/stdio.h */
                #include <stdarg.h>
                #include <avr/pgmspace.h>
-               int vsprintf(char *buf, const char *fmt, va_list ap);
+               #if !GNUC_PREREQ(3,4)
+                       int vsprintf(char *buf, const char *fmt, va_list ap);
+               #endif
                int vsprintf_P(char *buf, const char * PROGMEM fmt, va_list ap);
 
-               /* Support for hardvard architectures */
+               /* Support for harvard architectures */
                #ifdef _PROGMEM
                        #define PGM_READ_CHAR(s) pgm_read_byte(s)
                        #define PGM_FUNC(x) x ## _P
        /* GCC attributes */
        #define FORMAT(type,fmt,first)  /* nothing */
        #define NORETURN                /* nothing */
-       #define UNUSED(arg)             arg
+       #define UNUSED(type,arg)        type arg
 
-       /* Support for hardvard architectures */
+       /* Support for harvard architectures */
        #define PGM_READ_CHAR(s) (*(s))
        #define PGM_FUNC                /* nothing */
        #define PGM_ATTR                /* nothing */
index 4e01c893a4632cb004219623058d31d75dbff35f..72445cf95eed70bed43022f930566133f1f43ca6 100755 (executable)
 
 /*
  * $Log$
+ * Revision 1.5  2004/06/27 15:20:26  aleph
+ * Change UNUSED() macro to accept two arguments: type and name;
+ * Add macro GNUC_PREREQ to detect GCC version during build;
+ * Some spacing cleanups and typo fix
+ *
  * Revision 1.4  2004/06/06 18:09:51  bernie
  * Import DSP56800 changes; Print broken wall bricks in hex.
  *
@@ -134,7 +139,7 @@ void kdbg_init(void)
 /*!
  * Output one character to the debug console
  */
-static void kputchar(char c, UNUSED(void *unused))
+static void kputchar(char c, UNUSED(void *unused))
 {
        /* Poll while serial buffer is still busy */
        KDBG_WAIT_READY();
index 4ca511e390284d5b000536f40bb59a6b8a9f9832..def6d20f035a207968700ce39653f8786f98ed78 100755 (executable)
 
 /*
  * $Log$
+ * Revision 1.3  2004/06/27 15:20:26  aleph
+ * Change UNUSED() macro to accept two arguments: type and name;
+ * Add macro GNUC_PREREQ to detect GCC version during build;
+ * Some spacing cleanups and typo fix
+ *
  * Revision 1.2  2004/06/03 11:27:09  bernie
  * Add dual-license information.
  *
@@ -53,7 +58,7 @@ static void __str_put_char(char c, void *ptr)
        (*((char **)ptr))++;
 }
 
-static void __null_put_char(UNUSED(char c), UNUSED(void *ptr))
+static void __null_put_char(UNUSED(char, c), UNUSED(void *, ptr))
 {
        /* nop */
 }