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 2021/05/13 10:50:34 UTC

[mynewt-core] branch master updated: kernel/os: Remove min/max macros 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 671fd92  kernel/os: Remove min/max macros for C++
671fd92 is described below

commit 671fd9232b213c16bf43f8034914dd084e81350f
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Thu May 13 10:38:48 2021 +0200

    kernel/os: Remove min/max macros for C++
    
    Symbols min and max are standard template functions.
    When os.h is included from C++ code macros provided
    by this header break build.
    
    mynewt is written in C hence removing min/max definitions
    just from C++ build will not break any existing code.
---
 kernel/os/include/os/os.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/os/include/os/os.h b/kernel/os/include/os/os.h
index 18b92a0..b558886 100644
--- a/kernel/os/include/os/os.h
+++ b/kernel/os/include/os/os.h
@@ -27,7 +27,7 @@
 
 #ifdef __cplusplus
 extern "C" {
-#endif
+#else
 
 #ifndef min
 #define min(a, b) ((a)<(b)?(a):(b))
@@ -36,6 +36,7 @@ extern "C" {
 #ifndef max
 #define max(a, b) ((a)>(b)?(a):(b))
 #endif
+#endif
 
 #define os_get_return_addr() (__builtin_return_address(0))