Just a correction on the commit message: its not Windows.h that is defining `__out`. `__out` is a SAL keyword. Unfortunately, I don't know of a way to disable SAL.
On Sat, Jan 7, 2017 at 3:27 AM, Eric Fiselier via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: ericwf > Date: Sat Jan 7 05:27:06 2017 > New Revision: 291345 > > URL: http://llvm.org/viewvc/llvm-project?rev=291345&view=rev > Log: > Replace identifiers called `__out` because Windows.h #defines it. > > Windows is greedy and it defines the identifier `__out` as a macro. > This patch renames all conflicting libc++ identifiers in order > to correctly work on Windows. > > Modified: > libcxx/trunk/include/algorithm > libcxx/trunk/include/experimental/algorithm > libcxx/trunk/include/experimental/iterator > libcxx/trunk/include/regex > libcxx/trunk/test/support/nasty_macros.hpp > > Modified: libcxx/trunk/include/algorithm > URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/ > algorithm?rev=291345&r1=291344&r2=291345&view=diff > ============================================================ > ================== > --- libcxx/trunk/include/algorithm (original) > +++ libcxx/trunk/include/algorithm Sat Jan 7 05:27:06 2017 > @@ -3100,28 +3100,28 @@ template <class _PopulationIterator, cla > class _UniformRandomNumberGenerator> > _LIBCPP_INLINE_VISIBILITY > _SampleIterator __sample(_PopulationIterator __first, > - _PopulationIterator __last, _SampleIterator > __out, > + _PopulationIterator __last, _SampleIterator > __output, > _Distance __n, > _UniformRandomNumberGenerator & __g, > input_iterator_tag) { > > _Distance __k = 0; > for (; __first != __last && __k < __n; ++__first, (void)++__k) > - __out[__k] = *__first; > + __output[__k] = *__first; > _Distance __sz = __k; > for (; __first != __last; ++__first, (void)++__k) { > _Distance __r = _VSTD::uniform_int_distribution<_Distance>(0, > __k)(__g); > if (__r < __sz) > - __out[__r] = *__first; > + __output[__r] = *__first; > } > - return __out + _VSTD::min(__n, __k); > + return __output + _VSTD::min(__n, __k); > } > > template <class _PopulationIterator, class _SampleIterator, class > _Distance, > class _UniformRandomNumberGenerator> > _LIBCPP_INLINE_VISIBILITY > _SampleIterator __sample(_PopulationIterator __first, > - _PopulationIterator __last, _SampleIterator > __out, > + _PopulationIterator __last, _SampleIterator > __output, > _Distance __n, > _UniformRandomNumberGenerator& __g, > forward_iterator_tag) { > @@ -3130,18 +3130,18 @@ _SampleIterator __sample(_PopulationIter > _Distance __r = > _VSTD::uniform_int_distribution<_Distance>(0, > --__unsampled_sz)(__g); > if (__r < __n) { > - *__out++ = *__first; > + *__output++ = *__first; > --__n; > } > } > - return __out; > + return __output; > } > > template <class _PopulationIterator, class _SampleIterator, class > _Distance, > class _UniformRandomNumberGenerator> > _LIBCPP_INLINE_VISIBILITY > _SampleIterator __sample(_PopulationIterator __first, > - _PopulationIterator __last, _SampleIterator > __out, > + _PopulationIterator __last, _SampleIterator > __output, > _Distance __n, _UniformRandomNumberGenerator& > __g) { > typedef typename iterator_traits<_PopulationIterator>::iterator_ > category > _PopCategory; > @@ -3153,7 +3153,7 @@ _SampleIterator __sample(_PopulationIter > typedef typename common_type<_Distance, _Difference>::type _CommonType; > _LIBCPP_ASSERT(__n >= 0, "N must be a positive number."); > return _VSTD::__sample( > - __first, __last, __out, _CommonType(__n), > + __first, __last, __output, _CommonType(__n), > __g, _PopCategory()); > } > > @@ -3162,9 +3162,9 @@ template <class _PopulationIterator, cla > class _UniformRandomNumberGenerator> > inline _LIBCPP_INLINE_VISIBILITY > _SampleIterator sample(_PopulationIterator __first, > - _PopulationIterator __last, _SampleIterator __out, > + _PopulationIterator __last, _SampleIterator > __output, > _Distance __n, _UniformRandomNumberGenerator&& > __g) { > - return _VSTD::__sample(__first, __last, __out, __n, __g); > + return _VSTD::__sample(__first, __last, __output, __n, __g); > } > #endif // _LIBCPP_STD_VER > 14 > > > Modified: libcxx/trunk/include/experimental/algorithm > URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/ > experimental/algorithm?rev=291345&r1=291344&r2=291345&view=diff > ============================================================ > ================== > --- libcxx/trunk/include/experimental/algorithm (original) > +++ libcxx/trunk/include/experimental/algorithm Sat Jan 7 05:27:06 2017 > @@ -60,9 +60,9 @@ template <class _PopulationIterator, cla > class _UniformRandomNumberGenerator> > inline _LIBCPP_INLINE_VISIBILITY > _SampleIterator sample(_PopulationIterator __first, _PopulationIterator > __last, > - _SampleIterator __out, _Distance __n, > + _SampleIterator __output, _Distance __n, > _UniformRandomNumberGenerator &&__g) { > - return _VSTD::__sample(__first, __last, __out, __n, __g); > + return _VSTD::__sample(__first, __last, __output, __n, __g); > } > > _LIBCPP_END_NAMESPACE_LFTS > > Modified: libcxx/trunk/include/experimental/iterator > URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/ > experimental/iterator?rev=291345&r1=291344&r2=291345&view=diff > ============================================================ > ================== > --- libcxx/trunk/include/experimental/iterator (original) > +++ libcxx/trunk/include/experimental/iterator Sat Jan 7 05:27:06 2017 > @@ -75,19 +75,19 @@ public: > typedef void reference; > > ostream_joiner(ostream_type& __os, _Delim&& __d) > - : __out(_VSTD::addressof(__os)), __delim(_VSTD::move(__d)), > __first(true) {} > + : __output(_VSTD::addressof(__os)), __delim(_VSTD::move(__d)), > __first(true) {} > > ostream_joiner(ostream_type& __os, const _Delim& __d) > - : __out(_VSTD::addressof(__os)), __delim(__d), __first(true) {} > + : __output(_VSTD::addressof(__os)), __delim(__d), __first(true) > {} > > > template<typename _Tp> > ostream_joiner& operator=(const _Tp& __v) > { > if (!__first) > - *__out << __delim; > + *__output << __delim; > __first = false; > - *__out << __v; > + *__output << __v; > return *this; > } > > @@ -96,7 +96,7 @@ public: > ostream_joiner& operator++(int) _NOEXCEPT { return *this; } > > private: > - ostream_type* __out; > + ostream_type* __output; > _Delim __delim; > bool __first; > }; > > Modified: libcxx/trunk/include/regex > URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/ > regex?rev=291345&r1=291344&r2=291345&view=diff > ============================================================ > ================== > --- libcxx/trunk/include/regex (original) > +++ libcxx/trunk/include/regex Sat Jan 7 05:27:06 2017 > @@ -5262,15 +5262,15 @@ public: > // format: > template <class _OutputIter> > _OutputIter > - format(_OutputIter __out, const char_type* __fmt_first, > + format(_OutputIter __output, const char_type* __fmt_first, > const char_type* __fmt_last, > regex_constants::match_flag_type __flags = > regex_constants::format_default) const; > template <class _OutputIter, class _ST, class _SA> > _LIBCPP_INLINE_VISIBILITY > _OutputIter > - format(_OutputIter __out, const basic_string<char_type, _ST, > _SA>& __fmt, > + format(_OutputIter __output, const basic_string<char_type, _ST, > _SA>& __fmt, > regex_constants::match_flag_type __flags = > regex_constants::format_default) const > - {return format(__out, __fmt.data(), __fmt.data() + > __fmt.size(), __flags);} > + {return format(__output, __fmt.data(), __fmt.data() + > __fmt.size(), __flags);} > template <class _ST, class _SA> > _LIBCPP_INLINE_VISIBILITY > basic_string<char_type, _ST, _SA> > @@ -5382,7 +5382,7 @@ match_results<_BidirectionalIterator, _A > template <class _BidirectionalIterator, class _Allocator> > template <class _OutputIter> > _OutputIter > -match_results<_BidirectionalIterator, _Allocator>::format(_OutputIter > __out, > +match_results<_BidirectionalIterator, _Allocator>::format(_OutputIter > __output, > const char_type* __fmt_first, const char_type* __fmt_last, > regex_constants::match_flag_type __flags) const > { > @@ -5391,27 +5391,27 @@ match_results<_BidirectionalIterator, _A > for (; __fmt_first != __fmt_last; ++__fmt_first) > { > if (*__fmt_first == '&') > - __out = _VSTD::copy(__matches_[0].first, > __matches_[0].second, > - __out); > + __output = _VSTD::copy(__matches_[0].first, > __matches_[0].second, > + __output); > else if (*__fmt_first == '\\' && __fmt_first + 1 != > __fmt_last) > { > ++__fmt_first; > if ('0' <= *__fmt_first && *__fmt_first <= '9') > { > size_t __i = *__fmt_first - '0'; > - __out = _VSTD::copy((*this)[__i].first, > - (*this)[__i].second, __out); > + __output = _VSTD::copy((*this)[__i].first, > + (*this)[__i].second, __output); > } > else > { > - *__out = *__fmt_first; > - ++__out; > + *__output = *__fmt_first; > + ++__output; > } > } > else > { > - *__out = *__fmt_first; > - ++__out; > + *__output = *__fmt_first; > + ++__output; > } > } > } > @@ -5424,21 +5424,21 @@ match_results<_BidirectionalIterator, _A > switch (__fmt_first[1]) > { > case '$': > - *__out = *++__fmt_first; > - ++__out; > + *__output = *++__fmt_first; > + ++__output; > break; > case '&': > ++__fmt_first; > - __out = _VSTD::copy(__matches_[0].first, > __matches_[0].second, > - __out); > + __output = _VSTD::copy(__matches_[0].first, > __matches_[0].second, > + __output); > break; > case '`': > ++__fmt_first; > - __out = _VSTD::copy(__prefix_.first, > __prefix_.second, __out); > + __output = _VSTD::copy(__prefix_.first, > __prefix_.second, __output); > break; > case '\'': > ++__fmt_first; > - __out = _VSTD::copy(__suffix_.first, > __suffix_.second, __out); > + __output = _VSTD::copy(__suffix_.first, > __suffix_.second, __output); > break; > default: > if ('0' <= __fmt_first[1] && __fmt_first[1] <= '9') > @@ -5451,25 +5451,25 @@ match_results<_BidirectionalIterator, _A > ++__fmt_first; > __i = 10 * __i + *__fmt_first - '0'; > } > - __out = _VSTD::copy((*this)[__i].first, > - (*this)[__i].second, __out); > + __output = _VSTD::copy((*this)[__i].first, > + (*this)[__i].second, > __output); > } > else > { > - *__out = *__fmt_first; > - ++__out; > + *__output = *__fmt_first; > + ++__output; > } > break; > } > } > else > { > - *__out = *__fmt_first; > - ++__out; > + *__output = *__fmt_first; > + ++__output; > } > } > } > - return __out; > + return __output; > } > > template <class _BidirectionalIterator, class _Allocator> > @@ -6459,7 +6459,7 @@ typedef regex_token_iterator<wstring::co > template <class _OutputIterator, class _BidirectionalIterator, > class _Traits, class _CharT> > _OutputIterator > -regex_replace(_OutputIterator __out, > +regex_replace(_OutputIterator __output, > _BidirectionalIterator __first, _BidirectionalIterator > __last, > const basic_regex<_CharT, _Traits>& __e, const _CharT* > __fmt, > regex_constants::match_flag_type __flags = > regex_constants::match_default) > @@ -6470,7 +6470,7 @@ regex_replace(_OutputIterator __out, > if (__i == __eof) > { > if (!(__flags & regex_constants::format_no_copy)) > - __out = _VSTD::copy(__first, __last, __out); > + __output = _VSTD::copy(__first, __last, __output); > } > else > { > @@ -6478,29 +6478,29 @@ regex_replace(_OutputIterator __out, > for (size_t __len = char_traits<_CharT>::length(__fmt); __i != > __eof; ++__i) > { > if (!(__flags & regex_constants::format_no_copy)) > - __out = _VSTD::copy(__i->prefix().first, > __i->prefix().second, __out); > - __out = __i->format(__out, __fmt, __fmt + __len, __flags); > + __output = _VSTD::copy(__i->prefix().first, > __i->prefix().second, __output); > + __output = __i->format(__output, __fmt, __fmt + __len, > __flags); > __lm = __i->suffix(); > if (__flags & regex_constants::format_first_only) > break; > } > if (!(__flags & regex_constants::format_no_copy)) > - __out = _VSTD::copy(__lm.first, __lm.second, __out); > + __output = _VSTD::copy(__lm.first, __lm.second, __output); > } > - return __out; > + return __output; > } > > template <class _OutputIterator, class _BidirectionalIterator, > class _Traits, class _CharT, class _ST, class _SA> > inline _LIBCPP_INLINE_VISIBILITY > _OutputIterator > -regex_replace(_OutputIterator __out, > +regex_replace(_OutputIterator __output, > _BidirectionalIterator __first, _BidirectionalIterator > __last, > const basic_regex<_CharT, _Traits>& __e, > const basic_string<_CharT, _ST, _SA>& __fmt, > regex_constants::match_flag_type __flags = > regex_constants::match_default) > { > - return _VSTD::regex_replace(__out, __first, __last, __e, > __fmt.c_str(), __flags); > + return _VSTD::regex_replace(__output, __first, __last, __e, > __fmt.c_str(), __flags); > } > > template <class _Traits, class _CharT, class _ST, class _SA, class _FST, > > Modified: libcxx/trunk/test/support/nasty_macros.hpp > URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/ > support/nasty_macros.hpp?rev=291345&r1=291344&r2=291345&view=diff > ============================================================ > ================== > --- libcxx/trunk/test/support/nasty_macros.hpp (original) > +++ libcxx/trunk/test/support/nasty_macros.hpp Sat Jan 7 05:27:06 2017 > @@ -37,4 +37,11 @@ > #define _Y NASTY_MACRO > #define _Z NASTY_MACRO > > +// Test that libc++ doesn't use names reserved by WIN32 API Macros. > +// NOTE: Obviously we can only define these on non-windows platforms. > +#ifndef _WIN32 > +#define __deallocate NASTY_MACRO > +#define __out NASTY_MACRO > +#endif > + > #endif // SUPPORT_NASTY_MACROS_HPP > > > _______________________________________________ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > -- Saleem Abdulrasool compnerd (at) compnerd (dot) org
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits