[Bf-blender-cvs] [ad4b7741dba] master: Build-system: Force C linkage for all DNA type headers

Julian Eisel noreply at git.blender.org
Thu Nov 19 13:59:44 CET 2020


Commit: ad4b7741dba45a2be210942c18af6b6e4438f129
Author: Julian Eisel
Date:   Thu Nov 19 13:41:50 2020 +0100
Branches: master
https://developer.blender.org/rBad4b7741dba45a2be210942c18af6b6e4438f129

Build-system: Force C linkage for all DNA type headers

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

===================================================================

M	source/blender/makesdna/DNA_armature_types.h
M	source/blender/makesdna/DNA_boid_types.h
M	source/blender/makesdna/DNA_brush_types.h
M	source/blender/makesdna/DNA_cloth_types.h
M	source/blender/makesdna/DNA_collection_types.h
M	source/blender/makesdna/DNA_color_types.h
M	source/blender/makesdna/DNA_constraint_types.h
M	source/blender/makesdna/DNA_curve_types.h
M	source/blender/makesdna/DNA_curveprofile_types.h
M	source/blender/makesdna/DNA_dynamicpaint_types.h
M	source/blender/makesdna/DNA_effect_types.h
M	source/blender/makesdna/DNA_fileglobal_types.h
M	source/blender/makesdna/DNA_fluid_types.h
M	source/blender/makesdna/DNA_gpencil_modifier_types.h
M	source/blender/makesdna/DNA_gpencil_types.h
M	source/blender/makesdna/DNA_gpu_types.h
M	source/blender/makesdna/DNA_hair_types.h
M	source/blender/makesdna/DNA_image_types.h
M	source/blender/makesdna/DNA_ipo_types.h
M	source/blender/makesdna/DNA_key_types.h
M	source/blender/makesdna/DNA_lattice_types.h
M	source/blender/makesdna/DNA_light_types.h
M	source/blender/makesdna/DNA_linestyle_types.h
M	source/blender/makesdna/DNA_mask_types.h
M	source/blender/makesdna/DNA_material_types.h
M	source/blender/makesdna/DNA_meshdata_types.h
M	source/blender/makesdna/DNA_meta_types.h
M	source/blender/makesdna/DNA_nla_types.h
M	source/blender/makesdna/DNA_node_types.h
M	source/blender/makesdna/DNA_object_enums.h
M	source/blender/makesdna/DNA_outliner_types.h
M	source/blender/makesdna/DNA_packedFile_types.h
M	source/blender/makesdna/DNA_particle_types.h
M	source/blender/makesdna/DNA_pointcloud_types.h
M	source/blender/makesdna/DNA_rigidbody_types.h
M	source/blender/makesdna/DNA_screen_types.h
M	source/blender/makesdna/DNA_sdna_types.h
M	source/blender/makesdna/DNA_shader_fx_types.h
M	source/blender/makesdna/DNA_simulation_types.h
M	source/blender/makesdna/DNA_sound_types.h
M	source/blender/makesdna/DNA_space_types.h
M	source/blender/makesdna/DNA_speaker_types.h
M	source/blender/makesdna/DNA_text_types.h
M	source/blender/makesdna/DNA_tracking_types.h
M	source/blender/makesdna/DNA_vec_types.h
M	source/blender/makesdna/DNA_vfont_types.h
M	source/blender/makesdna/DNA_view2d_types.h
M	source/blender/makesdna/DNA_view3d_enums.h
M	source/blender/makesdna/DNA_view3d_types.h
M	source/blender/makesdna/DNA_volume_types.h
M	source/blender/makesdna/DNA_windowmanager_types.h
M	source/blender/makesdna/DNA_workspace_types.h
M	source/blender/makesdna/DNA_world_types.h
M	source/blender/makesdna/DNA_xr_types.h
M	source/blender/makesdna/intern/dna_utils.h

===================================================================

diff --git a/source/blender/makesdna/DNA_armature_types.h b/source/blender/makesdna/DNA_armature_types.h
index 2e029d041ec..de2d56bb264 100644
--- a/source/blender/makesdna/DNA_armature_types.h
+++ b/source/blender/makesdna/DNA_armature_types.h
@@ -27,6 +27,10 @@
 #include "DNA_defs.h"
 #include "DNA_listBase.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct AnimData;
 
 /* this system works on different transformation space levels;
@@ -280,3 +284,7 @@ typedef enum eBone_BBoneHandleType {
 } eBone_BBoneHandleType;
 
 #define MAXBONENAME 64
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/blender/makesdna/DNA_boid_types.h b/source/blender/makesdna/DNA_boid_types.h
index d5aa87fc8ae..7e010f27ce6 100644
--- a/source/blender/makesdna/DNA_boid_types.h
+++ b/source/blender/makesdna/DNA_boid_types.h
@@ -25,6 +25,10 @@
 
 #include "DNA_listBase.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef enum eBoidRuleType {
   eBoidRuleType_None = 0,
   /** go to goal assigned object or loudest assigned signal source */
