Commit 09b66ca
committed
retro_atomic: shield <atomic> include from caller's extern "C"
ui_qt.cpp wraps RetroArch headers in extern "C" { ... } when CXX_BUILD
is not defined. In non-unity builds the chain
ui_qt.cpp (extern "C") -> menu_driver.h -> gfx_thumbnail.h
-> retro_atomic.h -> <atomic>
ends up parsing libstdc++ <atomic> under C linkage, producing dozens of
"template with C linkage" errors on g++. The same hazard exists for any
C++ TU that wraps RetroArch headers in extern "C", and is currently
masked elsewhere only because no other such TU happens to pull in a
header that reaches retro_atomic.h.
Fix at the header level so every caller is protected, not just ui_qt.cpp:
- Add RETRO_BEGIN_DECLS_CXX / RETRO_END_DECLS_CXX to retro_common_api.h.
They expand to extern "C++" { ... } in C++ mode (with CXX_BUILD off)
and to nothing otherwise, mirroring the existing RETRO_BEGIN_DECLS /
RETRO_END_DECLS pair.
- Use them around the <atomic> / <cstddef> include in retro_atomic.h's
C++11 backend. The standard headers parse at C++ linkage regardless
of any surrounding extern "C" the caller imposes; the rest of the
file (typedefs and macros, no function declarations) is unaffected.
The previous comment claiming "no need for RETRO_BEGIN_DECLS / extern
\"C\" wrapping ... the wrapper would actively break that path" addressed
only half the problem -- the file's own wrapping -- and missed that the
caller's wrapper leaks into the <atomic> include. Updated to reflect
the real constraint.1 parent a340c70 commit 09b66ca
2 files changed
Lines changed: 19 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
321 | 323 | | |
322 | 324 | | |
323 | 325 | | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
328 | 332 | | |
329 | 333 | | |
330 | 334 | | |
| |||
359 | 363 | | |
360 | 364 | | |
361 | 365 | | |
| 366 | + | |
362 | 367 | | |
363 | 368 | | |
| 369 | + | |
364 | 370 | | |
365 | 371 | | |
366 | 372 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
| |||
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
53 | 62 | | |
54 | 63 | | |
55 | 64 | | |
| |||
0 commit comments