[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: proposed support for C1X-style static_assert
From: |
Paul Eggert |
Subject: |
Re: proposed support for C1X-style static_assert |
Date: |
Sun, 29 May 2011 14:33:48 -0700 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10 |
On 05/29/11 06:08, Bruno Haible wrote:
> Hi Paul,
>
>>> "verify.h" no longer defines the 'verify' macro if
>>> <assert.h> was already included in the same compilation unit.
>>
>> Thanks, I pushed this fix:
>
> This is better: The error is gone. But there are warnings now:
Thanks for catching that. I applied the following two patches,
one to fix the warnings, the other to substitute the new prefix
more consistently.
>From 6951841b81058b0dd883fcdeb2be31d6aa8b8658 Mon Sep 17 00:00:00 2001
From: Paul Eggert <address@hidden>
Date: Sun, 29 May 2011 14:30:36 -0700
Subject: [PATCH 1/2] assert-h: work around 'verify' incompatibility
* lib/verify.h: Use @...@ directives, not ifdef.
* modules/assert-h (assert.h): Implement the directives.
---
ChangeLog | 6 ++++++
lib/verify.h | 8 ++++----
modules/assert-h | 1 +
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8bcf087..bd060c7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-05-29 Paul Eggert <address@hidden>
+
+ assert-h: work around 'verify' incompatibility
+ * lib/verify.h: Use @...@ directives, not ifdef.
+ * modules/assert-h (assert.h): Implement the directives.
+
2011-05-29 Jim Meyering <address@hidden>
trim: remove three superfluous assignments
diff --git a/lib/verify.h b/lib/verify.h
index 7604860..c6d30a3 100644
--- a/lib/verify.h
+++ b/lib/verify.h
@@ -209,7 +209,7 @@ template <int w>
# endif
# endif
-# ifdef _GL_VERIFY_H
+/* @assert.h omit start@ */
/* Each of these macros verifies that its argument R is nonzero. To
be portable, R should be an integer constant expression. Unlike
@@ -223,13 +223,13 @@ template <int w>
/* Verify requirement R at compile-time, as an integer constant expression.
Return 1. */
-# define verify_true(R) _GL_VERIFY_TRUE (R, "verify_true (" #R ")")
+# define verify_true(R) _GL_VERIFY_TRUE (R, "verify_true (" #R ")")
/* Verify requirement R at compile-time, as a declaration without a
trailing ';'. */
-# define verify(R) _GL_VERIFY (R, "verify (" #R ")")
+# define verify(R) _GL_VERIFY (R, "verify (" #R ")")
-# endif
+/* @assert.h omit end@ */
#endif
diff --git a/modules/assert-h b/modules/assert-h
index 595fefe..f7eb482 100644
--- a/modules/assert-h
+++ b/modules/assert-h
@@ -27,6 +27,7 @@ assert.h: assert.in.h verify.h $(top_builddir)/config.status
-e 's|@''NEXT_ASSERT_H''@|$(NEXT_ASSERT_H)|g' \
< $(srcdir)/assert.in.h && \
sed -e 's|_GL_VERIFY_H|_${gl_include_guard_prefix}_STATIC_ASSERT_H|g'
\
+ -e '/@assert.h omit start@/,/@assert.h omit end@/d' \
-e 's|_gl_verify|_gl_static_assert|g' \
-e 's|_GL_VERIFY|_GL_STATIC_ASSERT|g' \
< $(srcdir)/verify.h; \
--
1.7.4.4
>From 3532d15484ebc37feded387216d716bc1c3533f6 Mon Sep 17 00:00:00 2001
From: Paul Eggert <address@hidden>
Date: Sun, 29 May 2011 14:31:22 -0700
Subject: [PATCH 2/2] * modules/assert-h (assert.h): Substitute the
symbol-prefix more consistently.
---
ChangeLog | 1 +
modules/assert-h | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index bd060c7..f287f4b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,7 @@
assert-h: work around 'verify' incompatibility
* lib/verify.h: Use @...@ directives, not ifdef.
* modules/assert-h (assert.h): Implement the directives.
+ (assert.h): Substitute the symbol-prefix more consistently.
2011-05-29 Jim Meyering <address@hidden>
diff --git a/modules/assert-h b/modules/assert-h
index f7eb482..85d6fc8 100644
--- a/modules/assert-h
+++ b/modules/assert-h
@@ -26,10 +26,10 @@ assert.h: assert.in.h verify.h $(top_builddir)/config.status
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_ASSERT_H''@|$(NEXT_ASSERT_H)|g' \
< $(srcdir)/assert.in.h && \
- sed -e 's|_GL_VERIFY_H|_${gl_include_guard_prefix}_STATIC_ASSERT_H|g'
\
- -e '/@assert.h omit start@/,/@assert.h omit end@/d' \
+ sed -e '/@assert.h omit start@/,/@assert.h omit end@/d' \
-e 's|_gl_verify|_gl_static_assert|g' \
-e 's|_GL_VERIFY|_GL_STATIC_ASSERT|g' \
+ -e 's|_GL\(_STATIC_ASSERT_H\)|_${gl_include_guard_prefix}\1|g' \
< $(srcdir)/verify.h; \
} > address@hidden && \
mv address@hidden $@
--
1.7.4.4
- Re: proposed support for C1X-style static_assert, (continued)
- Re: proposed support for C1X-style static_assert, Bruno Haible, 2011/05/05
- Re: proposed support for C1X-style static_assert, Paul Eggert, 2011/05/05
- Re: proposed support for C1X-style static_assert, Bruno Haible, 2011/05/05
- Re: proposed support for C1X-style static_assert, Paul Eggert, 2011/05/05
- Re: proposed support for C1X-style static_assert, Paul Eggert, 2011/05/06
- Re: proposed support for C1X-style static_assert, Bruno Haible, 2011/05/22
- Re: proposed support for C1X-style static_assert, Paul Eggert, 2011/05/22
- Re: proposed support for C1X-style static_assert, Bruno Haible, 2011/05/29
- Re: proposed support for C1X-style static_assert,
Paul Eggert <=
- Re: proposed support for C1X-style static_assert, Bruno Haible, 2011/05/29
Re: proposed support for C1X-style static_assert, Andy Moreton, 2011/05/06