Ignore MAP_VARIABLE in tst-mman-consts.py
[glibc.git] / string / test-endian-sign-conversion.c
blob2a01cc5819442098364b705fba711128a8b54961
1 /* Test endian.h endian-conversion macros work with -Wsign-conversion.
2 Copyright (C) 2018-2023 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
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.
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 <https://www.gnu.org/licenses/>. */
19 #include <endian.h>
20 #include <stdint.h>
22 uint16_t u16;
23 uint32_t u32;
24 uint64_t u64;
26 static int
27 do_test (void)
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;
48 #include <support/test-driver.c>