Skip to content

Commit 88f78df

Browse files
committed
[libc++] Make sure the LLVM libc shared utilities use libc++'s assertion mechanism
Otherwise, they would use their own mechanism based on C assert. It's better to use the same assertion mechanism consistently everywhere since this code is considered an implementation detail of libc++.
1 parent 4a6451a commit 88f78df

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

libcxx/src/include/from_chars_floating_point.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,22 @@
99
#ifndef _LIBCPP_SRC_INCLUDE_FROM_CHARS_FLOATING_POINT_H
1010
#define _LIBCPP_SRC_INCLUDE_FROM_CHARS_FLOATING_POINT_H
1111

12-
// These headers are in the shared LLVM-libc header library.
13-
#include "shared/fp_bits.h"
14-
#include "shared/str_to_float.h"
15-
#include "shared/str_to_integer.h"
16-
1712
#include <__assert>
1813
#include <__config>
1914
#include <cctype>
2015
#include <charconv>
2116
#include <concepts>
2217
#include <limits>
2318

19+
// Make sure we use libc++'s assertion machinery within the shared code we use
20+
// from LLVM libc.
21+
#define LIBC_ASSERT(cond) _LIBCPP_ASSERT((cond), _LIBCPP_TOSTRING(cond))
22+
23+
// These headers are in the shared LLVM-libc header library.
24+
#include "shared/fp_bits.h"
25+
#include "shared/str_to_float.h"
26+
#include "shared/str_to_integer.h"
27+
2428
// Included for the _Floating_type_traits class
2529
#include "to_chars_floating_point.h"
2630

0 commit comments

Comments
 (0)