Commit 6b91f82
committed
tests: Replace cpp parsing with C compilation for macro extraction
The previous cpp-based approach for extracting macro values proved
brittle across different platforms due to:
- Inconsistent cpp output formatting between implementations
- Shell arithmetic evaluation limitations with parenthetical expressions
- Complex error handling with multiple potential failure points
Replace the brittle cpp output parsing with a simple C program that
prints the macro value directly. This uses the actual build toolchain
and lets the C compiler handle all macro expansion and arithmetic
evaluation according to the C standard. It is more portable and
reliable across different platforms and compiler implementations.
The cpp approach remains in git history if needed for reference.
Tested:
- AlmaLinux 10.0 (x86-64-v2), 9.6, 8.10
- Arch Linux
- CentOS Stream 9
- Debian sid, 13.1, 12.12, 11.11, 10.13, 9.13, 8.11, 7.11, 6.0.10, 5, 4
- Fedora 42, 41
- FreeBSD 14.3, 13.5
- NetBSD 10.1, 9.4
- OpenBSD 7.7, 7.6
- openSUSE Leap 15.6, 15.5
- Ubuntu 25.04, 24.04.3, 22.04.5, 20.04.6, 18.04.6, 16.04.71 parent baed50b commit 6b91f82
1 file changed
+8
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | 9 | | |
17 | 10 | | |
18 | 11 | | |
19 | 12 | | |
20 | 13 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
29 | 22 | | |
30 | 23 | | |
31 | 24 | | |
| |||
0 commit comments