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

[msvc] fix warning about non-inline variable #3296

Closed
wants to merge 2 commits into from

Conversation

russelltg
Copy link
Contributor

With MSVC 17.4.4, I'm getting a warning originating from fmt headers:

fmt\core.h(2909,15): warning C5260: the constant variable 'fmt::v9::detail::invalid_arg_index' has internal linkage in an included header file context, but external linkage in imported header unit context; consider declaring it 'inline' as well if it will be shared across translation units, or 'static' to express intent to use it local to this translation unit
fmt\core.h(2909,15): message : to simplify migration, consider the temporary use of /Wv:18 flag with the version of the compiler with which you used to build without warnings
fmt\core.h(413,58): warning C5260: the constant variable 'fmt::v9::detail::micro' has internal linkage in an included header file context, but external linkage in imported header unit context; consider declaring it 'inline' as well if it will be shared across translation units, or 'static' to express intent to use it local to this translation unit
fmt\core.h(413,58): message : to simplify migration, consider the temporary use of /Wv:18 flag with the version of the compiler with which you used to build without warnings
fmt\format.h(639,20): warning C5260: the constant variable 'fmt::v9::detail::invalid_code_point' has internal linkage in an included header file context, but external linkage in imported header unit context; consider declaring it 'inline' as well if it will be shared across translation units, or 'static' to express intent to use it local to this translation unit
fmt\format.h(639,20): message : to simplify migration, consider the temporary use of /Wv:18 flag with the version of the compiler with which you used to build without warnings

It seems to me inline is the proper linkage specifier here, as the definition won't vary from compilation unit to compilation unit.

However, since it's only a C++17 feature, I've only enabled it when the feature is detected.

@russelltg
Copy link
Contributor Author

I tried to run clang-format, but it touched lines that I didn't touch. What is the suggested clang-format version so I can make sure I'm formatting the code correctly?

@vitaut
Copy link
Contributor

vitaut commented Feb 11, 2023

Thanks for the PR! Merged with a minor tweak in 6e6eb63. Most of the code is formatted with clang-format 12.

@vitaut vitaut closed this Feb 11, 2023
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

Successfully merging this pull request may close these issues.

2 participants