diff --git a/intern/ghost/GHOST_Path-api.hh b/intern/ghost/GHOST_Path-api.hh index a0ea21dfb21..0e56ffc820f 100644 --- a/intern/ghost/GHOST_Path-api.hh +++ b/intern/ghost/GHOST_Path-api.hh @@ -10,10 +10,6 @@ #include "GHOST_Types.h" -#ifdef __cplusplus -extern "C" { -#endif - GHOST_DECLARE_HANDLE(GHOST_SystemPathsHandle); /** @@ -63,7 +59,3 @@ extern const char *GHOST_getBinaryDir(); * Add the file to the operating system most recently used files */ extern void GHOST_addToSystemRecentFiles(const char *filepath); - -#ifdef __cplusplus -} -#endif diff --git a/intern/ghost/intern/GHOST_WaylandUtils.hh b/intern/ghost/intern/GHOST_WaylandUtils.hh index 1676789b068..e8efea4416e 100644 --- a/intern/ghost/intern/GHOST_WaylandUtils.hh +++ b/intern/ghost/intern/GHOST_WaylandUtils.hh @@ -8,15 +8,13 @@ #pragma once -#ifdef __cplusplus -# undef wl_array_for_each +#undef wl_array_for_each /** * This macro causes a warning for C++ code, define our own. * See: https://gitlab.freedesktop.org/wayland/wayland/-/issues/34 */ -# define WL_ARRAY_FOR_EACH(pos, array) \ - for (pos = (decltype(pos))((array)->data); \ - reinterpret_cast(pos) < \ - (reinterpret_cast((array)->data) + (array)->size); \ - (pos)++) -#endif +#define WL_ARRAY_FOR_EACH(pos, array) \ + for (pos = (decltype(pos))((array)->data); \ + reinterpret_cast(pos) < \ + (reinterpret_cast((array)->data) + (array)->size); \ + (pos)++) diff --git a/source/blender/blenkernel/BKE_deform.hh b/source/blender/blenkernel/BKE_deform.hh index ff0665ec54d..17223838dd3 100644 --- a/source/blender/blenkernel/BKE_deform.hh +++ b/source/blender/blenkernel/BKE_deform.hh @@ -254,8 +254,6 @@ void BKE_defvert_normalize_lock_map(MDeformVert *dvert, void BKE_defvert_extract_vgroup_to_vertweights( const MDeformVert *dvert, int defgroup, int verts_num, bool invert_vgroup, float *r_weights); -#ifdef __cplusplus - /** * The following three make basic interpolation, * using temp vert_weights array to avoid looking up same weight several times. @@ -283,7 +281,6 @@ void BKE_defvert_extract_vgroup_to_faceweights(const MDeformVert *dvert, blender::OffsetIndices faces, bool invert_vgroup, float *r_weights); -#endif void BKE_defvert_weight_to_rgb(float r_rgb[3], float weight); diff --git a/source/blender/blenkernel/BKE_node.hh b/source/blender/blenkernel/BKE_node.hh index 00c543eafc2..aa99684a3ac 100644 --- a/source/blender/blenkernel/BKE_node.hh +++ b/source/blender/blenkernel/BKE_node.hh @@ -86,7 +86,6 @@ typedef struct bNodeSocketTemplate { /* Use `void *` for callbacks that require C++. This is rather ugly, but works well for now. This * would not be necessary if we would use bNodeSocketType and bNodeType only in C++ code. * However, achieving this requires quite a few changes currently. */ -#ifdef __cplusplus namespace blender { class CPPType; namespace nodes { @@ -106,7 +105,6 @@ class ShaderNode; } // namespace realtime_compositor } // namespace blender -using CPPTypeHandle = blender::CPPType; using NodeMultiFunctionBuildFunction = void (*)(blender::nodes::NodeMultiFunctionBuilder &builder); using NodeGeometryExecFunction = void (*)(blender::nodes::GeoNodeExecParams params); using NodeDeclareFunction = void (*)(blender::nodes::NodeDeclarationBuilder &builder); @@ -130,23 +128,6 @@ using NodeGetCompositorShaderNodeFunction = blender::realtime_compositor::ShaderNode *(*)(blender::nodes::DNode node); using NodeExtraInfoFunction = void (*)(blender::nodes::NodeExtraInfoParams ¶ms); -#else -typedef void *NodeGetCompositorOperationFunction; -typedef void *NodeGetCompositorShaderNodeFunction; -typedef void *NodeMultiFunctionBuildFunction; -typedef void *NodeGeometryExecFunction; -typedef void *NodeDeclareFunction; -typedef void *NodeDeclareDynamicFunction; -typedef void *NodeGatherSocketLinkOperationsFunction; -typedef void *NodeGatherAddOperationsFunction; -typedef void *SocketGetCPPTypeFunction; -typedef void *SocketGetGeometryNodesCPPTypeFunction; -typedef void *SocketGetGeometryNodesCPPValueFunction; -typedef void *SocketGetCPPValueFunction; -typedef void *NodeExtraInfoFunction; -typedef struct CPPTypeHandle CPPTypeHandle; -#endif - /** * \brief Defines a socket type. * @@ -201,11 +182,11 @@ typedef struct bNodeSocketType { void (*free_self)(struct bNodeSocketType *stype); /* Return the CPPType of this socket. */ - const CPPTypeHandle *base_cpp_type; + const blender::CPPType *base_cpp_type; /* Get the value of this socket in a generic way. */ SocketGetCPPValueFunction get_base_cpp_value; /* Get geometry nodes cpp type. */ - const CPPTypeHandle *geometry_nodes_cpp_type; + const blender::CPPType *geometry_nodes_cpp_type; /* Get geometry nodes cpp value. */ SocketGetGeometryNodesCPPValueFunction get_geometry_nodes_cpp_value; /* Default value for this socket type. */ @@ -379,7 +360,7 @@ typedef struct bNodeType { * the node. In this case, the static declaration is mostly just a hint, and does not have to * match with the final node. */ - NodeDeclarationHandle *static_declaration; + blender::nodes::NodeDeclaration *static_declaration; /** * Add to the list of search names and operations gathered by node link drag searching. diff --git a/source/blender/blenkernel/BKE_node_runtime.hh b/source/blender/blenkernel/BKE_node_runtime.hh index b1b50f9f718..9b9f07adf2b 100644 --- a/source/blender/blenkernel/BKE_node_runtime.hh +++ b/source/blender/blenkernel/BKE_node_runtime.hh @@ -186,7 +186,7 @@ class bNodeSocketRuntime : NonCopyable, NonMovable { * data. It has to be updated when the node declaration changes. Access can be allowed by using * #AllowUsingOutdatedInfo. */ - const SocketDeclarationHandle *declaration = nullptr; + const nodes::SocketDeclaration *declaration = nullptr; /** #eNodeTreeChangedFlag. */ uint32_t changed_flag = 0; @@ -253,7 +253,7 @@ class bNodeRuntime : NonCopyable, NonMovable { * intended to change though. Especially when nodes become more dynamic with respect to how many * sockets they have. */ - NodeDeclarationHandle *declaration = nullptr; + nodes::NodeDeclaration *declaration = nullptr; /** #eNodeTreeChangedFlag. */ uint32_t changed_flag = 0; diff --git a/source/blender/blenkernel/BKE_subdiv_modifier.hh b/source/blender/blenkernel/BKE_subdiv_modifier.hh index e6a269be308..89468096f1c 100644 --- a/source/blender/blenkernel/BKE_subdiv_modifier.hh +++ b/source/blender/blenkernel/BKE_subdiv_modifier.hh @@ -12,10 +12,6 @@ #include "BLI_sys_types.h" -#ifdef __cplusplus -extern "C" { -#endif - /* Hardcoded for until GPU shaders are automatically generated, then we will have a more * programmatic way of detecting this. */ #define MAX_GPU_SUBDIV_SSBOS 12 @@ -96,7 +92,3 @@ Subdiv *BKE_subsurf_modifier_subdiv_descriptor_ensure(SubsurfRuntimeData *runtim * which should be used to check if the modifier is enabled. */ int BKE_subsurf_modifier_eval_required_mode(bool is_final_render, bool is_edit_mode); - -#ifdef __cplusplus -} -#endif diff --git a/source/blender/bmesh/bmesh_class.hh b/source/blender/bmesh/bmesh_class.hh index d4a7a822d6b..30b60006360 100644 --- a/source/blender/bmesh/bmesh_class.hh +++ b/source/blender/bmesh/bmesh_class.hh @@ -463,11 +463,7 @@ enum { /* Assignment from a void* to a typed pointer is not allowed in C++, * casting the LHS to void works fine though. */ -#ifdef __cplusplus -# define BM_CHECK_TYPE_ELEM_ASSIGN(ele) (BM_CHECK_TYPE_ELEM(ele)), *((void **)&ele) -#else -# define BM_CHECK_TYPE_ELEM_ASSIGN(ele) (BM_CHECK_TYPE_ELEM(ele)), ele -#endif +#define BM_CHECK_TYPE_ELEM_ASSIGN(ele) (BM_CHECK_TYPE_ELEM(ele)), *((void **)&ele) /** #BMHeader.hflag (char) */ enum { diff --git a/source/blender/bmesh/intern/bmesh_iterators.hh b/source/blender/bmesh/intern/bmesh_iterators.hh index 6aaf7b3b78c..39c837e72b8 100644 --- a/source/blender/bmesh/intern/bmesh_iterators.hh +++ b/source/blender/bmesh/intern/bmesh_iterators.hh @@ -219,8 +219,6 @@ void *BMO_iter_as_arrayN(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], void **stack_array, int stack_array_size); -#ifdef __cplusplus - int BM_iter_mesh_bitmap_from_filter(char itype, BMesh *bm, blender::MutableBitSpan bitmap, @@ -234,8 +232,6 @@ int BM_iter_mesh_bitmap_from_filter_tessface(BMesh *bm, bool (*test_fn)(BMFace *, void *user_data), void *user_data); -#endif - /** * \brief Elem Iter Flag Count * diff --git a/source/blender/editors/space_text/text_intern.hh b/source/blender/editors/space_text/text_intern.hh index d5162b292eb..c48db7bdf29 100644 --- a/source/blender/editors/space_text/text_intern.hh +++ b/source/blender/editors/space_text/text_intern.hh @@ -20,10 +20,6 @@ struct TextLine; struct bContext; struct wmOperatorType; -#ifdef __cplusplus -extern "C" { -#endif - /* `text_draw.cc` */ void draw_text_main(SpaceText *st, ARegion *region); @@ -181,11 +177,7 @@ void TEXT_OT_autocomplete(wmOperatorType *ot); /* `space_text.cc` */ -extern const char *text_context_dir[]; /* doc access */ - -#ifdef __cplusplus -} -#endif +extern "C" const char *text_context_dir[]; /* doc access */ namespace blender::ed::text { struct SpaceText_Runtime { diff --git a/source/blender/gpu/GPU_texture.hh b/source/blender/gpu/GPU_texture.hh index e58d83b529b..714c7f1afbd 100644 --- a/source/blender/gpu/GPU_texture.hh +++ b/source/blender/gpu/GPU_texture.hh @@ -12,9 +12,7 @@ #pragma once -#ifdef __cplusplus -# include -#endif +#include #include "BLI_assert.h" #include "BLI_utildefines.h" @@ -192,7 +190,6 @@ struct GPUSamplerState { /** Specifies how the GPUSamplerState structure should be interpreted when passed around. */ GPUSamplerStateType type : 8; -#ifdef __cplusplus /** * Constructs a sampler state with default filtering and extended extend in both x and y axis. * See the documentation on GPU_SAMPLER_FILTERING_DEFAULT and GPU_SAMPLER_EXTEND_MODE_EXTEND for @@ -387,18 +384,8 @@ struct GPUSamplerState { this->extend_yz == rhs.extend_yz && this->custom_type == rhs.custom_type && this->type == rhs.type; } -#endif }; -#ifndef __cplusplus -/** Identical to GPUSamplerState::default_sampler for non C++ users. */ -static const GPUSamplerState GPU_SAMPLER_DEFAULT = {GPU_SAMPLER_FILTERING_DEFAULT, - GPU_SAMPLER_EXTEND_MODE_EXTEND, - GPU_SAMPLER_EXTEND_MODE_EXTEND, - GPU_SAMPLER_CUSTOM_COMPARE, - GPU_SAMPLER_STATE_TYPE_PARAMETERS}; -#endif - /** \} */ /* -------------------------------------------------------------------- */ diff --git a/source/blender/imbuf/intern/IMB_filetype.hh b/source/blender/imbuf/intern/IMB_filetype.hh index ad3196966a8..235e4693a0d 100644 --- a/source/blender/imbuf/intern/IMB_filetype.hh +++ b/source/blender/imbuf/intern/IMB_filetype.hh @@ -10,10 +10,6 @@ #include "IMB_imbuf.hh" -#ifdef __cplusplus -extern "C" { -#endif - /* -------------------------------------------------------------------- */ /** \name Generic File Type * \{ */ @@ -297,7 +293,3 @@ ImBuf *imb_load_filepath_thumbnail_svg(const char *filepath, size_t *r_height); /** \} */ - -#ifdef __cplusplus -}; -#endif diff --git a/source/blender/imbuf/intern/format_bmp.cc b/source/blender/imbuf/intern/format_bmp.cc index 1a2b6763c72..66dbf0cbe13 100644 --- a/source/blender/imbuf/intern/format_bmp.cc +++ b/source/blender/imbuf/intern/format_bmp.cc @@ -14,8 +14,6 @@ OIIO_NAMESPACE_USING using namespace blender::imbuf; -extern "C" { - bool imb_is_a_bmp(const uchar *mem, size_t size) { return imb_oiio_check(mem, size, "bmp"); @@ -42,4 +40,3 @@ bool imb_save_bmp(ImBuf *ibuf, const char *filepath, int flags) return imb_oiio_write(ctx, filepath, file_spec); } -} diff --git a/source/blender/imbuf/intern/format_dds.cc b/source/blender/imbuf/intern/format_dds.cc index 0b6a88dbcb6..be3e7341be2 100644 --- a/source/blender/imbuf/intern/format_dds.cc +++ b/source/blender/imbuf/intern/format_dds.cc @@ -28,10 +28,6 @@ OIIO_NAMESPACE_USING using namespace blender::imbuf; -using std::unique_ptr; - -extern "C" { - static void LoadDXTCImage(ImBuf *ibuf, Filesystem::IOMemReader &mem_reader); void imb_init_dds() @@ -336,4 +332,3 @@ static void LoadDXTCImage(ImBuf *ibuf, Filesystem::IOMemReader &mem_reader) FlipDXTCImage(ibuf); } } -} diff --git a/source/blender/imbuf/intern/format_dpx.cc b/source/blender/imbuf/intern/format_dpx.cc index f6d2ff4ddf7..ff110a5c06d 100644 --- a/source/blender/imbuf/intern/format_dpx.cc +++ b/source/blender/imbuf/intern/format_dpx.cc @@ -15,7 +15,6 @@ OIIO_NAMESPACE_USING using namespace blender::imbuf; -extern "C" { bool imb_is_a_dpx(const uchar *mem, size_t size) { return imb_oiio_check(mem, size, "dpx"); @@ -85,4 +84,3 @@ bool imb_save_dpx(ImBuf *ibuf, const char *filepath, int flags) return imb_oiio_write(ctx, filepath, file_spec); } -} diff --git a/source/blender/imbuf/intern/format_hdr.cc b/source/blender/imbuf/intern/format_hdr.cc index 41973a446de..cedc4164e9b 100644 --- a/source/blender/imbuf/intern/format_hdr.cc +++ b/source/blender/imbuf/intern/format_hdr.cc @@ -14,8 +14,6 @@ OIIO_NAMESPACE_USING using namespace blender::imbuf; -extern "C" { - bool imb_is_a_hdr(const uchar *mem, size_t size) { return imb_oiio_check(mem, size, "hdr"); @@ -53,4 +51,3 @@ bool imb_save_hdr(ImBuf *ibuf, const char *filepath, int flags) return imb_oiio_write(ctx, filepath, file_spec); } -} diff --git a/source/blender/imbuf/intern/format_png.cc b/source/blender/imbuf/intern/format_png.cc index 6c4e1991c4b..a59f3721a51 100644 --- a/source/blender/imbuf/intern/format_png.cc +++ b/source/blender/imbuf/intern/format_png.cc @@ -15,8 +15,6 @@ OIIO_NAMESPACE_USING using namespace blender::imbuf; -extern "C" { - bool imb_is_a_png(const uchar *mem, size_t size) { return imb_oiio_check(mem, size, "png"); @@ -67,4 +65,3 @@ bool imb_save_png(ImBuf *ibuf, const char *filepath, int flags) return imb_oiio_write(ctx, filepath, file_spec); } -} diff --git a/source/blender/imbuf/intern/format_psd.cc b/source/blender/imbuf/intern/format_psd.cc index 09fe63692c8..cd6dafba284 100644 --- a/source/blender/imbuf/intern/format_psd.cc +++ b/source/blender/imbuf/intern/format_psd.cc @@ -15,8 +15,6 @@ OIIO_NAMESPACE_USING using namespace blender::imbuf; -extern "C" { - bool imb_is_a_psd(const uchar *mem, size_t size) { return imb_oiio_check(mem, size, "psd"); @@ -34,4 +32,3 @@ ImBuf *imb_load_psd(const uchar *mem, size_t size, int flags, char colorspace[IM return imb_oiio_read(ctx, config, colorspace, spec); } -} diff --git a/source/blender/imbuf/intern/format_targa.cc b/source/blender/imbuf/intern/format_targa.cc index 60cb36bc06d..ce42692ca43 100644 --- a/source/blender/imbuf/intern/format_targa.cc +++ b/source/blender/imbuf/intern/format_targa.cc @@ -14,8 +14,6 @@ OIIO_NAMESPACE_USING using namespace blender::imbuf; -extern "C" { - bool imb_is_a_tga(const uchar *mem, size_t size) { return imb_oiio_check(mem, size, "tga"); @@ -42,4 +40,3 @@ bool imb_save_tga(ImBuf *ibuf, const char *filepath, int flags) return imb_oiio_write(ctx, filepath, file_spec); } -} diff --git a/source/blender/imbuf/intern/format_tiff.cc b/source/blender/imbuf/intern/format_tiff.cc index 4ac5f04f4f0..37c45473dc2 100644 --- a/source/blender/imbuf/intern/format_tiff.cc +++ b/source/blender/imbuf/intern/format_tiff.cc @@ -15,8 +15,6 @@ OIIO_NAMESPACE_USING using namespace blender::imbuf; -extern "C" { - bool imb_is_a_tiff(const uchar *mem, size_t size) { return imb_oiio_check(mem, size, "tif"); @@ -75,4 +73,3 @@ bool imb_save_tiff(ImBuf *ibuf, const char *filepath, int flags) return imb_oiio_write(ctx, filepath, file_spec); } -} diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index 4ae858ffefa..2c15357b224 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -43,15 +43,11 @@ class bNodeTreeZone; namespace blender::bke { struct RuntimeNodeEnumItems; } // namespace blender::bke -using NodeDeclarationHandle = blender::nodes::NodeDeclaration; -using SocketDeclarationHandle = blender::nodes::SocketDeclaration; using bNodeTreeRuntimeHandle = blender::bke::bNodeTreeRuntime; using bNodeRuntimeHandle = blender::bke::bNodeRuntime; using bNodeSocketRuntimeHandle = blender::bke::bNodeSocketRuntime; using RuntimeNodeEnumItemsHandle = blender::bke::RuntimeNodeEnumItems; #else -typedef struct NodeDeclarationHandle NodeDeclarationHandle; -typedef struct SocketDeclarationHandle SocketDeclarationHandle; typedef struct bNodeTreeRuntimeHandle bNodeTreeRuntimeHandle; typedef struct bNodeRuntimeHandle bNodeRuntimeHandle; typedef struct bNodeSocketRuntimeHandle bNodeSocketRuntimeHandle; diff --git a/source/blender/nodes/texture/node_texture_util.hh b/source/blender/nodes/texture/node_texture_util.hh index a77965af4d3..8a96543b8da 100644 --- a/source/blender/nodes/texture/node_texture_util.hh +++ b/source/blender/nodes/texture/node_texture_util.hh @@ -16,10 +16,6 @@ #include "RE_texture.h" -#ifdef __cplusplus -extern "C" { -#endif - struct bNodeThreadStack; struct TexCallData { @@ -90,7 +86,3 @@ bNodeTreeExec *ntreeTexBeginExecTree_internal(bNodeExecContext *context, bNodeTree *ntree, bNodeInstanceKey parent_key); void ntreeTexEndExecTree_internal(bNodeTreeExec *exec); - -#ifdef __cplusplus -} -#endif