Commit 4e7349e
authored
[fix] Coverity:
The following warnings appeared in Coverity build log on Windows:
```
"sources/middle-layer/util/library_version.cpp", line 12: warning #7: unrecognized token
return QPL_VERSION;
^
```
The issue is related to the fact that `QPL_VERSION` macro is defined using `/D` command-line option:
```
target_compile_definitions(middle_layer_lib
PUBLIC QPL_VERSION="${CMAKE_PROJECT_VERSION}"
PUBLIC $<$<C_COMPILER_ID:MSVC>:_ENABLE_EXTENDED_ALIGNED_STORAGE>
```
So it is passed to the compiler command line as...
* `-DQPL_VERSION=\"1.8.0\"` (in case of a regular build)
* `"-DQPL_VERSION=\"1.8.0\""` (in case of a Coverity build)
Since the value of this macro is a string literal, quoting around it requires escaping. It seems that in case of Coverity escaping should be different to achieve the same result. Also it may be [different in case of different shells](https://cmake.org/pipermail/cmake/2007-June/014611.html).
So `QPL_VERSION` macro definition was moved from command-line options (using a function `target_compile_definitions` in CMake) to a CMake-generated header file `project_version.h` (using a template file `project_version.h.in` and a function `configure_file()` in CMake) which is a typical approach to organize this functionality.
Three new macro definitions were added to this file (besides `QPL_VERSION`):
* `QPL_VERSION_MAJOR`
* `QPL_VERSION_MINOR`
* `QPL_VERSION_PATCH`
This generated header file is installed by CMake to the install folder just like other header files in `/include/qpl/c_api`.QPL_VERSION macro is now defined in a CMake-generated file (#1246)1 parent 51bb69d commit 4e7349e
File tree
6 files changed
+46
-1
lines changed- include/qpl/c_api
- sources
- c_api
- middle-layer
- dispatcher
6 files changed
+46
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
29 | 34 | | |
30 | 35 | | |
31 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | 54 | | |
56 | 55 | | |
57 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| |||
0 commit comments