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

Clang warnings for described internal types #23

Closed
ecatmur opened this issue Nov 16, 2021 · 1 comment
Closed

Clang warnings for described internal types #23

ecatmur opened this issue Nov 16, 2021 · 1 comment

Comments

@ecatmur
Copy link
Contributor

ecatmur commented Nov 16, 2021

If I describe an enum or class in an unnamed namespace, clang emits warnings, either (if the descriptor is not used)

warning: unused function 'boost_enum_descriptor_fn' [-Wunused-function]

or, if the descriptor is used:

warning: function 'boost_enum_descriptor_fn' is not needed and will not be emitted [-Wunneeded-internal-declaration]

Example: https://godbolt.org/z/qPrdcT5KG

#include <boost/describe.hpp>
namespace {
BOOST_DEFINE_ENUM(E, A);
class S { BOOST_DESCRIBE_CLASS(S, (), (), (), ()); };
}
using namespace boost::describe;
using D = describe_enumerators<E>;
using B = describe_bases<S, mod_any_access>;
using M = describe_members<S, mod_any_access>;

It looks like these can be suppressed with [[maybe_unused]]; I'll submit a PR.

ecatmur added a commit to ecatmur/describe that referenced this issue Nov 16, 2021
Suppresses Wunused-function / Wunneeded-internal-declaration (clang) on internal-linkage types

boostorg#23
ecatmur added a commit to ecatmur/describe that referenced this issue Nov 16, 2021
Suppresses Wunused-function / Wunneeded-internal-declaration (clang) on internal-linkage types

boostorg#23
@pdimov
Copy link
Member

pdimov commented Nov 17, 2021

Thanks.

@pdimov pdimov closed this as completed Nov 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants