Message ID | 87iliog9op.fsf@oldenburg.str.redhat.com |
---|---|
State | New |
Headers | show |
Series | <wchar.h>: Make wmempcy, wcwidth, wcswidth available by default | expand |
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.
* 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
On 06/12/22 07:25, Florian Weimer via Libc-alpha wrote: > * 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. What is the define flags used by this old programs? I don't see much trouble adding __USE_XOPEN for _DEFAULT_SOURCE.
* Adhemerval Zanella Netto: > On 06/12/22 07:25, Florian Weimer via Libc-alpha wrote: >> * 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. > > > What is the define flags used by this old programs? I don't see much trouble > adding __USE_XOPEN for _DEFAULT_SOURCE. The program doesn't know anything about feature macros, so it uses implicit _DEFAULT_SOURCE by default. Thanks, Florian
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h index c1321c7518..203ef9ac1d 100644 --- a/wcsmbs/wchar.h +++ b/wcsmbs/wchar.h @@ -271,7 +271,7 @@ extern wchar_t *wmemmove (wchar_t *__s1, const wchar_t *__s2, size_t __n) /* Set N wide characters of S to C. */ extern wchar_t *wmemset (wchar_t *__s, wchar_t __c, size_t __n) __THROW; -#ifdef __USE_GNU +#ifdef __USE_MISC /* Copy N wide characters of SRC to DEST and return pointer to following wide character. */ extern wchar_t *wmempcpy (wchar_t *__restrict __s1, @@ -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. */ /* Convert initial portion of the wide string NPTR to `double'