Commit Graph

441 Commits

Author SHA1 Message Date
rdb 9d14117ad3 Merge branch 'release/1.10.x' 2019-09-16 21:20:20 +02:00
rdb 343c808fc4 dtoolbase: fix repeated calls to TypeRegistry::ptr() in register_type 2019-09-16 21:09:15 +02:00
rdb f4926bff20 Fix a variety of ABI compatibility issues
We need third-party extensions that link with the Panda3D libraries to continue to work when shipping them with the optimized libraries that deploy-ng uses.  To do this, we need the optimized build not to omit symbols that these extensions might depend on.
2019-09-16 03:33:09 +02:00
rdb 1ec7c5d20e Delete pystub, it is no longer needed or used for anything. 2019-08-23 18:58:53 +02:00
Mitchell Stokes cb7dbfc219 Remove unused files there were referencing ToonTown
Closes #659
2019-06-07 22:11:58 +02:00
rdb 0f5da1c155 dtoolbase: fix warning when compiling on Windows 2019-03-04 16:58:18 +01:00
rdb b466e77fe3 dtoolbase: make TypeRegistry lock statically initialized
This is possible now that all MutexImpl have a constexpr constructor.
2019-02-11 16:23:16 +01:00
rdb fb5191e812 pipeline: unify ConditionVarFull and ConditionVar
See #550.  Now that we use the Vista API for condition variables, the only place where the distinction is still relevant is Windows XP, and it's just not worth it for that one corner case.
2019-02-11 16:23:10 +01:00
rdb ab569916b1 Disable WinXP mutex emulation when _WIN32_WINNT >= 0x0600 2019-02-11 14:52:21 +01:00
rdb 89392f0e2d dtoolbase: new mutex and condition variable impl on Windows
This uses SRWLock on Vista and above, and uses a hand-rolled implementation on Windows XP that uses Events (and a spinlock, if this is a multi-core system).

Since SRWLocks aren't recursive, ReMutexWin32Impl has been added to implement recursive mutices, using old-fashioned critical sections.

MutexImpl now has a constexpr constructor on all implementations.
2019-02-07 00:20:59 +01:00
rdb 86c266fd88 Merge branch 'release/1.10.x' 2019-01-31 00:58:29 +01:00
rdb 3a6f7fcde1 dtoolbase: docstring clarification for record_python_type
[skip ci]
2019-01-31 00:11:21 +01:00
rdb ffa0c74402 Merge branch 'release/1.10.x' 2019-01-26 20:18:02 +01:00
rdb 403e56817a dtoolbase: fix x86 compilation error on Android 2019-01-26 19:22:44 +01:00
Brian Lach 7c6e677a23 dtoolbase: add std::initializer_list constructors for pvector, epvector, pdeque, plist, pset, pmultiset
Closes #520
2019-01-10 01:42:44 +01:00
rdb 6e8cb98861 dtoolbase: fix compile errors with --no-python 2018-11-06 20:32:37 +01:00
rdb 49b72fb198 Move Python support code from libp3interrogatedb to generated module
This prevents libp3interrogatedb from having a dependency on the Python library.

See #387
2018-11-06 19:24:37 +01:00
rdb e6f870ece6 Remove Python type tables from interrogatedb 2018-11-05 22:14:25 +01:00
Younguk Kim d6efceb1ed dtoolbase: fix NOMINMAX macro redefinition warning 2018-10-17 20:47:20 +09:00
rdb 90cc8fe385 Fix building with SIMPLE_THREADS=1 2018-10-16 22:15:36 +02:00
rdb 77724f49dc dtoolbase: remove TypeHandle::_none symbol, no longer needed 2018-09-23 13:50:06 +02:00
rdb 809f9b04f6 Fix problems with spinlock mutex/cvar implementation
This reimplements the spinlock on top of std::atomic_flag, which is guaranteed to be lockless.  It also inserts the PAUSE (REP NOP) instruction which is strongly recommended to be placed in busy-wait loops by Intel.

This also includes a recursive spinlock implementation.

The spinlock implementation is disabled by default, but can be enabled by adding the --override MUTEX_SPINLOCK=1 flag to makepanda.
2018-09-04 12:58:48 +02:00
rdb 670047b4b0 dtoolbase: enable use of std::atomic_flag, also on macOS 2018-09-04 12:02:13 +02:00
Sam Edwards 4695557a5d general: Don't require BUILDING_* for static builds 2018-08-31 23:54:32 -06:00
rdb b1fc88027a dtoolbase: add missing DTOOL_PLATFORM for linux_aarch64 2018-08-26 14:04:48 +02:00
rdb c9372c3699 Fix a few GCC compile warnings 2018-08-26 14:02:33 +02:00
rdb 21f5e77467 dtoolbase: prefer GCC AtomicAdjust implementation over i386 asm one 2018-08-19 16:05:39 +02:00
rdb 079a7495f2 Fix macOS build by providing missing std::copysign 2018-07-31 10:47:16 +02:00
rdb ad3ab3ad21 Define stable ordering for WeakPointerTo for use as map/set key
Currently, the WeakPointerTo comparison operators compare the raw pointers, but this is not useful as it may cause a false equality if one weak pointer in the comparison is expired and points to memory that has since been reused.

Instead, we can define a comparison based on the control block pointer, which exists since the new weak pointer implementation in 0bb81a43c9.  This is implemented in the owner_before method, matching C++11 std::weak_ptr semantics.

