This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] build: don't use attribute((leaf)) on static functions


Inspired by a recent change to glob, I checked for other
misuse of __THROW using:

$ git grep -l 'static.*THROW\b'

and then expanding to:

$ git grep -A5 'static.*(.*[^;]$' -- '**/*.c' | grep -B5 'THROW\b'^C

Remember, attribute((leaf)) makes sense only for extern
functions, and as some versions of gcc warn about its use
on static functions, using __THROWNL for those will have
no change in intended semantics.

* debug/vsprintf_chk.c (_IO_str_chk_overflow): Switch to __THROWNL.
* libio/memstream.c (_IO_mem_sync, _IO_mem_finish): Likewise.
* libio/oldstdfiles.c (_IO_check_libio): Likewise.
* libio/vsnprintf.c (_IO_strn_overflow): Likewise.
* libio/vswprintf.c (_IO_wstrn_overflow): Likewise.
* libio/wgenops.c (save_for_wbackup): Likewise.
* libio/wmemstream.c (_IO_wmem_sync, _IO_wmem_finish): Likewise.
* locale/programs/xmalloc.c (fixup_null_alloc): Likewise.
* malloc/malloc.c (malloc_hook_ini, realloc_hook_ini)
(memalign_hook_ini): Likewise.
* malloc/mtrace.c (tr_where, tr_freehook, tr_mallochook)
(tr_reallochook): Likewise.
* misc/getttyent.c (skip, value): Likewise.
* misc/getusershell.c (initshells): Likewise.
* resolv/gethnamaddr.c (map_v4v6_address, map_v4v6_hostent): Likewise.
* resolv/inet_net_ntop.c (inet_net_ntop_ipv4): Likewise.
* resolv/inet_net_pton.c (inet-net_pton_ipv4): Likewise.
* resolv/res_init.c (net_mask): Likewise.
* stdio-common/vfprintf.c (buffered_vfprintf, printf_unknown)
(group_number): Likewise.
* string/memcmp.c (memcmp_bytes, memcmp_common_alignment)
(memcmp_not_common_alignment): Likewise.
* sysdeps/posix/sigvec.c (sigvec_wrapper_handler): Likewise.
* sysdeps/posix/ttyname_r.c (getttyname_r): Likewise.
* time/strftime_l.c (tm_diff, iso_week_days, memcpy_lowcase)
(memcpy_uppcase, __strftime_internal): Likewise.
* time/tzset.c (compute_change, tzset_internal): Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
---
 ChangeLog                 | 29 +++++++++++++++++++++++++++++
 debug/vsprintf_chk.c      |  2 +-
 libio/memstream.c         |  4 ++--
 libio/oldstdfiles.c       |  2 +-
 libio/vsnprintf.c         |  2 +-
 libio/vswprintf.c         |  2 +-
 libio/wgenops.c           |  2 +-
 libio/wmemstream.c        |  4 ++--
 locale/programs/xmalloc.c |  2 +-
 malloc/malloc.c           |  6 +++---
 malloc/mtrace.c           | 10 +++++-----
 misc/getttyent.c          |  4 ++--
 misc/getusershell.c       |  2 +-
 resolv/gethnamaddr.c      |  4 ++--
 resolv/inet_net_ntop.c    |  2 +-
 resolv/inet_net_pton.c    |  2 +-
 resolv/res_init.c         |  2 +-
 stdio-common/vfprintf.c   |  8 ++++----
 string/memcmp.c           |  6 +++---
 sysdeps/posix/sigvec.c    |  2 +-
 sysdeps/posix/ttyname_r.c |  2 +-
 time/strftime_l.c         | 10 +++++-----
 time/tzset.c              |  5 +++--
 23 files changed, 72 insertions(+), 42 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 62fa5f5..79c4cb0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,34 @@
 2013-10-01  Eric Blake  <eblake@redhat.com>

