Skip to content

Commit 67a9a5a

Browse files
committed
dispatch: extract DISPATCH_EXTERN from the DISPATCH_EXPORT macro
This extracts a new `DISPATCH_EXTERN` macro from the existing definition of `DISPATCH_EXPORT`. This follows the standard style of many of Darwin's frameworks. Extracting and re-using this macro allows us to make the definition of `DISPATCH_EXPORT` more concise.
1 parent 13d250b commit 67a9a5a

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

dispatch/base.h

+12-12
Original file line numberDiff line numberDiff line change
@@ -178,24 +178,24 @@
178178
#endif
179179
#endif
180180

181+
#ifndef DISPATCH_EXTERN
182+
# if defined(__cplusplus)
183+
# define DISPATCH_EXTERN extern "C"
184+
# else
185+
# define DISPATCH_EXTERN extern
186+
# endif
187+
#define
188+
181189
#if defined(_WIN32)
182190
#if defined(__DISPATCH_BUILDING_DISPATCH__)
183-
#if defined(__cplusplus)
184-
#define DISPATCH_EXPORT extern "C" __declspec(dllexport)
191+
#define DISPATCH_EXPORT DISPATCH_EXTERN __declspec(dllexport)
185192
#else
186-
#define DISPATCH_EXPORT extern __declspec(dllexport)
187-
#endif
188-
#else
189-
#if defined(__cplusplus)
190-
#define DISPATCH_EXPORT extern "C" __declspec(dllimport)
191-
#else
192-
#define DISPATCH_EXPORT extern __declspec(dllimport)
193-
#endif
193+
#define DISPATCH_EXPORT DISPATCH_EXTERN __declspec(dllimport)
194194
#endif
195195
#elif __GNUC__
196-
#define DISPATCH_EXPORT extern __attribute__((visibility("default")))
196+
#define DISPATCH_EXPORT DISPATCH_EXTERN __attribute__((visibility("default")))
197197
#else
198-
#define DISPATCH_EXPORT extern
198+
#define DISPATCH_EXPORT DISPATCH_EXTERN
199199
#endif
200200

201201
#if __GNUC__

0 commit comments

Comments
 (0)