mirror of
https://github.com/pybind/pybind11.git
synced 2026-04-20 06:49:25 +00:00
Fully-automatic clang-format with include reordering (#3713)
* chore: add clang-format
* Removing check-style (Classic check-style)
Ported from @henryiii's 53056b1b0e
* Automatic clang-format changes (NO manual changes).
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
This commit is contained in:
committed by
GitHub
parent
e96221beff
commit
ec24786eab
@@ -7,12 +7,14 @@
|
||||
BSD-style license that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1910 // VS 2015's MSVC
|
||||
# pragma warning(disable: 4702) // unreachable code in system header (xatomic.h(382))
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1910 // VS 2015's MSVC
|
||||
# pragma warning(disable : 4702) // unreachable code in system header (xatomic.h(382))
|
||||
#endif
|
||||
|
||||
#include <pybind11/iostream.h>
|
||||
|
||||
#include "pybind11_tests.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <iostream>
|
||||
#include <mutex>
|
||||
@@ -51,13 +53,12 @@ struct TestThread {
|
||||
std::cout << "x" << std::flush;
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::microseconds(50));
|
||||
} };
|
||||
}
|
||||
};
|
||||
t_ = new std::thread(std::move(thread_f));
|
||||
}
|
||||
|
||||
~TestThread() {
|
||||
delete t_;
|
||||
}
|
||||
~TestThread() { delete t_; }
|
||||
|
||||
void stop() { stop_ = true; }
|
||||
|
||||
@@ -75,7 +76,6 @@ struct TestThread {
|
||||
std::atomic<bool> stop_;
|
||||
};
|
||||
|
||||
|
||||
TEST_SUBMODULE(iostream, m) {
|
||||
|
||||
add_ostream_redirect(m);
|
||||
@@ -92,9 +92,11 @@ TEST_SUBMODULE(iostream, m) {
|
||||
std::cout << msg << std::flush;
|
||||
});
|
||||
|
||||
m.def("guard_output", &noisy_function,
|
||||
py::call_guard<py::scoped_ostream_redirect>(),
|
||||
py::arg("msg"), py::arg("flush")=true);
|
||||
m.def("guard_output",
|
||||
&noisy_function,
|
||||
py::call_guard<py::scoped_ostream_redirect>(),
|
||||
py::arg("msg"),
|
||||
py::arg("flush") = true);
|
||||
|
||||
m.def("captured_err", [](const std::string &msg) {
|
||||
py::scoped_ostream_redirect redir(std::cerr, py::module_::import("sys").attr("stderr"));
|
||||
@@ -103,9 +105,11 @@ TEST_SUBMODULE(iostream, m) {
|
||||
|
||||
m.def("noisy_function", &noisy_function, py::arg("msg"), py::arg("flush") = true);
|
||||
|
||||
m.def("dual_guard", &noisy_funct_dual,
|
||||
py::call_guard<py::scoped_ostream_redirect, py::scoped_estream_redirect>(),
|
||||
py::arg("msg"), py::arg("emsg"));
|
||||
m.def("dual_guard",
|
||||
&noisy_funct_dual,
|
||||
py::call_guard<py::scoped_ostream_redirect, py::scoped_estream_redirect>(),
|
||||
py::arg("msg"),
|
||||
py::arg("emsg"));
|
||||
|
||||
m.def("raw_output", [](const std::string &msg) { std::cout << msg << std::flush; });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user