+	build: don't use attribute((leaf)) on static functions
+	* debug/vsprintf_chk.c (_IO_str_chk_overflow): Switch to __THROWNL.
+	* libio/memstream.c (_IO_mem_sync, _IO_mem_finish): Likewise.
+	* libio/oldstdfiles.c (_IO_check_libio): Likewise.
+	* libio/vsnprintf.c (_IO_strn_overflow): Likewise.
+	* libio/vswprintf.c (_IO_wstrn_overflow): Likewise.
+	* libio/wgenops.c (save_for_wbackup): Likewise.
+	* libio/wmemstream.c (_IO_wmem_sync, _IO_wmem_finish): Likewise.
+	* locale/programs/xmalloc.c (fixup_null_alloc): Likewise.
+	* malloc/malloc.c (malloc_hook_ini, realloc_hook_ini)
+	(memalign_hook_ini): Likewise.
+	* malloc/mtrace.c (tr_where, tr_freehook, tr_mallochook)
+	(tr_reallochook): Likewise.
+	* misc/getttyent.c (skip, value): Likewise.
+	* misc/getusershell.c (initshells): Likewise.
+	* resolv/gethnamaddr.c (map_v4v6_address, map_v4v6_hostent): Likewise.
+	* resolv/inet_net_ntop.c (inet_net_ntop_ipv4): Likewise.
+	* resolv/inet_net_pton.c (inet-net_pton_ipv4): Likewise.
+	* resolv/res_init.c (net_mask): Likewise.
+	* stdio-common/vfprintf.c (buffered_vfprintf, printf_unknown)
+	(group_number): Likewise.
+	* string/memcmp.c (memcmp_bytes, memcmp_common_alignment)
+	(memcmp_not_common_alignment): Likewise.
+	* sysdeps/posix/sigvec.c (sigvec_wrapper_handler): Likewise.
+	* sysdeps/posix/ttyname_r.c (getttyname_r): Likewise.
+	* time/strftime_l.c (tm_diff, iso_week_days, memcpy_lowcase)
+	(memcpy_uppcase, __strftime_internal): Likewise.
+	* time/tzset.c (compute_change, tzset_internal): Likewise.
+
 	[BZ #10635]
 	realpath: don't lose errno on failure
 	* stdlib/canonicalize.c (__realpath): Avoid clobbering errno
diff --git a/debug/vsprintf_chk.c b/debug/vsprintf_chk.c
index d1ed6b2..c15389d 100644
--- a/debug/vsprintf_chk.c
+++ b/debug/vsprintf_chk.c
@@ -21,7 +21,7 @@
 #include "../libio/strfile.h"


-static int _IO_str_chk_overflow (_IO_FILE *fp, int c) __THROW;
+static int _IO_str_chk_overflow (_IO_FILE *fp, int c) __THROWNL;

 static int
 _IO_str_chk_overflow (fp, c)
diff --git a/libio/memstream.c b/libio/memstream.c
index 3cb1bd7..26af35e 100644
--- a/libio/memstream.c
+++ b/libio/memstream.c
@@ -29,8 +29,8 @@ struct _IO_FILE_memstream
 };


-static int _IO_mem_sync (_IO_FILE* fp) __THROW;
-static void _IO_mem_finish (_IO_FILE* fp, int) __THROW;
+static int _IO_mem_sync (_IO_FILE* fp) __THROWNL;
+static void _IO_mem_finish (_IO_FILE* fp, int) __THROWNL;


 static const struct _IO_jump_t _IO_mem_jumps =
diff --git a/libio/oldstdfiles.c b/libio/oldstdfiles.c
index b02c62d..5c80d21 100644
--- a/libio/oldstdfiles.c
+++ b/libio/oldstdfiles.c
@@ -66,7 +66,7 @@ extern FILE *stdin;
 extern FILE *stdout;
 extern FILE *stderr;

