]> Savannah Git Hosting - gnulib.git/commitdiff
attribute: improve const, pure doc
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 10 Oct 2020 18:48:16 +0000 (11:48 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 10 Oct 2020 18:48:50 +0000 (11:48 -0700)
Problem reported by Marc Nieper-Wißkirchen in:
https://lists.gnu.org/r/bug-gnulib/2020-10/msg00035.html
* lib/attribute.h (ATTRIBUTE_CONST, ATTRIBUTE_PURE): Improv doc.  See:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51971#c1

ChangeLog
lib/attribute.h

index 875f3551ad714e7136555a3191201913b0b73e38..b479cf0c77df4293493d44f7d5b1c448d463347a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2020-10-10  Paul Eggert  <eggert@cs.ucla.edu>
+
+       attribute: improve const, pure doc
+       Problem reported by Marc Nieper-Wißkirchen in:
+       https://lists.gnu.org/r/bug-gnulib/2020-10/msg00035.html
+       * lib/attribute.h (ATTRIBUTE_CONST, ATTRIBUTE_PURE): Improv doc.  See:
+       https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51971#c1
+
 2020-10-05  Paul Eggert  <eggert@cs.ucla.edu>
 
        thread: pacify GCC on Solaris 10
index b97514655f39b7ab72ba8734208a605486d17fbc..48d9826c87b7c2618090ea6e1d976581da677aea 100644 (file)
 /* Applies to: function.  */
 #define ATTRIBUTE_ALWAYS_INLINE _GL_ATTRIBUTE_ALWAYS_INLINE
 
-/* The function does not affect observable state, and always returns a value.
-   Compilers can omit duplicate calls with the same arguments if
-   observable state is not changed between calls.  (This attribute is
-   looser than ATTRIBUTE_CONST.)  */
+/* It is OK for a compiler to omit duplicate calls with the same arguments.
+   This attribute is safe for a function that neither depends on
+   nor affects observable state, and always returns exactly once -
+   e.g., does not loop forever, and does not call longjmp.
+   (This attribute is stricter than ATTRIBUTE_PURE.)  */
 /* Applies to: functions.  */
-#define ATTRIBUTE_PURE _GL_ATTRIBUTE_PURE
+#define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST
 
-/* The function neither depends on nor affects observable state,
-   and always returns a value.  Compilers can omit duplicate calls with
-   the same arguments.  (This attribute is stricter than ATTRIBUTE_PURE.)  */
+/* It is OK for a compiler to omit duplicate calls with the same
+   arguments if observable state is not changed between calls.
+   This attribute is safe for a function that does not affect
+   observable state, and always returns exactly once.
+   (This attribute is looser than ATTRIBUTE_CONST.)  */
 /* Applies to: functions.  */
-#define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST
+#define ATTRIBUTE_PURE _GL_ATTRIBUTE_PURE
 
 /* The function is rarely executed.  */
 /* Applies to: functions.  */