Dear Gnulib maintainers,
AC_CHECK_HEADER_STDBOOL needs a fix, now that GCC 6 defaults to a C++11
dialect, which breaks the assumption that stdbool.h is allowed to
unconditionally define "false" as a macro.

Greetings from Gentoo
David

From 869dbef1edc58cc4918dfeba9c680452bff4279e Mon Sep 17 00:00:00 2001
From: David Seifert <s...@gentoo.org>
Date: Mon, 30 May 2016 22:54:32 +0200
Subject: [PATCH] Amend AC_CHECK_HEADER_STDBOOL for C++11 and modern dialects

---
 m4/stdbool.m4 | 39 +++++++++++++++++++++------------------
 1 file changed, 21 insertions(+), 18 deletions(-)

diff --git a/m4/stdbool.m4 b/m4/stdbool.m4
index 625520f..0863847 100644
--- a/m4/stdbool.m4
+++ b/m4/stdbool.m4
@@ -5,7 +5,7 @@ dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
-#serial 5
+#serial 6
 
 # Prepare for substituting <stdbool.h> if it is not supported.
 
@@ -43,23 +43,26 @@ AC_DEFUN([AC_CHECK_HEADER_STDBOOL],
         [AC_LANG_PROGRAM(
            [[
              #include <stdbool.h>
-             #ifndef bool
-              "error: bool is not defined"
-             #endif
-             #ifndef false
-              "error: false is not defined"
-             #endif
-             #if false
-              "error: false is not 0"
-             #endif
-             #ifndef true
-              "error: true is not defined"
-             #endif
-             #if true != 1
-              "error: true is not 1"
-             #endif
-             #ifndef __bool_true_false_are_defined
-              "error: __bool_true_false_are_defined is not defined"
+
+             #if __cplusplus < 201103L
+              #ifndef bool
+               "error: bool is not defined"
+              #endif
+              #ifndef false
+               "error: false is not defined"
+              #endif
+              #if false
+               "error: false is not 0"
+              #endif
+              #ifndef true
+               "error: true is not defined"
+              #endif
+              #if true != 1
+               "error: true is not 1"
+              #endif
+              #ifndef __bool_true_false_are_defined
+               "error: __bool_true_false_are_defined is not defined"
+              #endif
              #endif
 
              struct s { _Bool s: 1; _Bool t; } s;
-- 
2.8.1

Reply via email to