Skip to content
This repository has been archived by the owner on May 1, 2023. It is now read-only.

Commit

Permalink
suppress unused typedef warning
Browse files Browse the repository at this point in the history
Summary:
We're seeing the following compiler warnings:
```
unused type alias 'char_type' [-Werror,-Wunused-local-typedef]
```
and this breaks compilation since we build with `-Werror`.

I haven't fully understood why & when this warning is triggered (it doesn't always trigger), but by adding a `[[maybe_unused]]` we can suppress the warning.

Reviewed By: vitaut

Differential Revision: D38387281

fbshipit-source-id: a12c9791fcf3eb6bae72a78310ed461f882a9eb7
  • Loading branch information
h-friederich authored and facebook-github-bot committed Aug 5, 2022
1 parent bfe8418 commit fe5d8d6
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions deps/fmt/include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -2360,18 +2360,18 @@ FMT_CONSTEXPR void handle_dynamic_spec(int& value,
}
}

#define FMT_STRING_IMPL(s, base, explicit) \
[] { \
/* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \
/* Use a macro-like name to avoid shadowing warnings. */ \
struct FMT_GCC_VISIBILITY_HIDDEN FMT_COMPILE_STRING : base { \
using char_type = fmt::remove_cvref_t<decltype(s[0])>; \
FMT_MAYBE_UNUSED FMT_CONSTEXPR explicit \
operator fmt::basic_string_view<char_type>() const { \
return fmt::detail_exported::compile_string_to_view<char_type>(s); \
} \
}; \
return FMT_COMPILE_STRING(); \
#define FMT_STRING_IMPL(s, base, explicit) \
[] { \
/* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \
/* Use a macro-like name to avoid shadowing warnings. */ \
struct FMT_GCC_VISIBILITY_HIDDEN FMT_COMPILE_STRING : base { \
using char_type FMT_MAYBE_UNUSED = fmt::remove_cvref_t<decltype(s[0])>; \
FMT_MAYBE_UNUSED FMT_CONSTEXPR explicit \
operator fmt::basic_string_view<char_type>() const { \
return fmt::detail_exported::compile_string_to_view<char_type>(s); \
} \
}; \
return FMT_COMPILE_STRING(); \
}()

/**
Expand Down

0 comments on commit fe5d8d6

Please sign in to comment.