summaryrefslogtreecommitdiff
path: root/core/templates/cowdata.h
AgeCommit message (Collapse)Author
2021-09-15Fix placement new on zero-sized region warning on GCC 11.1Grigoris Pavlakis
On latest (11.1 as of this commit) GCC, the following warning is continuously issued during build: warning: placement new constructing an object of type 'SafeNumeric<unsigned int>' and size '4' in a region of type 'uint32_t*' {aka 'unsigned int*'} and size '0' [-Wplacement-new=] This happens because on 98ceb60eb4 the new operator override used was dropped and replaced with standard placement new. GCC sees the subtraction from the pointer and complains as it thinks that the SafeNumeric is placed outside an allocation, not knowing that the address requested is already inside one. After suggestions, the false positive is silenced, with no other changes.
2021-08-13Refactors the memnew_placement.AndreaCatania
With this commit the macro `memnew_placement` uses the standard memory placement syntax: `new (mem) TheClass()`, and removes the outdated and not used syntax: ``` _ALWAYS_INLINE_ void *operator new(size_t p_size, void *p_pointer, size_t check, const char *p_description) { ``` Thanks to this change, the function `memnew_placement` call is compatible with any class, and can also initialize classes with non-empty constructor: ``` // This is valid, like before. memnew_placement(mem, Variant); // This works too: memnew_placement(mem, Variant(123)); ```
2021-02-24Change CRASH_COND to ERR_FAIL in Cowdata::setRafał Mikrut
2021-02-19Improve robustness of atomicsPedro J. Estébanez
And fix increment in `CowData` not being conditional anymore after the recent changes. Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
2021-02-18Modernize atomicsPedro J. Estébanez
- Based on C++11's `atomic` - Reworked `SafeRefCount` (based on the rewrite by @hpvb) - Replaced free atomic functions by the new `SafeNumeric<T>` - Replaced wrong cases of `volatile bool` by the new `SafeFlag` - Platform-specific implementations no longer needed Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
2021-01-01Update copyright statements to 2021Rémi Verschelde
Happy new year to the wonderful Godot community! 2020 has been a tough year for most of us personally, but a good year for Godot development nonetheless with a huge amount of work done towards Godot 4.0 and great improvements backported to the long-lived 3.2 branch. We've had close to 400 contributors to engine code this year, authoring near 7,000 commit! (And that's only for the `master` branch and for the engine code, there's a lot more when counting docs, demos and other first-party repos.) Here's to a great year 2021 for all Godot users 🎆
2020-12-28Rename empty() to is_empty()Marcel Admiraal
2020-11-07Reorganized core/ directory, it was too fatty alreadyreduz
-Removed FuncRef, since Callable makes it obsolete -Removed int_types.h as its obsolete in c++11+ -Changed color names code