[libc-commits] [libc] [libc] Implement locale variants for 'stdlib.h' functions (PR #105718)

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Thu Aug 29 18:09:37 PDT 2024


jhuber6 wrote:

> We are starting to see failures in our builders and I suspect this patch could be the reason. I am looking into it further.
> 
> Log file: https://logs.chromium.org/logs/fuchsia/buildbucket/cr-buildbucket/8738242099202573585/+/u/clang/build/stdout
> 
> ```
> FAILED: libcxx/src/CMakeFiles/cxx_static.dir/string.cpp.obj 
> /b/s/w/ir/x/w/llvm_build/./bin/clang++ --target=armv6m-none-eabi -D_DEBUG -D_FILE_OFFSET_BITS=64 -D_GLIBCXX_ASSERTIONS -D_LARGEFILE_SOURCE -D_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY -D_LIBCPP_BUILDING_LIBRARY -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_LINK_PTHREAD_LIB -D_LIBCPP_LINK_RT_LIB -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/b/s/w/ir/x/w/llvm-llvm-project/libcxx/src -I/b/s/w/ir/x/w/llvm_build/tools/clang/stage2-bins/include/armv6m-unknown-none-eabi/c++/v1 -I/b/s/w/ir/x/w/llvm_build/tools/clang/stage2-bins/include/c++/v1 -isystem /b/s/w/ir/x/w/llvm_build/tools/clang/stage2-bins/include/armv6m-unknown-none-eabi -resource-dir=/b/s/w/ir/x/w/llvm_build/tools/clang/stage2-bins/./lib/clang/20 --target=armv6m-none-eabi -mthumb -Wno-atomic-alignment "-Dvfprintf(stream, format, vlist)=vprintf(format, vlist)" "-Dfprintf(stream, format, ...)=printf(format)" "-Dtimeval=struct timeval{int tv_sec; int tv_usec;}" "-Dgettimeofday(tv, tz)" -D_LIBCPP_PRINT=1 -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -ffunction-sections -fdata-sections -ffile-prefix-map=/b/s/w/ir/x/w/llvm_build/tools/clang/stage2-bins/runtimes/runtimes-armv6m-none-eabi-bins=../../../../../../llvm-llvm-project -ffile-prefix-map=/b/s/w/ir/x/w/llvm-llvm-project/= -no-canonical-prefixes -Os -DNDEBUG -std=c++2b -UNDEBUG -faligned-allocation -nostdinc++ -fvisibility-inlines-hidden -fvisibility=hidden -fsized-deallocation -Wall -Wextra -Wnewline-eof -Wshadow -Wwrite-strings -Wno-unused-parameter -Wno-long-long -Werror=return-type -Wextra-semi -Wundef -Wunused-template -Wformat-nonliteral -Wno-user-defined-literals -Wno-covered-switch-default -Wno-suggest-override -Wno-error -fno-exceptions -fno-rtti -nostdlibinc -MD -MT libcxx/src/CMakeFiles/cxx_static.dir/string.cpp.obj -MF libcxx/src/CMakeFiles/cxx_static.dir/string.cpp.obj.d -o libcxx/src/CMakeFiles/cxx_static.dir/string.cpp.obj -c /b/s/w/ir/x/w/llvm-llvm-project/libcxx/src/string.cpp
> /b/s/w/ir/x/w/llvm-llvm-project/libcxx/src/string.cpp:74:76: error: too few arguments to function call, expected 4, have 3
>    74 |   V r                                                     = f(p, &ptr, base);
>       |                                                             ~              ^
> /b/s/w/ir/x/w/llvm-llvm-project/libcxx/src/string.cpp:92:12: note: in instantiation of function template specialization 'std::__2::(anonymous namespace)::as_integer_helper<long, std::string, long (*)(const char *, char **, int, __locale_t *) noexcept>' requested here
>    92 |   long r = as_integer_helper<long>(func, s, idx, base, strtol);
>       |            ^
> /b/s/w/ir/x/w/llvm-llvm-project/libcxx/src/string.cpp:74:76: error: too few arguments to function call, expected 4, have 3
>    74 |   V r                                                     = f(p, &ptr, base);
>       |                                                             ~              ^
> /b/s/w/ir/x/w/llvm-llvm-project/libcxx/src/string.cpp:105:10: note: in instantiation of function template specialization 'std::__2::(anonymous namespace)::as_integer_helper<unsigned long, std::string, unsigned long (*)(const char *, char **, int, __locale_t *) noexcept>' requested here
>   105 |   return as_integer_helper<unsigned long>(func, s, idx, base, strtoul);
>       |          ^
> /b/s/w/ir/x/w/llvm-llvm-project/libcxx/src/string.cpp:74:76: error: too few arguments to function call, expected 4, have 3
>    74 |   V r                                                     = f(p, &ptr, base);
>       |                                                             ~              ^
> /b/s/w/ir/x/w/llvm-llvm-project/libcxx/src/string.cpp:110:10: note: in instantiation of function template specialization 'std::__2::(anonymous namespace)::as_integer_helper<long long, std::string, long long (*)(const char *, char **, int, __locale_t *) noexcept>' requested here
>   110 |   return as_integer_helper<long long>(func, s, idx, base, strtoll);
>       |          ^
> /b/s/w/ir/x/w/llvm-llvm-project/libcxx/src/string.cpp:74:76: error: too few arguments to function call, expected 4, have 3
>    74 |   V r                                                     = f(p, &ptr, base);
>       |                                                             ~              ^
> /b/s/w/ir/x/w/llvm-llvm-project/libcxx/src/string.cpp:115:10: note: in instantiation of function template specialization 'std::__2::(anonymous namespace)::as_integer_helper<unsigned long long, std::string, unsigned long long (*)(const char *, char **, int, __locale_t *) noexcept>' requested here
>   115 |   return as_integer_helper<unsigned long long>(func, s, idx, base, strtoull);
>       |          ^
> /b/s/w/ir/x/w/llvm-llvm-project/libcxx/src/string.cpp:158:70: error: too few arguments to function call, expected 3, have 2
>   158 |   V r                                                     = f(p, &ptr);
>       |                                                             ~        ^
> /b/s/w/ir/x/w/llvm-llvm-project/libcxx/src/string.cpp:174:10: note: in instantiation of function template specialization 'std::__2::(anonymous namespace)::as_float_helper<float, std::string, float (*)(const char *, char **, __locale_t *) noexcept>' requested here
>   174 |   return as_float_helper<float>(func, s, idx, strtof);
>       |          ^
> /b/s/w/ir/x/w/llvm-llvm-project/libcxx/src/string.cpp:158:70: error: too few arguments to function call, expected 3, have 2
>   158 |   V r                                                     = f(p, &ptr);
>       |                                                             ~        ^
> /b/s/w/ir/x/w/llvm-llvm-project/libcxx/src/string.cpp:179:10: note: in instantiation of function template specialization 'std::__2::(anonymous namespace)::as_float_helper<double, std::string, double (*)(const char *, char **, __locale_t *) noexcept>' requested here
>   179 |   return as_float_helper<double>(func, s, idx, strtod);
>       |          ^
> /b/s/w/ir/x/w/llvm-llvm-project/libcxx/src/string.cpp:158:70: error: too few arguments to function call, expected 3, have 2
>   158 |   V r                                                     = f(p, &ptr);
>       |                                                             ~        ^
> /b/s/w/ir/x/w/llvm-llvm-project/libcxx/src/string.cpp:184:10: note: in instantiation of function template specialization 'std::__2::(anonymous namespace)::as_float_helper<long double, std::string, long double (*)(const char *, char **, __locale_t *) noexcept>' requested here
>   184 |   return as_float_helper<long double>(func, s, idx, strtold);
>       |          ^
> 7 errors generated.
> ```

Does this bot build `libcxx` on top of `libc`? I have a similar config and don't notice anything off for the GPU case at least. Maybe there's a conflicting definition somewhere? All this did was add definitions into the header, but I don't see anything that's obviously locale related in the errors.

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


More information about the libc-commits mailing list