From 6f985574b775882075f48f59835bc5a42b1374dd Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Fri, 8 May 2020 18:16:39 +0200 Subject: Cleanup: take includes out of 'extern "C"' blocks Surrounding includes with an 'extern "C"' block is not necessary anymore. Also that made it harder to add any C++ code to some headers, or include headers that have "optional" C++ code like `MEM_guardedalloc.h`. I tested compilation on linux and windows (and got help from @LazyDodo). If this still breaks compilation due to some linker error, the header containing the symbol in question is probably missing an 'extern "C"' block. Differential Revision: https://developer.blender.org/D7653 --- source/blender/imbuf/intern/IMB_allocimbuf.h | 8 ++++++++ source/blender/imbuf/intern/IMB_colormanagement_intern.h | 8 ++++++++ source/blender/imbuf/intern/cineon/cineonlib.h | 4 ++-- source/blender/imbuf/intern/cineon/dpxlib.h | 4 ++-- source/blender/imbuf/intern/dds/dds_api.cpp | 6 ++---- source/blender/imbuf/intern/dds/dds_api.h | 4 ++-- source/blender/imbuf/intern/oiio/openimageio_api.cpp | 2 -- source/blender/imbuf/intern/oiio/openimageio_api.h | 4 ++-- source/blender/imbuf/intern/openexr/openexr_api.cpp | 10 +++------- source/blender/imbuf/intern/openexr/openexr_api.h | 4 ++-- 10 files changed, 31 insertions(+), 23 deletions(-) (limited to 'source/blender/imbuf') diff --git a/source/blender/imbuf/intern/IMB_allocimbuf.h b/source/blender/imbuf/intern/IMB_allocimbuf.h index c252a9a63f8..9f89969cf1c 100644 --- a/source/blender/imbuf/intern/IMB_allocimbuf.h +++ b/source/blender/imbuf/intern/IMB_allocimbuf.h @@ -24,6 +24,10 @@ #ifndef __IMB_ALLOCIMBUF_H__ #define __IMB_ALLOCIMBUF_H__ +#ifdef __cplusplus +extern "C" { +#endif + struct ImBuf; void imb_refcounter_lock_init(void); @@ -44,4 +48,8 @@ void imb_mmap_unlock(void); bool imb_addencodedbufferImBuf(struct ImBuf *ibuf); bool imb_enlargeencodedbufferImBuf(struct ImBuf *ibuf); +#ifdef __cplusplus +} +#endif + #endif diff --git a/source/blender/imbuf/intern/IMB_colormanagement_intern.h b/source/blender/imbuf/intern/IMB_colormanagement_intern.h index f0e599c1375..79abe8472b9 100644 --- a/source/blender/imbuf/intern/IMB_colormanagement_intern.h +++ b/source/blender/imbuf/intern/IMB_colormanagement_intern.h @@ -27,6 +27,10 @@ #include "BLI_sys_types.h" #include "DNA_listBase.h" +#ifdef __cplusplus +extern "C" { +#endif + struct ImBuf; struct OCIO_ConstProcessorRcPtr; @@ -123,4 +127,8 @@ void colorspace_set_default_role(char *colorspace, int size, int role); void colormanage_imbuf_set_default_spaces(struct ImBuf *ibuf); void colormanage_imbuf_make_linear(struct ImBuf *ibuf, const char *from_colorspace); +#ifdef __cplusplus +} +#endif + #endif /* __IMB_COLORMANAGEMENT_INTERN_H__ */ diff --git a/source/blender/imbuf/intern/cineon/cineonlib.h b/source/blender/imbuf/intern/cineon/cineonlib.h index 461407fcf25..040435e44ee 100644 --- a/source/blender/imbuf/intern/cineon/cineonlib.h +++ b/source/blender/imbuf/intern/cineon/cineonlib.h @@ -26,12 +26,12 @@ #ifndef __CINEONLIB_H__ #define __CINEONLIB_H__ +#include "logImageCore.h" + #ifdef __cplusplus extern "C" { #endif -#include "logImageCore.h" - #define CINEON_FILE_MAGIC 0x802A5FD7 #define CINEON_UNDEFINED_U8 0xFF #define CINEON_UNDEFINED_U16 0xFFFF diff --git a/source/blender/imbuf/intern/cineon/dpxlib.h b/source/blender/imbuf/intern/cineon/dpxlib.h index bf07b8e329d..3a7ebe9dddf 100644 --- a/source/blender/imbuf/intern/cineon/dpxlib.h +++ b/source/blender/imbuf/intern/cineon/dpxlib.h @@ -25,12 +25,12 @@ #ifndef __DPXLIB_H__ #define __DPXLIB_H__ +#include "logImageCore.h" + #ifdef __cplusplus extern "C" { #endif -#include "logImageCore.h" - #define DPX_FILE_MAGIC 0x53445058 #define DPX_UNDEFINED_U8 0xFF #define DPX_UNDEFINED_U16 0xFFFF diff --git a/source/blender/imbuf/intern/dds/dds_api.cpp b/source/blender/imbuf/intern/dds/dds_api.cpp index 832b380bbc2..83d304203a0 100644 --- a/source/blender/imbuf/intern/dds/dds_api.cpp +++ b/source/blender/imbuf/intern/dds/dds_api.cpp @@ -18,9 +18,7 @@ * \ingroup imbdds */ -extern "C" { #include "BLI_utildefines.h" -} #include #include @@ -34,8 +32,6 @@ extern "C" { # include "utfconv.h" #endif -extern "C" { - #include "IMB_allocimbuf.h" #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" @@ -44,6 +40,8 @@ extern "C" { #include "IMB_colormanagement.h" #include "IMB_colormanagement_intern.h" +extern "C" { + int imb_save_dds(struct ImBuf *ibuf, const char *name, int /*flags*/) { return (0); /* todo: finish this function */ diff --git a/source/blender/imbuf/intern/dds/dds_api.h b/source/blender/imbuf/intern/dds/dds_api.h index 12db8aa6416..e6782e217fc 100644 --- a/source/blender/imbuf/intern/dds/dds_api.h +++ b/source/blender/imbuf/intern/dds/dds_api.h @@ -21,12 +21,12 @@ #ifndef __DDS_API_H__ #define __DDS_API_H__ +#include "../../IMB_imbuf.h" + #ifdef __cplusplus extern "C" { #endif -#include "../../IMB_imbuf.h" - int imb_is_a_dds(const unsigned char *mem); /* use only first 32 bytes of mem */ int imb_save_dds(struct ImBuf *ibuf, const char *name, int flags); struct ImBuf *imb_load_dds(const unsigned char *mem, diff --git a/source/blender/imbuf/intern/oiio/openimageio_api.cpp b/source/blender/imbuf/intern/oiio/openimageio_api.cpp index 6d3234771e7..df51aada5f0 100644 --- a/source/blender/imbuf/intern/oiio/openimageio_api.cpp +++ b/source/blender/imbuf/intern/oiio/openimageio_api.cpp @@ -35,7 +35,6 @@ #include "MEM_guardedalloc.h" -extern "C" { #include "BLI_blenlib.h" #include "IMB_allocimbuf.h" @@ -43,7 +42,6 @@ extern "C" { #include "IMB_colormanagement_intern.h" #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" -} OIIO_NAMESPACE_USING diff --git a/source/blender/imbuf/intern/oiio/openimageio_api.h b/source/blender/imbuf/intern/oiio/openimageio_api.h index 520ad0c5da5..3dd089d65cb 100644 --- a/source/blender/imbuf/intern/oiio/openimageio_api.h +++ b/source/blender/imbuf/intern/oiio/openimageio_api.h @@ -24,12 +24,12 @@ #ifndef __OPENIMAGEIO_API_H__ #define __OPENIMAGEIO_API_H__ +#include + #ifdef __cplusplus extern "C" { #endif -#include - struct ImBuf; int imb_is_a_photoshop(const char *name); diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index a1719895853..62cc2e605e5 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -75,7 +75,7 @@ _CRTIMP void __cdecl _invalid_parameter_noinfo(void) { } #endif - +} #include "BLI_blenlib.h" #include "BLI_math_color.h" #include "BLI_threads.h" @@ -84,17 +84,13 @@ _CRTIMP void __cdecl _invalid_parameter_noinfo(void) #include "BKE_image.h" #include "IMB_allocimbuf.h" +#include "IMB_colormanagement.h" +#include "IMB_colormanagement_intern.h" #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" #include "IMB_metadata.h" #include "openexr_multi.h" -} - -extern "C" { -#include "IMB_colormanagement.h" -#include "IMB_colormanagement_intern.h" -} using namespace Imf; using namespace Imath; diff --git a/source/blender/imbuf/intern/openexr/openexr_api.h b/source/blender/imbuf/intern/openexr/openexr_api.h index df03d0d205f..b0835e5082e 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.h +++ b/source/blender/imbuf/intern/openexr/openexr_api.h @@ -24,12 +24,12 @@ #ifndef __OPENEXR_API_H__ #define __OPENEXR_API_H__ +#include + #ifdef __cplusplus extern "C" { #endif -#include - void imb_initopenexr(void); void imb_exitopenexr(void); -- cgit v1.2.3