bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: David Seifert
Subject: Re: [PATCH] Amend AC_CHECK_HEADER_STDBOOL for C++11 and modern dialects
Date: Wed, 1 Jun 2016 10:29:46 +0200

On 31 May 2016, at 18:07, Paul Eggert <address@hidden> wrote:

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 address@hidden since I installed a patch there too, to match.

<0001-stdbool-Restore-__bool_true_false_are_defined-check.patch>

Dear Paul,
thanks for adding the patches, and yes, __bool_true_false_are_defined is defined in C++.
I have been pondering the following improvements: stdbool.m4 is supposed to merely check that
stdbool.h fulfills C99 requirements. Why does it then necessarily check whether bool is a
defined _macro_? The reason why I am asking this, as clang++ currently gets rejected, as
it only defines the macros when __GNUC__ is defined:

/* Don't define bool, true, and false in C++, except as a GNU extension. */
#ifndef __cplusplus
#define bool _Bool
#define true 1
#define false 0
#elif defined(__GNUC__) && !defined(__STRICT_ANSI__)
/* Define _Bool, bool, false, true as a GNU extension. */
#define _Bool bool
#define bool  bool
#define false false
#define true  true
#endif

Wouldn't it be better to change the stdbool.m4 macro to instead try and use "bool" in a statement
or as a type, instead of checking whether the macro "bool" is defined. This is more general
and will work with more compilers. What do you think?

Regards
David

reply via email to

[Prev in Thread] Current Thread [Next in Thread]