From 14633d3e568eb9770a7e5046eff257113e0453fb Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Fri, 24 Jul 2020 13:42:01 -0300 Subject: Move ftime to a compatibility symbol It was made deprecated on 2.31, so it moves to compat symbol after two releases. It was also removed from exported symbol for riscv32 (since ABI will be supported on for 2.33). Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski --- time/tst-ftime.c | 59 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 30 insertions(+), 29 deletions(-) (limited to 'time/tst-ftime.c') diff --git a/time/tst-ftime.c b/time/tst-ftime.c index 08916c0..6978feb 100644 --- a/time/tst-ftime.c +++ b/time/tst-ftime.c @@ -16,9 +16,23 @@ License along with the GNU C Library; if not, see . */ -#include -#include -#include + +#include +#if TEST_COMPAT (libc, GLIBC_2_0, GLIBC_2_33) +#include +#include + +compat_symbol_reference (libc, ftime, ftime, GLIBC_2_0); + +struct timeb + { + time_t time; + unsigned short int millitm; + short int timezone; + short int dstflag; + }; + +extern int ftime (struct timeb *__timebuf); static int do_test (void) @@ -30,36 +44,23 @@ do_test (void) { prev = curr; - /* ftime was deprecated on 2.31. */ - DIAG_PUSH_NEEDS_COMMENT; - DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdeprecated-declarations"); - - if (ftime (&curr)) - { - printf ("ftime returned an error\n"); - return 1; - } - - DIAG_POP_NEEDS_COMMENT; - - if (curr.time < prev.time) - { - printf ("ftime's time flowed backwards\n"); - return 1; - } - - if (curr.time == prev.time - && curr.millitm < prev.millitm) - { - printf ("ftime's millitm flowed backwards\n"); - return 1; - } + /* ftime was deprecated on 2.31 and removed on 2.33. */ + TEST_COMPARE (ftime (&curr), 0); + TEST_VERIFY_EXIT (curr.time >= prev.time); + if (curr.time == prev.time) + TEST_VERIFY_EXIT (curr.millitm >= prev.millitm); if (curr.time > prev.time) sec ++; } return 0; } +#else +static int +do_test (void) +{ + return EXIT_UNSUPPORTED; +} +#endif -#define TEST_FUNCTION do_test () -#include "../test-skeleton.c" +#include -- cgit v1.1