Skip to content
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

fix redefinition warning for RESET_COLOR #792

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions include/fmt/format-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ inline int fmt_snprintf(char *buffer, size_t size, const char *format, ...) {
# define FMT_SWPRINTF swprintf
#endif // defined(_WIN32) && defined(__MINGW32__) && !defined(__NO_ISOCEXT)

const char RESET_COLOR[] = "\x1b[0m";
const wchar_t WRESET_COLOR[] = L"\x1b[0m";
static FMT_CONSTEXPR_DECL const char RESET_COLOR[] = "\x1b[0m";
static FMT_CONSTEXPR_DECL const wchar_t WRESET_COLOR[] = L"\x1b[0m";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why static?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that would be copy-pasta mistake on my part.


typedef void (*FormatFunc)(internal::buffer &, int, string_view);

Expand Down Expand Up @@ -526,7 +526,6 @@ FMT_CONSTEXPR void to_esc(uint8_t c, char out[], int offset) {

FMT_FUNC void vprint_rgb(rgb fd, string_view format, format_args args) {
char escape_fd[] = "\x1b[38;2;000;000;000m";
static FMT_CONSTEXPR_DECL const char RESET_COLOR[] = "\x1b[0m";
internal::to_esc(fd.r, escape_fd, 7);
internal::to_esc(fd.g, escape_fd, 11);
internal::to_esc(fd.b, escape_fd, 15);
Expand All @@ -539,7 +538,6 @@ FMT_FUNC void vprint_rgb(rgb fd, string_view format, format_args args) {
FMT_FUNC void vprint_rgb(rgb fd, rgb bg, string_view format, format_args args) {
char escape_fd[] = "\x1b[38;2;000;000;000m"; // foreground color
char escape_bg[] = "\x1b[48;2;000;000;000m"; // background color
static FMT_CONSTEXPR_DECL const char RESET_COLOR[] = "\x1b[0m";
internal::to_esc(fd.r, escape_fd, 7);
internal::to_esc(fd.g, escape_fd, 11);
internal::to_esc(fd.b, escape_fd, 15);
Expand Down