[PATCH] <wchar.h>: Make wmempcy, wcwidth, wcswidth available by default

Florian Weimer fweimer@redhat.com
Tue Dec 6 10:25:39 GMT 2022


* Andreas Schwab:

> On Dez 06 2022, Florian Weimer via Libc-alpha wrote:
>
>> @@ -363,14 +363,14 @@ extern size_t wcsnrtombs (char *__restrict __dst,
>>  
>>  
>>  /* The following functions are extensions found in X/Open CAE.  */
>> -#ifdef __USE_XOPEN
>> +#if defined __USE_XOPEN || defined __USE_MISC
>>  /* Determine number of column positions required for C.  */
>>  extern int wcwidth (wchar_t __c) __THROW;
>>  
>>  /* Determine number of column positions required for first N wide
>>     characters (or fewer if S ends before this) in S.  */
>>  extern int wcswidth (const wchar_t *__s, size_t __n) __THROW;
>> -#endif	/* Use X/Open.  */
>> +#endif /* __USE_XOPEN || __USE_MISC.  */
>
> Again, I do not see how that matches what FreeBSD does.  Both
> definitions are protected by __XSI_VISIBLE there.

Should we do this instead?

diff --git a/include/features.h b/include/features.h
index 123de9fd47..40d10a0fb5 100644
--- a/include/features.h
+++ b/include/features.h
@@ -393,6 +393,7 @@
 
 #if defined _DEFAULT_SOURCE
 # define __USE_MISC	1
+# define __USE_XOPEN	1
 #endif
 
 #ifdef	_ATFILE_SOURCE

Should we also define __USE_XOPEN_EXTENDED and __USE_XOPEN2K8 in this
case?  This would allow us to simplify a lot of conditionals involving
__USE_MISC.

Thanks,
Florian



More information about the Libc-alpha mailing list