I would now recommend deprecating most comparison operators of WeakPointerTo or redefining them to make more sense, ie. comparing equal if they (once) referred to the same object and not if they simply point to the same memory address.  This has not yet been done, though code that uses the comparison operators has been fixed in this commit.

Overloads of std::owner_less have been provided for creating a map or set with Weak(Const)PointerTo keys.
2018-07-30 17:27:09 +02:00
Sam Edwards b2bfb31114 general: Remove `using std::*` from headers
Also remove most `using namespace std;` statements. The only one that remains is in py_panda.h.

Closes #350
Closes #335
2018-06-14 16:04:49 +02:00
Sam Edwards 7790f8429d general: Fully qualify header references into the std namespace
Closes #341
2018-06-07 10:35:12 +02:00
Sam Edwards 4754ba524c dtoolbase: Avoid Windows's min/max macros 2018-06-07 10:35:00 +02:00
rdb e27cb2dec3 parser-inc: provide various more STL headers and definitions
This cuts down on various warnings generated by interrogate.
2018-06-04 20:44:14 +02:00
Sam Edwards 5e82671084 general: Do away with TYPENAME macro 2018-06-03 16:36:34 -06:00
Sam Edwards e2b4353800 general: Replace NULL (and 0 as pointer) with C++11 nullptr
Exceptions to this replacement are:
- .c files
- Headers included by a .c file
- stb_image.h
- dr_flac.h
- Strings
- Comments
2018-06-03 16:35:13 -06:00
rdb e0245d2777 First step towards eliminating `using namespace std;` (#335) 2018-06-03 20:32:23 +02:00
Sam Edwards 159b43e563 general: Address a few more compiler warnings 2018-06-01 02:54:13 -06:00
rdb 190c553c57 dtool_config.h: remove some macros for ancient C++ compilers 2018-05-30 23:15:24 +02:00
Sam Edwards 00e259d4dd dtoolbase: Fixup NODEFAULT macro
1. Test for Clang before _MSC_VER (Clang defines this on Windows)
2. Use it in pdtoa.cxx
2018-05-30 11:50:09 -06:00
rdb 6b726fa697 general: fix various compiler warnings and issues exposed thereby 2018-05-30 11:09:35 +02:00
Psychotropos 314cee133a dtoolbase: The bug in question is glibc-specific, treat it as such. 2018-05-30 09:07:16 +02:00
Sam Edwards 0ce9dc98b1 general: Move inclusion of checkPandaVersion.h to dtoolbase
This includes it everywhere, meaning developers no longer must
remember to include it in each metalib init file.
2018-05-26 18:39:24 -06:00
rdb 5e0ce969fe Work around clang 3.1 compile error with static constexpr
There is a bug in clang versions before 3.2 (including the one shipped with Xcode) that makes it give a "conflicting types" compile error when there is a static constexpr function defined outside the class.  The way to work around this is either to remove one of the "static" or "constexpr" keywords, or to simply put the definition inline.

See: https://stackoverflow.com/a/17494592/2135754

I would try and upgrade Xcode to version 5 to see if the problem is fixed, but the buildbot still runs OS X Lion (10.7) and the last version of Xcode that works on Lion is 4.6.3, so it seems easier to just apply these workarounds for now.
2018-05-24 14:34:03 +02:00
rdb 9fad3dba60 general: remove macros for compatibility with non-C++11 compilers
Now that we require MSVC 2015, we no longer need all this nonsense, so we can write cleaner code.
2018-05-23 23:33:05 +02:00
rdb f45ddcab2f general: switch to C++11 Lockable semantics for mutexes
This renames acquire/release to lock/unlock in order to be compatible with std::lock_guard and std::unique_lock (which will eventually replace the *MutexHolder classes).  It will also allow us to typedef MutexImpl to std::mutex later on.
2018-05-23 20:37:56 +02:00
rdb 0bb81a43c9 express: make a thread safe weak pointer implementation (#321)
To access a WeakPointerTo in a thread-safe way, use something like this:

    if (auto ptr = weak_ptr.lock()) {
      ..use ptr as regular PointerTo
    }

The new implementation no longer needs a reference to be stored to all weak pointers on the WeakReferenceList; a mere count of weak pointers is sufficient.  Therefore, callbacks theoretically no longer require a WeakPointerTo to be constructed.

The WeakPointerTo class is not actually atomic; it could be made so, but I don't believe it's worth it at this time.
2018-05-15 13:40:21 +02:00
rdb 8a98bf42a3 general: enable use of tie and tuple on macOS (from TR1, for now) 2018-05-05 23:09:39 +02:00
rdb d13464104c Fix compilation issue with --nothing on MSVC
I have no idea why this error happens, but it does not seem worth the effort to investigate further, so I'm just reverting the previous change to this file.
2018-04-06 20:50:31 +02:00
Sam Edwards 9dd37e9dbc general: Add guards to ensure proper BUILDING_ macros defined
This is designed to sanity-check the buildsystem, ensuring that the
expected BUILDING_ macros are defined at the expected time. It
also helps catch cases where the wrong BUILDING_/EXPCL_ macros
are used.
2018-03-25 13:17:52 -06:00
Sam Edwards bd2a9d709a dtoolbase: Introduce BUILDING_ defines for each component
This mirrors the prior commit.
2018-03-25 13:17:52 -06:00