Skip to content

Commit

Permalink
Merge pull request #1424 from hzeller:fix-tools
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 635994933
  • Loading branch information
copybara-github committed May 22, 2024
2 parents 5f8d727 + ce440e7 commit 83d6612
Show file tree
Hide file tree
Showing 55 changed files with 125 additions and 11 deletions.
2 changes: 2 additions & 0 deletions xls/common/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ cc_test(
deps = [
":math_util",
":xls_gunit_main",
"@com_google_absl//absl/base:core_headers",
"@com_google_fuzztest//fuzztest",
"@com_google_googletest//:gtest",
],
Expand Down Expand Up @@ -331,6 +332,7 @@ cc_library(
"//xls/common/status:status_macros",
"@com_google_absl//absl/log",
"@com_google_absl//absl/numeric:int128",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:str_format",
Expand Down
1 change: 1 addition & 0 deletions xls/common/case_converters.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.
#include "xls/common/case_converters.h"

#include <cctype>
#include <string>
#include <string_view>
#include <vector>
Expand Down
5 changes: 2 additions & 3 deletions xls/common/file/file_descriptor_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "xls/common/file/file_descriptor.h"

#include <cstdint>
#include <cstdio>
#include <filesystem> // NOLINT
#include <string>
#include <utility>
Expand Down Expand Up @@ -99,9 +100,7 @@ TEST_F(FileDescriptorTest, FileDescriptorIsClosedAndResetOnClose) {
}

TEST_F(FileDescriptorTest, FileDescriptorIsClosedOnDestruction) {
{
MockFileDescriptor fd(6);
}
{ MockFileDescriptor fd(6); }

EXPECT_EQ(recently_closed_fd, 6);
}
Expand Down
2 changes: 2 additions & 0 deletions xls/common/file/named_pipe.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "xls/common/file/named_pipe.h"

#include <sys/stat.h>
#include <unistd.h>

#include <cerrno>
#include <cstdio>
Expand All @@ -28,6 +29,7 @@
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_format.h"
#include "xls/common/file/file_descriptor.h"
#include "xls/common/status/error_code_to_status.h"
#include "xls/common/status/status_macros.h"

Expand Down
3 changes: 2 additions & 1 deletion xls/common/file/temp_directory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@

#include "xls/common/file/temp_directory.h"

#include <cstdlib> // NOLINT (needed for mkdtemp())
#include <filesystem> // NOLINT
#include <string>
#include <system_error>
#include <system_error> // NOLINT
#include <utility>

#include "absl/log/log.h"
Expand Down
5 changes: 3 additions & 2 deletions xls/common/file/temp_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
#include <fcntl.h>
#include <unistd.h>

#include <cerrno>
#include <cstdlib> // NOLINT (needed for mkostemps())
#include <filesystem> // NOLINT
#include <string>
#include <string_view>
#include <system_error>
#include <system_error> // NOLINT
#include <utility>

#include "absl/log/log.h"
Expand All @@ -45,7 +47,6 @@ absl::Status WriteContent(int fd, std::string_view content) {
}
return absl::UnavailableError(absl::StrCat(
"Failed to write content to temporary file: ", Strerror(errno)));

}
bytes_written += bytes_written_this_time;
}
Expand Down
3 changes: 3 additions & 0 deletions xls/common/file/temp_file_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

#include "xls/common/file/temp_file.h"

#include <unistd.h>

