Patchwork [fixincldes] AIX assert.h static_assert

login
register
mail settings
Submitter David Edelsohn
Date Aug. 31, 2013, 11:40 p.m.
Message ID <CAGWvny=-YrwQJ=VGfCR5y63KR=oV2taJHoBk2DxFks1o27GSOg@mail.gmail.com>
Download mbox | patch
Permalink /patch/271579/
State New
Headers show

Comments

David Edelsohn - Aug. 31, 2013, 11:40 p.m.
In a recent change to AIX 7, the assert.h header defines
static_assert.  I presume this was intended not to avoid conflicts
with the new C++ keyword.  Sigh. However, the definition is not
protected from C++, which causes problem if the header is included in
C++ code, which it is in libstdc++.  This fixincludes patch protects
the definition so that it only applies to ISO C code.

Bootstrapped on powerpc-ibm-aix7.1.0.0

Thanks, David

* inclhack.def (aix_assert): New fix.
* fixincl.x: Regenerate.
* tests/base/assert.h [AIX_ASSERT_CHECK]: New check.
Bruce Korb - Sept. 1, 2013, 12:01 a.m.
Sure.  Looks fine.  Please apply to all active branches.

On Sat, Aug 31, 2013 at 4:40 PM, David Edelsohn <dje.gcc@gmail.com> wrote:

Patch

Index: inclhack.def
===================================================================
--- inclhack.def    (revision 202134)
+++ inclhack.def    (working copy)
@@ -569,6 +569,20 @@ 
 };

 /*
+ * assert.h on AIX 7 redefines static_assert as _Static_assert without
+ * protecting C++.
+ */
+fix = {
+    hackname  = aix_assert;
+    mach      = "*-*-aix*";
+    files     = assert.h;
+    select    = "#define[ \t]static_assert[ \t]_Static_assert";
+    c_fix     = format;
+    c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
+    test_text = "#define static_assert _Static_assert";
+};
+
+/*
  * complex.h on AIX 5 and AIX 6 define _Complex_I and I in terms of __I,
  * which only is provided by AIX xlc C99.
  */