diff options
-rw-r--r-- | pr/include/prerror.h | 15 | ||||
-rw-r--r-- | pr/include/prlog.h | 8 |
2 files changed, 8 insertions, 15 deletions
diff --git a/pr/include/prerror.h b/pr/include/prerror.h index af2cb916..cf94872e 100644 --- a/pr/include/prerror.h +++ b/pr/include/prerror.h @@ -49,21 +49,6 @@ typedef PRInt32 PRErrorCode; #include "prerr.h" /* -** Compile-time assert. "condition" must be a constant expression. -** The macro should be used only once per source line in places where -** a "typedef" declaration is allowed. -** For stringification of the line numbers where the macro is used we need some -** macro indirection. IMPL is required to get macro-expansion of __LINE__ to -** its integer value so that IMPL2 will stringify the number, not "__LINE__". -*/ -#define PR_STATIC_ASSERT(condition) \ - PR_STATIC_ASSERT_IMPL(condition, __LINE__) -#define PR_STATIC_ASSERT_IMPL(condition, line) \ - PR_STATIC_ASSERT_IMPL2(condition, line) -#define PR_STATIC_ASSERT_IMPL2(condition, line) \ - typedef int pr_static_assert_line_##line[(condition) ? 1 : -1] - -/* ** Set error will preserve an error condition within a thread context. ** The values stored are the NSPR (platform independent) translation of ** the error. Also, if available, the platform specific oserror is stored. diff --git a/pr/include/prlog.h b/pr/include/prlog.h index 6b88a5cb..2a65b3de 100644 --- a/pr/include/prlog.h +++ b/pr/include/prlog.h @@ -251,6 +251,14 @@ NSPR_API(void) PR_Assert(const char *s, const char *file, PRIntn ln); #endif /* defined(DEBUG) || defined(FORCE_PR_ASSERT) */ +/* +** Compile-time assert. "condition" must be a constant expression. +** The macro can be used only in places where an "extern" declaration is +** allowed. +*/ +#define PR_STATIC_ASSERT(condition) \ + extern void pr_static_assert(int arg[(condition) ? 1 : -1]) + PR_END_EXTERN_C #endif /* prlog_h___ */ |