-static void _IO_check_libio (void) __THROW __attribute__ ((constructor));
+static void _IO_check_libio (void) __THROWNL __attribute__ ((constructor));

 /* This function determines which shared C library the application
    was linked against. We then set up the stdin/stdout/stderr and
diff --git a/libio/vsnprintf.c b/libio/vsnprintf.c
index 865ccac..c61c6a1 100644
--- a/libio/vsnprintf.c
+++ b/libio/vsnprintf.c
@@ -27,7 +27,7 @@
 #include "libioP.h"
 #include "strfile.h"

-static int _IO_strn_overflow (_IO_FILE *fp, int c) __THROW;
+static int _IO_strn_overflow (_IO_FILE *fp, int c) __THROWNL;

 static int
 _IO_strn_overflow (fp, c)
diff --git a/libio/vswprintf.c b/libio/vswprintf.c
index 136bda8..4765fab 100644
--- a/libio/vswprintf.c
+++ b/libio/vswprintf.c
@@ -28,7 +28,7 @@
 #include "strfile.h"


-static wint_t _IO_wstrn_overflow (_IO_FILE *fp, wint_t c) __THROW;
+static wint_t _IO_wstrn_overflow (_IO_FILE *fp, wint_t c) __THROWNL;

 static wint_t
 _IO_wstrn_overflow (fp, c)
diff --git a/libio/wgenops.c b/libio/wgenops.c
index b39b691..f630451 100644
--- a/libio/wgenops.c
+++ b/libio/wgenops.c
@@ -39,7 +39,7 @@
 #endif


-static int save_for_wbackup (_IO_FILE *fp, wchar_t *end_p) __THROW
+static int save_for_wbackup (_IO_FILE *fp, wchar_t *end_p) __THROWNL
 #ifdef _LIBC
      internal_function
 #endif
diff --git a/libio/wmemstream.c b/libio/wmemstream.c
index fd7fe44..572b71a 100644
--- a/libio/wmemstream.c
+++ b/libio/wmemstream.c
@@ -30,8 +30,8 @@ struct _IO_FILE_wmemstream
 };


-static int _IO_wmem_sync (_IO_FILE* fp) __THROW;
-static void _IO_wmem_finish (_IO_FILE* fp, int) __THROW;
+static int _IO_wmem_sync (_IO_FILE* fp) __THROWNL;
+static void _IO_wmem_finish (_IO_FILE* fp, int) __THROWNL;


 static const struct _IO_jump_t _IO_wmem_jumps =
diff --git a/locale/programs/xmalloc.c b/locale/programs/xmalloc.c
index 2a3751e..3de4359 100644
--- a/locale/programs/xmalloc.c
+++ b/locale/programs/xmalloc.c
@@ -25,7 +25,7 @@

 #if STDC_HEADERS || _LIBC
 #include <stdlib.h>
-static VOID *fixup_null_alloc (size_t n) __THROW;
+static VOID *fixup_null_alloc (size_t n) __THROWNL;
 VOID *xmalloc (size_t n) __THROW;
 VOID *xcalloc (size_t n, size_t s) __THROW;
 VOID *xrealloc (VOID *p, size_t n) __THROW;
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 2938234..fb6561d 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -1841,11 +1841,11 @@ static void     malloc_consolidate(mstate);

 /* Forward declarations.  */
 static void* malloc_hook_ini (size_t sz,
-			      const void *caller) __THROW;
+			      const void *caller) __THROWNL;
 static void* realloc_hook_ini (void* ptr, size_t sz,
-			       const void *caller) __THROW;
+			       const void *caller) __THROWNL;
 static void* memalign_hook_ini (size_t alignment, size_t sz,
-				const void *caller) __THROW;
+				const void *caller) __THROWNL;

 void weak_variable (*__malloc_initialize_hook) (void) = NULL;
 void weak_variable (*__free_hook) (void *__ptr,
diff --git a/malloc/mtrace.c b/malloc/mtrace.c
index ee94133..98761b1 100644
--- a/malloc/mtrace.c
+++ b/malloc/mtrace.c
@@ -77,7 +77,7 @@ tr_break (void)
 }
 libc_hidden_def (tr_break)

-static void tr_where (const __ptr_t, Dl_info *) __THROW internal_function;
+static void tr_where (const __ptr_t, Dl_info *) __THROWNL internal_function;
 static void
 internal_function
 tr_where (caller, info)
