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

[incubator-nuttx] 01/03: libc: Change OK/ERROR macro to enum

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

jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit bb8c4485a2803c7873b275a2e732665633b394cb
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Fri Nov 27 15:50:25 2020 +0800

    libc: Change OK/ERROR macro to enum
    
    to avoid the conflict with 3rd party c++ library(e.g. protobuf):
    https://github.com/protocolbuffers/protobuf/blob/fdc35840b95f56c3aef44a3fc6ae5991f21620a5/src/google/protobuf/stubs/status.h#L47
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
    Change-Id: Ie8bb9008a8375c729f8b947c9f10baa80104d157
---
 include/sys/types.h | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/include/sys/types.h b/include/sys/types.h
index 4bc7b97..ea46899 100644
--- a/include/sys/types.h
+++ b/include/sys/types.h
@@ -76,16 +76,6 @@
 #  endif
 #endif
 
-/* POSIX-like OS return values: */
-
-#if !defined(__cplusplus)
-#  undef  ERROR
-#  define ERROR -1
-#endif
-
-#undef  OK
-#define OK 0
-
 /* Scheduling Priorities.
  *
  * NOTES:
@@ -305,6 +295,14 @@ typedef uint64_t u_int64_t;
 
 typedef CODE int (*main_t)(int argc, FAR char *argv[]);
 
+/* POSIX-like OS return values: */
+
+enum
+{
+  ERROR = -1,
+  OK = 0,
+};
+
 #endif /* __ASSEMBLY__ */
 
 /****************************************************************************