Skip to content

Commit 63c710b

Browse files
committed
Cleanup
1 parent ef55545 commit 63c710b

File tree

6 files changed

+13
-12
lines changed

6 files changed

+13
-12
lines changed

libc/src/stdio/baremetal/printf.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ LLVM_LIBC_FUNCTION(int, printf, (const char *__restrict format, ...)) {
4747
int flushval = wb.overflow_write("");
4848
if (flushval != printf_core::WRITE_OK)
4949
retval = flushval;
50-
50+
5151
return retval;
5252
}
5353

libc/src/stdio/baremetal/vprintf.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace LIBC_NAMESPACE_DECL {
2222
namespace {
2323

2424
LIBC_INLINE int stdout_write_hook(cpp::string_view new_str, void *) {
25-
write_to_stdout(new_str);
25+
write_to_stdout(new_str);
2626
return printf_core::WRITE_OK;
2727
}
2828

@@ -40,7 +40,7 @@ LLVM_LIBC_FUNCTION(int, vprintf,
4040
buffer, BUFF_SIZE, &stdout_write_hook, nullptr);
4141
printf_core::Writer<printf_core::WriteMode::FLUSH_TO_STREAM> writer(wb);
4242

43-
int retval = printf_core::printf_main(&writer, format, args);
43+
int retval = printf_core::printf_main(&writer, format, args); // TODO baremetal stuff
4444

4545
int flushval = wb.overflow_write("");
4646
if (flushval != printf_core::WRITE_OK)

libc/src/stdio/printf_core/core_structs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct PrintfResult {
3131

3232
constexpr bool has_error() { return error != 0; }
3333

34-
constexpr operator size_t() { return value; }
34+
// constexpr operator size_t() { return value; }
3535
};
3636

3737
// These length modifiers match the length modifiers in the format string, which

libc/src/stdio/printf_core/printf_main.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ PrintfResult printf_main(Writer<write_mode> *writer, const char *__restrict str,
3030
!cur_section.raw_string.empty();
3131
cur_section = parser.get_next_section()) {
3232
if (cur_section.has_conv)
33-
result = convert(writer, cur_section);
33+
result = convert(writer, cur_section); // look at usages
3434
else
35-
result = writer->write(cur_section.raw_string);
35+
result = writer->write(cur_section.raw_string); // look at usages
3636

3737
if (result < 0)
3838
return {0, -result};

libc/src/time/strftime_core/strftime_main.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ int strftime_main(printf_core::Writer<write_mode> *writer,
3636
return result;
3737
}
3838

39-
return writer->get_chars_written();
39+
return static_cast<int>(writer->get_chars_written());
4040
}
4141

4242
} // namespace strftime_core

libc/test/src/stdio/fprintf_test.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,14 @@ TEST(LlvmLibcFPrintfTest, WriteToFile) {
9191
ASSERT_EQ(printf_test::fclose(file), 0);
9292
}
9393

94-
struct NoopStream {};
95-
96-
static ssize_t noop_write(void *, const char *, size_t size) { return size; }
97-
9894
TEST(LlvmLibcFPrintfTest, CharsWrittenOverflow) {
95+
struct NoopStream {};
96+
auto noop_write = [](void *cookie, const char *buf, size_t size) -> ssize_t {
97+
return size;
98+
};
99+
99100
NoopStream stream;
100-
cookie_io_functions_t funcs = {nullptr, &noop_write, nullptr, nullptr};
101+
cookie_io_functions_t funcs = {nullptr, +noop_write, nullptr, nullptr};
101102
::FILE *file = printf_test::fopencookie(&stream, "w", funcs);
102103
ASSERT_NE(file, nullptr);
103104

0 commit comments

Comments
 (0)