Commit 3c411c43 authored by Pádraig Brady's avatar Pádraig Brady

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.
parent ec6a60bf
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
......@@ -125,7 +125,7 @@ int savewd_chdir (struct savewd *wd, char const *dir, int options,
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);
......
......@@ -34,7 +34,7 @@ typedef void (*sa_handler_t) (int);
/* 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
......
......@@ -54,7 +54,7 @@ _GL_INLINE_HEADER_BEGIN
#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 @@ get_stat_atime_ns (struct stat const *st)
}
/* 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 @@ get_stat_ctime_ns (struct stat const *st)
}
/* 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 @@ get_stat_mtime_ns (struct stat const *st)
}
/* 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 @@ get_stat_birthtime_ns (struct stat const *st)
}
/* 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 @@ get_stat_atime (struct stat const *st)
}
/* 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 @@ get_stat_ctime (struct stat const *st)
}
/* 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 @@ get_stat_mtime (struct stat const *st)
/* 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;
......
......@@ -74,7 +74,7 @@ make_timespec (time_t s, long int ns)
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 @@ timespec_cmp (struct timespec a, struct timespec b)
/* 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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment