summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2010-10-28 14:24:52 +0000
committerWerner Koch <wk@gnupg.org>2010-10-28 14:24:52 +0000
commit8c512c3cf0d596eafb708abe3581486894dfe20e (patch)
treed10f93a9f1e8502301b9d245ba6426ca67de6057 /src
parent53ea388c985107dd8874388d61cecfd0cab3f628 (diff)
downloadlibgpg-error-8c512c3cf0d596eafb708abe3581486894dfe20e.tar.gz
Add some code to allow building with MSC.
Diffstat (limited to 'src')
-rw-r--r--src/gpg-error.h.in2
-rw-r--r--src/init.c4
-rw-r--r--src/mkstrtable.awk2
-rw-r--r--src/w32-gettext.c14
4 files changed, 14 insertions, 8 deletions
diff --git a/src/gpg-error.h.in b/src/gpg-error.h.in
index ae1be21..f89945a 100644
--- a/src/gpg-error.h.in
+++ b/src/gpg-error.h.in
@@ -25,6 +25,8 @@
#ifdef __GNUC__
#define GPG_ERR_INLINE __inline__
+#elif _MSC_VER >= 1300
+#define GPG_ERR_INLINE __inline
#elif __STDC_VERSION__ >= 199901L
#define GPG_ERR_INLINE inline
#else
diff --git a/src/init.c b/src/init.c
index 91abcb0..d1ea44c 100644
--- a/src/init.c
+++ b/src/init.c
@@ -380,6 +380,10 @@ DllMain (HINSTANCE hinst, DWORD reason, LPVOID reserved)
tls_index = TlsAlloc ();
if (tls_index == TLS_OUT_OF_INDEXES)
return FALSE;
+#ifndef _GPG_ERR_HAVE_CONSTRUCTOR
+ /* If we have not constructors (e.g. MSC) we call it here. */
+ _gpg_w32__init_gettext_module ();
+#endif
/* falltru. */
case DLL_THREAD_ATTACH:
tls = LocalAlloc (LPTR, sizeof *tls);
diff --git a/src/mkstrtable.awk b/src/mkstrtable.awk
index d97e150..c9de9c1 100644
--- a/src/mkstrtable.awk
+++ b/src/mkstrtable.awk
@@ -157,7 +157,7 @@ END {
print " " pos[coded_msgs];
print " };";
print "";
- print "static inline int";
+ print "static GPG_ERR_INLINE int";
print namespace "msgidxof (int code)";
print "{";
print " return (0 ? 0";
diff --git a/src/w32-gettext.c b/src/w32-gettext.c
index ca4fbbd..0d0c1eb 100644
--- a/src/w32-gettext.c
+++ b/src/w32-gettext.c
@@ -50,7 +50,7 @@
#endif /*!jnlib_malloc*/
#include "init.h"
-
+#include "gpg-error.h"
/* localname.c from gettext BEGIN. */
@@ -1026,7 +1026,7 @@ my_nl_locale_name (const char *categoryname)
/* Support functions. */
-static __inline__ uint32_t
+static GPG_ERR_INLINE uint32_t
do_swap_u32 (uint32_t i)
{
return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24);
@@ -1041,8 +1041,8 @@ do_swap_u32 (uint32_t i)
/* The so called `hashpjw' function by P.J. Weinberger
[see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools,
1986, 1987 Bell Telephone Laboratories, Inc.] */
-static __inline__ unsigned long
-hash_string( const char *str_param )
+static GPG_ERR_INLINE unsigned long
+hash_string (const char *str_param)
{
unsigned long int hval, g;
const char *str = str_param;
@@ -1147,11 +1147,11 @@ static char *current_domainname;
/* Constructor for this module. This can only be used if we are a
- DLL. IF used as a static lib we can't control the process set; for
+ DLL. If used as a static lib we can't control the process set; for
example it might be used with a main module which is not build with
mingw and thus does not know how to call the constructors. */
#ifdef DLL_EXPORT
-static void module_init (void) __attribute__ ((__constructor__));
+static void module_init (void) _GPG_ERR_CONSTRUCTOR;
#endif
static void
module_init (void)
@@ -1165,7 +1165,7 @@ module_init (void)
}
}
-#ifndef DLL_EXPORT
+#if !defined(DLL_EXPORT) || !defined(_GPG_ERR_HAVE_CONSTRUCTOR)
void
_gpg_w32__init_gettext_module (void)
{