]> Savannah Git Hosting - gnulib.git/commitdiff
xsize: Use module 'attribute'.
authorBruno Haible <bruno@clisp.org>
Fri, 8 May 2020 16:05:35 +0000 (18:05 +0200)
committerBruno Haible <bruno@clisp.org>
Fri, 8 May 2020 16:41:56 +0000 (18:41 +0200)
* lib/xsize.h: Include attribute.h. Use ATTRIBUTE_PURE.
* modules/xsize (Depends-on): Add attribute.

ChangeLog
lib/xsize.h
modules/xsize

index 0e0cc81ff81ed4b66d2bd3b67378a45eb3ac330b..df4f5d102ee36ebbb403f6a4f4212489703b857f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2020-05-08  Bruno Haible  <bruno@clisp.org>
+
+       xsize: Use module 'attribute'.
+       * lib/xsize.h: Include attribute.h. Use ATTRIBUTE_PURE.
+       * modules/xsize (Depends-on): Add attribute.
+
 2020-05-06  Paul Eggert  <eggert@cs.ucla.edu>
 
        * m4/gnulib-common.m4 (gl_COMMON_BODY): Minor style fixes.
index cd126772564f3709805cb8b43a70612893e665bc..8e5f14c8f37fc8623abeba616c318ebfcd9b4108 100644 (file)
@@ -27,6 +27,9 @@
 # include <stdint.h>
 #endif
 
+/* Get ATTRIBUTE_PURE.  */
+#include "attribute.h"
+
 #ifndef _GL_INLINE_HEADER_BEGIN
  #error "Please include config.h first."
 #endif
@@ -56,10 +59,7 @@ _GL_INLINE_HEADER_BEGIN
   ((N) <= SIZE_MAX ? (size_t) (N) : SIZE_MAX)
 
 /* Sum of two sizes, with overflow check.  */
-XSIZE_INLINE size_t
-#if __GNUC__ >= 3
-__attribute__ ((__pure__))
-#endif
+XSIZE_INLINE size_t ATTRIBUTE_PURE
 xsum (size_t size1, size_t size2)
 {
   size_t sum = size1 + size2;
@@ -67,30 +67,21 @@ xsum (size_t size1, size_t size2)
 }
 
 /* Sum of three sizes, with overflow check.  */
-XSIZE_INLINE size_t
-#if __GNUC__ >= 3
-__attribute__ ((__pure__))
-#endif
+XSIZE_INLINE size_t ATTRIBUTE_PURE
 xsum3 (size_t size1, size_t size2, size_t size3)
 {
   return xsum (xsum (size1, size2), size3);
 }
 
 /* Sum of four sizes, with overflow check.  */
-XSIZE_INLINE size_t
-#if __GNUC__ >= 3
-__attribute__ ((__pure__))
-#endif
+XSIZE_INLINE size_t ATTRIBUTE_PURE
 xsum4 (size_t size1, size_t size2, size_t size3, size_t size4)
 {
   return xsum (xsum (xsum (size1, size2), size3), size4);
 }
 
 /* Maximum of two sizes, with overflow check.  */
-XSIZE_INLINE size_t
-#if __GNUC__ >= 3
-__attribute__ ((__pure__))
-#endif
+XSIZE_INLINE size_t ATTRIBUTE_PURE
 xmax (size_t size1, size_t size2)
 {
   /* No explicit check is needed here, because for any n:
index a13eb867ff1c152a2bf8bd079bacbce6934bb375..3b2ad56681ada792e047026ce56a62cff6fdbd83 100644 (file)
@@ -7,6 +7,7 @@ lib/xsize.c
 m4/xsize.m4
 
 Depends-on:
+attribute
 extern-inline
 size_max