KEMBAR78
Fix missing includes in fmt.cc by yujincheng08 · Pull Request #3994 · fmtlib/fmt · GitHub
Skip to content

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.

This causes duplicated std definitions in the fmt module
@vitaut vitaut merged commit 0f6e716 into fmtlib:master Jun 8, 2024
@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