mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH] Fix usage of __strftime_fmt_1 in wcsftime
@ 2018-04-07 14:26 Samuel Holland
  2018-04-07 14:29 ` Rich Felker
  0 siblings, 1 reply; 3+ messages in thread
From: Samuel Holland @ 2018-04-07 14:26 UTC (permalink / raw)
  To: musl; +Cc: Samuel Holland

Commit 8a6bd7307da3fc4d08dd6a9277b611ccb4971354 modified the signature
of __strftime_fmt_1 in strftime.c, but failed to update the prototype in
wcsftime.c. This was found by compiling musl with LTO:

    src/time/wcsftime.c:7:13: warning: type of '__strftime_fmt_1' does \
        not match original declaration [-Wlto-type-mismatch]
---
 src/time/wcsftime.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/time/wcsftime.c b/src/time/wcsftime.c
index 638e64f6..6584c45c 100644
--- a/src/time/wcsftime.c
+++ b/src/time/wcsftime.c
@@ -4,7 +4,7 @@
 #include "locale_impl.h"
 #include "libc.h"
 
-const char *__strftime_fmt_1(char (*s)[100], size_t *l, int f, const struct tm *tm, locale_t loc);
+const char *__strftime_fmt_1(char (*s)[100], size_t *l, int f, const struct tm *tm, locale_t loc, int pad);
 
 size_t __wcsftime_l(wchar_t *restrict s, size_t n, const wchar_t *restrict f, const struct tm *restrict tm, locale_t loc)
 {
@@ -35,7 +35,7 @@ size_t __wcsftime_l(wchar_t *restrict s, size_t n, const wchar_t *restrict f, co
 		}
 		f = p;
 		if (*f == 'E' || *f == 'O') f++;
-		t_mb = __strftime_fmt_1(&buf, &k, *f, tm, loc);
+		t_mb = __strftime_fmt_1(&buf, &k, *f, tm, loc, 0);
 		if (!t_mb) break;
 		k = mbstowcs(wbuf, t_mb, sizeof wbuf / sizeof *wbuf);
 		if (k == (size_t)-1) return 0;
-- 
2.16.1



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix usage of __strftime_fmt_1 in wcsftime
  2018-04-07 14:26 [PATCH] Fix usage of __strftime_fmt_1 in wcsftime Samuel Holland
@ 2018-04-07 14:29 ` Rich Felker
  2018-04-07 14:46   ` Samuel Holland
  0 siblings, 1 reply; 3+ messages in thread
From: Rich Felker @ 2018-04-07 14:29 UTC (permalink / raw)
  To: musl

On Sat, Apr 07, 2018 at 09:26:32AM -0500, Samuel Holland wrote:
> Commit 8a6bd7307da3fc4d08dd6a9277b611ccb4971354 modified the signature
> of __strftime_fmt_1 in strftime.c, but failed to update the prototype in
> wcsftime.c. This was found by compiling musl with LTO:
> 
>     src/time/wcsftime.c:7:13: warning: type of '__strftime_fmt_1' does \
>         not match original declaration [-Wlto-type-mismatch]
> ---
>  src/time/wcsftime.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/time/wcsftime.c b/src/time/wcsftime.c
> index 638e64f6..6584c45c 100644
> --- a/src/time/wcsftime.c
> +++ b/src/time/wcsftime.c
> @@ -4,7 +4,7 @@
>  #include "locale_impl.h"
>  #include "libc.h"
>  
> -const char *__strftime_fmt_1(char (*s)[100], size_t *l, int f, const struct tm *tm, locale_t loc);
> +const char *__strftime_fmt_1(char (*s)[100], size_t *l, int f, const struct tm *tm, locale_t loc, int pad);
>  
>  size_t __wcsftime_l(wchar_t *restrict s, size_t n, const wchar_t *restrict f, const struct tm *restrict tm, locale_t loc)
>  {
> @@ -35,7 +35,7 @@ size_t __wcsftime_l(wchar_t *restrict s, size_t n, const wchar_t *restrict f, co
>  		}
>  		f = p;
>  		if (*f == 'E' || *f == 'O') f++;
> -		t_mb = __strftime_fmt_1(&buf, &k, *f, tm, loc);
> +		t_mb = __strftime_fmt_1(&buf, &k, *f, tm, loc, 0);
>  		if (!t_mb) break;
>  		k = mbstowcs(wbuf, t_mb, sizeof wbuf / sizeof *wbuf);
>  		if (k == (size_t)-1) return 0;
> -- 
> 2.16.1

I think this is necessary but incomplete. It's likely the affected
functionality is not working in wcsftime... :(

Rich


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix usage of __strftime_fmt_1 in wcsftime
  2018-04-07 14:29 ` Rich Felker
@ 2018-04-07 14:46   ` Samuel Holland
  0 siblings, 0 replies; 3+ messages in thread
From: Samuel Holland @ 2018-04-07 14:46 UTC (permalink / raw)
  To: musl

On 04/07/18 09:29, Rich Felker wrote:
> On Sat, Apr 07, 2018 at 09:26:32AM -0500, Samuel Holland wrote:
>> Commit 8a6bd7307da3fc4d08dd6a9277b611ccb4971354 modified the signature
>> of __strftime_fmt_1 in strftime.c, but failed to update the prototype in
>> wcsftime.c. This was found by compiling musl with LTO:
>>
>>     src/time/wcsftime.c:7:13: warning: type of '__strftime_fmt_1' does \
>>         not match original declaration [-Wlto-type-mismatch]
>> ---
>>  src/time/wcsftime.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/time/wcsftime.c b/src/time/wcsftime.c
>> index 638e64f6..6584c45c 100644
>> --- a/src/time/wcsftime.c
>> +++ b/src/time/wcsftime.c
>> @@ -4,7 +4,7 @@
>>  #include "locale_impl.h"
>>  #include "libc.h"
>>  
>> -const char *__strftime_fmt_1(char (*s)[100], size_t *l, int f, const struct tm *tm, locale_t loc);
>> +const char *__strftime_fmt_1(char (*s)[100], size_t *l, int f, const struct tm *tm, locale_t loc, int pad);
>>  
>>  size_t __wcsftime_l(wchar_t *restrict s, size_t n, const wchar_t *restrict f, const struct tm *restrict tm, locale_t loc)
>>  {
>> @@ -35,7 +35,7 @@ size_t __wcsftime_l(wchar_t *restrict s, size_t n, const wchar_t *restrict f, co
>>  		}
>>  		f = p;
>>  		if (*f == 'E' || *f == 'O') f++;
>> -		t_mb = __strftime_fmt_1(&buf, &k, *f, tm, loc);
>> +		t_mb = __strftime_fmt_1(&buf, &k, *f, tm, loc, 0);
>>  		if (!t_mb) break;
>>  		k = mbstowcs(wbuf, t_mb, sizeof wbuf / sizeof *wbuf);
>>  		if (k == (size_t)-1) return 0;
>> -- 
>> 2.16.1
> 
> I think this is necessary but incomplete. It's likely the affected
> functionality is not working in wcsftime... :(

You're right, I'll send a complete patch for the functionality.

> Rich

Samuel


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-04-07 14:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-07 14:26 [PATCH] Fix usage of __strftime_fmt_1 in wcsftime Samuel Holland
2018-04-07 14:29 ` Rich Felker
2018-04-07 14:46   ` Samuel Holland

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).