Hi, in include/share/alloc.h there is this section: #ifndef SIZE_MAX # ifndef SIZE_T_MAX # ifdef _MSC_VER # define SIZE_T_MAX SIZE_MAX # else # error # endif # endif # define SIZE_MAX SIZE_T_MAX #endif So, if we are on MSVC and have neither SIZE_MAX nor SIZE_T_MAX, we'll define SIZE_T_MAX to mean SIZE_MAX and SIZE_MAX to mean SIZE_T_MAX. I'm afraid this won't work ... It is like this since commit a4c321e, before that it used to say: ... # ifdef _MSC_VER # define SIZE_T_MAX UINT_MAX /* What happens on 64 bit windows? */ ... I can't offer a patch because I don't know much about MSVC or Windows 64 bit, but some kind of fix is obviously needed. Additional random issue I happened to notice: There is no git tag for 1.3.0pre3, the latest is 1.3.0pre2. Ulrich
On 6.4.2013 23:30, Ulrich Klauer wrote:> Hi, > in include/share/alloc.h there is this section: > > #ifndef SIZE_MAX > # ifndef SIZE_T_MAX > # ifdef _MSC_VER > # define SIZE_T_MAX SIZE_MAX > # else > # error > # endif > # endif > # define SIZE_MAX SIZE_T_MAX > #endif > > So, if we are on MSVC and have neither SIZE_MAX nor SIZE_T_MAX, we'll > define SIZE_T_MAX to mean SIZE_MAX and SIZE_MAX to mean SIZE_T_MAX. > I'm afraid this won't work ... > > It is like this since commit a4c321e, before that it used to say: > ... > # ifdef _MSC_VER > # define SIZE_T_MAX UINT_MAX /* What happens on 64 bit windows? */ > ... > I can't offer a patch because I don't know much about MSVC or Windows > 64 bit, but some kind of fix is obviously needed. > >Patch for the circular define. -------------- next part -------------- diff --git a/include/share/alloc.h b/include/share/alloc.h index 8fc17f7..969209e 100644 --- a/include/share/alloc.h +++ b/include/share/alloc.h @@ -50,7 +50,11 @@ #ifndef SIZE_MAX # ifndef SIZE_T_MAX # ifdef _MSC_VER -# define SIZE_T_MAX SIZE_MAX +# ifdef _WIN64 +# define SIZE_T_MAX 0xffffffffffffffffui64 +# else +# define SIZE_T_MAX 0xffffffff +# endif # else # error # endif
Erik de Castro Lopo
2013-Apr-07 08:14 UTC
[flac-dev] Circular preprocessor define with MSVC
Janne Hyv?rinen wrote:> On 6.4.2013 23:30, Ulrich Klauer wrote: > > Hi, > > in include/share/alloc.h there is this section: > > > > #ifndef SIZE_MAX > > # ifndef SIZE_T_MAX > > # ifdef _MSC_VER > > # define SIZE_T_MAX SIZE_MAX > > # else > > # error > > # endif > > # endif > > # define SIZE_MAX SIZE_T_MAX > > #endif > > > > So, if we are on MSVC and have neither SIZE_MAX nor SIZE_T_MAX, we'll > > define SIZE_T_MAX to mean SIZE_MAX and SIZE_MAX to mean SIZE_T_MAX. > > I'm afraid this won't work ... > > > > It is like this since commit a4c321e, before that it used to say: > > ... > > # ifdef _MSC_VER > > # define SIZE_T_MAX UINT_MAX /* What happens on 64 bit windows? */ > > ... > > I can't offer a patch because I don't know much about MSVC or Windows > > 64 bit, but some kind of fix is obviously needed. > > > > > > Patch for the circular define.Patch applied. Thanks. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/