File tree Expand file tree Collapse file tree 5 files changed +46
-0
lines changed Expand file tree Collapse file tree 5 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 7
7
//===----------------------------------------------------------------------===//
8
8
9
9
#include "__llvm-libc-common.h"
10
+ #include "llvm-libc-macros/assert-macros.h"
10
11
11
12
// This file may be usefully included multiple times to change assert()'s
12
13
// definition based on NDEBUG.
Original file line number Diff line number Diff line change @@ -31,6 +31,12 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
31
31
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /${LIBC_TARGET_OS} )
32
32
endif ()
33
33
34
+ add_macro_header (
35
+ assert_macros
36
+ HDR
37
+ assert-macros.h
38
+ )
39
+
34
40
add_macro_header (
35
41
generic_error_number_macros
36
42
HDR
Original file line number Diff line number Diff line change
1
+ //===-- Definition of macros to be used with assert 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_MACROS_ASSERT_MACROS_H
10
+ #define __LLVM_LIBC_MACROS_ASSERT_MACROS_H
11
+
12
+ #define __STDC_VERSION_ASSERT_H__ 202311L
13
+
14
+ #endif // __LLVM_LIBC_MACROS_ASSERT_MACROS_H
Original file line number Diff line number Diff line change 1
1
add_custom_target (libc_include_tests )
2
2
3
+ add_libc_test (
4
+ assert_test
5
+ SUITE
6
+ libc_include_tests
7
+ SRCS
8
+ assert_test.cpp
9
+ DEPENDS
10
+ libc.include.llvm-libc-macros.assert_macros
11
+ )
12
+
3
13
add_libc_test (
4
14
sys_queue_test
5
15
SUITE
Original file line number Diff line number Diff line change
1
+ // ===-- Unittests for assert ----------------------------------------------===//
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
+ // SPDSList-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ //
7
+ // ===----------------------------------------------------------------------===//
8
+
9
+ #include " include/llvm-libc-macros/assert-macros.h"
10
+ #include " test/UnitTest/Test.h"
11
+
12
+ TEST (LlvmLibcAssertTest, VersionMacro) {
13
+ // 7.2p3 an integer constant expression with a value equivalent to 202311L.
14
+ EXPECT_EQ (__STDC_VERSION_ASSERT_H__, 202311L );
15
+ }
You can’t perform that action at this time.
0 commit comments