Commit Graph

49 Commits

Author SHA1 Message Date
Ion Gaztañaga
f29a4c8248 Make new_delete_resource_imp and null_memory_resource_imp "final" 2025-12-23 11:07:04 +01:00
Ion Gaztañaga
e4fcf4b862 Add overaligned type support for global pmr: implement operator_new_raw_allocate/operator_delete_raw_deallocate and use them in new_delete_resource_imp 2025-12-23 11:02:38 +01:00
Ion Gaztañaga
7972bb2c97 Fixes #305: ("Warnings with -Wstrict-prototypes"). 2025-08-26 00:35:29 +02:00
Juan Carlos Arevalo Baeza (JCAB)
18f29c6eda Fix all instances of MSVC warning C4146 (unsigned negation)
Unsigned negation is a well-defined operation in C and C++ and it is commonly used when doing bit manipulation of unsigned integers, because it builds a high-pass bitmask.

For instance, if `X` is known to be a power of two, `-X` is precisely the mask needed to align a value down to a multiple of `X` by means of a bit-wise `&` operation.

However, it can occasionally be flagging a bug, when the original intent was mathematical negation. For this reason, an explicit fix is preferred to suppressing this warning.

This change fixes all the instances of unsigned negation of the form `-X` to `0 - X`.

It also includes a drive-by spot-fix for the macro `left_bits(x)` whose parameter was missing the usual parenthesis. This was benign in all the uses of the macro.
2025-07-30 15:35:34 -07:00
Ion Gaztañaga
ae221a13f7 Fix GCC compiler versions 2024-12-23 21:10:52 +01:00
Ion Gaztañaga
fad402d037 Fixes #234 ("dlmalloc_ext_2_8_6.c⚠️ iteration 2305843009213693951 invokes undefined behavior") 2024-12-23 19:35:53 +01:00
Ion Gaztañaga
74dfab45fc Fix warning "incompatible pointer types passing 'int *' to parameter of type 'volatile long *' [-Wincompatible-pointer-types]", in clang-win 2024-08-22 00:46:40 +02:00
Ion Gaztañaga
7c74232a40 Remove Boost.StaticAsser dependency 2024-01-02 19:46:05 +01:00
Ion Gaztañaga
52013a99ef Fixes #225 ("variable set but not used in dlmalloc_ext_2_8_6.c") 2023-04-18 23:12:33 +02:00
Ion Gaztañaga
552688c7fc Simplify dependencies dropping Boost.Core 2023-02-01 23:00:23 +01:00
Ion Gaztañaga
2e7983f997 Add missing boost/assert or static_assert include 2023-01-18 23:45:53 +01:00
Ion Gaztañaga
e9b09a5ee7 Use direct-initialization since copy-initialization invokes the copy ctor in older standard versions 2022-12-11 20:36:28 +01:00
Yuriy Chernyshov
488500ed85 Fix using pmr::polymorphic_allocator in pre-main
A similar problems for the above (i. e. non-atomic) branch was addressed in #148, yet the default C++11 branch causes segault with the following stacktrace:

```
(gdb) bt
#0  0x000000000e1c3d28 in boost::container::pmr::memory_resource::allocate (this=0x0, bytes=92, alignment=4)
    at boost/container/include/boost/container/pmr/memory_resource.hpp:48
#1  0x000000000e2e9e59 in boost::container::pmr::polymorphic_allocator<float>::allocate (this=0x7fffffffd148, n=23)
    at boost/container/include/boost/container/pmr/polymorphic_allocator.hpp:92
#2  0x000000000e2e9cdd in std::__y1::allocator_traits<boost::container::pmr::polymorphic_allocator<float> >::allocate (__a=..., __n=23)
    at libcxx/include/__memory/allocator_traits.h:262
#3  0x000000000e2e9b13 in std::__y1::vector<float, boost::container::pmr::polymorphic_allocator<float> >::__vallocate (this=0x7fffffffd130, __n=23)
    at libcxx/include/vector:958
#4  0x000000000e33c591 in std::__y1::vector<float, boost::container::pmr::polymorphic_allocator<float> >::vector (this=0x7fffffffd130, __n=23)
    at libcxx/include/vector:1106
```
2022-10-01 11:24:42 +02:00
Ion Gaztañaga
231dd48e70 Fixes #211 ("Use atomics for pmr get/set default resource") 2022-07-25 01:28:58 +02:00
Ion Gaztañaga
42e7aaecec Fixes #200 (Warning) 2021-11-17 15:33:04 +01:00
Ion Gaztañaga
bfbab6ed7f Fixes #186 ("Warnings out the wazoo") 2021-08-09 00:59:57 +02:00
Ion Gaztañaga
aaa2485ebf Fixes #188 ("Build fails when RTTI is disabled") 2021-08-08 00:06:01 +02:00
Ion Gaztañaga
d5a830434e - Replaced default standard exception classes with Boost.Container own classes, reducing considerably the included files overhead 2020-12-30 15:07:32 +01:00
Ion Gaztañaga
3e09b67f76 Fixes #169 ("flood of warnings building dlmalloc_ext_2_8_6.c on clang11") 2020-10-31 18:55:09 +01:00
Ion Gaztañaga
90de9533ec Fixes #151 ("Buffer overflow in monotonic_buffer_resource::do_allocate"). 2020-07-12 11:07:50 +02:00
Ion Gaztañaga
f9340421da Merge branch 'develop' of https://github.com/eldiener/container into eldiener-develop 2020-05-25 00:36:06 +02:00
Ion Gaztañaga
39edf046d5 Additional fix for #148 ("Fix static initialization issues in pmr global resources") in set_default_resource 2020-05-24 19:00:19 +02:00
Ion Gaztañaga
eff9bdfdaa Fixes #148 again (Fix static initialization issues in pmr global resources) 2020-05-24 00:37:36 +02:00
Ion Gaztañaga
4548ddacf7 Merge branch 'develop' into use-boost-override 2020-05-23 23:42:15 +02:00
Ion Gaztañaga
093467e1d3 Fixes #148 (Fix static initialization issues in pmr global resources) 2020-05-23 23:38:58 +02:00
Eugene Zelenko
811dc94bb4 Use BOOST_OVERRIDE to fix GCC -Wsuggest-override and Clang-tidy modernize-use-override warnings. 2020-05-08 09:28:49 -07:00
Edward Diener
5d526092fb Addition needed for Embarcarder clang-based compilers. 2020-04-23 13:45:23 -04:00
Ion Gaztañaga
27c1fea452 Fixes #136 ("List of non BOOST-prefixed macros") 2019-12-19 05:29:46 +01:00
Ion Gaztañaga
a9ceb4d9c6 Better use forward declarations and export symbols 2019-01-03 03:32:03 +01:00
Ion Gaztañaga
e94c779b56 Fix GitHub #77 ("warning: 'sbrk' is deprecated") 2018-11-11 01:38:27 +01:00
Ion Gaztañaga
3a2f61fdb0 Merge branch 'container-misc-typos' of https://github.com/luzpaz/container into luzpaz-container-misc-typos 2018-11-10 23:32:42 +01:00
Ion Gaztañaga
b51a9e7a25 Fix wrong s_allocated_memory estimation and use more conservative to avoid code that seems to break some older compilers 2018-09-26 01:06:33 +02:00
luz.paz
a6ac16d0c4 container: misc-typos
Found via `codespell -q 3 -L iff,nd`
2018-09-23 15:54:39 -04:00
Ion Gaztañaga
920e009d71 Implemented proposed resolution for LWG 3120 2018-06-18 00:29:22 +02:00
Ion Gaztañaga
9a22431578 * Clean up constructor template auto deduction guides to use Boost.Container traits
* GitHub #73: '"triviality of pair".

