]> Savannah Git Hosting - gnulib.git/commitdiff
Clarify _GL_ATTRIBUTE_NODISCARD code.
authorBruno Haible <bruno@clisp.org>
Sat, 28 Jan 2023 19:22:02 +0000 (20:22 +0100)
committerBruno Haible <bruno@clisp.org>
Fri, 10 Feb 2023 02:26:01 +0000 (03:26 +0100)
Reported by Paul Eggert.

* m4/gnulib-common.m4 (gl_COMMON_BODY): Add comment regarding
_GL_ATTRIBUTE_NODISCARD definition.

ChangeLog
m4/gnulib-common.m4

index 4c8197821edf6b34a481f14d8d8f344dacbf2fdc..c78d93a6590723af76f943e9c260019b737d6095 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2023-01-28  Bruno Haible  <bruno@clisp.org>
+
+       Clarify _GL_ATTRIBUTE_NODISCARD code.
+       Reported by Paul Eggert.
+       * m4/gnulib-common.m4 (gl_COMMON_BODY): Add comment regarding
+       _GL_ATTRIBUTE_NODISCARD definition.
+
 2023-01-28  Bruno Haible  <bruno@clisp.org>
 
        unistdio/*printf: Fix negative width handling for %U, %lU, %llU.
index 808efc4ab12019b3f5bcd9b1f0b6457bc53513e0..060968dcf008fe28ac16db97ecc231acb86e62f5 100644 (file)
@@ -381,7 +381,10 @@ AC_DEFUN([gl_COMMON_BODY], [
 #ifndef _GL_ATTRIBUTE_NODISCARD
 # if defined __clang__ && defined __cplusplus
   /* With clang up to 15.0.6 (at least), in C++ mode, [[__nodiscard__]] produces
-     a warning.  */
+     a warning.
+     The 1000 below means a yet unknown threshold.  When clang++ version X
+     starts supporting [[__nodiscard__]] without warning about it, you can
+     replace the 1000 with X.  */
 #  if __clang_major__ >= 1000
 #   define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]]
 #  endif