-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libc++][test][NFC] Remove unused inclusions of <iostream>
#134776
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[libc++][test][NFC] Remove unused inclusions of <iostream>
#134776
Conversation
Some test files for flat container adaptors redundantly include `<iostream>`. This patch removes the redundant inclusions.
@llvm/pr-subscribers-libcxx Author: A. Jiang (frederick-vs-ja) ChangesSome test files for flat container adaptors redundantly include Full diff: https://github.com/llvm/llvm-project/pull/134776.diff 4 Files Affected:
diff --git a/libcxx/test/std/containers/container.adaptors/flat.map/flat.map.iterators/reverse_iterator.pass.cpp b/libcxx/test/std/containers/container.adaptors/flat.map/flat.map.iterators/reverse_iterator.pass.cpp
index fc3949d70745f..7a111e228c115 100644
--- a/libcxx/test/std/containers/container.adaptors/flat.map/flat.map.iterators/reverse_iterator.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/flat.map/flat.map.iterators/reverse_iterator.pass.cpp
@@ -28,7 +28,6 @@
#include <iterator>
#include "test_macros.h"
-#include <iostream>
int main(int, char**) {
{
diff --git a/libcxx/test/std/containers/container.adaptors/flat.multimap/flat.multimap.iterators/reverse_iterator.pass.cpp b/libcxx/test/std/containers/container.adaptors/flat.multimap/flat.multimap.iterators/reverse_iterator.pass.cpp
index 8c1e5451f703f..35b2b9f8a9e7e 100644
--- a/libcxx/test/std/containers/container.adaptors/flat.multimap/flat.multimap.iterators/reverse_iterator.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/flat.multimap/flat.multimap.iterators/reverse_iterator.pass.cpp
@@ -30,7 +30,6 @@
#include <iterator>
#include "test_macros.h"
-#include <iostream>
int main(int, char**) {
{
diff --git a/libcxx/test/std/containers/container.adaptors/flat.multiset/flat.multiset.iterators/reverse_iterator.pass.cpp b/libcxx/test/std/containers/container.adaptors/flat.multiset/flat.multiset.iterators/reverse_iterator.pass.cpp
index 9d443ef8784e2..76bd49b4abd9e 100644
--- a/libcxx/test/std/containers/container.adaptors/flat.multiset/flat.multiset.iterators/reverse_iterator.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/flat.multiset/flat.multiset.iterators/reverse_iterator.pass.cpp
@@ -28,7 +28,6 @@
#include <iterator>
#include "test_macros.h"
-#include <iostream>
void test() {
{
diff --git a/libcxx/test/std/containers/container.adaptors/flat.set/flat.set.iterators/reverse_iterator.pass.cpp b/libcxx/test/std/containers/container.adaptors/flat.set/flat.set.iterators/reverse_iterator.pass.cpp
index d1e4cef3de19e..a9ef87d483e6f 100644
--- a/libcxx/test/std/containers/container.adaptors/flat.set/flat.set.iterators/reverse_iterator.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/flat.set/flat.set.iterators/reverse_iterator.pass.cpp
@@ -28,7 +28,6 @@
#include <iterator>
#include "test_macros.h"
-#include <iostream>
void test() {
{
|
@@ -28,7 +28,6 @@ | |||
#include <iterator> | |||
|
|||
#include "test_macros.h" | |||
#include <iostream> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The <vector>
and <iterator>
includes above seem to be unused as well. Probably also the case in the other tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is somehow tricky. These files don't explicitly write vector
but implicitly use vector<T>
as default template arguments. Likewise, the reverse iterator types are reverse_iterator
specializations, which are guaranteed to be provided in <iterator>
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have to provide these things though <flat_map>
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I found that these files use std::distance
, which is only guaranteed to be available in <iterator>
and <ranges>
, although transitively introduced by several headers in libc++.
I think we should either keep includes of <iterator>
or replace these std::distance
calls with operator-
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When they're used we can keep them.
Error: Command failed due to missing milestone. |
@@ -28,7 +28,6 @@ | |||
#include <iterator> | |||
|
|||
#include "test_macros.h" | |||
#include <iostream> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When they're used we can keep them.
…4776) Some test files for flat container adaptors redundantly include `<iostream>` and, surprisingly, `<cstddef>`. This patch removes the redundant inclusions. Inclusions of `<vector>` is also removed since a sane implementation is expected to make instantiation of `flat_(multi)map<K, V>` or `flat_(multi)set<K>` valid when only `<flat_map>` or `<flat_set>` is included.
Some test files for flat container adaptors redundantly include
<iostream>
and, surprisingly,<cstddef>
. This patch removes the redundant inclusions.Inclusions of
<vector>
is also removed since a sane implementation is expected to make instantiation offlat_(multi)map<K, V>
orflat_(multi)set<K>
valid when only<flat_map>
or<flat_set>
is included.