瀏覽代碼

extern C only around the declaration, not the implementation

Andre Weissflog 7 年之前
父節點
當前提交
f1efc6de17
共有 4 個文件被更改,包括 4 次插入59 次删除
  1. 0 8
      sokol_app.h
  2. 0 8
      sokol_audio.h
  3. 0 40
      sokol_gfx.h
  4. 4 3
      sokol_time.h

+ 0 - 8
sokol_app.h

@@ -656,10 +656,6 @@ extern const void* sapp_d3d11_get_depth_stencil_view(void);
     #define _SOKOL_UNUSED(x) (void)(x)
 #endif
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /* helper macros */
 #define _sapp_def(val, def) (((val) == 0) ? (def) : (val))
 #define _sapp_absf(a) (((a)<0.0f)?-(a):(a))
@@ -5521,10 +5517,6 @@ const void* sapp_d3d11_get_depth_stencil_view(void) {
 
 #undef _sapp_def
 
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
 #ifdef _MSC_VER
 #pragma warning(pop)
 #endif

+ 0 - 8
sokol_audio.h

@@ -194,10 +194,6 @@ extern int saudio_push(const float* frames, int num_frames);
     #endif
 #endif
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #define _saudio_def(val, def) (((val) == 0) ? (def) : (val))
 #define _saudio_def_flt(val, def) (((val) == 0.0f) ? (def) : (val))
 
@@ -679,10 +675,6 @@ int saudio_push(const float* frames, int num_frames) {
 #undef _saudio_def
 #undef _saudio_def_flt
 
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
 #ifdef _MSC_VER
 #pragma warning(pop)
 #endif

+ 0 - 40
sokol_gfx.h

@@ -1624,10 +1624,6 @@ extern void sg_discard_context(sg_context ctx_id);
 #define SG_DEFAULT_CLEAR_STENCIL (0)
 #endif
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 enum {
     _SG_SLOT_SHIFT = 16,
     _SG_SLOT_MASK = (1<<_SG_SLOT_SHIFT)-1,
@@ -1864,19 +1860,11 @@ _SOKOL_PRIVATE int _sg_slot_index(uint32_t id) {
     return id & _SG_SLOT_MASK;
 }
 
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
 /*== GL BACKEND ==============================================================*/
 #if defined(SOKOL_GLCORE33) || defined(SOKOL_GLES2) || defined(SOKOL_GLES3)
 /* strstr(), memset() */
 #include <string.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #ifndef GL_UNSIGNED_INT_2_10_10_10_REV
 #define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
 #endif
@@ -4080,10 +4068,6 @@ _SOKOL_PRIVATE void _sg_update_image(_sg_image* img, const sg_image_content* dat
     }
 }
 
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
 /*== D3D11 BACKEND ===========================================================*/
 #elif defined(SOKOL_D3D11)
 
@@ -4116,10 +4100,6 @@ _SOKOL_PRIVATE void _sg_update_image(_sg_image* img, const sg_image_content* dat
 #endif
 #endif
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /*-- enum translation functions ----------------------------------------------*/
 _SOKOL_PRIVATE D3D11_USAGE _sg_d3d11_usage(sg_usage usg) {
     switch (usg) {
@@ -5636,10 +5616,6 @@ _SOKOL_PRIVATE void _sg_update_image(_sg_image* img, const sg_image_content* dat
     }
 }
 
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
 /*== METAL BACKEND ===========================================================*/
 #elif defined(SOKOL_METAL)
 
@@ -5652,10 +5628,6 @@ _SOKOL_PRIVATE void _sg_update_image(_sg_image* img, const sg_image_content* dat
 #include <TargetConditionals.h>
 #import <Metal/Metal.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-    
 enum {
     _SG_MTL_DEFAULT_UB_SIZE = 4 * 1024 * 1024,
     #if !TARGET_OS_IPHONE
@@ -7383,17 +7355,9 @@ _SOKOL_PRIVATE void _sg_update_image(_sg_image* img, const sg_image_content* dat
     _sg_mtl_copy_image_content(img, mtl_tex, data);
 }
 
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
 #else
 #error "No rendering backend selected"
 #endif
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /*== RESOURCE POOLS ==========================================================*/
 typedef struct {
     int size;
@@ -9025,10 +8989,6 @@ void sg_update_image(sg_image img_id, const sg_image_content* data) {
         img->upd_frame_index = _sg.frame_index;
     }
 }
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
 #ifdef _MSC_VER
 #pragma warning(pop)
 #endif

+ 4 - 3
sokol_time.h

@@ -93,6 +93,10 @@ extern double stm_ms(uint64_t ticks);
 extern double stm_us(uint64_t ticks);
 extern double stm_ns(uint64_t ticks);
 
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
 /*-- IMPLEMENTATION ----------------------------------------------------------*/
 #ifdef SOKOL_IMPL
 #ifndef SOKOL_ASSERT
@@ -205,6 +209,3 @@ double stm_ns(uint64_t ticks) {
 }
 #endif /* SOKOL_IMPL */
 
-#ifdef __cplusplus
-} /* extern "C" */
-#endif