Skip to content

Commit e4837fb

Browse files
jdx-ghjjohnstn
authored andcommitted
Fix newlib/testsuite/newlib.time/tzset.c compilation for 16-bit targets
When the test case is compiled for a target with a 16-bit int, the compiler emits the two warnings shown below, causing the test to fail. The code assumes that int is 32 bits wide, which is not always the case. This patch removes that assumption and fixes the resulting compilation warnings. Signed-off-by: Jan Dubiec <jdx@o2.pl>
1 parent 637a7dd commit e4837fb

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

  • newlib/testsuite/newlib.time

newlib/testsuite/newlib.time/tzset.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
/* Test that valid POSIX timezone strings are correctly parsed by tzset(3). */
22
#include <stdio.h>
33
#include <stdlib.h>
4+
#include <stdint.h>
45

56
// BEGIN test vectors
67
#include <time.h>
78
#include <limits.h>
89

9-
#define IN_SECONDS(h, m, s) ((h) * 3600 + (m) * 60 + (s))
10+
#define IN_SECONDS(h, m, s) ((h) * INT32_C(3600) + (m) * INT32_C(60) + (s))
1011
#define NO_TIME INT_MIN
1112

1213
struct tz_test {
1314
const char* tzstr;
14-
int offset_seconds;
15-
int dst_offset_seconds;
15+
int32_t offset_seconds;
16+
int32_t dst_offset_seconds;
1617
};
1718

1819
extern struct tm winter_tm;

0 commit comments

Comments
 (0)