Skip to content

Commit e4c4385

Browse files
Abseil Teamcopybara-github
authored andcommitted
Remove template alias nullability annotations.
These were deprecated before the last LTS release. PiperOrigin-RevId: 762205726 Change-Id: I9d15a08967086296ecc9650a7ae0ae9c4973c405
1 parent 9d51fa7 commit e4c4385

File tree

6 files changed

+0
-227
lines changed

6 files changed

+0
-227
lines changed

CMake/AbseilDll.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ set(ABSL_INTERNAL_DLL_FILES
2525
"base/internal/low_level_alloc.cc"
2626
"base/internal/low_level_alloc.h"
2727
"base/internal/low_level_scheduling.h"
28-
"base/internal/nullability_deprecated.h"
2928
"base/internal/per_thread_tls.h"
3029
"base/internal/poison.cc"
3130
"base/internal/poison.h"

absl/base/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ cc_library(
8282

8383
cc_library(
8484
name = "nullability",
85-
srcs = ["internal/nullability_deprecated.h"],
8685
hdrs = ["nullability.h"],
8786
copts = ABSL_DEFAULT_COPTS,
8887
linkopts = ABSL_DEFAULT_LINKOPTS,

absl/base/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ absl_cc_library(
7272
nullability
7373
HDRS
7474
"nullability.h"
75-
SRCS
76-
"internal/nullability_deprecated.h"
7775
DEPS
7876
absl::config
7977
absl::core_headers

absl/base/internal/nullability_deprecated.h

Lines changed: 0 additions & 106 deletions
This file was deleted.

absl/base/nullability.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@
184184
#define ABSL_BASE_NULLABILITY_H_
185185

186186
#include "absl/base/config.h"
187-
#include "absl/base/internal/nullability_deprecated.h"
188187

189188
// ABSL_POINTERS_DEFAULT_NONNULL
190189
//

absl/base/nullability_test.cc

Lines changed: 0 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,13 @@
1414

1515
#include "absl/base/nullability.h"
1616

17-
#include <cassert>
1817
#include <memory>
1918
#include <type_traits>
2019
#include <utility>
2120

2221
#include "gtest/gtest.h"
23-
#include "absl/base/attributes.h"
2422

2523
namespace {
26-
namespace macro_annotations {
2724
void funcWithNonnullArg(int* absl_nonnull /*arg*/) {}
2825
template <typename T>
2926
void funcWithDeducedNonnullArg(T* absl_nonnull /*arg*/) {}
@@ -90,117 +87,4 @@ TEST(PassThroughTest, PassesThroughPointerToMemberFunction) {
9087
EXPECT_TRUE((std::is_same<absl_nullable T, T>::value));
9188
EXPECT_TRUE((std::is_same<absl_nullability_unknown T, T>::value));
9289
}
93-
} // namespace macro_annotations
94-
95-
// Allow testing of the deprecated type alias annotations.
96-
ABSL_INTERNAL_DISABLE_DEPRECATED_DECLARATION_WARNING
97-
98-
using ::absl::Nonnull;
99-
using ::absl::NullabilityUnknown;
100-
using ::absl::Nullable;
101-
namespace type_alias_annotations {
102-
103-
void funcWithNonnullArg(Nonnull<int*> /*arg*/) {}
104-
template <typename T>
105-
void funcWithDeducedNonnullArg(Nonnull<T*> /*arg*/) {}
106-
107-
TEST(NonnullTest, NonnullArgument) {
108-
int var = 0;
109-
funcWithNonnullArg(&var);
110-
funcWithDeducedNonnullArg(&var);
111-
}
112-
113-
Nonnull<int*> funcWithNonnullReturn() {
114-
static int var = 0;
115-
return &var;
116-
}
117-
118-
TEST(NonnullTest, NonnullReturn) {
119-
auto var = funcWithNonnullReturn();
120-
(void)var;
121-
}
122-
123-
TEST(PassThroughTest, PassesThroughRawPointerToInt) {
124-
EXPECT_TRUE((std::is_same<Nonnull<int*>, int*>::value));
125-
EXPECT_TRUE((std::is_same<Nullable<int*>, int*>::value));
126-
EXPECT_TRUE((std::is_same<NullabilityUnknown<int*>, int*>::value));
127-
}
128-
129-
TEST(PassThroughTest, PassesThroughRawPointerToVoid) {
130-
EXPECT_TRUE((std::is_same<Nonnull<void*>, void*>::value));
131-
EXPECT_TRUE((std::is_same<Nullable<void*>, void*>::value));
132-
EXPECT_TRUE((std::is_same<NullabilityUnknown<void*>, void*>::value));
133-
}
134-
135-
TEST(PassThroughTest, PassesThroughUniquePointerToInt) {
136-
using T = std::unique_ptr<int>;
137-
EXPECT_TRUE((std::is_same<Nonnull<T>, T>::value));
138-
EXPECT_TRUE((std::is_same<Nullable<T>, T>::value));
139-
EXPECT_TRUE((std::is_same<NullabilityUnknown<T>, T>::value));
140-
}
141-
142-
TEST(PassThroughTest, PassesThroughSharedPointerToInt) {
143-
using T = std::shared_ptr<int>;
144-
EXPECT_TRUE((std::is_same<Nonnull<T>, T>::value));
145-
EXPECT_TRUE((std::is_same<Nullable<T>, T>::value));
146-
EXPECT_TRUE((std::is_same<NullabilityUnknown<T>, T>::value));
147-
}
148-
149-
TEST(PassThroughTest, PassesThroughSharedPointerToVoid) {
150-
using T = std::shared_ptr<void>;
151-
EXPECT_TRUE((std::is_same<Nonnull<T>, T>::value));
152-
EXPECT_TRUE((std::is_same<Nullable<T>, T>::value));
153-
EXPECT_TRUE((std::is_same<NullabilityUnknown<T>, T>::value));
154-
}
155-
156-
TEST(PassThroughTest, PassesThroughPointerToMemberObject) {
157-
using T = decltype(&std::pair<int, int>::first);
158-
EXPECT_TRUE((std::is_same<Nonnull<T>, T>::value));
159-
EXPECT_TRUE((std::is_same<Nullable<T>, T>::value));
160-
EXPECT_TRUE((std::is_same<NullabilityUnknown<T>, T>::value));
161-
}
162-
163-
TEST(PassThroughTest, PassesThroughPointerToMemberFunction) {
164-
using T = decltype(&std::unique_ptr<int>::reset);
165-
EXPECT_TRUE((std::is_same<Nonnull<T>, T>::value));
166-
EXPECT_TRUE((std::is_same<Nullable<T>, T>::value));
167-
EXPECT_TRUE((std::is_same<NullabilityUnknown<T>, T>::value));
168-
}
169-
170-
} // namespace type_alias_annotations
171-
} // namespace
172-
173-
// Nullable ADL lookup test
174-
namespace util {
175-
// Helper for NullableAdlTest. Returns true, denoting that argument-dependent
176-
// lookup found this implementation of DidAdlWin. Must be in namespace
177-
// util itself, not a nested anonymous namespace.
178-
template <typename T>
179-
bool DidAdlWin(T*) {
180-
return true;
181-
}
182-
183-
// Because this type is defined in namespace util, an unqualified call to
184-
// DidAdlWin with a pointer to MakeAdlWin will find the above implementation.
185-
struct MakeAdlWin {};
186-
} // namespace util
187-
188-
namespace {
189-
// Returns false, denoting that ADL did not inspect namespace util. If it
190-
// had, the better match (T*) above would have won out over the (...) here.
191-
bool DidAdlWin(...) { return false; }
192-
193-
TEST(NullableAdlTest, NullableAddsNothingToArgumentDependentLookup) {
194-
// Treatment: util::Nullable<int*> contributes nothing to ADL because
195-
// int* itself doesn't.
196-
EXPECT_FALSE(DidAdlWin((int*)nullptr));
197-
EXPECT_FALSE(DidAdlWin((Nullable<int*>)nullptr));
198-
199-
// Control: Argument-dependent lookup does find the implementation in
200-
// namespace util when the underlying pointee type resides there.
201-
EXPECT_TRUE(DidAdlWin((util::MakeAdlWin*)nullptr));
202-
EXPECT_TRUE(DidAdlWin((Nullable<util::MakeAdlWin*>)nullptr));
203-
}
204-
205-
ABSL_INTERNAL_RESTORE_DEPRECATED_DECLARATION_WARNING
20690
} // namespace

0 commit comments

Comments
 (0)