#include <cstdlib> // NOLINT (needed for mkdtemp())
#include <filesystem> // NOLINT
#include <string>
#include <system_error>
Expand Down
1 change: 1 addition & 0 deletions xls/common/logging/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ cc_test(
deps = [
":log_lines",
":scoped_mock_log",
"@com_google_absl//absl/base:log_severity",
"//xls/common:xls_gunit_main",
"@com_google_googletest//:gtest",
],
Expand Down
4 changes: 4 additions & 0 deletions xls/common/logging/log_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

#include "xls/common/logging/log_flags.h"

#include <algorithm>

#include "absl/base/log_severity.h"
#include "absl/flags/flag.h"
#include "absl/log/globals.h"

namespace {
Expand Down
2 changes: 2 additions & 0 deletions xls/common/logging/log_lines_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
#include <string>
#include <string_view>

#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/base/log_severity.h"
#include "xls/common/logging/scoped_mock_log.h"

namespace {
Expand Down
1 change: 1 addition & 0 deletions xls/common/math_util_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include "gtest/gtest.h"
#include "fuzztest/fuzztest.h"
#include "absl/base/macros.h"

namespace xls {
namespace {
Expand Down
2 changes: 2 additions & 0 deletions xls/common/status/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ cc_test(
deps = [
":matchers",
":ret_check",
"@com_google_absl//absl/base:log_severity",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
"//xls/common:xls_gunit_main",
Expand All @@ -93,6 +94,7 @@ cc_library(
"@com_google_absl//absl/log:log_sink",
"@com_google_absl//absl/status",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:cord",
"@com_google_absl//absl/synchronization",
"@com_google_absl//absl/time",
"@com_google_absl//absl/types:span",
Expand Down
1 change: 1 addition & 0 deletions xls/common/status/error_code_to_status.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <system_error> // NOLINT(build/c++11)

#include "absl/status/status.h"
#include "xls/common/status/status_builder.h"

namespace xls {

Expand Down
3 changes: 3 additions & 0 deletions xls/common/status/matchers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@
#include <string>
#include <string_view>

#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/status/status.h"
#include "absl/strings/str_cat.h"
#include "xls/common/status/status_builder.h"

namespace xls {
namespace status_testing {
Expand Down
1 change: 1 addition & 0 deletions xls/common/status/ret_check.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "absl/base/log_severity.h"
#include "absl/status/status.h"
#include "xls/common/source_location.h"
#include "xls/common/status/status_builder.h"

namespace xls {
namespace internal_status_macros_ret_check {
Expand Down
1 change: 1 addition & 0 deletions xls/common/status/ret_check_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/base/log_severity.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "xls/common/logging/scoped_mock_log.h"
Expand Down
2 changes: 2 additions & 0 deletions xls/common/status/status_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@
#include "absl/log/log_entry.h"
#include "absl/log/log_sink.h"
#include "absl/status/status.h"
#include "absl/strings/cord.h"
#include "absl/strings/str_cat.h"
#include "absl/synchronization/mutex.h"
#include "absl/time/clock.h"
#include "absl/time/time.h"
#include "xls/common/source_location.h"
#include "xls/common/symbolized_stacktrace.h"

Expand Down
1 change: 1 addition & 0 deletions xls/common/status/status_macros_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include "xls/common/status/status_macros.h"

#include <cstddef>
#include <memory>
#include <string>
#include <string_view>
Expand Down
1 change: 1 addition & 0 deletions xls/common/strerror.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include "xls/common/strerror.h"

#include <cstring> // NOLINT needed for strerror_r
#include <string>
#include <type_traits>

Expand Down
1 change: 1 addition & 0 deletions xls/common/strerror_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "xls/common/strerror.h"

#include <cerrno>
#include <cstring>

#include "gtest/gtest.h"

Expand Down
1 change: 1 addition & 0 deletions xls/common/string_to_int.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include "absl/log/log.h"
#include "absl/numeric/int128.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_format.h"
#include "absl/strings/strip.h"
Expand Down
1 change: 1 addition & 0 deletions xls/common/strong_int_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include "xls/common/strong_int.h"

#include <cstddef>
#include <cstdint>
#include <iostream>
#include <limits>
Expand Down
1 change: 1 addition & 0 deletions xls/common/subprocess_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "gtest/gtest.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/time/clock.h"
#include "absl/time/time.h"
#include "xls/common/status/matchers.h"

Expand Down
13 changes: 13 additions & 0 deletions xls/contrib/ice40/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ cc_library(
":io_strategy",
"//xls/codegen:finite_state_machine",
"//xls/codegen:module_signature",
"//xls/codegen:module_signature_cc_proto",
"//xls/codegen:vast",
"//xls/common:math_util",
"//xls/common/status:ret_check",
"//xls/common/status:status_macros",
"//xls/ir:bits",
"//xls/ir:format_preference",
"//xls/ir:source_location",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
Expand All @@ -58,6 +60,7 @@ cc_test(
"//xls/simulation:module_testbench",
"//xls/simulation:module_testbench_thread",
"//xls/simulation:verilog_test_base",
"//xls/tools:verilog_include",
"@com_google_absl//absl/log",
"@com_google_googletest//:gtest",
],
Expand Down Expand Up @@ -90,6 +93,8 @@ cc_binary(
":io_strategy_factory",
":wrap_io",
"//xls/codegen:module_signature",
"//xls/codegen:module_signature_cc_proto",
"//xls/codegen:vast",
"//xls/common:exit_status",
"//xls/common:init_xls",
"//xls/common/file:filesystem",
Expand All @@ -107,6 +112,7 @@ cc_library(
deps = [
":ice40_io_strategy",
":io_strategy_factory",
"//xls/codegen:vast",
"//xls/common:module_initializer",
],
alwayslink = True,
Expand All @@ -121,8 +127,10 @@ cc_binary(
":ice40_device_rpc_strategy_registry",
"//xls/common:exit_status",
"//xls/common:init_xls",
"//xls/ir",
"//xls/ir:format_preference",
"//xls/ir:ir_parser",
"//xls/ir:type",
"//xls/ir:value",
"@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/log:check",
Expand All @@ -143,8 +151,11 @@ cc_library(
"//xls/common/file:filesystem",
"//xls/common/status:ret_check",
"//xls/common/status:status_macros",
"//xls/ir:bit_push_buffer",
"//xls/ir:bits",
"//xls/ir:type",
"//xls/ir:value",
"@com_google_absl//absl/base",
"@com_google_absl//absl/log",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
Expand Down Expand Up @@ -221,8 +232,10 @@ cc_library(
hdrs = ["io_strategy_factory.h"],
deps = [
":io_strategy",
"//xls/codegen:vast",
"@com_google_absl//absl/base:no_destructor",
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/strings:str_format",
],
Expand Down
1 change: 1 addition & 0 deletions xls/contrib/ice40/device_rpc_strategy_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_format.h"
#include "xls/contrib/ice40/device_rpc_strategy.h"

namespace xls {

Expand Down
2 changes: 2 additions & 0 deletions xls/contrib/ice40/drpc_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
#include "xls/contrib/ice40/device_rpc_strategy_factory.h"
#include "xls/ir/format_preference.h"
#include "xls/ir/ir_parser.h"
#include "xls/ir/package.h"
#include "xls/ir/type.h"
#include "xls/ir/value.h"

ABSL_FLAG(std::string, target_device, "",
Expand Down
4 changes: 4 additions & 0 deletions xls/contrib/ice40/ice40_device_rpc_strategy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <termios.h>
#include <unistd.h>

#include <cerrno>
#include <cstdint>
#include <filesystem>
#include <ios>
Expand All @@ -26,6 +27,7 @@
#include <system_error>
#include <vector>

#include "absl/base/casts.h"
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
Expand All @@ -38,7 +40,9 @@
#include "xls/common/status/ret_check.h"
#include "xls/common/status/status_macros.h"
#include "xls/common/strerror.h"
#include "xls/ir/bit_push_buffer.h"
#include "xls/ir/bits.h"
#include "xls/ir/type.h"
#include "xls/ir/value.h"

namespace xls {
Expand Down
2 changes: 2 additions & 0 deletions xls/contrib/ice40/ice40_io_strategy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@

#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "xls/codegen/vast.h"
#include "xls/common/file/filesystem.h"
#include "xls/common/file/get_runfile_path.h"
#include "xls/common/status/status_macros.h"
#include "xls/ir/source_location.h"
#include "xls/tools/verilog_include.h"

namespace xls {
namespace verilog {
Expand Down
3 changes: 3 additions & 0 deletions xls/contrib/ice40/ice40_io_strategy_registry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <memory>

#include "xls/codegen/vast.h"
#include "xls/common/module_initializer.h"
#include "xls/contrib/ice40/ice40_io_strategy.h"
#include "xls/contrib/ice40/io_strategy_factory.h"
Expand Down
Loading

0 comments on commit 83d6612

Please sign in to comment.