@@ -130,7 +130,7 @@ lock_and_info (const __ptr_t caller, Dl_info *mem)
 }


-static void tr_freehook (__ptr_t, const __ptr_t) __THROW;
+static void tr_freehook (__ptr_t, const __ptr_t) __THROWNL;
 static void
 tr_freehook (ptr, caller)
      __ptr_t ptr;
@@ -159,7 +159,7 @@ tr_freehook (ptr, caller)
   __libc_lock_unlock (lock);
 }

-static __ptr_t tr_mallochook (size_t, const __ptr_t) __THROW;
+static __ptr_t tr_mallochook (size_t, const __ptr_t) __THROWNL;
 static __ptr_t
 tr_mallochook (size, caller)
      size_t size;
@@ -190,7 +190,7 @@ tr_mallochook (size, caller)
 }

 static __ptr_t tr_reallochook (__ptr_t, size_t, const __ptr_t)
-     __THROW;
+     __THROWNL;
 static __ptr_t
 tr_reallochook (ptr, size, caller)
      __ptr_t ptr;
@@ -243,7 +243,7 @@ tr_reallochook (ptr, size, caller)
 }

 static __ptr_t tr_memalignhook (size_t, size_t,
-				const __ptr_t) __THROW;
+				const __ptr_t) __THROWNL;
 static __ptr_t
 tr_memalignhook (alignment, size, caller)
      size_t alignment, size;
diff --git a/misc/getttyent.c b/misc/getttyent.c
index 864f65f..806b799 100644
--- a/misc/getttyent.c
+++ b/misc/getttyent.c
@@ -57,8 +57,8 @@ getttynam(tty)
 	return (t);
 }

-static char *skip (char *) __THROW internal_function;
-static char *value (char *) __THROW internal_function;
+static char *skip (char *) __THROWNL internal_function;
+static char *value (char *) __THROWNL internal_function;

 struct ttyent *
 getttyent (void)
diff --git a/misc/getusershell.c b/misc/getusershell.c
index fc2c43b..e2b6024 100644
--- a/misc/getusershell.c
+++ b/misc/getusershell.c
@@ -56,7 +56,7 @@ static const char *const okshells[] = { _PATH_BSHELL, _PATH_CSHELL, NULL };
 static const char *okshells[3];
 #endif
 static char **curshell, **shells, *strings;
-static char **initshells (void) __THROW;
+static char **initshells (void) __THROWNL;

 /*
  * Get a list of shells from _PATH_SHELLS, if it exists.
diff --git a/resolv/gethnamaddr.c b/resolv/gethnamaddr.c
index 1fd8f92..f7ce4a5 100644
--- a/resolv/gethnamaddr.c
+++ b/resolv/gethnamaddr.c
@@ -107,8 +107,8 @@ static u_char host_addr[16];	/* IPv4 or IPv6 */
 static FILE *hostf = NULL;
 static int stayopen = 0;

-static void map_v4v6_address (const char *src, char *dst) __THROW;
-static void map_v4v6_hostent (struct hostent *hp, char **bp, int *len) __THROW;
+static void map_v4v6_address (const char *src, char *dst) __THROWNL;
+static void map_v4v6_hostent (struct hostent *hp, char **bp, int *len) __THROWNL;

 #ifdef RESOLVSORT
 extern void addrsort (char **, int) __THROW;
