Allow the core to detect the used compiler version - #108
Allow the core to detect the used compiler version#108alessandropellegrini wants to merge 1 commit into
Conversation
rootsim-cc will inject in the model a variable allowing the core to detect what version of the compiler was used to compile the code. Signed-off-by: Alessandro Pellegrini <a.pellegrini@ing.uniroma2.it>
|
Documentation coverage is 82.6% 👍 |
Codecov Report
@@ Coverage Diff @@
## develop #108 +/- ##
===========================================
- Coverage 86.77% 86.22% -0.55%
===========================================
Files 40 39 -1
Lines 1459 1365 -94
Branches 38 37 -1
===========================================
- Hits 1266 1177 -89
+ Misses 178 173 -5
Partials 15 15 |
| * SPDX-License-Identifier: GPL-3.0-only | ||
| */ | ||
| #include <core/core.h> | ||
| #include <core/compiler.h> |
Check warning
Code scanning / Cppcheck (reported by Codacy)
Include file: <core/compiler.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
| */ | ||
| #pragma once | ||
|
|
||
| #include <stdint.h> |
Check warning
Code scanning / Cppcheck (reported by Codacy)
Include file: <stdint.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
| #include <stdint.h> | ||
|
|
||
| /// The version of the compiler used to generate a model | ||
| uint32_t __attribute__((weak)) rootsim_compiler_version = 0; |
Check warning
Code scanning / Cppcheck (reported by Codacy)
misra violation 804 with no text in the supplied rule-texts-file
Piccions
left a comment
There was a problem hiding this comment.
I left some comments, thanks for your work!
| uint32_t __attribute__((weak)) rootsim_compiler_version = 0; | ||
|
|
||
| /// This macro allows to convert a major, minor and patch version into a single uint32_t | ||
| #define ROOTSIM_COMPILER_VERSION(a,b,c) (uint32_t)(((a) << 16) + ((b) << 8) + (c)) |
There was a problem hiding this comment.
If we used an array of three unsigned chars to represent the version, we wouldn't need a macro to set it (or to read it, even if the corresponding macros haven't been defined)
| #include <stdint.h> | ||
|
|
||
| /// The version of the compiler used to generate a model | ||
| uint32_t __attribute__((weak)) rootsim_compiler_version = 0; |
There was a problem hiding this comment.
We could declare this variable here rather than defining it inside this header, and define it as a weak symbol inside core.c
|
Do we drop this PR or do we want this feature to be merged? |
|
Let's keep this open. I have a plan to slightly repurpose this stuff, even though the compiler is dead code now. |
rootsim-cc will inject in the model a variable allowing the core to detect what version of the compiler was used to compile the code.