[riot-notifications] [RIOT-OS/RIOT] build system: add machine-readable RIOT_VERSION_CODE macro (#16765)

Martine Lenders notifications at github.com
Tue Sep 21 15:57:43 CEST 2021


@miri64 commented on this pull request.



> @@ -187,6 +187,21 @@ extern "C" {
  */
 #define IS_USED(module) IS_ACTIVE(module)
 
+/**
+ * @def         RIOT_VERSION_NUM(major, minor, patch, extra)
+ * @brief       Generates a 64 bit variable of a release version
+ *              Comparisons to this only apply to released branches
+ *
+ * @param[in]   major   Mayor version of the release
+ * @param[in]   minor   Minor version of the release
+ * @param[in]   patch   Patch level of the release
+ * @param[in]   extra   Extra version, user defined

How the user can define this and why he should do so should also be documented here. Something like: 


> To define `extra` add a file `EXTRAVERSION` to the RIOT root with the content
> ```makefile
> RIOT_EXTRAVERSION = <extra>
> ```
> with `<extra>` being the number of your local version. This can be useful to ...

> +static void test_kernel_version(void)
+{
+    uint16_t mayor, minor, patch, extra;
+
+    TEST_ASSERT(RIOT_VERSION_CODE);
+    TEST_ASSERT(RIOT_VERSION_CODE > RIOT_VERSION_NUM(2017, 1, 3, 0));
+    TEST_ASSERT(RIOT_VERSION_CODE < RIOT_VERSION_NUM(2080, 10, 2, 0));
+
+    kernel_version_parse(RIOT_VERSION_NUM(2020, 7, 1, 0),
+                         &mayor, &minor, &patch, &extra);
+
+    TEST_ASSERT_EQUAL_INT(2020, mayor);
+    TEST_ASSERT_EQUAL_INT(7, minor);
+    TEST_ASSERT_EQUAL_INT(1, patch);
+    TEST_ASSERT_EQUAL_INT(0, extra);
+#if RIOT_VERSION_CODE < RIOT_VERSION_NUM(2000, 1, 1, 1)

```suggestion
#if RIOT_VERSION_CODE < RIOT_VERSION_NUM(2000, 1, 1, 0)
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/16765#pullrequestreview-759787009
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210921/22af2527/attachment.htm>


More information about the notifications mailing list