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

benpicco notifications at github.com
Sat Aug 21 14:09:47 CEST 2021


<!--
The RIOT community cares a lot about code quality.
Therefore, before describing what your contribution is about, we would like
you to make sure that your modifications are compliant with the RIOT
coding conventions, see https://github.com/RIOT-OS/RIOT/wiki/Coding-conventions.
-->

### Contribution description

For external modules it can be handy to determine the RIOT version using a define.
Linux provides a `KERNEL_VERSION` macro for that. It splits a 32 bit version number into 16 bit mayor version, 8 bit minor version and 8 bit patch level.

This also works for RIOT's versioning scheme, so let's adopt the same scheme. 

### Testing procedure

A new unit test is provided in `tests/unittests/tests-kernel_defines`.



### Issues/PRs references

https://forum.riot-os.org/t/detect-riot-os-version/3329

You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/16765

-- Commit Summary --

  * core/include/kernel_defines.h: add KERNEL_VERSION macro
  * tests/unittests: add test for kernel_defines

-- File Changes --

    M Makefile.include (7)
    M core/include/kernel_defines.h (12)
    A tests/unittests/tests-kernel_defines/Makefile (1)
    A tests/unittests/tests-kernel_defines/tests-kernel_defines.c (57)
    A tests/unittests/tests-kernel_defines/tests-kernel_defines.h (37)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/16765.patch
https://github.com/RIOT-OS/RIOT/pull/16765.diff

-- 
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210821/100be04c/attachment.htm>


More information about the notifications mailing list