Commit 027b213b9eed126363dd1e54636f04d2a5997d69
1 parent
d43f266d
Exists in
master
and in
3 other branches
Fixing compiler detection.
Showing
1 changed file
with
24 additions
and
8 deletions
Show diff stats
src/include/lib3270.h
@@ -47,26 +47,39 @@ | @@ -47,26 +47,39 @@ | ||
47 | #define ENOTCONN 126 | 47 | #define ENOTCONN 126 |
48 | #endif // !ENOTCONN | 48 | #endif // !ENOTCONN |
49 | 49 | ||
50 | + #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || defined (__clang__) | ||
51 | + | ||
52 | + #define LIB3270_DEPRECATED(func) func __attribute__ ((deprecated)) | ||
53 | + | ||
54 | + #elif defined(_WIN32) | ||
55 | + | ||
56 | + #define LIB3270_DEPRECATED(func) __declspec(deprecated) func | ||
57 | + | ||
58 | + #else | ||
59 | + | ||
60 | + #define LIB3270_DEPRECATED(func) func | ||
61 | + | ||
62 | + #endif /* __GNUC__ */ | ||
63 | + | ||
50 | #if defined(__GNUC__) | 64 | #if defined(__GNUC__) |
51 | 65 | ||
52 | #define LIB3270_GNUC_FORMAT(s,f) __attribute__ ((__format__ (__printf__, s, f))) | 66 | #define LIB3270_GNUC_FORMAT(s,f) __attribute__ ((__format__ (__printf__, s, f))) |
53 | - #define LIB3270_DEPRECATED(func) func __attribute__ ((deprecated)) | ||
54 | #define LIB3270_GNUC_NULL_TERMINATED __attribute__((__sentinel__)) | 67 | #define LIB3270_GNUC_NULL_TERMINATED __attribute__((__sentinel__)) |
55 | 68 | ||
56 | #elif defined(_WIN32) | 69 | #elif defined(_WIN32) |
57 | 70 | ||
58 | - #define LIB3270_DEPRECATED(func) __declspec(deprecated) func | ||
59 | #define LIB3270_GNUC_NULL_TERMINATED __attribute__((__sentinel__)) | 71 | #define LIB3270_GNUC_NULL_TERMINATED __attribute__((__sentinel__)) |
72 | + #define LIB3270_GNUC_FORMAT(s,f) | ||
60 | 73 | ||
61 | #elif defined(__LCLINT__) | 74 | #elif defined(__LCLINT__) |
62 | 75 | ||
63 | - #define LIB3270_DEPRECATED(func) func | ||
64 | #define LIB3270_GNUC_NULL_TERMINATED | 76 | #define LIB3270_GNUC_NULL_TERMINATED |
77 | + #define LIB3270_GNUC_FORMAT(s,f) | ||
65 | 78 | ||
66 | #else | 79 | #else |
67 | 80 | ||
68 | - #define LIB3270_DEPRECATED(func) func | ||
69 | #define LIB3270_GNUC_NULL_TERMINATED | 81 | #define LIB3270_GNUC_NULL_TERMINATED |
82 | + #define LIB3270_GNUC_FORMAT(s,f) | ||
70 | 83 | ||
71 | #endif | 84 | #endif |
72 | 85 | ||
@@ -322,9 +335,7 @@ | @@ -322,9 +335,7 @@ | ||
322 | #define LIB3270_INTERNAL extern __attribute__((visibility("hidden"))) | 335 | #define LIB3270_INTERNAL extern __attribute__((visibility("hidden"))) |
323 | #define LIB3270_EXPORT extern __attribute__((visibility("hidden"))) | 336 | #define LIB3270_EXPORT extern __attribute__((visibility("hidden"))) |
324 | 337 | ||
325 | - #elif defined(_WIN32) | ||
326 | - | ||
327 | - #include <windows.h> | 338 | + #elif defined(_WIN32) || defined(_MSC_VER) |
328 | 339 | ||
329 | #define LIB3270_INTERNAL extern | 340 | #define LIB3270_INTERNAL extern |
330 | #define LIB3270_EXPORT extern __declspec (dllexport) | 341 | #define LIB3270_EXPORT extern __declspec (dllexport) |
@@ -334,11 +345,16 @@ | @@ -334,11 +345,16 @@ | ||
334 | #define LIB3270_INTERNAL __hidden extern | 345 | #define LIB3270_INTERNAL __hidden extern |
335 | #define LIB3270_EXPORT extern | 346 | #define LIB3270_EXPORT extern |
336 | 347 | ||
337 | - #else | 348 | + #elif defined(__GNUC__) || defined(HAVE_GNUC_VISIBILITY) |
338 | 349 | ||
339 | #define LIB3270_INTERNAL __attribute__((visibility("hidden"))) extern | 350 | #define LIB3270_INTERNAL __attribute__((visibility("hidden"))) extern |
340 | #define LIB3270_EXPORT __attribute__((visibility("default"))) extern | 351 | #define LIB3270_EXPORT __attribute__((visibility("default"))) extern |
341 | 352 | ||
353 | + #else | ||
354 | + | ||
355 | + #define LIB3270_INTERNAL | ||
356 | + #define LIB3270_EXPORT | ||
357 | + | ||
342 | #endif | 358 | #endif |
343 | 359 | ||
344 | /** | 360 | /** |