test_poisoned_macros.cpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* Copyright (C) 2011 John Maddock
  2. *
  3. * Use, modification and distribution is subject to the
  4. * Boost Software License, Version 1.0. (See accompanying
  5. * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  6. */
  7. //
  8. // Verify that if malloc/free are macros that everything still works OK:
  9. //
  10. #include <functional>
  11. #include <new>
  12. #include <cstddef>
  13. #include <cstdlib>
  14. #include <exception>
  15. #include <algorithm>
  16. #include <boost/limits.hpp>
  17. #include <iostream>
  18. #include <locale>
  19. namespace std{
  20. void* undefined_poisoned_symbol1(unsigned x);
  21. void undefined_poisoned_symbol2(void* x);
  22. }
  23. #define malloc(x) undefined_poisoned_symbol1(x)
  24. #define free(x) undefined_poisoned_symbol2(x)
  25. #include <boost/pool/pool.hpp>
  26. #include <boost/pool/object_pool.hpp>
  27. #include <boost/pool/pool_alloc.hpp>
  28. #include <boost/pool/singleton_pool.hpp>
  29. template class boost::object_pool<int, boost::default_user_allocator_new_delete>;
  30. template class boost::object_pool<int, boost::default_user_allocator_malloc_free>;
  31. template class boost::pool<boost::default_user_allocator_new_delete>;
  32. template class boost::pool<boost::default_user_allocator_malloc_free>;
  33. template class boost::pool_allocator<int, boost::default_user_allocator_new_delete>;
  34. template class boost::pool_allocator<int, boost::default_user_allocator_malloc_free>;
  35. template class boost::fast_pool_allocator<int, boost::default_user_allocator_new_delete>;
  36. template class boost::fast_pool_allocator<int, boost::default_user_allocator_malloc_free>;
  37. template class boost::simple_segregated_storage<unsigned>;
  38. template class boost::singleton_pool<int, 32>;