ignore-value tests: Use module 'attribute'.
authorBruno Haible <bruno@clisp.org>
Fri, 8 May 2020 16:30:01 +0000 (18:30 +0200)
committerBruno Haible <bruno@clisp.org>
Fri, 8 May 2020 16:41:56 +0000 (18:41 +0200)
* m4/gnulib-common.m4 (gl_COMMON_BODY): Fix a typo.
* tests/test-ignore-value.c: Include attribute.h.
(_GL_ATTRIBUTE_RETURN_CHECK): Remove macro. Use NODISCARD instead.
* modules/ignore-value-tests (Depends-on): Add attribute.

ChangeLog
m4/gnulib-common.m4
modules/ignore-value-tests
tests/test-ignore-value.c

index 56c15bce4c59f2a9164085bd169b625c46da23e8..6f154d5137c2d1dcdfce7dab6c6250ef9d799a22 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2020-05-08  Bruno Haible  <bruno@clisp.org>
+
+       ignore-value tests: Use module 'attribute'.
+       * m4/gnulib-common.m4 (gl_COMMON_BODY): Fix a typo.
+       * tests/test-ignore-value.c: Include attribute.h.
+       (_GL_ATTRIBUTE_RETURN_CHECK): Remove macro. Use NODISCARD instead.
+       * modules/ignore-value-tests (Depends-on): Add attribute.
+
 2020-05-08  Bruno Haible  <bruno@clisp.org>
 
        uniname/uniname: Use module 'attribute'.
index 79771599bccaea5b3a47c47c53f560fdc7e9231c..f4ba5e3a00d02ce1ebcc2f68e3c73da569511e10 100644 (file)
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 49
+# gnulib-common.m4 serial 50
 dnl Copyright (C) 2007-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -96,7 +96,7 @@ AC_DEFUN([gl_COMMON_BODY], [
 # define _GL_ATTR_returns_nonnull _GL_GNUC_PREREQ (4, 9)
 # define _GL_ATTR_sentinel _GL_GNUC_PREREQ (4, 0)
 # define _GL_ATTR_unused _GL_GNUC_PREREQ (2, 7)
-# define _GL_ATTR_warn_unused_result_GL_GNUC_PREREQ (3, 4)
+# define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4)
 #endif
 
 ]dnl There is no _GL_ATTRIBUTE_ALIGNED; use stdalign's _Alignas instead.
index 9c8c6d6f1a81aaf8c3a14d924642d2c11acc3422..855d77193668e3e3d7797bbef116f1d0e291285e 100644 (file)
@@ -2,6 +2,7 @@ Files:
 tests/test-ignore-value.c
 
 Depends-on:
+attribute
 stdio
 
 configure.ac:
index f323a7bfa36634df2cfdefd428c909a2136e0c33..9d5511515d3bf2575e06862993a8aaeeabc57e64 100644 (file)
 
 #include <stdio.h>
 
-#ifndef _GL_ATTRIBUTE_RETURN_CHECK
-# if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4)
-#  define _GL_ATTRIBUTE_RETURN_CHECK
-# else
-#  define _GL_ATTRIBUTE_RETURN_CHECK __attribute__((__warn_unused_result__))
-# endif
-#endif
+#include "attribute.h"
 
 struct s { int i; };
-static char doChar (void) _GL_ATTRIBUTE_RETURN_CHECK;
-static int doInt (void) _GL_ATTRIBUTE_RETURN_CHECK;
-static off_t doOff (void) _GL_ATTRIBUTE_RETURN_CHECK;
-static void *doPtr (void) _GL_ATTRIBUTE_RETURN_CHECK;
-static struct s doStruct (void) _GL_ATTRIBUTE_RETURN_CHECK;
+static char doChar (void) NODISCARD;
+static int doInt (void) NODISCARD;
+static off_t doOff (void) NODISCARD;
+static void *doPtr (void) NODISCARD;
+static struct s doStruct (void) NODISCARD;
 
 static char
 doChar (void)