You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by je...@apache.org on 2020/11/24 07:23:33 UTC

[mynewt-core] branch master updated: baselibc: Always define static_assert for C

This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 5f3c68b  baselibc: Always define static_assert for C
5f3c68b is described below

commit 5f3c68b5571948a57f1d6d0d0224d4e7320e6e8b
Author: Jerzy Kasenberg <je...@gmail.com>
AuthorDate: Sun Nov 22 12:09:21 2020 +0100

    baselibc: Always define static_assert for C
    
    Currently static_assert is only defined when
    __STDC_VERSION__ >= 201112L.
    
    Static asserts present in header files should
    use static_assert to be able to build with C++.
    
    For non C++ build it should map _Static_assert.
    While _Static_assert is C11 feature it can be
    present for older compilers.
    
    This drops checking for compiler version,
    if compiler does not support _Static_assert it
    will fail anyway.
---
 libc/baselibc/include/assert.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libc/baselibc/include/assert.h b/libc/baselibc/include/assert.h
index b06f5a2..9a96466 100644
--- a/libc/baselibc/include/assert.h
+++ b/libc/baselibc/include/assert.h
@@ -27,7 +27,7 @@ extern "C" {
 
 #endif
 
-#if __STDC_VERSION__ >= 201112L && !defined __cplusplus
+#if !defined __cplusplus
 #define static_assert _Static_assert
 #endif