Skip to content

Commit

Permalink
extern C only around the declaration, not the implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
floooh committed Jul 23, 2018
1 parent 1f028a7 commit f1efc6d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 59 deletions.
8 changes: 0 additions & 8 deletions sokol_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down
8 changes: 0 additions & 8 deletions sokol_audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down Expand Up @@ -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
Expand Down
40 changes: 0 additions & 40 deletions sokol_gfx.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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)

Expand All @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions sokol_time.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -205,6 +209,3 @@ double stm_ns(uint64_t ticks) {
}
#endif /* SOKOL_IMPL */

#ifdef __cplusplus
} /* extern "C" */
#endif

0 comments on commit f1efc6d

Please sign in to comment.