Skip to content

Commit fcb81a3

Browse files
committed
[libc] move abs_timesout and monotonicity out of linux dir
1 parent fb9e1d2 commit fcb81a3

File tree

11 files changed

+52
-104
lines changed

11 files changed

+52
-104
lines changed

libc/src/__support/threads/linux/futex_utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "src/__support/macros/attributes.h"
1717
#include "src/__support/macros/config.h"
1818
#include "src/__support/threads/linux/futex_word.h"
19-
#include "src/__support/time/linux/abs_timeout.h"
19+
#include "src/__support/time/abs_timeout.h"
2020
#include <linux/errno.h>
2121
#include <linux/futex.h>
2222

libc/src/__support/threads/linux/rwlock.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#endif
3636

3737
#if LIBC_COPT_TIMEOUT_ENSURE_MONOTONICITY
38-
#include "src/__support/time/linux/monotonicity.h"
38+
#include "src/__support/time/monotonicity.h"
3939
#endif
4040

4141
namespace LIBC_NAMESPACE_DECL {

libc/src/__support/time/CMakeLists.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,32 @@ if(TARGET libc.src.__support.time.${LIBC_TARGET_OS}.clock_settime)
2828
libc.src.__support.time.${LIBC_TARGET_OS}.clock_settime
2929
)
3030
endif()
31+
32+
add_header_library(
33+
abs_timeout
34+
HDRS
35+
abs_timeout.h
36+
DEPENDS
37+
libc.hdr.types.struct_timespec
38+
libc.src.__support.time.units
39+
libc.src.__support.CPP.expected
40+
)
41+
42+
add_header_library(
43+
clock_conversion
44+
HDRS
45+
clock_conversion.h
46+
DEPENDS
47+
.clock_gettime
48+
libc.src.__support.time.units
49+
)
50+
51+
add_header_library(
52+
monotonicity
53+
HDRS
54+
monotonicity.h
55+
DEPENDS
56+
.clock_conversion
57+
.abs_timeout
58+
libc.hdr.time_macros
59+
)

libc/src/__support/time/linux/abs_timeout.h renamed to libc/src/__support/time/abs_timeout.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
//===--- Linux absolute timeout ---------------------------------*- C++ -*-===//
1+
//===--- absolute timeout ---------------------------------*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
7-
//===----------------------------------------------------------------------===//
7+
//===----------------------------------------------------------------===//
88

9-
#ifndef LLVM_LIBC_SRC___SUPPORT_TIME_LINUX_ABS_TIMEOUT_H
10-
#define LLVM_LIBC_SRC___SUPPORT_TIME_LINUX_ABS_TIMEOUT_H
9+
#ifndef LLVM_LIBC_SRC___SUPPORT_TIME_ABS_TIMEOUT_H
10+
#define LLVM_LIBC_SRC___SUPPORT_TIME_ABS_TIMEOUT_H
1111

1212
#include "hdr/time_macros.h"
1313
#include "hdr/types/struct_timespec.h"
@@ -47,4 +47,4 @@ class AbsTimeout {
4747
} // namespace internal
4848
} // namespace LIBC_NAMESPACE_DECL
4949

50-
#endif // LLVM_LIBC_SRC___SUPPORT_TIME_LINUX_ABS_TIMEOUT_H
50+
#endif // LLVM_LIBC_SRC___SUPPORT_TIME_ABS_TIMEOUT_H

libc/src/__support/time/linux/CMakeLists.txt

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -28,32 +28,3 @@ add_object_library(
2828
libc.src.__support.error_or
2929
libc.src.__support.OSUtil.osutil
3030
)
31-
32-
add_header_library(
33-
clock_conversion
34-
HDRS
35-
clock_conversion.h
36-
DEPENDS
37-
.clock_gettime
38-
libc.src.__support.time.units
39-
)
40-
41-
add_header_library(
42-
abs_timeout
43-
HDRS
44-
abs_timeout.h
45-
DEPENDS
46-
libc.hdr.types.struct_timespec
47-
libc.src.__support.time.units
48-
libc.src.__support.CPP.expected
49-
)
50-
51-
add_header_library(
52-
monotonicity
53-
HDRS
54-
monotonicity.h
55-
DEPENDS
56-
.clock_conversion
57-
.abs_timeout
58-
libc.hdr.time_macros
59-
)

libc/src/__support/time/linux/monotonicity.h renamed to libc/src/__support/time/monotonicity.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
//===--- timeout linux implementation ---------------------------*- C++ -*-===//
1+
//===--- timeout implementation ---------------------------*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
7-
//===----------------------------------------------------------------------===//
7+
//===----------------------------------------------------------------===//
88

9-
#ifndef LLVM_LIBC_SRC___SUPPORT_TIME_LINUX_MONOTONICITY_H
10-
#define LLVM_LIBC_SRC___SUPPORT_TIME_LINUX_MONOTONICITY_H
9+
#ifndef LLVM_LIBC_SRC___SUPPORT_TIME_MONOTONICITY_H
10+
#define LLVM_LIBC_SRC___SUPPORT_TIME_MONOTONICITY_H
1111

1212
#include "hdr/time_macros.h"
1313
#include "src/__support/libc_assert.h"
1414
#include "src/__support/macros/config.h"
15+
#include "src/__support/time/abs_timeout.h"
1516
#include "src/__support/time/clock_conversion.h"
16-
#include "src/__support/time/linux/abs_timeout.h"
1717
namespace LIBC_NAMESPACE_DECL {
1818
namespace internal {
1919
// This function is separated from abs_timeout.
@@ -41,4 +41,4 @@ LIBC_INLINE void ensure_monotonicity(AbsTimeout &timeout) {
4141
} // namespace internal
4242
} // namespace LIBC_NAMESPACE_DECL
4343

44-
#endif // LLVM_LIBC_SRC___SUPPORT_TIME_LINUX_MONOTONICITY_H
44+
#endif // LLVM_LIBC_SRC___SUPPORT_TIME_MONOTONICITY_H

libc/src/pthread/pthread_rwlock_clockwrlock.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "src/__support/common.h"
1313
#include "src/__support/macros/config.h"
1414
#include "src/__support/threads/linux/rwlock.h"
15-
#include "src/__support/time/linux/abs_timeout.h"
15+
#include "src/__support/time/abs_timeout.h"
1616

1717
#include <pthread.h>
1818

libc/src/pthread/pthread_rwlock_timedrdlock.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include "src/__support/macros/config.h"
1414
#include "src/__support/macros/optimization.h"
1515
#include "src/__support/threads/linux/rwlock.h"
16-
#include "src/__support/time/linux/abs_timeout.h"
16+
#include "src/__support/time/abs_timeout.h"
1717

1818
#include <pthread.h>
1919

libc/src/pthread/pthread_rwlock_timedwrlock.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include "src/__support/macros/config.h"
1414
#include "src/__support/macros/optimization.h"
1515
#include "src/__support/threads/linux/rwlock.h"
16-
#include "src/__support/time/linux/abs_timeout.h"
16+
#include "src/__support/time/abs_timeout.h"
1717

1818
#include <pthread.h>
1919

libc/test/src/__support/threads/darwin/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@ add_libc_test(
55
SRCS
66
mutex_test.cpp
77
DEPENDS
8-
libc.src.__support.threads.darwin.mutex
8+
libc.src.__support.threads.mutex
9+
libc.src.__support.threads.darwin.futex_utils
10+
libc.src.__support.time.darwin.clock_gettime
911
)

0 commit comments

Comments
 (0)