[PATCH 2/4] score: New header file <rtems/score/assert.h>

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Jul 26 12:48:42 UTC 2013


---
 cpukit/score/Makefile.am                  |    1 +
 cpukit/score/include/rtems/score/assert.h |   45 +++++++++++++++++++++++++++++
 cpukit/score/preinstall.am                |    4 ++
 3 files changed, 50 insertions(+), 0 deletions(-)
 create mode 100644 cpukit/score/include/rtems/score/assert.h

diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index 531ddc1..b623732 100644
--- a/cpukit/score/Makefile.am
+++ b/cpukit/score/Makefile.am
@@ -17,6 +17,7 @@ include_rtems_scoredir = $(includedir)/rtems/score
 include_rtems_score_HEADERS = include/rtems/score/address.h
 include_rtems_score_HEADERS += include/rtems/score/apiext.h
 include_rtems_score_HEADERS += include/rtems/score/apimutex.h
+include_rtems_score_HEADERS += include/rtems/score/assert.h
 include_rtems_score_HEADERS += include/rtems/score/chain.h
 include_rtems_score_HEADERS += include/rtems/score/chainimpl.h
 include_rtems_score_HEADERS += include/rtems/score/context.h
diff --git a/cpukit/score/include/rtems/score/assert.h b/cpukit/score/include/rtems/score/assert.h
new file mode 100644
index 0000000..205515d
--- /dev/null
+++ b/cpukit/score/include/rtems/score/assert.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2013 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Dornierstr. 4
+ *  82178 Puchheim
+ *  Germany
+ *  <rtems at embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ */
+
+#ifndef _RTEMS_SCORE_ASSERT_H
+#define _RTEMS_SCORE_ASSERT_H
+
+#include <rtems/score/basedefs.h>
+
+#if defined( RTEMS_DEBUG )
+  #include <assert.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @brief Assertion similar to assert() controlled via RTEMS_DEBUG instead of
+ * NDEBUG.
+ */
+#if defined( RTEMS_DEBUG )
+  #define _Assert( _e ) \
+    ( ( _e ) ? \
+      ( void ) 0 : \
+        __assert_func( __FILE__, __LINE__, __ASSERT_FUNC, #_e ) )
+#else
+  #define _Assert( _e ) ( ( void ) 0 )
+#endif
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _RTEMS_SCORE_ASSERT_H */
diff --git a/cpukit/score/preinstall.am b/cpukit/score/preinstall.am
index 420fdaa..5d9cbed 100644
--- a/cpukit/score/preinstall.am
+++ b/cpukit/score/preinstall.am
@@ -51,6 +51,10 @@ $(PROJECT_INCLUDE)/rtems/score/apimutex.h: include/rtems/score/apimutex.h $(PROJ
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/apimutex.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/apimutex.h
 
+$(PROJECT_INCLUDE)/rtems/score/assert.h: include/rtems/score/assert.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/assert.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/assert.h
+
 $(PROJECT_INCLUDE)/rtems/score/chain.h: include/rtems/score/chain.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/chain.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/chain.h
-- 
1.7.7




More information about the devel mailing list