Re: glib/gatomic.c



On 13-03-07 07:26 AM, John Emmas wrote:
Hello guys,

This morning I updated from git and found a minor problem in glib/gatomic.c. 
At around line 530 there's a section of code that looks like this:-

Oops.  My bad.


/* mingw32 does not have MemoryBarrier.
 * MemoryBarrier may be defined as a macro or a function.
 * Just make a failsafe version for ourselves. */
#ifdef MemoryBarrier
#define _GMemoryBarrier MemoryBarrier
#else

static inline void _GMemoryBarrier (void) {
  long dummy = 0;
  InterlockedExchange (&dummy, 1);
}
#endif

Unfortunately, for MSVC, the 'inline' keyword is only available when building
as C++.  For standard 'C' we need to use '__inline'.  I solved the problem by
adding #include "gutils.h", just after #include "config.h" at the top of the
file.  That has the effect of converting 'inline' to '__inline'.  If that's
not an appropriate solution can someone please let me know?

Do all versions of MSVC have MemoryBarrier?  In that case, we should make sure
we never try the function path for MSVC.  Perhaps I should just do that for
mingw32?


Incidentally, a couple of months ago I need to make a small number of changes
to that file in order to be able to build using VC8.0. Mostly it just involved
adding a few lines like this:-

#pragma intrinsic (_InterlockedAnd)

I've attached a full diff for that file in case it's helpful.

Interesting.  I'll push.  Just curious: can you also try building HarfBuzz and
see if we need those there too?

Thanks,
behdad


John


_______________________________________________
gtk-devel-list mailing list
gtk-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list


-- 
behdad
http://behdad.org/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]