]> Savannah Git Hosting - gnulib.git/commitdiff
apply _GL_ATTRIBUTE_PURE to some inline functions
authorPádraig Brady <P@draigBrady.com>
Sat, 6 Dec 2014 01:28:17 +0000 (01:28 +0000)
committerPádraig Brady <P@draigBrady.com>
Mon, 8 Dec 2014 10:20:34 +0000 (10:20 +0000)
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.

ChangeLog
lib/savewd.h
lib/sig-handler.h
lib/stat-time.h
lib/timespec.h

index 41207ea73e56a16abfe4276cb4d737c7cee532da..75b8eacf6cd2ed9c5d5dc0bb173eaec5459fe228 100644 (file)
--- 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
index cd0817b7ced3b8ddd98f6046f8791dede6716610..4d2d7d6dbc88d6ec606832b1f7f93be58a168135 100644 (file)
@@ -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);
index f4fe7eca87420fc8ea7360cfa0eca34a1af582b8..3af1a91c5b073d6bffcd6493c3eb377118f6124b 100644 (file)
@@ -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
index b3df6eb816d28aef1e5e5f80d541969143e15051..9cbf8e044d0417f2f95f51c497ca628ae561e763 100644 (file)
@@ -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;
index 872cbb76e3765261d4f4fbd191ad26f8c3ee8900..dfc1277a71fb66a21b62893c276d4720ceb5e2ba 100644 (file)
@@ -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;