Skip to content

Commit 11870cc

Browse files
committed
[libc][annex_k] Add Annex K support macros.
1 parent be83e0f commit 11870cc

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
3131
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
3232
endif()
3333

34+
add_macro_header(
35+
annex_k_macros
36+
HDR
37+
annex-k-macros.h
38+
)
39+
3440
add_macro_header(
3541
assert_macros
3642
HDR
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//===-- Definition of macros to be used with Annex K functions ------------===//
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_INCLUDE_LLVM_LIBC_MACROS_ANNEX_K_MACROS_H
10+
#define LLVM_LIBC_INCLUDE_LLVM_LIBC_MACROS_ANNEX_K_MACROS_H
11+
12+
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
13+
(defined(__cplusplus) && __cplusplus >= 201703L)
14+
15+
// TODO(bassiounix): Who should def this macro (clang vs libc)? Where?
16+
#define __STDC_LIB_EXT1__ 201112L
17+
18+
#if defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ == 1
19+
20+
#define LIBC_HAS_ANNEX_K
21+
22+
#endif // defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ == 1
23+
24+
#endif // (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) ||
25+
// (defined(__cplusplus) && __cplusplus >= 201703L)
26+
#endif // LLVM_LIBC_INCLUDE_LLVM_LIBC_MACROS_ANNEX_K_MACROS_H

0 commit comments

Comments
 (0)