[rtems-central commit] interface: Add "Generated from ..." comments

Sebastian Huber sebh at rtems.org
Thu Oct 8 13:25:41 UTC 2020


Module:    rtems-central
Branch:    master
Commit:    8454159107b70ba023fc2ed90623e30e10703648
Changeset: http://git.rtems.org/rtems-central/commit/?id=8454159107b70ba023fc2ed90623e30e10703648

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Oct  7 11:27:08 2020 +0200

interface: Add "Generated from ..." comments

---

 rtemsspec/interface.py            |  2 ++
 rtemsspec/tests/test_interface.py | 30 ++++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/rtemsspec/interface.py b/rtemsspec/interface.py
index a8a00f8..0d5d25d 100644
--- a/rtemsspec/interface.py
+++ b/rtemsspec/interface.py
@@ -210,6 +210,7 @@ class Node:
             self.content.append(f"}} {name};")
 
     def _generate(self) -> None:
+        self.content.add(f"/* Generated from spec:{self.item.uid} */")
         _NODE_GENERATORS[self.item["interface-type"]](self)
 
     def generate(self) -> None:
@@ -517,6 +518,7 @@ class _HeaderFile:
             self._content.add_brief_description(self._item["brief"])
         self._content.add_copyrights_and_licenses()
         self._content.add_automatically_generated_warning()
+        self._content.add(f"/* Generated from spec:{self._item.uid} */")
         with self._content.header_guard(self._item["path"]):
             exp_mapper = _HeaderExpressionMapper(self._item,
                                                  self.enabled_by_defined)
diff --git a/rtemsspec/tests/test_interface.py b/rtemsspec/tests/test_interface.py
index f518c16..357a411 100644
--- a/rtemsspec/tests/test_interface.py
+++ b/rtemsspec/tests/test_interface.py
@@ -99,6 +99,8 @@ def test_interface(tmpdir):
  * https://docs.rtems.org/branches/master/eng/req/howto.html
  */
 
+/* Generated from spec:/h */
+
 #ifndef _H_H
 #define _H_H
 
@@ -118,6 +120,8 @@ def test_interface(tmpdir):
 extern "C" {
 #endif
 
+/* Generated from spec:/ga */
+
 /**
  * @defgroup GroupA Group A
  *
@@ -126,15 +130,21 @@ extern "C" {
  * Group A description.
  */
 
+/* Generated from spec:/gb */
+
 /**
  * @defgroup GroupB Group B
  *
  * @ingroup GroupA
  */
 
+/* Generated from spec:/forward-decl */
+
 /* Forward declaration */
 struct Struct;
 
+/* Generated from spec:/enum */
+
 /**
  * @ingroup GroupB
  *
@@ -159,6 +169,8 @@ typedef enum {
   ENUMERATOR_2
 } Enum;
 
+/* Generated from spec:/define */
+
 /**
  * @ingroup GroupA
  */
@@ -171,6 +183,8 @@ typedef enum {
     ((float_t) 123)
 #endif
 
+/* Generated from spec:/enum3 */
+
 /**
  * @ingroup GroupB
  *
@@ -183,6 +197,8 @@ typedef enum EnumB {
   ENUMERATOR_B = ENUMERATOR_A
 } EnumB;
 
+/* Generated from spec:/func */
+
 /**
  * @ingroup GroupA
  *
@@ -202,6 +218,8 @@ typedef enum EnumB {
  */
 void Function( int Param0, const int *Param1, int *Param2, int *Param3 );
 
+/* Generated from spec:/func2 */
+
 /**
  * @ingroup GroupB
  *
@@ -241,6 +259,8 @@ static inline int VeryLongFunction(
   return VeryLongParam0 + 1;
 }
 
+/* Generated from spec:/macro */
+
 /**
  * @ingroup GroupB
  *
@@ -274,6 +294,8 @@ static inline int VeryLongFunction(
   } while ( 0 ); \\
   VeryLongParam0 + 1;
 
+/* Generated from spec:/macro2 */
+
 /**
  * @ingroup GroupB
  *
@@ -289,6 +311,8 @@ static inline int VeryLongFunction(
   #define MACRO( Param0 ) ( ( Param0 ) + 1 )
 #endif
 
+/* Generated from spec:/s */
+
 /**
  * @ingroup GroupC
  */
@@ -336,6 +360,8 @@ struct Struct {
   Enum some_member_4;
 };
 
+/* Generated from spec:/td */
+
 /**
  * @ingroup GroupB
  *
@@ -345,6 +371,8 @@ struct Struct {
  */
 typedef uint32_t Integer /* Some comment. */;
 
+/* Generated from spec:/td3 */
+
 /**
  * @ingroup GroupB
  */
@@ -353,6 +381,8 @@ typedef uint32_t Integer /* Some comment. */;
 #endif
 
 #if !defined(ASM)
+  /* Generated from spec:/var */
+
   /**
    * @ingroup GroupC
    *



More information about the vc mailing list