@@ -222,3 +226,7 @@ typedef struct BoidSettings {
 //#define BOID_RULE_LAND            (1 << 3)        /* goal */
 //#define BOID_RULE_WITH_BOIDS      (1 << 4)        /* avoid collision */
 //#define BOID_RULE_WITH_DEFLECTORS (1 << 5)    /* avoid collision */
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index 3524cb7e7b5..756f21321f4 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -27,6 +27,10 @@
 #include "DNA_curve_types.h"
 #include "DNA_texture_types.h" /* for MTex */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct CurveMapping;
 struct Image;
 struct MTex;
@@ -980,3 +984,7 @@ enum {
 
 #define MAX_BRUSH_PIXEL_RADIUS 500
 #define GP_MAX_BRUSH_PIXEL_RADIUS 1000
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/blender/makesdna/DNA_cloth_types.h b/source/blender/makesdna/DNA_cloth_types.h
index 3d11b3cd7a3..11993d95c2c 100644
--- a/source/blender/makesdna/DNA_cloth_types.h
+++ b/source/blender/makesdna/DNA_cloth_types.h
@@ -25,6 +25,10 @@
 
 #include "DNA_defs.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * This struct contains all the global data required to run a simulation.
  * At the time of this writing, this structure contains data appropriate
@@ -250,3 +254,7 @@ typedef enum {
   CLOTH_COLLSETTINGS_FLAG_ENABLED = (1 << 1), /* enables cloth - object collisions */
   CLOTH_COLLSETTINGS_FLAG_SELF = (1 << 2),    /* enables selfcollisions */
 } CLOTH_COLLISIONSETTINGS_FLAGS;
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/blender/makesdna/DNA_collection_types.h b/source/blender/makesdna/DNA_collection_types.h
index e188426fdda..0a80e00d456 100644
--- a/source/blender/makesdna/DNA_collection_types.h
+++ b/source/blender/makesdna/DNA_collection_types.h
@@ -29,6 +29,10 @@
 #include "DNA_defs.h"
 #include "DNA_listBase.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct Collection;
 struct Object;
 
@@ -109,3 +113,7 @@ typedef enum CollectionColorTag {
 
   COLLECTION_COLOR_TOT,
 } CollectionColorTag;
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/blender/makesdna/DNA_color_types.h b/source/blender/makesdna/DNA_color_types.h
index ff419e1794e..bcebbf32ebd 100644
--- a/source/blender/makesdna/DNA_color_types.h
+++ b/source/blender/makesdna/DNA_color_types.h
@@ -26,6 +26,10 @@
 #include "DNA_defs.h"
 #include "DNA_vec_types.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* general defines for kernel functions */
 #define CM_RESOL 32
 #define CM_TABLE 256
@@ -214,3 +218,7 @@ typedef struct ColorManagedColorspaceSettings {
 enum {
   COLORMANAGE_VIEW_USE_CURVES = (1 << 0),
 };
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h
index 93a67602047..70d33d9ff94 100644
--- a/source/blender/makesdna/DNA_constraint_types.h
+++ b/source/blender/makesdna/DNA_constraint_types.h
@@ -28,6 +28,10 @@
 #include "DNA_defs.h"
 #include "DNA_listBase.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct Action;
 struct Ipo;
 struct Text;
@@ -1172,3 +1176,7 @@ typedef enum eStretchTo_Flags {
 #define CONSTRAINT_RB_CONETWIST 4
 #define CONSTRAINT_RB_VEHICLE 11
 #define CONSTRAINT_RB_GENERIC6DOF 12
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h
index 4eca81c27cc..372cfb225fa 100644
--- a/source/blender/makesdna/DNA_curve_types.h
+++ b/source/blender/makesdna/DNA_curve_types.h
@@ -28,6 +28,10 @@
 #include "DNA_listBase.h"
 #include "DNA_vec_types.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define MAXTEXTBOX 256 /* used in readfile.c and editfont.c */
 
 struct AnimData;
@@ -606,3 +610,7 @@ enum {
 
 /* indicates point has been seen during surface duplication */
 #define SURF_SEEN 4
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/blender/makesdna/DNA_curveprofile_types.h b/source/blender/makesdna/DNA_curveprofile_types.h
index 5b425741df2..450155a32e1 100644
--- a/source/blender/makesdna/DNA_curveprofile_types.h
+++ b/source/blender/makesdna/DNA_curveprofile_types.h
@@ -25,6 +25,10 @@
 
 #include "DNA_vec_types.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /** Number of points in high resolution table is dynamic up to a maximum. */
 #define PROF_TABLE_MAX 512
 /** Number of table points per control point. */
@@ -98,3 +102,7 @@ typedef enum eCurveProfilePresets {
   PROF_PRESET_CROWN = 3,    /* Second molding example. */
   PROF_PRESET_STEPS = 4,    /* Dynamic number of steps defined by segments_len. */
 } eCurveProfilePresets;
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/blender/makesdna/DNA_dynamicpaint_types.h b/source/blender/makesdna/DNA_dynamicpaint_types.h
index 94f54a0d200..24dc90d6c21 100644
--- a/source/blender/makesdna/DNA_dynamicpaint_types.h
+++ b/source/blender/makesdna/DNA_dynamicpaint_types.h
@@ -21,6 +21,11 @@
 #pragma once
 
 #include "DNA_listBase.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct PaintSurfaceData;
 
 /* surface format */
@@ -261,3 +266,7 @@ typedef struct DynamicPaintBrushSettings {
   float wave_factor, wave_clamp;
   float max_velocity, smudge_strength;
 } DynamicPaintBrushSettings;
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/blender/makesdna/DNA_effect_types.h b/source/blender/makesdna/DNA_effect_types.h
index c25e9d0dded..33f2e1b47c0 100644
--- a/source/blender/makesdna/DNA_effect_types.h
+++ b/source/blender/makesdna/DNA_effect_types.h
@@ -23,6 +23,10 @@
 
 #pragma once
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* don't forget, new effects also in writefile.c for dna!!! */
 
 #define PAF_MAXMULT 4
@@ -129,3 +133,7 @@ typedef struct WaveEff {
   float timeoffs, lifetime;
 
 } WaveEff;
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/blender/makesdna/DNA_fileglobal_types.h b/source/blender/makesdna/DNA_fileglobal_types.h
index bb660fb8eaa..dc43524a325 100644
--- a/source/blender/makesdna/DNA_fileglobal_types.h
+++ b/source/blender/makesdna/DNA_fileglobal_types.h
@@ -23,6 +23,10 @@
 
 #pragma once
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * FileGlobal stores a part of the current user-interface settings at
  * the moment of saving, and the file-specific settings.
@@ -53,3 +57,7 @@ typedef struct FileGlobal {
 /* example: if in 2.43 the meshes lose mesh data, minversion is 2.43 then too */
 /* or: in 2.42, subversion 1, same as above, minversion then is 2.42, min subversion 1 */
 /* (defines for version are in the BKE_blender_version.h file, for historic reasons) */
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/blender/makesdna/DNA_fluid_types.h b/source/blender/makesdna/DNA_fluid_types.h
index 2786d4df868..98007a2b0b1 100644
--- a/source/blender/makesdna/DNA_fluid_types.h
+++ b/source/blender/makesdna/DNA_fluid_types.h
@@ -25,6 +25,10 @@
 
 #include "DNA_listBase.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * #FluidDomainSettings.flags
  * Domain flags.
@@ -860,3 +864,7 @@ typedef struct FluidEffectorSettings {
   short guide_mode;
   char _pad2[2];
 } FluidEffectorSettings;
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/blender/makesdna/DNA_gpencil_modifier_types.h b/source/blender/makesdna/DNA_gpencil_modifier_types.h
index f84265eea1d..bd5afc457ac 100644
--- a/source/blender/makesdna/DNA_gpencil_modifier_types.h
+++ b/source/blender/makesdna/DNA_gpencil_modifier_types.h
@@ -23,6 +23,10 @@
 #include "DNA_defs.h"
 #include "DNA_listBase.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct LatticeDeformData;
 
 /* WARNING ALERT! TYPEDEF VALUES ARE WRITTEN IN FILES! SO DO NOT CHANGE!
@@ -801,3 +805,7 @@ typedef enum eTextureGpencil_Mode {
   FILL = 1,
   STROKE_AND_FILL = 2,
 } eTextureGpencil_Mode;
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index 94b75642fd6..212f0bfa1c9 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -27,6 +27,10 @@
 #include "DNA_brush_types.h"
 #include "DNA_listBase.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct AnimData;
 struct MDeformVert;
 struct Curve;
@@ -835,3 +839,7 @@ typedef enum eGP_DrawMode {
 #define GPENCIL_ANY_VERTEX_MASK(flag) \
   ((flag & (GP_VERTEX_MASK_SELECTMODE_POINT | GP_VERTEX_MASK_SELECTMODE_STROKE | \
             GP_VERTEX_MASK_SELECTMODE_SEGMENT)))
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/blender/makesdna/DNA_gpu_types.h b/source/blender/makesdna/DNA_gpu_types.h
index b1ace1bda49..8cea1451525 100644
--- a/source/blender/makesdna/DNA_gpu_types.h
+++ b/source/blender/makesdna/DNA_gpu_types.h
@@ -23,6 +23,10 @@
 
 #pragma once
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Keep for 'Camera' versioning. */
 /** Properties for dof effect. */
 typedef struct GPUDOFSettings {
@@ -36,3 +40,7 @@ typedef struct GPUDOFSettings {
   int num_blades;
   int high_quality;
 } GPUDOFSettings;
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/blender/makesdna/DNA_hair_types.h b/source/blender/makesdna/DNA_hair_types.h
index 27799560395..2e819b32033 100644
--- a/sourc

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list