From 5ac3ea17df811a71fa64aff78ea1b900facd3364 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Sun, 29 Apr 2012 15:34:20 +0200 Subject: Fix attributes for fortify functions. --- misc/bits/syslog-ldbl.h | 4 ++-- misc/bits/syslog.h | 4 ++-- misc/sys/cdefs.h | 23 +++++++++++------------ misc/sys/syslog.h | 2 +- 4 files changed, 16 insertions(+), 17 deletions(-) (limited to 'misc') diff --git a/misc/bits/syslog-ldbl.h b/misc/bits/syslog-ldbl.h index f71dbb46fd..bd70a51911 100644 --- a/misc/bits/syslog-ldbl.h +++ b/misc/bits/syslog-ldbl.h @@ -1,5 +1,5 @@ /* -mlong-double-64 compatibility mode for syslog functions. - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -26,7 +26,7 @@ __LDBL_REDIR_DECL (syslog) __LDBL_REDIR_DECL (vsyslog) #endif -#if __USE_FORTIFY_LEVEL > 0 && defined __extern_always_inline +#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function __LDBL_REDIR_DECL (__syslog_chk) # ifdef __USE_BSD diff --git a/misc/bits/syslog.h b/misc/bits/syslog.h index dc7c75be50..f9af61dce9 100644 --- a/misc/bits/syslog.h +++ b/misc/bits/syslog.h @@ -25,7 +25,7 @@ extern void __syslog_chk (int __pri, int __flag, const char *__fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4))); #ifdef __va_arg_pack -__extern_always_inline void +__fortify_function void syslog (int __pri, const char *__fmt, ...) { __syslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ()); @@ -41,7 +41,7 @@ extern void __vsyslog_chk (int __pri, int __flag, const char *__fmt, __gnuc_va_list __ap) __attribute__ ((__format__ (__printf__, 3, 0))); -__extern_always_inline void +__fortify_function void vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap) { __vsyslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h index 724f26e399..f4e96dbe6a 100644 --- a/misc/sys/cdefs.h +++ b/misc/sys/cdefs.h @@ -140,6 +140,7 @@ /* Fortify support. */ #define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1) #define __bos0(ptr) __builtin_object_size (ptr, 0) +#define __fortify_function __extern_always_inline __attribute_artificial__ #if __GNUC_PREREQ (4,3) # define __warndecl(name, msg) \ @@ -309,26 +310,24 @@ # define __always_inline __inline #endif +/* Associate error messages with the source location of the call site rather + than with the source location inside the function. */ +#if __GNUC_PREREQ (4,3) +# define __attribute_artificial__ __attribute__ ((__artificial__)) +#else +# define __attribute_artificial__ /* Ignore */ +#endif + /* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 inline semantics, unless -fgnu89-inline is used. */ #if !defined __cplusplus || __GNUC_PREREQ (4,3) # if defined __GNUC_STDC_INLINE__ || defined __cplusplus # define __extern_inline extern __inline __attribute__ ((__gnu_inline__)) -# if __GNUC_PREREQ (4,3) -# define __extern_always_inline \ - extern __always_inline __attribute__ ((__gnu_inline__, __artificial__)) -# else -# define __extern_always_inline \ +# define __extern_always_inline \ extern __always_inline __attribute__ ((__gnu_inline__)) -# endif # else # define __extern_inline extern __inline -# if __GNUC_PREREQ (4,3) -# define __extern_always_inline \ - extern __always_inline __attribute__ ((__artificial__)) -# else -# define __extern_always_inline extern __always_inline -# endif +# define __extern_always_inline extern __always_inline # endif #endif diff --git a/misc/sys/syslog.h b/misc/sys/syslog.h index aed419e446..77123ab503 100644 --- a/misc/sys/syslog.h +++ b/misc/sys/syslog.h @@ -203,7 +203,7 @@ extern void vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap) /* Define some macros helping to catch buffer overflows. */ -#if __USE_FORTIFY_LEVEL > 0 && defined __extern_always_inline +#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function # include #endif #ifdef __LDBL_COMPAT -- cgit v1.2.3