diff --git a/resolv/inet_net_ntop.c b/resolv/inet_net_ntop.c
index e50c6a0..432eba5 100644
--- a/resolv/inet_net_ntop.c
+++ b/resolv/inet_net_ntop.c
@@ -36,7 +36,7 @@ static const char rcsid[] = "$BINDId: inet_net_ntop.c,v 1.6 1999/01/08 19:23:42
 #endif

 static char *	inet_net_ntop_ipv4 (const u_char *src, int bits,
-				    char *dst, size_t size) __THROW;
+				    char *dst, size_t size) __THROWNL;

 /*
  * char *
diff --git a/resolv/inet_net_pton.c b/resolv/inet_net_pton.c
index 14916f8..b4d257c 100644
--- a/resolv/inet_net_pton.c
+++ b/resolv/inet_net_pton.c
@@ -38,7 +38,7 @@ static const char rcsid[] = "$BINDId: inet_net_pton.c,v 1.11 1999/01/08 19:23:44
 #endif

 static int	inet_net_pton_ipv4 (const char *src, u_char *dst,
-				    size_t size) __THROW;
+				    size_t size) __THROWNL;

 /*
  * static int
diff --git a/resolv/res_init.c b/resolv/res_init.c
index 5e1a747..46abb92 100644
--- a/resolv/res_init.c
+++ b/resolv/res_init.c
@@ -100,7 +100,7 @@ static void res_setoptions (res_state, const char *, const char *)
 #ifdef RESOLVSORT
 static const char sort_mask_chars[] = "/&";
 #define ISSORTMASK(ch) (strchr(sort_mask_chars, ch) != NULL)
-static u_int32_t net_mask (struct in_addr) __THROW;
+static u_int32_t net_mask (struct in_addr) __THROWNL;
 #endif

 #if !defined(isascii)	/* XXX - could be a function */
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index fb22f69..ee6715c 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -200,19 +200,19 @@ static const CHAR_T null[] = L_("(null)");

 /* Helper function to provide temporary buffering for unbuffered streams.  */
 static int buffered_vfprintf (FILE *stream, const CHAR_T *fmt, va_list)
-     __THROW __attribute__ ((noinline)) internal_function;
+     __THROWNL __attribute__ ((noinline)) internal_function;

 /* Handle unknown format specifier.  */
 static int printf_unknown (FILE *, const struct printf_info *,
-			   const void *const *) __THROW;
+			   const void *const *) __THROWNL;

 /* Group digits of number string.  */
 #ifdef COMPILE_WPRINTF
 static CHAR_T *group_number (CHAR_T *, CHAR_T *, const char *, wchar_t)
-     __THROW internal_function;
+     __THROWNL internal_function;
 #else
 static CHAR_T *group_number (CHAR_T *, CHAR_T *, const char *, const char *)
-     __THROW internal_function;
+     __THROWNL internal_function;
 #endif


diff --git a/string/memcmp.c b/string/memcmp.c
index dd76145..282effa 100644
--- a/string/memcmp.c
+++ b/string/memcmp.c
@@ -86,7 +86,7 @@ typedef unsigned char byte;
    A and B are known to be different.
    This is needed only on little-endian machines.  */

-static int memcmp_bytes (op_t, op_t) __THROW;
+static int memcmp_bytes (op_t, op_t) __THROWNL;

 static int
 memcmp_bytes (a, b)
@@ -108,7 +108,7 @@ memcmp_bytes (a, b)
 }
 #endif

