Skip to content

Commit

Permalink
fixes for monolithic build mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
GerHobbelt committed Oct 17, 2024
1 parent 96cb351 commit 7bc521e
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 71 deletions.
76 changes: 38 additions & 38 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
#include <fmt/chrono.h>
#include <fmt/color.h>

int main() {
int main(void) {
fmt::print(fg(fmt::color::green), "{}\n", std::chrono::day(7));
}
```
Expand Down Expand Up @@ -396,7 +396,7 @@
```c++
#include <fmt/chrono.h>
int main() {
int main(void) {
fmt::print("{}\n", std::chrono::days(42)); // prints "42d"
}
```
Expand All @@ -415,15 +415,15 @@
#include <source_location>
#include <fmt/std.h>

int main() {
int main(void) {
fmt::print("{}\n", std::source_location::current());
}
```
prints
```
/app/example.cpp:5:51: int main()
/app/example.cpp:5:51: int main(void)
```
Thanks @felix642.
Expand All @@ -436,7 +436,7 @@
#include <bitset>
#include <fmt/std.h>
int main() {
int main(void) {
fmt::print("{}\n", std::bitset<6>(42)); // prints "101010"
}
```
Expand All @@ -463,7 +463,7 @@
}
};

int main() {
int main(void) {
fmt::print("[{:>20.2f}]", point{1, 2});
}
```
Expand All @@ -482,7 +482,7 @@
#include <filesystem>
#include <fmt/std.h>
int main() {
int main(void) {
fmt::print("{:g}\n", std::filesystem::path("C:\\foo"));
}
```
Expand Down Expand Up @@ -700,7 +700,7 @@
#include <vector>
#include <fmt/std.h>
int main() {
int main(void) {
auto v = std::vector<bool>{true};
fmt::print("{}", v[0]);
}
Expand Down Expand Up @@ -881,7 +881,7 @@

auto format_as(floaty_mc_floatface f) { return f.value; }

int main() {
int main(void) {
fmt::print("{:8}\n", floaty_mc_floatface{0.42}); // prints " 0.42"
}
```
Expand All @@ -899,7 +899,7 @@
```c++
#include <fmt/chrono.h>
int main() {
int main(void) {
// prints " 2023"
fmt::print("{:>8%Y}\n", std::chrono::system_clock::now());
}
Expand All @@ -919,7 +919,7 @@
```c++
#include <fmt/chrono.h>

int main() {
int main(void) {
// prints 01.234567
fmt::print("{:%S}\n", std::chrono::microseconds(1234567));
}
Expand Down Expand Up @@ -955,7 +955,7 @@
```c++
#include <fmt/chrono.h>
int main() {
int main(void) {
auto t = std::chrono::system_clock::from_time_t(0) -
std::chrono::milliseconds(250);
fmt::print("{:%S}\n", t); // prints 59.750000000
Expand All @@ -981,7 +981,7 @@
#include <fmt/std.h>
#include <vector>

int main() {
int main(void) {
try {
std::vector<bool>().at(0);
} catch(const std::exception& e) {
Expand Down Expand Up @@ -1010,7 +1010,7 @@
#include <stack>
#include <vector>
int main() {
int main(void) {
auto s = std::stack<bool, std::vector<bool>>();
for (auto b: {true, false, true}) s.push(b);
fmt::print("{}\n", s); // prints [true, false, true]
Expand Down Expand Up @@ -1214,7 +1214,7 @@
```c++
#include <fmt/compile.h>
int main() {
int main(void) {
using namespace fmt::literals;
constexpr size_t n = fmt::formatted_size("{}"_cf, 42);
fmt::print("{}\n", n); // prints 2
Expand Down Expand Up @@ -1250,7 +1250,7 @@
#include <fmt/ranges.h>
#include <vector>

int main() {
int main(void) {
auto v = std::vector{1, 2, 3};
fmt::print("{:n}\n", v); // prints 1, 2, 3
}
Expand Down Expand Up @@ -1388,7 +1388,7 @@
#include <thread>
#include <fmt/ostream.h>
int main() {
int main(void) {
fmt::print("Current thread id: {}\n",
fmt::streamed(std::this_thread::get_id()));
}
Expand All @@ -1412,7 +1412,7 @@
#include <variant>
#include <fmt/std.h>

int main() {
int main(void) {
auto v = std::variant<int, std::string>(42);
fmt::print("{}\n", v);
}
Expand All @@ -1435,7 +1435,7 @@
#include <filesystem>
#include <fmt/std.h>
int main() {
int main(void) {
fmt::print("There is no place like {}.", std::filesystem::path("/home"));
}
```
Expand All @@ -1453,7 +1453,7 @@
#include <thread>
#include <fmt/std.h>

int main() {
int main(void) {
fmt::print("Current thread id: {}\n", std::this_thread::get_id());
}
```
Expand All @@ -1466,7 +1466,7 @@
#include <fmt/chrono.h>
#include <fmt/color.h>
int main() {
int main(void) {
auto now = std::chrono::system_clock::now();
fmt::print(
"[{}] {}: {}\n",
Expand Down Expand Up @@ -1496,7 +1496,7 @@
#include <vector>
#include <fmt/ranges.h>

int main() {
int main(void) {
fmt::print("{::#x}\n", std::vector{10, 20, 30});
}
```
Expand Down Expand Up @@ -1721,7 +1721,7 @@
```c++
#include <fmt/chrono.h>
int main() {
int main(void) {
fmt::print("{:%S}", std::chrono::milliseconds(1234));
}
```
Expand All @@ -1744,7 +1744,7 @@
```c++
#include <fmt/format.h>

int main() {
int main(void) {
fmt::print("{} dollars", fmt::group_digits(1000000));
}
```
Expand All @@ -1771,7 +1771,7 @@
```c++
#include <fmt/format.h>
int main() {
int main(void) {
using namespace fmt::literals;
fmt::print("{answer:s}", "answer"_a=42);
}
Expand All @@ -1790,7 +1790,7 @@
#include <fmt/ranges.h>
#include <vector>

int main() {
int main(void) {
fmt::print("{}", std::vector<std::string>{"\naan"});
}
```
Expand All @@ -1815,7 +1815,7 @@
#include <fmt/ranges.h>
#include <map>
int main() {
int main(void) {
fmt::print("{}", std::map<std::string, int>{{"answer", 42}});
}
```
Expand Down Expand Up @@ -2029,7 +2029,7 @@
```c++
#include <fmt/core.h>

int main() {
int main(void) {
fmt::print("{:d}", "I am not a number");
}
```
Expand Down Expand Up @@ -2200,7 +2200,7 @@
#include <cstddef>
#include <vector>

int main() {
int main(void) {
auto bytes = std::vector{std::byte(4), std::byte(2)};
fmt::print("{}", fmt::join(bytes, ""));
}
Expand All @@ -2217,7 +2217,7 @@
```c++
#include <fmt/chrono.h>
int main() {
int main(void) {
fmt::print("{}", std::chrono::system_clock::now());
}
```
Expand All @@ -2231,7 +2231,7 @@
```c++
#include <fmt/chrono.h>

int main() {
int main(void) {
std::locale::global(std::locale("ru_RU.UTF-8"));
auto monday = std::chrono::weekday(1);
fmt::print("{}\n", monday); // prints "Mon"
Expand Down Expand Up @@ -2261,7 +2261,7 @@
```c++
#include <fmt/chrono.h>
int main() {
int main(void) {
using tp = std::chrono::time_point<
std::chrono::system_clock, std::chrono::seconds>;
fmt::print("{:%S}", tp(std::chrono::seconds(42)));
Expand All @@ -2276,7 +2276,7 @@
```c++
#include <fmt/core.h>

int main() {
int main(void) {
fmt::print("{0:.3}", 1.1);
}
```
Expand All @@ -2295,7 +2295,7 @@
#include <fmt/core.h>
#include <locale>
int main() {
int main(void) {
std::locale::global(std::locale("fr_FR.UTF-8"));
fmt::print("{0:.2Lf}", 0.42);
}
Expand Down Expand Up @@ -2338,7 +2338,7 @@
```c++
#include <fmt/core.h>

int main() {
int main(void) {
fmt::print("{:s}", true);
}
```
Expand All @@ -2351,7 +2351,7 @@
```c++
#include <fmt/format.h>
int main() {
int main(void) {
fmt::print("My main: {}\n", fmt::ptr(main));
}
```
Expand Down Expand Up @@ -2384,7 +2384,7 @@
```c++
#include <fmt/core.h>

int main() {
int main(void) {
fmt::print("{:-<10}{}\n", "你好", "世界");
fmt::print("{:-<10}{}\n", "hello", "world");
}
Expand All @@ -2403,7 +2403,7 @@
```c++
#include <fmt/os.h>
int main() {
int main(void) {
fmt::ostream out1 = fmt::output_file("guide");
out1.print("Zaphod");
out1.close();
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ See the [documentation](https://fmt.dev) for more details.
``` c++
#include <fmt/base.h>

int main() {
int main(void) {
fmt::print("Hello, world!\n");
}
```
Expand All @@ -101,7 +101,7 @@ std::string s = fmt::format("I'd rather be {1} than {0}.", "right", "happy");
``` c++
#include <fmt/chrono.h>

int main() {
int main(void) {
auto now = std::chrono::system_clock::now();
fmt::print("Date and time: {}\n", now);
fmt::print("Time: {:%H:%M}\n", now);
Expand All @@ -119,7 +119,7 @@ Output:
#include <vector>
#include <fmt/ranges.h>
int main() {
int main(void) {
std::vector<int> v = {1, 2, 3};
fmt::print("{}\n", v);
}
Expand All @@ -143,7 +143,7 @@ format specifier for a string.
``` c++
#include <fmt/os.h>

int main() {
int main(void) {
auto out = fmt::output_file("guide.txt");
out.print("Don't {}", "Panic");
}
Expand All @@ -157,7 +157,7 @@ fprintf](http://www.zverovich.net/2020/08/04/optimal-file-buffer-size.html).
``` c++
#include <fmt/color.h>
int main() {
int main(void) {
fmt::print(fg(fmt::color::crimson) | fmt::emphasis::bold,
"Hello, {}!\n", "world");
fmt::print(fg(fmt::color::floral_white) | bg(fmt::color::slate_gray) |
Expand Down
Loading

0 comments on commit 7bc521e

Please sign in to comment.