[libcxx-commits] [libcxx] [llvm] [libc++][C++03] Use `__cxx03/` headers in C++03 mode (PR #109002)

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Dec 20 06:55:42 PST 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {undef deprecator}-->


:warning: undef deprecator found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git diff -U0 --pickaxe-regex -S '([^a-zA-Z0-9#_-]undef[^a-zA-Z0-9_-]|UndefValue::get)' 8dc23efbe6c584c06d6472c6f1b679b5ca861b07 0e188c0ca5f67c151bf01430f9f2e276e604c0d1 libcxx/include/__cxx03/__configuration/config_site_shim.h libcxx/include/__cxx03/__configuration/abi.h libcxx/include/__cxx03/__configuration/compiler.h libcxx/include/__cxx03/__configuration/language.h libcxx/include/__cxx03/__configuration/platform.h libcxx/include/__cxx03/__locale_dir/locale_base_api/bsd_locale_fallbacks.h libcxx/include/__cxx03/__thread/support/pthread.h libcxx/include/complex.h libcxx/include/ctype.h libcxx/include/errno.h libcxx/include/fenv.h libcxx/include/float.h libcxx/include/inttypes.h libcxx/include/math.h libcxx/include/stdatomic.h libcxx/include/stdbool.h libcxx/include/stddef.h libcxx/include/stdio.h libcxx/include/stdlib.h libcxx/include/string.h libcxx/include/tgmath.h libcxx/include/uchar.h libcxx/include/wchar.h libcxx/include/wctype.h libcxx/test/libcxx/algorithms/half_positive.pass.cpp libcxx/test/libcxx/assertions/customize_verbose_abort.link-time.pass.cpp libcxx/test/libcxx/assertions/default_verbose_abort.pass.cpp libcxx/test/libcxx/assertions/modes/none.pass.cpp libcxx/test/libcxx/assertions/single_expression.pass.cpp libcxx/test/libcxx/atomics/atomics.syn/compatible_with_stdatomic.compile.pass.cpp libcxx/test/libcxx/containers/associative/tree_balance_after_insert.pass.cpp libcxx/test/libcxx/containers/associative/tree_key_value_traits.pass.cpp libcxx/test/libcxx/containers/associative/tree_left_rotate.pass.cpp libcxx/test/libcxx/containers/associative/tree_remove.pass.cpp libcxx/test/libcxx/containers/associative/tree_right_rotate.pass.cpp libcxx/test/libcxx/containers/associative/unord.map/abi.compile.pass.cpp libcxx/test/libcxx/containers/associative/unord.set/abi.compile.pass.cpp libcxx/test/libcxx/containers/container_traits.compile.pass.cpp libcxx/test/libcxx/containers/unord/key_value_traits.pass.cpp libcxx/test/libcxx/containers/unord/next_pow2.pass.cpp libcxx/test/libcxx/containers/unord/next_prime.pass.cpp libcxx/test/libcxx/depr/depr.c.headers/extern_c.pass.cpp libcxx/test/libcxx/input.output/file.streams/fstreams/filebuf/traits_mismatch.verify.cpp libcxx/test/libcxx/input.output/file.streams/fstreams/traits_mismatch.verify.cpp libcxx/test/libcxx/input.output/iostream.format/input.streams/traits_mismatch.verify.cpp libcxx/test/libcxx/input.output/iostream.format/output.streams/traits_mismatch.verify.cpp libcxx/test/libcxx/input.output/string.streams/stringbuf/const_sso_buffer.pass.cpp libcxx/test/libcxx/input.output/string.streams/traits_mismatch.verify.cpp libcxx/test/libcxx/iterators/aliasing_iterator.pass.cpp libcxx/test/libcxx/iterators/bounded_iter/arithmetic.pass.cpp libcxx/test/libcxx/iterators/bounded_iter/comparison.pass.cpp libcxx/test/libcxx/iterators/bounded_iter/pointer_traits.pass.cpp libcxx/test/libcxx/iterators/bounded_iter/types.compile.pass.cpp libcxx/test/libcxx/iterators/contiguous_iterators.conv.compile.pass.cpp libcxx/test/libcxx/iterators/contiguous_iterators.verify.cpp libcxx/test/libcxx/iterators/iterator.primitives/iterator.operations/prev.verify.cpp libcxx/test/libcxx/language.support/support.dynamic/libcpp_deallocate.sh.cpp libcxx/test/libcxx/memory/allocation_guard.pass.cpp libcxx/test/libcxx/memory/swap_allocator.pass.cpp libcxx/test/libcxx/numerics/bit.ops.pass.cpp libcxx/test/libcxx/numerics/clamp_to_integral.pass.cpp libcxx/test/libcxx/numerics/complex.number/cmplx.over.pow.pass.cpp libcxx/test/libcxx/selftest/test_macros.pass.cpp libcxx/test/libcxx/strings/c.strings/constexpr_memmove.pass.cpp libcxx/test/libcxx/type_traits/datasizeof.compile.pass.cpp libcxx/test/libcxx/type_traits/is_constant_evaluated.pass.cpp libcxx/test/libcxx/type_traits/is_trivially_comparable.compile.pass.cpp libcxx/test/libcxx/type_traits/is_trivially_relocatable.compile.pass.cpp libcxx/test/libcxx/utilities/exception_guard.odr.sh.cpp libcxx/test/libcxx/utilities/is_pointer_in_range.pass.cpp libcxx/test/libcxx/utilities/is_valid_range.pass.cpp libcxx/test/libcxx/utilities/meta/meta_base.pass.cpp libcxx/test/libcxx/utilities/no_destroy.pass.cpp libcxx/test/libcxx/utilities/template.bitset/includes.pass.cpp libcxx/test/libcxx/utilities/utility/private_constructor_tag.compile.pass.cpp libcxx/test/std/containers/sequences/array/array.fill/fill.verify.cpp libcxx/test/std/containers/sequences/array/array.swap/swap.verify.cpp libcxx/test/std/containers/sequences/array/array.tuple/get.verify.cpp libcxx/test/std/containers/sequences/array/array.tuple/tuple_element.verify.cpp libcxx/test/std/containers/sequences/array/size_and_alignment.compile.pass.cpp libcxx/test/std/containers/sequences/forwardlist/types.pass.cpp libcxx/test/std/containers/sequences/list/types.pass.cpp libcxx/test/std/containers/sequences/vector/vector.cons/exceptions.pass.cpp libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/default.pass.cpp libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/default.pass.cpp libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/move.pass.cpp libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/pointer.pass.cpp libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/string.pass.cpp libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/default.pass.cpp libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp libcxx/test/std/input.output/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp libcxx/test/std/input.output/string.streams/istringstream/istringstream.cons/default.pass.cpp libcxx/test/std/input.output/string.streams/istringstream/istringstream.cons/move.pass.cpp libcxx/test/std/input.output/string.streams/istringstream/istringstream.cons/string.pass.cpp libcxx/test/std/input.output/string.streams/ostringstream/ostringstream.cons/default.pass.cpp libcxx/test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.pass.cpp libcxx/test/std/input.output/string.streams/ostringstream/ostringstream.cons/string.pass.cpp libcxx/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp libcxx/test/std/input.output/string.streams/stringstream/stringstream.cons/default.pass.cpp libcxx/test/std/input.output/string.streams/stringstream/stringstream.cons/move.pass.cpp libcxx/test/std/input.output/string.streams/stringstream/stringstream.cons/string.pass.cpp libcxx/test/std/language.support/support.runtime/cstdalign.compile.pass.cpp libcxx/test/std/numerics/c.math/isnormal.pass.cpp libcxx/test/std/numerics/c.math/signbit.pass.cpp libcxx/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/init.pass.cpp libcxx/test/std/strings/basic.string/char.bad.verify.cpp libcxx/test/std/strings/string.view/char.bad.verify.cpp libcxx/test/std/utilities/template.bitset/bitset.members/nonstdmem.uglified.compile.pass.cpp libcxx/test/support/test_macros.h libcxx/test/tools/clang_tidy_checks/proper_version_checks.cpp
``````````

</details>


The following files introduce new uses of undef:
 - libcxx/include/__cxx03/__configuration/config_site_shim.h

[Undef](https://llvm.org/docs/LangRef.html#undefined-values) is now deprecated and should only be used in the rare cases where no replacement is possible. For example, a load of uninitialized memory yields `undef`. You should use `poison` values for placeholders instead.

In tests, avoid using `undef` and having tests that trigger undefined behavior. If you need an operand with some unimportant value, you can add a new argument to the function and use that instead.

For example, this is considered a bad practice:
```llvm
define void @fn() {
  ...
  br i1 undef, ...
}
```

Please use the following instead:
```llvm
define void @fn(i1 %cond) {
  ...
  br i1 %cond, ...
}
```

Please refer to the [Undefined Behavior Manual](https://llvm.org/docs/UndefinedBehavior.html) for more information.



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


More information about the libcxx-commits mailing list