Re: [PATCH] Amend AC_CHECK_HEADER_STDBOOL for C++11 and modern dialects

Paul Eggert <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.patches,gmane.comp.lib.gnulib.bugs
Organization UCLA Computer Science Department
Message-ID <[email protected]>
On 05/31/2016 12:33 AM, David Seifert wrote:
> configure.ac:
>
> AC_INIT
> AC_PROG_CXX
> m4_include([stdbool.m4])
> AC_LANG_PUSH([C++])
> AC_CHECK_HEADER_STDBOOL

Thanks for the example. I installed your patch into gnulib. But I don't 
see how it can work without __bool_true_false_are_defined being defined, 
so I installed the attached additional patch as well. Please let us know 
if you see a problem with this.

CC:ing [email protected] since I installed a patch there too, to 
match.
0001-stdbool-Restore-__bool_true_false_are_defined-check.patch (application/x-patch, 1.8 KB)
From cb7476a1db148980b8cff02824774598ffaea8ce Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Tue, 31 May 2016 09:03:15 -0700
Subject: [PATCH] stdbool: Restore __bool_true_false_are_defined check

* m4/stdbool.m4 (AC_CHECK_HEADER_STDBOOL):
__bool_true_false_are_defined is still defined, even with C++11.
---
 ChangeLog     | 6 ++++++
 m4/stdbool.m4 | 9 +++++----
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 02a7c86..a6df98a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2016-05-31  Paul Eggert  <[email protected]>
+
+	stdbool: Restore __bool_true_false_are_defined check
+	* m4/stdbool.m4 (AC_CHECK_HEADER_STDBOOL):
+	__bool_true_false_are_defined is still defined, even with C++11.
+
 2016-05-31  David Seifert <[email protected]>  (tiny change)
 
 	stdbool: Port AC_CHECK_HEADER_STDBOOL to C++11
diff --git a/m4/stdbool.m4 b/m4/stdbool.m4
index 0863847..a556153 100644
--- a/m4/stdbool.m4
+++ b/m4/stdbool.m4
@@ -44,7 +44,7 @@ AC_DEFUN([AC_CHECK_HEADER_STDBOOL],
            [[
              #include <stdbool.h>
 
-             #if __cplusplus < 201103L
+             #if __cplusplus < 201103
               #ifndef bool
                "error: bool is not defined"
               #endif
@@ -60,9 +60,10 @@ AC_DEFUN([AC_CHECK_HEADER_STDBOOL],
               #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
+
+             #ifndef __bool_true_false_are_defined
+              "error: __bool_true_false_are_defined is not defined"
              #endif
 
              struct s { _Bool s: 1; _Bool t; } s;
-- 
2.5.5
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.