[Piglit] [PATCH] util: Do not define asprintf for MinGW.

Vinson Lee vlee at freedesktop.org
Sat Dec 21 12:23:26 PST 2013


On Sat, Dec 21, 2013 at 11:15 AM, Brian Paul <brianp at vmware.com> wrote:
> On 12/20/2013 04:33 PM, Brian Paul wrote:
>>
>> On 12/19/2013 05:39 PM, Vinson Lee wrote:
>>>
>>> MinGW provides asprintf in stdio.h.
>>>
>>> Bugzilla:
>>>
>>> https://urldefense.proofpoint.com/v1/url?u=https://bugs.freedesktop.org/show_bug.cgi?id%3D72556&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=lGQMzzTgII0I7jefp2FHq7WtZ%2BTLs8wadB%2BiIj9xpBY%3D%0A&m=OrHWJ9GIP9EIrk176XOZS9JGrUT%2B7HISc4lSVkuMhGg%3D%0A&s=a79ce4cd2796d1b58a32d5ede65eeb342a943b935d6dded8915662b82dab1699
>>>
>>> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
>>> ---
>>>   tests/util/piglit-util.c | 16 ++--------------
>>>   1 file changed, 2 insertions(+), 14 deletions(-)
>>>
>>> diff --git a/tests/util/piglit-util.c b/tests/util/piglit-util.c
>>> index 1c7f118..fbc8723 100644
>>> --- a/tests/util/piglit-util.c
>>> +++ b/tests/util/piglit-util.c
>>> @@ -56,14 +56,7 @@
>>>   #include "piglit-util.h"
>>>
>>>
>>> -#if defined(_WIN32)
>>> -
>>> -/* Some versions of MinGW are missing _vscprintf's declaration,
>>> although they
>>> - * still provide the symbol in the import library.
>>> - */
>>> -#ifdef __MINGW32__
>>> -_CRTIMP int _vscprintf(const char *format, va_list argptr);
>>> -#endif
>>> +#if defined(_MSC_VER)
>>>
>>>   int asprintf(char **strp, const char *fmt, ...)
>>>   {
>>> @@ -76,15 +69,10 @@ int asprintf(char **strp, const char *fmt, ...)
>>>
>>>       va_copy(args_copy, args);
>>>
>>> -#ifdef _WIN32
>>>       /* We need to use _vcsprintf to calculate the length as
>>> vsnprintf returns -1
>>>        * if the number of characters to write is greater than count.
>>>        */
>>>       length = _vscprintf(fmt, args_copy);
>>> -#else
>>> -    char dummy;
>>> -    length = vsnprintf(&dummy, sizeof dummy, fmt, args_copy);
>>> -#endif
>>>
>>>       va_end(args_copy);
>>>
>>> @@ -103,7 +91,7 @@ int asprintf(char **strp, const char *fmt, ...)
>>>       return length;
>>>   }
>>>
>>> -#endif /* _WIN32 */
>>> +#endif /* _MSC_VER */
>>>
>>>   /**
>>>    * \brief Split \a string into an array of strings.
>>>
>>
>> Looks OK, but I'll be on the alert for any regressions here.
>
>
> Yeah, this broke things here.  I'm going to revert this for now.
>
> FWIW, I have Mingw gcc 4.6.3:
>
> $ i686-w64-mingw32-gcc --version
> i686-w64-mingw32-gcc (GCC) 4.6.3
>
> How about you?
>
> -Brian
>
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit


I am using Fedora 20 with MinGW 4.8.2.

$ x86_64-w64-mingw32-gcc --version
x86_64-w64-mingw32-gcc (GCC) 4.8.2 20131016 (Fedora MinGW 4.8.2-1.fc20)

I'm building with these commands.
$ mingw64-cmake .
$ make

What distro are you using and with what build commands? I can try to
reproduce the error that you are seeing.


More information about the Piglit mailing list