[Boost-bugs] [Boost C++ Libraries] #10697: Boost coroutine leaks windows.h into global namespace

Subject: [Boost-bugs] [Boost C++ Libraries] #10697: Boost coroutine leaks windows.h into global namespace
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-10-25 11:54:44


#10697: Boost coroutine leaks windows.h into global namespace
-------------------------------------------+-----------------------
 Reporter: jarmo.tiitto@… | Owner: olli
     Type: Bugs | Status: new
Milestone: Boost 1.57.0 | Component: coroutine
  Version: Boost 1.56.0 | Severity: Problem
 Keywords: windows.h coroutine namespace |
-------------------------------------------+-----------------------
 I was surprised that file
 "boost/coroutine/windows/protected_stack_allocator.hpp" from coroutine
 library from boost release 1.56.0 version just insanely includes windows.h
 in public header without any protection from the header leaking into
 global namespace severely polluting it.

 Because of this 'boost/coroutine/protected_stack_allocator.hpp' is
 rendered UNUSABLE/BROKEN on windows (all compilers) and namespace
 pollution may apply to Unix/Linux as well. The feature is released very
 hacky and unfinished way by having such code issues.

 To fix this cleanly simplest thing would be to contain and move windows.h
 (or other platform depend) inclusion into a .cpp file which is compiled.

 The file "boost/coroutine/<platform>/protected_stack_allocator.hpp" would
 contain function prototypes something like:

 {{{
 void * allocate_protected_memory(size_t)
 void free_protected_memory(void *)
 }}}

 in boost::detail namespace to just allocate protected stack memory area
 (no original pointer adjusting) and the protected_stack_allocator template
 that uses the function prototypes. The compiled file then implements the
 prototypes and the platform depend stuff would be hidden from library
 user.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/10697>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:17 UTC