aboutsummaryrefslogtreecommitdiff
path: root/src/include/autoinit_funcs.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/autoinit_funcs.h')
-rw-r--r--src/include/autoinit_funcs.h23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/include/autoinit_funcs.h b/src/include/autoinit_funcs.h
index 6d5117e1..d925c7be 100644
--- a/src/include/autoinit_funcs.h
+++ b/src/include/autoinit_funcs.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * AutoinitFuncs: Automatic Initialization and Deinitialization Functions 2 * AutoinitFuncs: Automatic Initialization and Deinitialization Functions
3 * CopyrightCopyright (C) 2014 Karlson2k (Evgeny Grin) 3 * Copyright(C) 2014-2017 Karlson2k (Evgeny Grin)
4 * 4 *
5 * This header is free software; you can redistribute it and / or 5 * This header is free software; you can redistribute it and / or
6 * modify it under the terms of the GNU Lesser General Public 6 * modify it under the terms of the GNU Lesser General Public
@@ -47,11 +47,13 @@
47 47
48 _SET_INIT_AND_DEINIT_FUNCS(libInit,libDeinit); 48 _SET_INIT_AND_DEINIT_FUNCS(libInit,libDeinit);
49 ------------------------------------------------- 49 -------------------------------------------------
50 50
51 If initializer or deinitializer functions is not needed, just define 51 If initializer or deinitializer function is not needed, just define
52 it as empty function. 52 it as empty function.
53 53
54 This header should work with GCC, clang, MSVC (2010 or later). 54 This header should work with GCC, clang, MSVC (2010 or later) and
55 SunPro / Sun Studio / Oracle Solaris Studio / Oracle Developer Studio
56 compiler.
55 Supported C and C++ languages; application, static and dynamic (DLL) 57 Supported C and C++ languages; application, static and dynamic (DLL)
56 libraries; non-optimized (Debug) and optimized (Release) compilation 58 libraries; non-optimized (Debug) and optimized (Release) compilation
57 and linking. 59 and linking.
@@ -65,10 +67,10 @@
65* Current version of the header. 67* Current version of the header.
66* 0x01093001 = 1.9.30-1. 68* 0x01093001 = 1.9.30-1.
67*/ 69*/
68#define AUTOINIT_FUNCS_VERSION 0x01000001 70#define AUTOINIT_FUNCS_VERSION 0x01000100
69 71
70#if defined(__GNUC__) || defined(__SUNPRO_C) 72#if defined(__GNUC__)
71#/* if possible - check for supported attribute */ 73 /* if possible - check for supported attribute */
72#ifdef __has_attribute 74#ifdef __has_attribute
73#if !__has_attribute(constructor) || !__has_attribute(destructor) 75#if !__has_attribute(constructor) || !__has_attribute(destructor)
74#define _GNUC_ATTR_CONSTR_NOT_SUPPORTED 1 76#define _GNUC_ATTR_CONSTR_NOT_SUPPORTED 1
@@ -76,7 +78,10 @@
76#endif /* __has_attribute */ 78#endif /* __has_attribute */
77#endif /* __GNUC__ */ 79#endif /* __GNUC__ */
78 80
79#if (defined(__GNUC__) || defined(__SUNPRO_C)) && !defined(_GNUC_ATTR_CONSTR_NOT_SUPPORTED) 81/* "_attribute__ ((constructor))" is supported by GCC, clang and
82 Sun/Oracle compiler starting from version 12.1. */
83#if (defined(__GNUC__) && !defined(_GNUC_ATTR_CONSTR_NOT_SUPPORTED)) || \
84 (defined(__SUNPRO_C) && __SUNPRO_C+0 >= 0x5100)
80 85
81#define GNUC_SET_INIT_AND_DEINIT(FI,FD) \ 86#define GNUC_SET_INIT_AND_DEINIT(FI,FD) \
82 void __attribute__ ((constructor)) _GNUC_init_helper_##FI(void) \ 87 void __attribute__ ((constructor)) _GNUC_init_helper_##FI(void) \