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 missing includes in fmt.cc #3994

Merged
merged 2 commits into from
Jun 8, 2024
Merged

Fix missing includes in fmt.cc #3994

merged 2 commits into from
Jun 8, 2024

Conversation

yujincheng08
Copy link
Contributor

@yujincheng08 yujincheng08 commented Jun 6, 2024

This causes duplicated std definitions in the fmt module, e.g.,

ld.lld: error: undefined symbol: std::_LIBCPP_ABI_NAMESPACE::source_location@fmt::file_name[abi:v170000]() const

Copy link
Contributor

@vitaut vitaut left a comment

Choose a reason for hiding this comment

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

Thanks for the PR.

include/fmt/base.h Outdated Show resolved Hide resolved
This causes duplicated std definitions in the fmt module
@vitaut vitaut merged commit 0f6e716 into fmtlib:master Jun 8, 2024
42 checks passed
@vitaut
Copy link
Contributor

vitaut commented Jun 8, 2024

Thank you!

@yujincheng08 yujincheng08 deleted the include branch June 8, 2024 20:51
@yujincheng08
Copy link
Contributor Author

-Winclude-angled-in-module-purview becomes worse when I am using libstdc++ instead of libc++. Maybe we should guard all includes in headers by FMT_MODULE.

@vitaut
Copy link
Contributor

vitaut commented Jun 9, 2024

-Winclude-angled-in-module-purview becomes worse when I am using libstdc++ instead of libc++

@yujincheng08, what warnings do you get?

@yujincheng08
Copy link
Contributor Author

yujincheng08 commented Jun 9, 2024

@vitaut The warnings are:

[10/14] /usr/bin/clang++-18 -DFMT_MODULE -Ifmt/include -O3 -DNDEBUG -std=gnu++20 -fvisibility=hidden -fvisibility-inlines-hidden -MD -MT CMakeFiles/fmt.dir/src/fmt.cc.o -MF CMakeFiles/fmt.dir/src/fmt.cc.o.d @CMakeFiles/fmt.dir/src/fmt.cc.o.modmap -o CMakeFiles/fmt.dir/src/fmt.cc.o -c fmt/src/fmt.cc
In file included from fmt/src/fmt.cc:102:
In file included from fmt/include/fmt/args.h:17:
fmt/include/fmt/format.h:42:12: warning: '#include <filename>' attaches the declarations to the named module 'fmt', which is not usually intended; consider moving that directive before the module declaration [-Winclude-angled-in-module-purview]
   42 | #  include <cmath>             // std::signbit
      |            ^
fmt/include/fmt/format.h:44:12: warning: '#include <filename>' attaches the declarations to the named module 'fmt', which is not usually intended; consider moving that directive before the module declaration [-Winclude-angled-in-module-purview]
   44 | #  include <cstring>           // std::memcpy
      |            ^
In file included from fmt/src/fmt.cc:103:
fmt/include/fmt/chrono.h:14:12: warning: '#include <filename>' attaches the declarations to the named module 'fmt', which is not usually intended; consider moving that directive before the module declaration [-Winclude-angled-in-module-purview]
   14 | #  include <cmath>    // std::isfinite
      |            ^
fmt/include/fmt/chrono.h:15:12: warning: '#include <filename>' attaches the declarations to the named module 'fmt', which is not usually intended; consider moving that directive before the module declaration [-Winclude-angled-in-module-purview]
   15 | #  include <cstring>  // std::memcpy
      |            ^
fmt/include/fmt/chrono.h:16:12: warning: '#include <filename>' attaches the declarations to the named module 'fmt', which is not usually intended; consider moving that directive before the module declaration [-Winclude-angled-in-module-purview]
   16 | #  include <ctime>
      |            ^
In file included from fmt/src/fmt.cc:108:
fmt/include/fmt/os.h:11:10: warning: '#include <filename>' attaches the declarations to the named module 'fmt', which is not usually intended; consider moving that directive before the module declaration [-Winclude-angled-in-module-purview]
   11 | #include <cerrno>
      |          ^
fmt/include/fmt/os.h:14:12: warning: '#include <filename>' attaches the declarations to the named module 'fmt', which is not usually intended; consider moving that directive before the module declaration [-Winclude-angled-in-module-purview]
   14 | #  include <cstdio>
      |            ^
In file included from fmt/src/fmt.cc:113:
fmt/include/fmt/std.h:13:12: warning: '#include <filename>' attaches the declarations to the named module 'fmt', which is not usually intended; consider moving that directive before the module declaration [-Winclude-angled-in-module-purview]
   13 | #  include <bitset>
      |            ^
fmt/include/fmt/std.h:15:12: warning: '#include <filename>' attaches the declarations to the named module 'fmt', which is not usually intended; consider moving that directive before the module declaration [-Winclude-angled-in-module-purview]
   15 | #  include <cstdlib>
      |            ^
In file included from fmt/src/fmt.cc:114:
fmt/include/fmt/xchar.h:12:12: warning: '#include <filename>' attaches the declarations to the named module 'fmt', which is not usually intended; consider moving that directive before the module declaration [-Winclude-angled-in-module-purview]
   12 | #  include <cwchar>
      |            ^
In file included from fmt/src/fmt.cc:125:
In file included from fmt/src/format.cc:8:
fmt/include/fmt/format-inl.h:13:12: warning: '#include <filename>' attaches the declarations to the named module 'fmt', which is not usually intended; consider moving that directive before the module declaration [-Winclude-angled-in-module-purview]
   13 | #  include <cmath>
      |            ^
fmt/include/fmt/format-inl.h:16:10: warning: '#include <filename>' attaches the declarations to the named module 'fmt', which is not usually intended; consider moving that directive before the module declaration [-Winclude-angled-in-module-purview]
   16 | #include <cerrno>  // errno
      |          ^
fmt/include/fmt/format-inl.h:17:10: warning: '#include <filename>' attaches the declarations to the named module 'fmt', which is not usually intended; consider moving that directive before the module declaration [-Winclude-angled-in-module-purview]
   17 | #include <climits>
      |          ^
In file included from fmt/src/fmt.cc:127:
fmt/src/os.cc:15:10: warning: '#include <filename>' attaches the declarations to the named module 'fmt', which is not usually intended; consider moving that directive before the module declaration [-Winclude-angled-in-module-purview]
   15 | #include <climits>
      |          ^
14 warnings generated.

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