]> Savannah Git Hosting - gnulib.git/commitdiff
assert-h: work around include confusion
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 14 Sep 2022 18:44:19 +0000 (13:44 -0500)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 14 Sep 2022 18:45:26 +0000 (13:45 -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
m4/assert_h.m4

index 1846e7c381f129cd1edc4976854c3265452649fd..199b088200795dc68fac9d7fed159f9ef2b42f4a 100644 (file)
--- 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
index ec756a970b7280783177bf63622138a0164e12cd..43937869ecda953fd11e0ceda6ad1e79473b8d26 100644 (file)
@@ -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