[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/2] assert-h: work around include confusion
From: |
Paul Eggert |
Subject: |
[PATCH 2/2] assert-h: work around include confusion |
Date: |
Wed, 14 Sep 2022 13:46:14 -0500 |
* m4/assert_h.m4 (gl_ASSERT_H): Arrange for <config.h> to not
include <assert.h> if assert is already defined. This works
around bugs in packages that mistakenly include <config.h> after
including <assert.h> (typically due to double-inclusion of
<config.h>). Found in coreutils, which I plan to fix.
---
ChangeLog | 7 +++++++
m4/assert_h.m4 | 2 +-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 1846e7c381..199b088200 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2022-09-14 Paul Eggert <eggert@cs.ucla.edu>
+ assert-h: work around include confusion
+ * m4/assert_h.m4 (gl_ASSERT_H): Arrange for <config.h> to not
+ include <assert.h> if assert is already defined. This works
+ around bugs in packages that mistakenly include <config.h> after
+ including <assert.h> (typically due to double-inclusion of
+ <config.h>). Found in coreutils, which I plan to fix.
+
stdbool: depend on C99
Record that stdbool depends on C99 these days.
This matters only for ancient compilers that need special
diff --git a/m4/assert_h.m4 b/m4/assert_h.m4
index ec756a970b..43937869ec 100644
--- a/m4/assert_h.m4
+++ b/m4/assert_h.m4
@@ -47,7 +47,7 @@ AC_DEFUN([gl_ASSERT_H],
dnl including assert.h. Break the #undef apart with a comment
dnl so that 'configure' does not comment it out.
AH_VERBATIM([zzstatic_assert],
-[#if (!defined HAVE_C_STATIC_ASSERT \
+[#if (!defined HAVE_C_STATIC_ASSERT && !defined assert \
&& __cpp_static_assert < 201411 && __GNUG__ < 6)
#include <assert.h>
#undef/**/assert
--
2.37.2