Closed yujincheng08 closed 4 weeks ago
Thank you!
-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
.
-Winclude-angled-in-module-purview becomes worse when I am using libstdc++ instead of libc++
@yujincheng08, what warnings do you get?
@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.
This causes duplicated std definitions in the fmt module, e.g.,