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 2/5] nptl: Convert tst-cond11.c to use libsupport



On 10/05/2019 06:42, Adhemerval Zanella wrote:
> 
> 
>> Il giorno 9 mag 2019, alle ore 20:03, Joseph Myers <joseph@codesourcery.com> ha scritto:
>>
>>> On Thu, 9 May 2019, Adhemerval Zanella wrote:
>>>
>>>> On 09/05/2019 14:08, Florian Weimer wrote:
>>>> * Adhemerval Zanella:
>>>>
>>>>>> support/Makefile       |   3 +-
>>>>>> support/README         |   5 +-
>>>>>> support/timespec-add.c |  71 ++++++++++++++++++-
>>>>>> support/timespec-sub.c |  71 ++++++++++++++++++-
>>>>>> support/timespec.c     |  58 ++++++++++++++-
>>>>>> support/timespec.h     |  79 ++++++++++++++++++++-
>>>>
>>>> Could you push these changes as a separate commit?  Thanks.
>>>>
>>>> Florian
>>>>
>>> Ok, I will split the patch.
>>
>> These changes have broken the build for x32, with errors such as:
>>
>> timespec.c: In function 'test_timespec_before_impl':
>> timespec.c:32:23: error: format '%ld' expects argument of type 'long int', but argument 4 has type '__time_t' {aka 'const long long int'} [-Werror=format=]
> 
> I will check this out.
> 

I will check the following patch to fix it:

---
diff --git a/support/timespec.c b/support/timespec.c
index f1b88c1f4c..653293970a 100644
--- a/support/timespec.c
+++ b/support/timespec.c
@@ -18,6 +18,7 @@
 
 #include <support/timespec.h>
 #include <stdio.h>
+#include <stdint.h>
 
 void
 test_timespec_before_impl (const char *file, int line,
@@ -29,12 +30,12 @@ test_timespec_before_impl (const char *file, int line,
          && left.tv_nsec > right.tv_nsec)) {
     support_record_failure ();
     const struct timespec diff = timespec_sub (left, right);
-    printf ("%s:%d: %ld.%09lds not before %ld.%09lds "
-           "(difference %ld.%09lds)n",
+    printf ("%s:%d: %jd.%09jds not before %jd.%09jds "
+           "(difference %jd.%09jds)n",
            file, line,
-           left.tv_sec, left.tv_nsec,
-           right.tv_sec, right.tv_nsec,
-           diff.tv_sec, diff.tv_nsec);
+           (intmax_t) left.tv_sec, (intmax_t) left.tv_nsec,
+           (intmax_t) right.tv_sec, (intmax_t) right.tv_nsec,
+           (intmax_t) diff.tv_sec, (intmax_t) diff.tv_nsec);
   }
 }
 
@@ -48,11 +49,11 @@ test_timespec_equal_or_after_impl (const char *file, int line,
          && left.tv_nsec < right.tv_nsec)) {
     support_record_failure ();
     const struct timespec diff = timespec_sub (right, left);
-    printf ("%s:%d: %ld.%09lds not after %ld.%09lds "
-           "(difference %ld.%09lds)n",
+    printf ("%s:%d: %jd.%09jds not after %jd.%09jds "
+           "(difference %jd.%09jds)n",
            file, line,
-           left.tv_sec, left.tv_nsec,
-           right.tv_sec, right.tv_nsec,
-           diff.tv_sec, diff.tv_nsec);
+           (intmax_t) left.tv_sec, (intmax_t) left.tv_nsec,
+           (intmax_t) right.tv_sec, (intmax_t) right.tv_nsec,
+           (intmax_t) diff.tv_sec, (intmax_t) diff.tv_nsec);
   }
---


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