Skip to content

Commit 1d2eb3b

Browse files
committed
SourceKit: correct the macro definitions to avoid warnings on Windows
This silences a large number of warnings due to `-Winconsistent-dllimport`. While it is possible to support the library to be built statically, that is not currently supported by the build system, so simply leave that unsupported for decoration. An option here for ELF targets would be to use `__attribute__((__visibility__("default")))` and enable hidden visibility by default enabling a small bit of optimization.
1 parent d1d8cdd commit 1d2eb3b

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tools/SourceKit/tools/sourcekitd/bin/InProc/CodeCompletionSwiftInterop.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,15 @@
4343
#define SWIFTIDE_END_DECLS
4444
#endif
4545

46-
#ifndef SWIFTIDE_PUBLIC
47-
#if defined(_MSC_VER)
48-
#define SWIFTIDE_PUBLIC __declspec(dllimport)
46+
#if defined(_WIN32)
47+
// NOTE: static builds are currently unsupported.
48+
# if defined(sourcekitd_EXPORTS)
49+
# define SWIFTIDE_PUBLIC __declspec(dllexport)
50+
# else
51+
# define SWIFTIDE_PUBLIC __declspec(dllimport)
52+
# endif
4953
#else
50-
#define SWIFTIDE_PUBLIC
51-
#endif
54+
# define SWIFTIDE_PUBLIC /**/
5255
#endif
5356

5457
#ifndef __has_feature

0 commit comments

Comments
 (0)