diff options
author | jimw@rama.(none) <> | 2006-09-28 20:17:17 -0700 |
---|---|---|
committer | jimw@rama.(none) <> | 2006-09-28 20:17:17 -0700 |
commit | 2961966b3badf38e4a0ae3ac46cb6bddfa2fe925 (patch) | |
tree | 21c74922c7fb46d9ca1136416175b9c0fbeadbda /include | |
parent | f53e014f7518d58a147383e5efcd8c810b5be10c (diff) | |
parent | d5d89bcf63be07fc74e90237d201da310722ea80 (diff) | |
download | mariadb-git-2961966b3badf38e4a0ae3ac46cb6bddfa2fe925.tar.gz |
Merge bk-internal:/home/bk/mysql-5.0-maint
into rama.(none):/home/jimw/my/mysql-5.0-clean
Diffstat (limited to 'include')
-rw-r--r-- | include/m_ctype.h | 5 | ||||
-rw-r--r-- | include/m_string.h | 3 | ||||
-rw-r--r-- | include/my_global.h | 22 | ||||
-rw-r--r-- | include/my_sys.h | 4 |
4 files changed, 28 insertions, 6 deletions
diff --git a/include/m_ctype.h b/include/m_ctype.h index 54ae41bf2e0..233e32585dc 100644 --- a/include/m_ctype.h +++ b/include/m_ctype.h @@ -184,7 +184,7 @@ typedef struct my_charset_handler_st /* Charset dependant snprintf() */ int (*snprintf)(struct charset_info_st *, char *to, uint n, const char *fmt, - ...); + ...) ATTRIBUTE_FORMAT(printf, 4, 5); int (*long10_to_str)(struct charset_info_st *, char *to, uint n, int radix, long int val); int (*longlong10_to_str)(struct charset_info_st *, char *to, uint n, @@ -319,7 +319,8 @@ int my_wc_mb_8bit(CHARSET_INFO *cs,my_wc_t wc, uchar *s, uchar *e); ulong my_scan_8bit(CHARSET_INFO *cs, const char *b, const char *e, int sq); int my_snprintf_8bit(struct charset_info_st *, char *to, uint n, - const char *fmt, ...); + const char *fmt, ...) + ATTRIBUTE_FORMAT(printf, 4, 5); long my_strntol_8bit(CHARSET_INFO *, const char *s, uint l, int base, char **e, int *err); diff --git a/include/m_string.h b/include/m_string.h index c02ce92cd88..8a526d70d1d 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -254,7 +254,8 @@ extern ulonglong strtoull(const char *str, char **ptr, int base); extern int my_vsnprintf( char *str, size_t n, const char *format, va_list ap ); -extern int my_snprintf(char* to, size_t n, const char* fmt, ...); +extern int my_snprintf(char *to, size_t n, const char *fmt, ...) + ATTRIBUTE_FORMAT(printf, 3, 4); #if defined(__cplusplus) && !defined(OS2) } diff --git a/include/my_global.h b/include/my_global.h index 4a9e1673de4..6363b5ac8d3 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -454,15 +454,35 @@ typedef unsigned short ushort; #define function_volatile volatile #define my_reinterpret_cast(A) reinterpret_cast<A> #define my_const_cast(A) const_cast<A> +# ifndef GCC_VERSION +# define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) +# endif #elif !defined(my_reinterpret_cast) #define my_reinterpret_cast(A) (A) #define my_const_cast(A) (A) #endif -#if !defined(__attribute__) && (defined(__cplusplus) || !defined(__GNUC__) || __GNUC__ == 2 && __GNUC_MINOR__ < 8) + +/* + Disable __attribute__() on GCC < 2.7 and non-GCC compilers +*/ +#if !defined(__attribute__) && (!defined(__GNUC__) || GCC_VERSION < 2007) #define __attribute__(A) #endif /* + __attribute__((format(...))) is only supported in gcc >= 2.8 and g++ >= 3.4 +*/ +#ifndef ATTRIBUTE_FORMAT +# if defined(__GNUC__) && \ + ((!defined(__cplusplus__) && GCC_VERSION >= 2008) || \ + GCC_VERSION >= 3004) +# define ATTRIBUTE_FORMAT(style, m, n) __attribute__((format(style, m, n))) +# else +# define ATTRIBUTE_FORMAT(style, m, n) +# endif +#endif + +/* Wen using the embedded library, users might run into link problems, duplicate declaration of __cxa_pure_virtual, solved by declaring it a weak symbol. diff --git a/include/my_sys.h b/include/my_sys.h index 9b283ace029..2c0ef955477 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -632,8 +632,8 @@ extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags); extern int my_sync(File fd, myf my_flags); extern int my_error _VARARGS((int nr,myf MyFlags, ...)); extern int my_printf_error _VARARGS((uint my_err, const char *format, - myf MyFlags, ...) - __attribute__ ((format (printf, 2, 4)))); + myf MyFlags, ...)) + ATTRIBUTE_FORMAT(printf, 2, 4); extern int my_error_register(const char **errmsgs, int first, int last); extern const char **my_error_unregister(int first, int last); extern int my_message(uint my_err, const char *str,myf MyFlags); |