* Fixed race condition bug in unsynchronized_pool_resource
2018-06-14 13:17:55 +02:00
Ion Gaztañaga
9137957672 Fixes Issue #61: "compile problems on Android ndk r16 beta 1" 2018-01-27 23:27:54 +01:00
Ion Gaztañaga
22f00f45d8 Fixed issue #65 pmr::monotonic_buffer_resource::allocate() can return a pointer to freed memory after release() is called. 2018-01-27 21:23:43 +01:00
Ion Gaztañaga
fa2494631a Use namespace dtl instead of container_detail to avoid excessively long symbol names. 2017-11-07 00:51:46 +01:00
Brian Kuhl
7816a9777b Update alloc_lib.c 2017-09-06 20:59:35 -04:00
Miro Knejp
bf25231d5d Avoid -Wunreachable-code in do_allocate()
do_allocate() triggered the warning
"code will never be executed [-Wunreachable-code]"
in Clang.

Changed both do_allocate and do_deallocate to keep the existing
similarity.
2016-11-02 13:43:34 +01:00
Jupp Müller
a4e9686f8a Fix declaration changes meaning error with GCC 4.4.7 (#11856) 2015-12-23 09:18:51 +01:00
Gaurav
0cfe2231f9 DL_SIZE_IMPL also dereference addr
DL_SIZE_IMPL also dereference addr, so call inside Null check statement.
2015-10-14 16:07:50 +05:30
Ion Gaztañaga
33d2f0f7af Add Polymorphic Memory Resource utilities and rework the separately compiled library:
- Dlmalloc's based C function are boost_cont_xxx no longer exported, but wrapped into C++ linkage dlmalloc_xxx functions to effectively reuse Boost's dynamic library and autolink machinery instead of rewriting machinery to compile the C source file.
- Refactored scoped_allocator_adaptor's construct logic as it was shared with polymorphic allocator's one. Moved common logic to detail/dispatch_uses_allocator.hpp. Refactored also scoped_allocator_adaptor test utilities to be reused with polymorphic_allocator tests.
2015-09-07 19:16:46 +02:00
Ion Gaztañaga
5d35aec80f Fixed Trac #11339 ("VC12 LNK2005 error with boost::container::adaptive_pool") 2015-06-13 16:44:46 +02:00
Ion Gaztañaga
d51ef9db46 Added NO_MALLINFO and NO_MALLOC_STATS defines to dlmalloc to avoid dependencies. Implemented boost_cont_allocated_memory based on internal_mallinfo 2014-08-14 00:27:22 +02:00
Ion Gaztañaga
8c1bfe2881 Removed trailing whitespaces 2014-05-28 15:50:13 +02:00
Ion Gaztañaga
edc4e6da80 Reverted alloc_lib extension change. It breaks Windows builds. 2014-02-10 21:26:20 +01:00
Ion Gaztañaga
30431adf1e Changed extended allocator file extension from C to C++ as some toolsets (like clang) don't ignore C++ options when compiling C files. 2014-02-09 23:20:44 +01:00
Ion Gaztañaga
41c2056ec6 - Modified relational operators to be friend inline definitions. This allows compilation checking when instantiating classes, avoids predeclarations and results in less verbose code.
- First to make associative containers' tree implementation configurable.
2013-12-23 23:34:28 +01:00