-
Notifications
You must be signed in to change notification settings - Fork 5
Allow the core to detect the used compiler version #108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| /** | ||
| * @file core/compiler.h | ||
| * | ||
| * @brief Compiler version detection variable | ||
| * | ||
| * Compiler version detection variable | ||
| * | ||
| * The variable rootsim_compiler_version is used to detect the compiler version. | ||
| * It is set to 0 by default, but it is overridden by the compiler when a model is compiled. | ||
| * The macro ROOTSIM_COMPILER_VERSION is used to check the compiler version. | ||
| * | ||
| * SPDX-FileCopyrightText: 2008-2023 HPDCS Group <rootsim@googlegroups.com> | ||
| * SPDX-License-Identifier: GPL-3.0-only | ||
| */ | ||
| #pragma once | ||
|
|
||
| #include <stdint.h> | ||
|
|
||
| /// The version of the compiler used to generate a model | ||
| uint32_t __attribute__((weak)) rootsim_compiler_version = 0; | ||
Check warningCode scanning / Cppcheck (reported by Codacy) misra violation 804 with no text in the supplied rule-texts-file
misra violation 804 with no text in the supplied rule-texts-file
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could declare this variable here rather than defining it inside this header, and define it as a weak symbol inside |
||
|
|
||
| /// 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)) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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) |
||
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.