Skip to content

Commit b3630d6

Browse files
committed
add endian
1 parent f8ef269 commit b3630d6

File tree

7 files changed

+59
-0
lines changed

7 files changed

+59
-0
lines changed

libc/config/linux/aarch64/headers.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ set(TARGET_PUBLIC_HEADERS
44
libc.include.ctype
55
libc.include.dlfcn
66
libc.include.elf
7+
libc.include.endian
78
libc.include.errno
89
libc.include.features
910
libc.include.fenv

libc/config/linux/x86_64/headers.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ set(TARGET_PUBLIC_HEADERS
55
libc.include.dirent
66
libc.include.dlfcn
77
libc.include.elf
8+
libc.include.endian
89
libc.include.errno
910
libc.include.fcntl
1011
libc.include.features

libc/include/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,15 @@ add_header_macro(
7373
.llvm_libc_common_h
7474
)
7575

76+
add_header_macro(
77+
endian
78+
../libc/include/endian.yaml
79+
endian.h
80+
DEPENDS
81+
.llvm-libc-macros.endian_macros
82+
.llvm_libc_common_h
83+
)
84+
7685
add_header_macro(
7786
features
7887
../libc/include/features.yaml

libc/include/endian.h.def

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//===-- System V header endian.h ------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef LLVM_LIBC_ENDIAN_H
10+
#define LLVM_LIBC_ENDIAN_H
11+
12+
#include "__llvm-libc-common.h"
13+
#include "llvm-libc-macros/endian-macros.h"
14+
15+
%%public_api()
16+
17+
#endif // LLVM_LIBC_ENDIAN_H

libc/include/endian.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
header: endian.h
2+
header_template: endian.h.def
3+
standards:
4+
- POSIX
5+
macros: []
6+
types: []
7+
enums: []
8+
objects: []
9+
functions: []

libc/include/llvm-libc-macros/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,12 @@ add_macro_header(
310310
elf-macros.h
311311
)
312312

313+
add_macro_header(
314+
endian_macros
315+
HDR
316+
endian-macros.h
317+
)
318+
313319
add_macro_header(
314320
locale_macros
315321
HDR
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//===-- Definition of macros from endian.h --------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef LLVM_LIBC_MACROS_ENDIAN_MACROS_H
10+
#define LLVM_LIBC_MACROS_ENDIAN_MACROS_H
11+
12+
#define LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__
13+
#define BIG_ENDIAN __ORDER_BIG_ENDIAN__
14+
#define BYTE_ORDER __BYTE_ORDER__
15+
16+
#endif // LLVM_LIBC_MACROS_ENDIAN_MACROS_H

0 commit comments

Comments
 (0)