This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2 13/30] ldbl-128ibm-compat: Add ISO C99 versions of scanf functions


Hi, Paul,

I'm sorry I took so long to reply to this message.  It sent me down a
rabbit hole.

On Fri, 08 Nov 2019, Paul E Murphy wrote:
>
>On 10/25/19 10:33 AM, Gabriel F. T. Gomes wrote:
>> From: "Gabriel F. T. Gomes" <gabrielftg@linux.ibm.com>
>> 
>> --- /dev/null
>> +++ b/sysdeps/ieee754/ldbl-128ibm-compat/test-isoc99-scanf-ieee128.c
>> @@ -0,0 +1,13 @@
>> +#undef _GNU_SOURCE
>> +/* The following macro definitions are a hack.  They word around disabling
>> +   the GNU extension while still using a few internal headers.  */  
>
>Indeed a hack. How frail is this?

A bit too much! :B

I spent some time trying to remember why I thought that was necessary and
I have a better understanding, now.

This hack is only really necessary for the wide-character versions of the
tests, because in wcsmbs/wchar.h, the redirections for vfwscanf, vwscanf,
and, more specifically, vswscanf to their ISO C99 versions is protected by
#if !defined __USE_GNU, whereas the redirections for fwscanf, wscanf, and
swscanf, as well as for all of the non-wide equivalents is protected by
#if !__GLIBC_USE (DEPRECATED_SCANF).

The use of DEPRECATED_SCANF is somewhat recent (added by commit ID
03992356e6fe) and it is my understanding that the change is missing for
vswscanf (and friends) simply due to oversight.

I have a patch to implement the missing change and I just finished running
it with build-many-glibcs.py.  I'll send it for review.

>> +#define u_char unsigned char
>> +#define u_short unsigned short
>> +#define u_int unsigned int
>> +#define u_long unsigned long
>> +#include <libio/stdio.h>
>> +#include <stdlib/stdlib.h>
>> +#include <string/string.h>
>> +#include <wcsmbs/wchar.h>
>>
>> [...]
>>
>> --- /dev/null
>> +++ b/sysdeps/ieee754/ldbl-128ibm-compat/test-isoc99-wscanf-ieee128.c
>> @@ -0,0 +1,13 @@
>> +#undef _GNU_SOURCE
>> +/* The following macro definitions are a hack.  They word around disabling
>> +   the GNU extension while still using a few internal headers.  */  
>
>The same hack shows up four times, should it be isolated in one place?

With the fix, I'll try and make it all go away.  Thanks for pointing that out.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]