Mercurial > hg > octave-nkf > gnulib-hg
changeset 17820:5ca75b20ebc2
apply _GL_ATTRIBUTE_PURE to some inline functions
clang 3.4.2 flagged these inline functions as pure
* lib/savewd.h (savewd_errno): Set _GL_ATTRIBUTE_PURE.
* lib/sig-handler.h (get_handler): Likewise.
* lib/stat-time.h (get_stat_{a,c,m,birth}time{,_ns}): Likewise.
* lib/timespec.h (timespec_cmp, timespec_sign): Likewise.
author | Pádraig Brady <P@draigBrady.com> |
---|---|
date | Sat, 06 Dec 2014 01:28:17 +0000 |
parents | 2c202161ad79 |
children | 2b1ae4b1a0ae |
files | ChangeLog lib/savewd.h lib/sig-handler.h lib/stat-time.h lib/timespec.h |
diffstat | 5 files changed, 21 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2014-12-08 Pádraig Brady <P@draigBrady.com> + + apply _GL_ATTRIBUTE_PURE to some inline functions + clang 3.4.2 flagged these inline functions as pure + * lib/savewd.h (savewd_errno): Set _GL_ATTRIBUTE_PURE. + * lib/sig-handler.h (get_handler): Likewise. + * lib/stat-time.h (get_stat_{a,c,m,birth}time{,_ns}): Likewise. + * lib/timespec.h (timespec_cmp, timespec_sign): Likewise. + 2014-12-06 Pádraig Brady <P@draigBrady.com> vasnprintf: fix potential use after free
--- a/lib/savewd.h +++ b/lib/savewd.h @@ -125,7 +125,7 @@ int savewd_restore (struct savewd *wd, int status); /* Return WD's error number, or 0 if WD is not in an error state. */ -SAVEWD_INLINE int +SAVEWD_INLINE int _GL_ATTRIBUTE_PURE savewd_errno (struct savewd const *wd) { return (wd->state == ERROR_STATE ? wd->val.errnum : 0);
--- a/lib/sig-handler.h +++ b/lib/sig-handler.h @@ -34,7 +34,7 @@ /* Return the handler of a signal, as a sa_handler_t value regardless of its true type. The resulting function can be compared to special values like SIG_IGN but it is not portable to call it. */ -SIG_HANDLER_INLINE sa_handler_t +SIG_HANDLER_INLINE sa_handler_t _GL_ATTRIBUTE_PURE get_handler (struct sigaction const *a) { #ifdef SA_SIGINFO
--- a/lib/stat-time.h +++ b/lib/stat-time.h @@ -54,7 +54,7 @@ #endif /* Return the nanosecond component of *ST's access time. */ -_GL_STAT_TIME_INLINE long int +_GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE get_stat_atime_ns (struct stat const *st) { # if defined STAT_TIMESPEC @@ -67,7 +67,7 @@ } /* Return the nanosecond component of *ST's status change time. */ -_GL_STAT_TIME_INLINE long int +_GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE get_stat_ctime_ns (struct stat const *st) { # if defined STAT_TIMESPEC @@ -80,7 +80,7 @@ } /* Return the nanosecond component of *ST's data modification time. */ -_GL_STAT_TIME_INLINE long int +_GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE get_stat_mtime_ns (struct stat const *st) { # if defined STAT_TIMESPEC @@ -93,7 +93,7 @@ } /* Return the nanosecond component of *ST's birth time. */ -_GL_STAT_TIME_INLINE long int +_GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE get_stat_birthtime_ns (struct stat const *st) { # if defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC @@ -108,7 +108,7 @@ } /* Return *ST's access time. */ -_GL_STAT_TIME_INLINE struct timespec +_GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE get_stat_atime (struct stat const *st) { #ifdef STAT_TIMESPEC @@ -122,7 +122,7 @@ } /* Return *ST's status change time. */ -_GL_STAT_TIME_INLINE struct timespec +_GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE get_stat_ctime (struct stat const *st) { #ifdef STAT_TIMESPEC @@ -136,7 +136,7 @@ } /* Return *ST's data modification time. */ -_GL_STAT_TIME_INLINE struct timespec +_GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE get_stat_mtime (struct stat const *st) { #ifdef STAT_TIMESPEC @@ -151,7 +151,7 @@ /* Return *ST's birth time, if available; otherwise return a value with tv_sec and tv_nsec both equal to -1. */ -_GL_STAT_TIME_INLINE struct timespec +_GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE get_stat_birthtime (struct stat const *st) { struct timespec t;
--- a/lib/timespec.h +++ b/lib/timespec.h @@ -74,7 +74,7 @@ The (int) cast avoids a gcc -Wconversion warning. */ -_GL_TIMESPEC_INLINE int +_GL_TIMESPEC_INLINE int _GL_ATTRIBUTE_PURE timespec_cmp (struct timespec a, struct timespec b) { return (a.tv_sec < b.tv_sec ? -1 @@ -84,7 +84,7 @@ /* Return -1, 0, 1, depending on the sign of A. A.tv_nsec must be nonnegative. */ -_GL_TIMESPEC_INLINE int +_GL_TIMESPEC_INLINE int _GL_ATTRIBUTE_PURE timespec_sign (struct timespec a) { return a.tv_sec < 0 ? -1 : a.tv_sec || a.tv_nsec;