[libc-commits] [libc] [libc] Template StringConverter pop function to avoid duplicate code (PR #152204)

LLVM Continuous Integration via libc-commits libc-commits at lists.llvm.org
Wed Aug 6 15:49:39 PDT 2025


llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `libc-x86_64-debian-gcc-fullbuild-dbg` running on `libc-x86_64-debian-fullbuild` while building `libc` at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/131/builds/27754

<details>
<summary>Here is the relevant piece of the build log for the reference</summary>

```
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
-- For x86_64 builtins preferring x86_64/floatundisf.S to floatundisf.c
-- For x86_64 builtins preferring x86_64/floatdixf.c to floatdixf.c
-- For x86_64 builtins preferring x86_64/floatundixf.S to floatundixf.c
-- check-runtimes does nothing.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/build
@@@BUILD_STEP build libc@@@
Running: ninja libc
[1/11] Building CXX object libc/src/wchar/CMakeFiles/libc.src.wchar.mbsinit.dir/mbsinit.cpp.o
FAILED: libc/src/wchar/CMakeFiles/libc.src.wchar.mbsinit.dir/mbsinit.cpp.o 
/usr/bin/g++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc -isystem /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/build/libc/include -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -Wimplicit-fallthrough -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -g -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_DEFAULT -DLIBC_THREAD_MODE=LIBC_THREAD_MODE_PLATFORM -fpie -ffreestanding -DLIBC_FULL_BUILD -isystem/usr/lib/gcc/x86_64-linux-gnu/12//include -nostdinc -idirafter/usr/include -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wdeprecated -fext-numeric-literals -Wno-pedantic -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -DLIBC_COPT_PUBLIC_PACKAGING -std=gnu++17 -MD -MT libc/src/wchar/CMakeFiles/libc.src.wchar.mbsinit.dir/mbsinit.cpp.o -MF libc/src/wchar/CMakeFiles/libc.src.wchar.mbsinit.dir/mbsinit.cpp.o.d -o libc/src/wchar/CMakeFiles/libc.src.wchar.mbsinit.dir/mbsinit.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/wchar/mbsinit.cpp
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/wchar/mbsinit.cpp:14:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/wchar/character_converter.h:36:13: error: explicit specialization in non-namespace scope ‘class __llvm_libc_20_0_0_git::internal::CharacterConverter’
   36 |   template <> size_t sizeAs<char8_t>() { return state->total_bytes; }
      |             ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/wchar/character_converter.h:36:22: error: template-id ‘sizeAs<char8_t>’ in declaration of primary template
   36 |   template <> size_t sizeAs<char8_t>() { return state->total_bytes; }
      |                      ^~~~~~~~~~~~~~~
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/wchar/character_converter.h:37:13: error: explicit specialization in non-namespace scope ‘class __llvm_libc_20_0_0_git::internal::CharacterConverter’
   37 |   template <> size_t sizeAs<char32_t>() { return 1; }
      |             ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/wchar/character_converter.h:37:22: error: template-id ‘sizeAs<char32_t>’ in declaration of primary template
   37 |   template <> size_t sizeAs<char32_t>() { return 1; }
      |                      ^~~~~~~~~~~~~~~~
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/wchar/character_converter.h:37:22: error: ‘size_t __llvm_libc_20_0_0_git::internal::CharacterConverter::sizeAs()’ cannot be overloaded with ‘size_t __llvm_libc_20_0_0_git::internal::CharacterConverter::sizeAs()’
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/wchar/character_converter.h:36:22: note: previous declaration ‘size_t __llvm_libc_20_0_0_git::internal::CharacterConverter::sizeAs()’
   36 |   template <> size_t sizeAs<char8_t>() { return state->total_bytes; }
      |                      ^~~~~~~~~~~~~~~
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/wchar/character_converter.h:45:13: error: explicit specialization in non-namespace scope ‘class __llvm_libc_20_0_0_git::internal::CharacterConverter’
   45 |   template <> ErrorOr<char8_t> pop() { return pop_utf8(); }
      |             ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/wchar/character_converter.h:46:13: error: explicit specialization in non-namespace scope ‘class __llvm_libc_20_0_0_git::internal::CharacterConverter’
   46 |   template <> ErrorOr<char32_t> pop() { return pop_utf32(); }
      |             ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/wchar/character_converter.h:46:33: error: ‘__llvm_libc_20_0_0_git::ErrorOr<char32_t> __llvm_libc_20_0_0_git::internal::CharacterConverter::pop()’ cannot be overloaded with ‘__llvm_libc_20_0_0_git::ErrorOr<unsigned char> __llvm_libc_20_0_0_git::internal::CharacterConverter::pop()’
   46 |   template <> ErrorOr<char32_t> pop() { return pop_utf32(); }
      |                                 ^~~
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/wchar/character_converter.h:45:32: note: previous declaration ‘__llvm_libc_20_0_0_git::ErrorOr<unsigned char> __llvm_libc_20_0_0_git::internal::CharacterConverter::pop()’
   45 |   template <> ErrorOr<char8_t> pop() { return pop_utf8(); }
      |                                ^~~
[2/11] Building CXX object libc/src/__support/wchar/CMakeFiles/libc.src.__support.wchar.mbrtowc.dir/mbrtowc.cpp.o
FAILED: libc/src/__support/wchar/CMakeFiles/libc.src.__support.wchar.mbrtowc.dir/mbrtowc.cpp.o 
/usr/bin/g++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -D_DEBUG -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc -isystem /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/build/libc/include -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -Wimplicit-fallthrough -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -g -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_DEFAULT -DLIBC_THREAD_MODE=LIBC_THREAD_MODE_PLATFORM -fpie -ffreestanding -DLIBC_FULL_BUILD -isystem/usr/lib/gcc/x86_64-linux-gnu/12//include -nostdinc -idirafter/usr/include -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wdeprecated -fext-numeric-literals -Wno-pedantic -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -std=gnu++17 -MD -MT libc/src/__support/wchar/CMakeFiles/libc.src.__support.wchar.mbrtowc.dir/mbrtowc.cpp.o -MF libc/src/__support/wchar/CMakeFiles/libc.src.__support.wchar.mbrtowc.dir/mbrtowc.cpp.o.d -o libc/src/__support/wchar/CMakeFiles/libc.src.__support.wchar.mbrtowc.dir/mbrtowc.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/wchar/mbrtowc.cpp
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/wchar/mbrtowc.cpp:16:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/wchar/character_converter.h:36:13: error: explicit specialization in non-namespace scope ‘class __llvm_libc_20_0_0_git::internal::CharacterConverter’
   36 |   template <> size_t sizeAs<char8_t>() { return state->total_bytes; }
      |             ^
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/wchar/character_converter.h:36:22: error: template-id ‘sizeAs<char8_t>’ in declaration of primary template

```

</details>

https://github.com/llvm/llvm-project/pull/152204


More information about the libc-commits mailing list