-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[libc++] Rename __bit_reference template parameter to avoid conflict #80661
[libc++] Rename __bit_reference template parameter to avoid conflict #80661
Conversation
As of 4d20cfc, `__bit_reference` contains a template `__fill_n` with a bool `_FillValue` parameter. Unfortunately there is a relatively widely used piece of scientific software called NetCDF, which exposes a (C) macro `_FillValue` in its public headers. When building the NetCDF C++ bindings, this quickly leads to compilation errors when the macro interferes with the template in `__bit_reference`. Rename the parameter to `_Fill_Value` to avoid the conflict.
@llvm/pr-subscribers-libcxx Author: Dimitry Andric (DimitryAndric) ChangesAs of 4d20cfc, Unfortunately there is a relatively widely used piece of scientific software called NetCDF, which exposes a (C) macro When building the NetCDF C++ bindings, this quickly leads to compilation errors when the macro interferes with the template in Rename the parameter to Full diff: https://github.com/llvm/llvm-project/pull/80661.diff 1 Files Affected:
diff --git a/libcxx/include/__bit_reference b/libcxx/include/__bit_reference
index 9032b8f018093..e0b647eb62a8a 100644
--- a/libcxx/include/__bit_reference
+++ b/libcxx/include/__bit_reference
@@ -173,7 +173,7 @@ private:
// fill_n
-template <bool _FillValue, class _Cp>
+template <bool _Fill_Value, class _Cp>
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
__fill_n(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n) {
using _It = __bit_iterator<_Cp, false>;
@@ -185,7 +185,7 @@ __fill_n(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n) {
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
__storage_type __dn = std::min(__clz_f, __n);
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
- if (_FillValue)
+ if (_Fill_Value)
*__first.__seg_ |= __m;
else
*__first.__seg_ &= ~__m;
@@ -194,13 +194,13 @@ __fill_n(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n) {
}
// do middle whole words
__storage_type __nw = __n / __bits_per_word;
- std::fill_n(std::__to_address(__first.__seg_), __nw, _FillValue ? static_cast<__storage_type>(-1) : 0);
+ std::fill_n(std::__to_address(__first.__seg_), __nw, _Fill_Value ? static_cast<__storage_type>(-1) : 0);
__n -= __nw * __bits_per_word;
// do last partial word
if (__n > 0) {
__first.__seg_ += __nw;
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
- if (_FillValue)
+ if (_Fill_Value)
*__first.__seg_ |= __m;
else
*__first.__seg_ &= ~__m;
@@ -1007,7 +1007,7 @@ private:
friend class __bit_iterator<_Cp, true>;
template <class _Dp>
friend struct __bit_array;
- template <bool _FillValue, class _Dp>
+ template <bool _Fill_Value, class _Dp>
_LIBCPP_CONSTEXPR_SINCE_CXX20 friend void __fill_n(__bit_iterator<_Dp, false> __first, typename _Dp::size_type __n);
template <class _Dp, bool _IC>
|
Let's rename it to |
@DimitryAndric Please file a bug report against |
I filed Unidata/netcdf-c#2858, but it appears to be a historical mistake which is part of the NetCDF API now. |
…lvm#80661) As of 4d20cfc, `__bit_reference` contains a template `__fill_n` with a bool `_FillValue` parameter. Unfortunately there is a relatively widely used piece of scientific software called NetCDF, which exposes a (C) macro `_FillValue` in its public headers. When building the NetCDF C++ bindings, this quickly leads to compilation errors when the macro interferes with the template in `__bit_reference`. Rename the parameter to `_FillVal` to avoid the conflict. (cherry picked from commit 1ec2522)
…lvm#80661) As of 4d20cfc, `__bit_reference` contains a template `__fill_n` with a bool `_FillValue` parameter. Unfortunately there is a relatively widely used piece of scientific software called NetCDF, which exposes a (C) macro `_FillValue` in its public headers. When building the NetCDF C++ bindings, this quickly leads to compilation errors when the macro interferes with the template in `__bit_reference`. Rename the parameter to `_FillVal` to avoid the conflict. (cherry picked from commit 1ec2522)
…lvm#80661) As of 4d20cfc, `__bit_reference` contains a template `__fill_n` with a bool `_FillValue` parameter. Unfortunately there is a relatively widely used piece of scientific software called NetCDF, which exposes a (C) macro `_FillValue` in its public headers. When building the NetCDF C++ bindings, this quickly leads to compilation errors when the macro interferes with the template in `__bit_reference`. Rename the parameter to `_FillVal` to avoid the conflict.
…lvm#80661) As of 4d20cfc, `__bit_reference` contains a template `__fill_n` with a bool `_FillValue` parameter. Unfortunately there is a relatively widely used piece of scientific software called NetCDF, which exposes a (C) macro `_FillValue` in its public headers. When building the NetCDF C++ bindings, this quickly leads to compilation errors when the macro interferes with the template in `__bit_reference`. Rename the parameter to `_FillVal` to avoid the conflict. (cherry picked from commit 1ec2522)
…lvm#80661) As of 4d20cfc, `__bit_reference` contains a template `__fill_n` with a bool `_FillValue` parameter. Unfortunately there is a relatively widely used piece of scientific software called NetCDF, which exposes a (C) macro `_FillValue` in its public headers. When building the NetCDF C++ bindings, this quickly leads to compilation errors when the macro interferes with the template in `__bit_reference`. Rename the parameter to `_FillVal` to avoid the conflict. (cherry picked from commit 1ec2522)
…lvm#80661) As of 4d20cfc, `__bit_reference` contains a template `__fill_n` with a bool `_FillValue` parameter. Unfortunately there is a relatively widely used piece of scientific software called NetCDF, which exposes a (C) macro `_FillValue` in its public headers. When building the NetCDF C++ bindings, this quickly leads to compilation errors when the macro interferes with the template in `__bit_reference`. Rename the parameter to `_FillVal` to avoid the conflict. (cherry picked from commit 1ec2522)
…lvm#80661) As of 4d20cfc, `__bit_reference` contains a template `__fill_n` with a bool `_FillValue` parameter. Unfortunately there is a relatively widely used piece of scientific software called NetCDF, which exposes a (C) macro `_FillValue` in its public headers. When building the NetCDF C++ bindings, this quickly leads to compilation errors when the macro interferes with the template in `__bit_reference`. Rename the parameter to `_FillVal` to avoid the conflict. (cherry picked from commit 1ec2522)
As of 4d20cfc,
__bit_reference
contains a template__fill_n
with a bool_FillValue
parameter.Unfortunately there is a relatively widely used piece of scientific software called NetCDF, which exposes a (C) macro
_FillValue
in its public headers.When building the NetCDF C++ bindings, this quickly leads to compilation errors when the macro interferes with the template in
__bit_reference
.Rename the parameter to
_Fill_Value
to avoid the conflict.