[libc-commits] [libc] [libc] Fix warnings emitted by GCC (PR #98751)
via libc-commits
libc-commits at lists.llvm.org
Sat Jul 13 09:14:26 PDT 2024
overmighty wrote:
Remaining warnings when compiling with GCC 14.1.1 on x86-64:
```
In file included from /home/overmighty/projects/llvm-project/libc/test/UnitTest/Test.h:37,
from /home/overmighty/projects/llvm-project/libc/test/src/__support/CPP/type_traits_test.cpp:11:
/home/overmighty/projects/llvm-project/libc/test/src/__support/CPP/type_traits_test.cpp: In member function ‘virtual void __llvm_libc_19_0_0_git::cpp::LlvmLibcTypeTraitsTest_aligned_storage::Run()’:
/home/overmighty/projects/llvm-project/libc/test/src/__support/CPP/type_traits_test.cpp:122:13: warning: ISO C++ does not allow ‘alignof’ with a non-type [-Wpedantic]
122 | EXPECT_EQ(alignof(buf), alignof(S));
| ^~~~~~~
/home/overmighty/projects/llvm-project/libc/test/UnitTest/LibcTest.h:406:7: note: in definition of macro ‘LIBC_TEST_SCAFFOLDING_’
406 | if (TEST) \
| ^~~~
/home/overmighty/projects/llvm-project/libc/test/UnitTest/LibcTest.h:420:29: note: in expansion of macro ‘LIBC_TEST_BINOP_’
420 | #define EXPECT_EQ(LHS, RHS) LIBC_TEST_BINOP_(EQ, LHS, RHS, )
| ^~~~~~~~~~~~~~~~
/home/overmighty/projects/llvm-project/libc/test/src/__support/CPP/type_traits_test.cpp:122:3: note: in expansion of macro ‘EXPECT_EQ’
122 | EXPECT_EQ(alignof(buf), alignof(S));
| ^~~~~~~~~
```
```
/home/overmighty/projects/llvm-project/libc/test/src/string/memory_utils/op_tests.cpp:198:26: warning: ignoring attributes on template argument ‘__m128i’ [-Wignored-attributes]
198 | generic::Bcmp<__m128i>,
| ^
/home/overmighty/projects/llvm-project/libc/test/src/string/memory_utils/op_tests.cpp:201:26: warning: ignoring attributes on template argument ‘__m256i’ [-Wignored-attributes]
201 | generic::Bcmp<__m256i>,
| ^
/home/overmighty/projects/llvm-project/libc/test/src/string/memory_utils/op_tests.cpp:281:28: warning: ignoring attributes on template argument ‘__m128i’ [-Wignored-attributes]
281 | generic::Memcmp<__m128i>, //
| ^
/home/overmighty/projects/llvm-project/libc/test/src/string/memory_utils/op_tests.cpp:284:28: warning: ignoring attributes on template argument ‘__m256i’ [-Wignored-attributes]
284 | generic::Memcmp<__m256i>, //
| ^
```
The attributes ignored seem to be `__aligned__(16)` and `__aligned__(32)`.
Notes without warnings:
```
In file included from /home/overmighty/projects/llvm-project/libc/src/stdio/printf_core/printf_main.cpp:15:
/home/overmighty/projects/llvm-project/libc/src/stdio/printf_core/parser.h: In instantiation of ‘__llvm_libc_19_0_0_git::cpp::optional<T> __llvm_libc_19_0_0_git::printf_core::Parser<ArgProvider>::get_arg_value(size_t) [with T = long double; ArgProvider = __llvm_libc_19_0_0_git::internal::ArgList; size_t = long unsigned int]’:
/home/overmighty/projects/llvm-project/libc/src/stdio/printf_core/parser.h:236:11: required from ‘__llvm_libc_19_0_0_git::printf_core::FormatSection __llvm_libc_19_0_0_git::printf_core::Parser<ArgProvider>::get_next_section() [with ArgProvider = __llvm_libc_19_0_0_git::internal::ArgList]’
52 | auto temp = get_arg_value<arg_type>(index); \
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
/home/overmighty/projects/llvm-project/libc/src/stdio/printf_core/printf_main.cpp:27:59: required from here
27 | for (FormatSection cur_section = parser.get_next_section();
| ~~~~~~~~~~~~~~~~~~~~~~~^~
/home/overmighty/projects/llvm-project/libc/src/stdio/printf_core/parser.h:415:51: note: the ABI of passing union with ‘long double’ has changed in GCC 4.4
415 | template <class T> LIBC_INLINE cpp::optional<T> get_arg_value(size_t index) {
| ^~~~~~~~~~~~~
```
https://github.com/llvm/llvm-project/pull/98751
More information about the libc-commits
mailing list