Move the compiler version tests to ws_compiler_tests.h and use them elsewhere.
While we're at it, sort some header file lists, and clean up white space. Change-Id: If737dda45334fedf1df7295d8719ad9381daf7a1 Reviewed-on: https://code.wireshark.org/review/24089 Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
ea49c337c5
commit
a0973d0f94
|
@ -2992,12 +2992,13 @@ install(
|
||||||
set(SHARK_PUBLIC_HEADERS
|
set(SHARK_PUBLIC_HEADERS
|
||||||
cfile.h
|
cfile.h
|
||||||
file.h
|
file.h
|
||||||
register.h
|
|
||||||
globals.h
|
globals.h
|
||||||
log.h
|
log.h
|
||||||
ws_symbol_export.h
|
register.h
|
||||||
ws_attributes.h
|
ws_attributes.h
|
||||||
|
ws_compiler_tests.h
|
||||||
ws_diag_control.h
|
ws_diag_control.h
|
||||||
|
ws_symbol_export.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT WIN32)
|
if(NOT WIN32)
|
||||||
|
|
13
Makefile.am
13
Makefile.am
|
@ -721,12 +721,13 @@ dumpcap_LDADD = \
|
||||||
pkginclude_HEADERS = \
|
pkginclude_HEADERS = \
|
||||||
cfile.h \
|
cfile.h \
|
||||||
file.h \
|
file.h \
|
||||||
register.h \
|
|
||||||
globals.h \
|
globals.h \
|
||||||
log.h \
|
log.h \
|
||||||
ws_symbol_export.h \
|
register.h \
|
||||||
ws_attributes.h \
|
ws_attributes.h \
|
||||||
ws_diag_control.h
|
ws_compiler_tests.h \
|
||||||
|
ws_diag_control.h \
|
||||||
|
ws_symbol_export.h
|
||||||
|
|
||||||
# this target needed for distribution only
|
# this target needed for distribution only
|
||||||
noinst_HEADERS = \
|
noinst_HEADERS = \
|
||||||
|
@ -734,14 +735,14 @@ noinst_HEADERS = \
|
||||||
capture_opts.h \
|
capture_opts.h \
|
||||||
capture_stop_conditions.h \
|
capture_stop_conditions.h \
|
||||||
conditions.h \
|
conditions.h \
|
||||||
|
extcap.h \
|
||||||
|
extcap_parser.h \
|
||||||
|
extcap_spawn.h \
|
||||||
fileset.h \
|
fileset.h \
|
||||||
frame_tvbuff.h \
|
frame_tvbuff.h \
|
||||||
ringbuffer.h \
|
ringbuffer.h \
|
||||||
summary.h \
|
summary.h \
|
||||||
sync_pipe.h \
|
sync_pipe.h \
|
||||||
extcap.h \
|
|
||||||
extcap_parser.h \
|
|
||||||
extcap_spawn.h \
|
|
||||||
version_info.h
|
version_info.h
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
115
ws_attributes.h
115
ws_attributes.h
|
@ -22,123 +22,12 @@
|
||||||
#ifndef __WS_ATTRIBUTES_H__
|
#ifndef __WS_ATTRIBUTES_H__
|
||||||
#define __WS_ATTRIBUTES_H__
|
#define __WS_ATTRIBUTES_H__
|
||||||
|
|
||||||
|
#include "ws_compiler_tests.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
/*
|
|
||||||
* This was introduced by Clang:
|
|
||||||
*
|
|
||||||
* http://clang.llvm.org/docs/LanguageExtensions.html#has-attribute
|
|
||||||
*
|
|
||||||
* in some version (which version?); it has been picked up by GCC 5.0.
|
|
||||||
*/
|
|
||||||
#ifndef __has_attribute
|
|
||||||
/*
|
|
||||||
* It's a macro, so you can check whether it's defined to check
|
|
||||||
* whether it's supported.
|
|
||||||
*
|
|
||||||
* If it's not, define it to always return 0, so that we move on to
|
|
||||||
* the fallback checks.
|
|
||||||
*/
|
|
||||||
#define __has_attribute(x) 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Note that the C90 spec's "6.8.1 Conditional inclusion" and the
|
|
||||||
* C99 spec's and C11 spec's "6.10.1 Conditional inclusion" say:
|
|
||||||
*
|
|
||||||
* Prior to evaluation, macro invocations in the list of preprocessing
|
|
||||||
* tokens that will become the controlling constant expression are
|
|
||||||
* replaced (except for those macro names modified by the defined unary
|
|
||||||
* operator), just as in normal text. If the token "defined" is
|
|
||||||
* generated as a result of this replacement process or use of the
|
|
||||||
* "defined" unary operator does not match one of the two specified
|
|
||||||
* forms prior to macro replacement, the behavior is undefined.
|
|
||||||
*
|
|
||||||
* so you shouldn't use defined() in a #define that's used in #if or
|
|
||||||
* #elif. Some versions of Clang, for example, will warn about this.
|
|
||||||
*
|
|
||||||
* Instead, we check whether the pre-defined macros for particular
|
|
||||||
* compilers are defined and, if not, define the "is this version XXX
|
|
||||||
* or a later version of this compiler" macros as 0.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Check whether this is GCC major.minor or a later release, or some
|
|
||||||
* compiler that claims to be "just like GCC" of that version or a
|
|
||||||
* later release.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if !defined(__GNUC__)
|
|
||||||
#define WS_IS_AT_LEAST_GNUC_VERSION(major, minor) 0
|
|
||||||
#else
|
|
||||||
#define WS_IS_AT_LEAST_GNUC_VERSION(major, minor) \
|
|
||||||
(__GNUC__ > (major) || \
|
|
||||||
(__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Check whether this is Sun C/SunPro C/Oracle Studio major.minor
|
|
||||||
* or a later release.
|
|
||||||
*
|
|
||||||
* The version number in __SUNPRO_C is encoded in hex BCD, with the
|
|
||||||
* uppermost hex digit being the major version number, the next
|
|
||||||
* one or two hex digits being the minor version number, and
|
|
||||||
* the last digit being the patch version.
|
|
||||||
*
|
|
||||||
* It represents the *compiler* version, not the product version;
|
|
||||||
* see
|
|
||||||
*
|
|
||||||
* https://sourceforge.net/p/predef/wiki/Compilers/
|
|
||||||
*
|
|
||||||
* for a partial mapping, which we assume continues for later
|
|
||||||
* 12.x product releases.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if !defined(__SUNPRO_C)
|
|
||||||
#define WS_IS_AT_LEAST_SUNC_VERSION(major, minor) 0
|
|
||||||
#else
|
|
||||||
#define WS_SUNPRO_VERSION_TO_BCD(major, minor) \
|
|
||||||
(((minor) >= 10) ? \
|
|
||||||
(((major) << 12) | (((minor)/10) << 8) | (((minor)%10) << 4)) : \
|
|
||||||
(((major) << 8) | ((minor) << 4)))
|
|
||||||
#define WS_IS_AT_LEAST_SUNC_VERSION(major, minor) \
|
|
||||||
(__SUNPRO_C >= WS_SUNPRO_VERSION_TO_BCD((major), (minor)))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Check whether this is IBM XL C major.minor or a later release.
|
|
||||||
*
|
|
||||||
* The version number in __xlC__ has the major version in the
|
|
||||||
* upper 8 bits and the minor version in the lower 8 bits.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if !defined(__xlC__)
|
|
||||||
#define WS_IS_AT_LEAST_XL_C_VERSION(major, minor) 0
|
|
||||||
#else
|
|
||||||
#define WS_IS_AT_LEAST_XL_C_VERSION(major, minor) \
|
|
||||||
(__xlC__ >= (((major) << 8) | (minor)))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Check whether this is HP aC++/HP C major.minor or a later release.
|
|
||||||
*
|
|
||||||
* The version number in __HP_aCC is encoded in zero-padded decimal BCD,
|
|
||||||
* with the "A." stripped off, the uppermost two decimal digits being
|
|
||||||
* the major version number, the next two decimal digits being the minor
|
|
||||||
* version number, and the last two decimal digits being the patch version.
|
|
||||||
* (Strip off the A., remove the . between the major and minor version
|
|
||||||
* number, and add two digits of patch.)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if !defined(__HP_aCC)
|
|
||||||
#define WS_IS_AT_LEAST_HP_C_VERSION(major, minor) 0
|
|
||||||
#else
|
|
||||||
#define WS_IS_AT_LEAST_HP_C_VERSION(major, minor) \
|
|
||||||
(__HP_aCC >= ((major)*10000 + (minor)*100))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we're running GCC or clang define _U_ to be "__attribute__((unused))"
|
* If we're running GCC or clang define _U_ to be "__attribute__((unused))"
|
||||||
* so we can use _U_ to flag unused function parameters and not get warnings
|
* so we can use _U_ to flag unused function parameters and not get warnings
|
||||||
|
|
|
@ -0,0 +1,150 @@
|
||||||
|
/* ws_compiler_tests.h
|
||||||
|
*
|
||||||
|
* Wireshark - Network traffic analyzer
|
||||||
|
* By Gerald Combs <gerald@wireshark.org>
|
||||||
|
* Copyright 1998 Gerald Combs
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __WS_COMPILER_TESTS_H__
|
||||||
|
#define __WS_COMPILER_TESTS_H__
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This was introduced by Clang:
|
||||||
|
*
|
||||||
|
* http://clang.llvm.org/docs/LanguageExtensions.html#has-attribute
|
||||||
|
*
|
||||||
|
* in some version (which version?); it has been picked up by GCC 5.0.
|
||||||
|
*/
|
||||||
|
#ifndef __has_attribute
|
||||||
|
/*
|
||||||
|
* It's a macro, so you can check whether it's defined to check
|
||||||
|
* whether it's supported.
|
||||||
|
*
|
||||||
|
* If it's not, define it to always return 0, so that we move on to
|
||||||
|
* the fallback checks.
|
||||||
|
*/
|
||||||
|
#define __has_attribute(x) 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Note that the C90 spec's "6.8.1 Conditional inclusion" and the
|
||||||
|
* C99 spec's and C11 spec's "6.10.1 Conditional inclusion" say:
|
||||||
|
*
|
||||||
|
* Prior to evaluation, macro invocations in the list of preprocessing
|
||||||
|
* tokens that will become the controlling constant expression are
|
||||||
|
* replaced (except for those macro names modified by the defined unary
|
||||||
|
* operator), just as in normal text. If the token "defined" is
|
||||||
|
* generated as a result of this replacement process or use of the
|
||||||
|
* "defined" unary operator does not match one of the two specified
|
||||||
|
* forms prior to macro replacement, the behavior is undefined.
|
||||||
|
*
|
||||||
|
* so you shouldn't use defined() in a #define that's used in #if or
|
||||||
|
* #elif. Some versions of Clang, for example, will warn about this.
|
||||||
|
*
|
||||||
|
* Instead, we check whether the pre-defined macros for particular
|
||||||
|
* compilers are defined and, if not, define the "is this version XXX
|
||||||
|
* or a later version of this compiler" macros as 0.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check whether this is GCC major.minor or a later release, or some
|
||||||
|
* compiler that claims to be "just like GCC" of that version or a
|
||||||
|
* later release.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(__GNUC__)
|
||||||
|
#define WS_IS_AT_LEAST_GNUC_VERSION(major, minor) 0
|
||||||
|
#else
|
||||||
|
#define WS_IS_AT_LEAST_GNUC_VERSION(major, minor) \
|
||||||
|
(__GNUC__ > (major) || \
|
||||||
|
(__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check whether this is Clang major.minor or a later release.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(__clang__)
|
||||||
|
#define WS_IS_AT_LEAST_CLANG_VERSION(major, minor) 0
|
||||||
|
#else
|
||||||
|
#define WS_IS_AT_LEAST_CLANG_VERSION(major, minor) \
|
||||||
|
(__clang_major__ > (major) || \
|
||||||
|
(__clang_major__ == (major) && __clang_minor__ >= (minor)))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check whether this is Sun C/SunPro C/Oracle Studio major.minor
|
||||||
|
* or a later release.
|
||||||
|
*
|
||||||
|
* The version number in __SUNPRO_C is encoded in hex BCD, with the
|
||||||
|
* uppermost hex digit being the major version number, the next
|
||||||
|
* one or two hex digits being the minor version number, and
|
||||||
|
* the last digit being the patch version.
|
||||||
|
*
|
||||||
|
* It represents the *compiler* version, not the product version;
|
||||||
|
* see
|
||||||
|
*
|
||||||
|
* https://sourceforge.net/p/predef/wiki/Compilers/
|
||||||
|
*
|
||||||
|
* for a partial mapping, which we assume continues for later
|
||||||
|
* 12.x product releases.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(__SUNPRO_C)
|
||||||
|
#define WS_IS_AT_LEAST_SUNC_VERSION(major, minor) 0
|
||||||
|
#else
|
||||||
|
#define WS_SUNPRO_VERSION_TO_BCD(major, minor) \
|
||||||
|
(((minor) >= 10) ? \
|
||||||
|
(((major) << 12) | (((minor)/10) << 8) | (((minor)%10) << 4)) : \
|
||||||
|
(((major) << 8) | ((minor) << 4)))
|
||||||
|
#define WS_IS_AT_LEAST_SUNC_VERSION(major, minor) \
|
||||||
|
(__SUNPRO_C >= WS_SUNPRO_VERSION_TO_BCD((major), (minor)))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check whether this is IBM XL C major.minor or a later release.
|
||||||
|
*
|
||||||
|
* The version number in __xlC__ has the major version in the
|
||||||
|
* upper 8 bits and the minor version in the lower 8 bits.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(__xlC__)
|
||||||
|
#define WS_IS_AT_LEAST_XL_C_VERSION(major, minor) 0
|
||||||
|
#else
|
||||||
|
#define WS_IS_AT_LEAST_XL_C_VERSION(major, minor) \
|
||||||
|
(__xlC__ >= (((major) << 8) | (minor)))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check whether this is HP aC++/HP C major.minor or a later release.
|
||||||
|
*
|
||||||
|
* The version number in __HP_aCC is encoded in zero-padded decimal BCD,
|
||||||
|
* with the "A." stripped off, the uppermost two decimal digits being
|
||||||
|
* the major version number, the next two decimal digits being the minor
|
||||||
|
* version number, and the last two decimal digits being the patch version.
|
||||||
|
* (Strip off the A., remove the . between the major and minor version
|
||||||
|
* number, and add two digits of patch.)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(__HP_aCC)
|
||||||
|
#define WS_IS_AT_LEAST_HP_C_VERSION(major, minor) 0
|
||||||
|
#else
|
||||||
|
#define WS_IS_AT_LEAST_HP_C_VERSION(major, minor) \
|
||||||
|
(__HP_aCC >= ((major)*10000 + (minor)*100))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __WS_COMPILER_TESTS_H__ */
|
|
@ -24,6 +24,8 @@
|
||||||
#ifndef __WS_DIAG_CONTROL_H__
|
#ifndef __WS_DIAG_CONTROL_H__
|
||||||
#define __WS_DIAG_CONTROL_H__
|
#define __WS_DIAG_CONTROL_H__
|
||||||
|
|
||||||
|
#include "ws_compiler_tests.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
@ -45,26 +47,35 @@ extern "C" {
|
||||||
pragma clang diagnostic error/warning/ignored -Wxxx and
|
pragma clang diagnostic error/warning/ignored -Wxxx and
|
||||||
pragma clang diagnostic push/pop were introduced in clang 2.8 */
|
pragma clang diagnostic push/pop were introduced in clang 2.8 */
|
||||||
|
|
||||||
#if defined(__GNUC__) && !defined(__clang__)
|
#if !defined(__clang__) && WS_IS_AT_LEAST_GNUC_VERSION(4,8)
|
||||||
# define gcc_version ((__GNUC__ * 1000) + (__GNUC_MINOR__ * 10))
|
/*
|
||||||
# if gcc_version >= 4080
|
* This is GCC, or a compiler that 1) claims to be GCC and 2) does
|
||||||
/*
|
* *not* claim to be Clang, and is claiming to be GCC version 4.8.0
|
||||||
* gcc version is >= 4.8.0. We can use "GCC diagnostic push/pop" *and*
|
* or later.
|
||||||
* gcc supports "-Wpedantic".
|
* We can use "GCC diagnostic push/pop" *and* gcc supports "-Wpedantic".
|
||||||
*/
|
*/
|
||||||
# define DIAG_PRAGMA(x) DIAG_DO_PRAGMA(GCC diagnostic x)
|
#define DIAG_PRAGMA(x) DIAG_DO_PRAGMA(GCC diagnostic x)
|
||||||
# define DIAG_OFF(x) DIAG_PRAGMA(push) DIAG_PRAGMA(ignored DIAG_JOINSTR(-W,x))
|
#define DIAG_OFF(x) DIAG_PRAGMA(push) DIAG_PRAGMA(ignored DIAG_JOINSTR(-W,x))
|
||||||
# define DIAG_ON(x) DIAG_PRAGMA(pop)
|
#define DIAG_ON(x) DIAG_PRAGMA(pop)
|
||||||
# endif
|
#elif WS_IS_AT_LEAST_CLANG_VERSION(2,8)
|
||||||
#elif defined(__clang__)
|
/*
|
||||||
# define clang_version ((__clang_major__ * 1000) + (__clang_minor__ * 10))
|
* This is Clang 2.8 or later: we can use "clang diagnostic ignored -Wxxx"
|
||||||
# if clang_version >= 2080
|
* and "clang diagnostic push/pop".
|
||||||
/* clang version is >= 2.8: we can use "clang diagnostic ignored -Wxxx"
|
*/
|
||||||
and "clang diagnostic push/pop" */
|
#define DIAG_PRAGMA(x) DIAG_DO_PRAGMA(clang diagnostic x)
|
||||||
# define DIAG_PRAGMA(x) DIAG_DO_PRAGMA(clang diagnostic x)
|
#define DIAG_OFF(x) DIAG_PRAGMA(push) DIAG_PRAGMA(ignored DIAG_JOINSTR(-W,x))
|
||||||
# define DIAG_OFF(x) DIAG_PRAGMA(push) DIAG_PRAGMA(ignored DIAG_JOINSTR(-W,x))
|
#define DIAG_ON(x) DIAG_PRAGMA(pop)
|
||||||
# define DIAG_ON(x) DIAG_PRAGMA(pop)
|
#else
|
||||||
# endif
|
/*
|
||||||
|
* This is none of the above; we don't have any way to turn diagnostics
|
||||||
|
* on or off.
|
||||||
|
*
|
||||||
|
* XXX - you can do that in MSVC, but it's done differently; we'd
|
||||||
|
* have to have macros for *particular* diagnostics, using the
|
||||||
|
* warning flag for GCC and Clang and the error number for MSVC.
|
||||||
|
*/
|
||||||
|
#define DIAG_OFF(x)
|
||||||
|
#define DIAG_ON(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Use for clang specific pragmas, so we can keep -Wpragmas enabled */
|
/* Use for clang specific pragmas, so we can keep -Wpragmas enabled */
|
||||||
|
@ -76,13 +87,6 @@ extern "C" {
|
||||||
# define DIAG_ON_CLANG(x)
|
# define DIAG_ON_CLANG(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DIAG_OFF
|
|
||||||
/* no gcc or clang, or gcc version < 4.2.0, or clang version < 2.8:
|
|
||||||
we can't do anything */
|
|
||||||
# define DIAG_OFF(x)
|
|
||||||
# define DIAG_ON(x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For dealing with APIs which are only deprecated in macOS (like the
|
* For dealing with APIs which are only deprecated in macOS (like the
|
||||||
* OpenSSL and MIT/Heimdal Kerberos APIs).
|
* OpenSSL and MIT/Heimdal Kerberos APIs).
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "ws_compiler_tests.h"
|
||||||
|
|
||||||
/** Reset symbol export behavior.
|
/** Reset symbol export behavior.
|
||||||
* If you {un}define WS_BUILD_DLL on the fly you'll have to define this
|
* If you {un}define WS_BUILD_DLL on the fly you'll have to define this
|
||||||
* as well.
|
* as well.
|
||||||
|
@ -83,13 +85,13 @@
|
||||||
*/
|
*/
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
/* GCC */
|
/* GCC */
|
||||||
#define WS_DLL_PUBLIC_DEF __attribute__ ((dllexport))
|
#define WS_DLL_PUBLIC_DEF __attribute__ ((dllexport))
|
||||||
#else /* ! __GNUC__ */
|
#else /* ! __GNUC__ */
|
||||||
/*
|
/*
|
||||||
* Presumably MSVC.
|
* Presumably MSVC.
|
||||||
* Note: actually gcc seems to also support this syntax.
|
* Note: actually gcc seems to also support this syntax.
|
||||||
*/
|
*/
|
||||||
#define WS_DLL_PUBLIC_DEF __declspec(dllexport)
|
#define WS_DLL_PUBLIC_DEF __declspec(dllexport)
|
||||||
#endif /* __GNUC__ */
|
#endif /* __GNUC__ */
|
||||||
#else /* WS_BUILD_DLL */
|
#else /* WS_BUILD_DLL */
|
||||||
/*
|
/*
|
||||||
|
@ -103,19 +105,19 @@
|
||||||
*/
|
*/
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
/* GCC */
|
/* GCC */
|
||||||
#define WS_DLL_PUBLIC_DEF __attribute__ ((dllimport))
|
#define WS_DLL_PUBLIC_DEF __attribute__ ((dllimport))
|
||||||
#elif ! (defined ENABLE_STATIC) /* ! __GNUC__ */
|
#elif ! (defined ENABLE_STATIC) /* ! __GNUC__ */
|
||||||
/*
|
/*
|
||||||
* Presumably MSVC, and we're not building all-static.
|
* Presumably MSVC, and we're not building all-static.
|
||||||
* Note: actually gcc seems to also support this syntax.
|
* Note: actually gcc seems to also support this syntax.
|
||||||
*/
|
*/
|
||||||
#define WS_DLL_PUBLIC_DEF __declspec(dllimport)
|
#define WS_DLL_PUBLIC_DEF __declspec(dllimport)
|
||||||
#else /* ! __GNUC__ && ENABLE_STATIC */
|
#else /* ! __GNUC__ && ENABLE_STATIC */
|
||||||
/*
|
/*
|
||||||
* Presumably MSVC, and we're building all-static, so we're
|
* Presumably MSVC, and we're building all-static, so we're
|
||||||
* not building any DLLs.
|
* not building any DLLs.
|
||||||
*/
|
*/
|
||||||
#define WS_DLL_PUBLIC_DEF
|
#define WS_DLL_PUBLIC_DEF
|
||||||
#endif /* __GNUC__ */
|
#endif /* __GNUC__ */
|
||||||
#endif /* WS_BUILD_DLL */
|
#endif /* WS_BUILD_DLL */
|
||||||
|
|
||||||
|
@ -129,42 +131,58 @@
|
||||||
/*
|
/*
|
||||||
* Compiling for UN*X, where the dllimport and dllexport stuff
|
* Compiling for UN*X, where the dllimport and dllexport stuff
|
||||||
* is neither necessary nor supported; just specify the
|
* is neither necessary nor supported; just specify the
|
||||||
* visibility if we have a compiler that claims compatibility
|
* visibility if we have a compiler that supports doing so.
|
||||||
* with GCC 4 or later.
|
|
||||||
*/
|
*/
|
||||||
#if __GNUC__ >= 4
|
#if WS_IS_AT_LEAST_GNUC_VERSION(3,4) \
|
||||||
|
|| WS_IS_AT_LEAST_XL_C_VERSION(12,0)
|
||||||
|
/*
|
||||||
|
* GCC 3.4 or later, or some compiler asserting compatibility with
|
||||||
|
* GCC 3.4 or later, or XL C 13.0 or later, so we have
|
||||||
|
* __attribute__((visibility()).
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Symbols exported from libraries.
|
* Symbols exported from libraries.
|
||||||
*/
|
*/
|
||||||
#define WS_DLL_PUBLIC_DEF __attribute__ ((visibility ("default")))
|
#define WS_DLL_PUBLIC_DEF __attribute__ ((visibility ("default")))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Non-static symbols *not* exported from libraries.
|
* Non-static symbols *not* exported from libraries.
|
||||||
*/
|
*/
|
||||||
#define WS_DLL_LOCAL __attribute__ ((visibility ("hidden")))
|
#define WS_DLL_LOCAL __attribute__ ((visibility ("hidden")))
|
||||||
#else /* ! __GNUC__ >= 4 */
|
#elif WS_IS_AT_LEAST_SUNC_VERSION(5,5)
|
||||||
/*
|
/*
|
||||||
* We have no way to make stuff not explicitly marked as
|
* Sun C 5.5 or later, so we have __global and __hidden.
|
||||||
* visible invisible outside a library, but we might have
|
* (Sun C 5.9 and later also have __attribute__((visibility()),
|
||||||
* a way to make stuff explicitly marked as local invisible
|
* but there's no reason to prefer it with Sun C.)
|
||||||
* outside the library.
|
|
||||||
*
|
|
||||||
* This was lifted from GLib; see above for why we don't use
|
|
||||||
* G_GNUC_INTERNAL.
|
|
||||||
*/
|
*/
|
||||||
#if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
|
|
||||||
/* This supports GCC-style __attribute__ ((visibility (XXX))) */
|
/*
|
||||||
#define WS_DLL_PUBLIC_DEF __attribute__ ((visibility ("default")))
|
* Symbols exported from libraries.
|
||||||
#define WS_DLL_LOCAL __attribute__ ((visibility ("hidden")))
|
*/
|
||||||
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
|
#define WS_DLL_PUBLIC_DEF __global
|
||||||
/* This doesn't, but supports __global and __hidden */
|
|
||||||
#define WS_DLL_PUBLIC_DEF __global
|
/*
|
||||||
#define WS_DLL_LOCAL __hidden
|
* Non-static symbols *not* exported from libraries.
|
||||||
#else /* not Sun C with "hidden" support */
|
*/
|
||||||
#define WS_DLL_PUBLIC_DEF
|
#define WS_DLL_LOCAL __hidden
|
||||||
#define WS_DLL_LOCAL
|
#else
|
||||||
#endif
|
/*
|
||||||
#endif /* __GNUC__ >= 4 */
|
* We have neither a way to make stuff not explicitly marked as
|
||||||
|
* visible invisible outside a library nor a way to make stuff
|
||||||
|
* explicitly marked as local invisible outside the library.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Symbols exported from libraries.
|
||||||
|
*/
|
||||||
|
#define WS_DLL_PUBLIC_DEF
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Non-static symbols *not* exported from libraries.
|
||||||
|
*/
|
||||||
|
#define WS_DLL_LOCAL
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue