]> git.ipfire.org Git - thirdparty/glibc.git/blame - string/test-endian-sign-conversion.c
Make mktime etc. compatible with __time64_t
[thirdparty/glibc.git] / string / test-endian-sign-conversion.c
CommitLineData
0d40d0ec 1/* Test endian.h endian-conversion macros work with -Wsign-conversion.
04277e02 2 Copyright (C) 2018-2019 Free Software Foundation, Inc.
f8887d0a
L
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
18
0d40d0ec
JM
19#include <endian.h>
20#include <stdint.h>
f8887d0a 21
0d40d0ec
JM
22uint16_t u16;
23uint32_t u32;
24uint64_t u64;
25
26static int
27do_test (void)
f8887d0a 28{
0d40d0ec
JM
29 /* This is a compilation test. */
30 u16 = (htobe16 (u16));
31 u16 = (htole16 (u16));
32 u16 = (be16toh (u16));
33 u16 = (le16toh (u16));
34 u32 = (htobe32 (u32));
35 u32 = (htole32 (u32));
36 u32 = (be32toh (u32));
37 u32 = (le32toh (u32));
38 u64 = (htobe64 (u64));
39 u64 = (htole64 (u64));
40 u64 = (be64toh (u64));
41 u64 = (le64toh (u64));
42 (void) u16;
43 (void) u32;
44 (void) u64;
45 return 0;
f8887d0a 46}
0d40d0ec
JM
47
48#include <support/test-driver.c>