From ad4b7741dba45a2be210942c18af6b6e4438f129 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Thu, 19 Nov 2020 13:41:50 +0100 Subject: Build-system: Force C linkage for all DNA type headers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some DNA headers already did this, most did not. Even though many of them would be included in C++ files and thus compiled as C++. This would be confusing and developers may think they have to add `extern "C"` too a whole lot of (indirect) includes to be able to use a C header in C++. However, this is a misconception. `extern "C"` does not cause code to be compiled with C rather than C++! It only causes the linker to not use C++ function name mangling. See https://stackoverflow.com/a/1041880. Because extern DNA headers don't have function declarations, using `extern "C"` actually should not have any effect. On the other hand, adding it causes no harm and avoids confusion. So let's just have it consistently in C header files. Differential Revision: https://developer.blender.org/D9578 Reviewed by: Bastien Montagne, Sybren Stüvel --- source/blender/makesdna/DNA_screen_types.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source/blender/makesdna/DNA_screen_types.h') diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h index e42ff2a6e58..3a99a6f4ee8 100644 --- a/source/blender/makesdna/DNA_screen_types.h +++ b/source/blender/makesdna/DNA_screen_types.h @@ -30,6 +30,10 @@ #include "DNA_ID.h" +#ifdef __cplusplus +extern "C" { +#endif + struct ARegion; struct ARegionType; struct PanelType; @@ -723,3 +727,7 @@ enum { /* Only editor overlays (currently gizmos only!) should be redrawn. */ RGN_DRAW_EDITOR_OVERLAYS = 32, }; + +#ifdef __cplusplus +} +#endif -- cgit v1.2.3