-static int memcmp_common_alignment (long, long, size_t) __THROW;
+static int memcmp_common_alignment (long, long, size_t) __THROWNL;

 /* memcmp_common_alignment -- Compare blocks at SRCP1 and SRCP2 with LEN `op_t'
    objects (not LEN bytes!).  Both SRCP1 and SRCP2 should be aligned for
@@ -195,7 +195,7 @@ memcmp_common_alignment (srcp1, srcp2, len)
   return 0;
 }

-static int memcmp_not_common_alignment (long, long, size_t) __THROW;
+static int memcmp_not_common_alignment (long, long, size_t) __THROWNL;

 /* memcmp_not_common_alignment -- Compare blocks at SRCP1 and SRCP2 with LEN
    `op_t' objects (not LEN bytes!).  SRCP2 should be aligned for memory
diff --git a/sysdeps/posix/sigvec.c b/sysdeps/posix/sigvec.c
index e3a453e..177f2ab 100644
--- a/sysdeps/posix/sigvec.c
+++ b/sysdeps/posix/sigvec.c
@@ -31,7 +31,7 @@ struct sigvec_wrapper_data
   unsigned int sw_mask;
 };

-static void sigvec_wrapper_handler (int sig) __THROW;
+static void sigvec_wrapper_handler (int sig) __THROWNL;

 static struct sigvec_wrapper_data sigvec_wrapper_data[NSIG];
 #endif
diff --git a/sysdeps/posix/ttyname_r.c b/sysdeps/posix/ttyname_r.c
index 239f384..47a4eac 100644
--- a/sysdeps/posix/ttyname_r.c
+++ b/sysdeps/posix/ttyname_r.c
@@ -33,7 +33,7 @@ static const char dev[] = "/dev";

 static int getttyname_r (int fd, char *buf, size_t buflen,
 			 dev_t mydev, ino_t myino, int save,
-			 int *dostat) __THROW internal_function;
+			 int *dostat) __THROWNL internal_function;

 static int
 internal_function
diff --git a/time/strftime_l.c b/time/strftime_l.c
index cf7d1a7..6901219 100644
--- a/time/strftime_l.c
+++ b/time/strftime_l.c
@@ -329,7 +329,7 @@ static const CHAR_T zeroes[16] = /* "0000000000000000" */
 #define ISDIGIT(Ch) ((unsigned int) (Ch) - L_('0') <= 9)

 static CHAR_T *memcpy_lowcase (CHAR_T *dest, const CHAR_T *src,
-			       size_t len LOCALE_PARAM_PROTO) __THROW;
+			       size_t len LOCALE_PARAM_PROTO) __THROWNL;

 static CHAR_T *
 memcpy_lowcase (dest, src, len LOCALE_PARAM)
@@ -344,7 +344,7 @@ memcpy_lowcase (dest, src, len LOCALE_PARAM)
 }

 static CHAR_T *memcpy_uppcase (CHAR_T *dest, const CHAR_T *src,
-			       size_t len LOCALE_PARAM_PROTO) __THROW;
+			       size_t len LOCALE_PARAM_PROTO) __THROWNL;

 static CHAR_T *
 memcpy_uppcase (dest, src, len LOCALE_PARAM)
@@ -363,7 +363,7 @@ memcpy_uppcase (dest, src, len LOCALE_PARAM)
 /* Yield the difference between *A and *B,
    measured in seconds, ignoring leap seconds.  */
 # define tm_diff ftime_tm_diff
-static int tm_diff (const struct tm *, const struct tm *) __THROW;
+static int tm_diff (const struct tm *, const struct tm *) __THROWNL;
 static int
 tm_diff (a, b)
      const struct tm *a;
@@ -397,7 +397,7 @@ tm_diff (a, b)
 #define ISO_WEEK_START_WDAY 1 /* Monday */
 #define ISO_WEEK1_WDAY 4 /* Thursday */
 #define YDAY_MINIMUM (-366)
-static int iso_week_days (int, int) __THROW;
+static int iso_week_days (int, int) __THROWNL;
 #ifdef __GNUC__
 __inline__
 #endif
@@ -452,7 +452,7 @@ static CHAR_T const month_name[][10] =
 static size_t __strftime_internal (CHAR_T *, size_t, const CHAR_T *,
 				   const struct tm *, bool *
 				   ut_argument_spec_iso
-				   LOCALE_PARAM_PROTO) __THROW;
+				   LOCALE_PARAM_PROTO) __THROWNL;

 /* Write information from TP into S according to the format
    string FORMAT, writing no more that MAXSIZE characters
diff --git a/time/tzset.c b/time/tzset.c
index 4f8af8d..4b6cf85 100644
--- a/time/tzset.c
+++ b/time/tzset.c
@@ -68,9 +68,10 @@ typedef struct
 static tz_rule tz_rules[2];


-static void compute_change (tz_rule *rule, int year) __THROW internal_function;
+static void compute_change (tz_rule *rule, int year)
+     __THROWNL internal_function;
 static void tzset_internal (int always, int explicit)
-     __THROW internal_function;
+     __THROWNL internal_function;
 
 /* List of buffers containing time zone strings. */
 struct tzstring_l
-- 
1.8.3.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]