Commit Graph

1630 Commits

Author SHA1 Message Date
rdb b13c4fb8d1 pystub: add a few more calls 2018-11-05 22:14:20 +01:00
Sam Edwards 0b91b3eeb3 vrpn: Add VRPN headers to parser-inc, remove CPPPARSER workarounds 2018-11-03 22:51:32 -06:00
rdb 5ac3cf3fc6 Eliminate C++ DConfig; replace it with a Python compatibility shim 2018-11-02 23:27:07 +01:00
rdb ad3b145951 interrogate: generated property getter should copy in some cases
This is to fix eg. public ButtonHandle members from being returned as const reference, which means they won't outlive the struct they are accessed on, a recipe for obscure crashes.

The is_trivial() criterium for this to apply is admittedly really arbitrary; I haven't really figured out what the right criterium should be, but it's better than hardcoding ButtonHandle.
2018-10-29 16:08:29 -06:00
rdb 2ed4cd7ce6 cppparser: fix CPPStructType::is_trivial() for eg. ButtonHandle 2018-10-29 16:08:29 -06:00
loblao e67d2a16c1
Dtool_PyModuleInitHelper: Fix segfault 2018-10-18 12:14:20 -03: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 82e2c39172 dtoolutil: fix tautological comparison compile warning 2018-10-16 16:32:57 +02:00
rdb 51f5124048 dtoolutil: consistently use char32_t for Unicode code points
Unlike wchar_t, char32_t is guaranteed to be able to hold a UTF-32 character.
2018-10-15 22:23:45 +02:00
rdb ebfb3702ac prc: work around macOS compiler error when making optimized build 2018-10-15 22:21:45 +02:00
rdb d7f19b73e0 dtoolutil: minor fix to TextEncoder::append_text 2018-10-15 13:27:36 +02:00
Sam Edwards 602ea6ebf4 general: Fix a couple more compiler warnings
- express: Fix a warning when compiling for debug

- dtoolutil: Give TextEncoder a virtual destructor
2018-10-13 16:14:34 -06:00
rdb 29b577971f dtoolutil: improve Unicode encoding/decoding, support non-BMP chars
- Support encoding and decoding four-byte UTF-8 sequences
- E_unicode supports surrogate pairs, renamed to E_utf16be for clarity
- char32_t should be used for storing a Unicode code point
2018-10-08 22:33:54 +02:00
rdb 9061fd9416 dtoolutil: fix TextEncoder methods for Python 3
The no-arguments get_text() and set_text() will now return Unicode strings in Python 3, but passing in an encoding will make them return/take bytes objects.

In Python 2, they all take regular strings, but Unicode is also accepted by the no-argument get_text() and set_text().

In the future we probably want to remove most of this interface for Python users, to whom all this is unnecessary since it duplicates functionality already in the standard library.
2018-10-08 22:14:51 +02:00
rdb 8375340582 py_panda: fix TypeError being raised instead of AttributeError
This prevented doing something like hasattr(vec3, "stuff")
2018-10-07 20:24:19 +02:00
Sam Edwards 8d14705689 interrogate: Fix typo 2018-10-07 01:36:44 -06:00
rdb 5ae38a8a92 Fix crash loading from search path
Possible fix for #395
2018-09-27 22:16:56 +02:00
rdb a3a7c0cf9d parser-inc: add more POSIX system header stubs 2018-09-23 14:21:19 +02:00
rdb 77724f49dc dtoolbase: remove TypeHandle::_none symbol, no longer needed 2018-09-23 13:50:06 +02:00
rdb d6b7abedfe prc: fix some race conditions querying bool and searchpath vars
This is not perfect, and we need to more thoroughly address thread safety in the PRC system, but it will nonetheless address a lot of the race condition issues when querying these variables from two threads at the same time.
2018-09-23 13:44:38 +02:00
rdb aacafe7be3 dtoolutil: give DSearchPath a defaulted move constructor 2018-09-23 13:03:47 +02:00
rdb 8b3cc74cad interrogate: write out OS-generic filenames in #include directives
Fixes #386
2018-09-13 21:14:04 +02:00
rdb cb9e65720a interrogate: do not use MOVE in generated code, but use std::move 2018-09-09 13:48:50 +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
Mitchell Stokes f663d215d5 Remove some unused variables 2018-08-19 16:55:07 +02:00
rdb c4b657b5b2 interrogate: support implicit typecast operators in some cases
For example, this will let us pass a ConfigVariableFilename to anything that accepts a Filename, just like in C++.

Does not work if the return value if the typecast operator requires management.
2018-08-19 16:06:16 +02:00
rdb 21f5e77467 dtoolbase: prefer GCC AtomicAdjust implementation over i386 asm one 2018-08-19 16:05:39 +02:00
rdb 5da8b63a66 cppparser: fix formatting of typecast operator 2018-08-19 16:04:56 +02:00
rdb 4ff619b75f pystub: fix some definitions that should be variables, not funcs
This is needed to compile Panda3D with -flto.
2018-08-09 14:56:40 +02:00
rdb 2a2b48134b parser-inc: fix bad socklen_t definition in ws2tcpip.h 2018-08-02 21:24:37 +02:00
rdb 30721ba33b cppparser: fix issues when parsing templated constructor definition 2018-07-31 14:05:08 +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
rdb 684a58e7e9 parser-inc: add timespec 2018-07-17 22:21:44 +02:00
rdb e673937384 parser-inc: add <memory> include to unordered_map/set for allocator 2018-07-09 16:02:06 +02:00
rdb e9e18c2277 dtoolutil: fix PandaSystem TypeHandle static init issue 2018-07-04 20:29:31 +02:00
rdb 68e7f681f4 interrogate: support enum class to limited extent in Python 2
Only the basics are supported; the __members__ or iter interface is not supported at this time.

See also #351 for discussion on pulling in enum34 module.
2018-07-02 12:16:35 +02:00
rdb 9441c28f61 interrogate: do not wrap methods with rvalue arguments
This could in theory be supported, but this is not really intuitive from a Python user's point of view.
2018-06-30 21:38:45 +02:00
rdb e191ee84f4 cppparser: class is not implicitly copyable if it has a move ctor 2018-06-30 21:38:45 +02:00
rdb b2c04a8c7a interrogate: support scoped enum args and return values 2018-06-30 21:38:40 +02:00
rdb c03a75d755 interrogate: use range for in various places for code cleanliness 2018-06-30 17:18:14 +02:00
rdb 0367c73026 py_panda: fix leak of reference counted class with inaccessible dtor
If a class inherits from ReferenceCount, it can be destructed by downcasting to ReferenceCount, so it should not be an obstacle to properly clean it up when such a class is returned from C++.

This issue comes up when a CycleData is returned via MemoryUsagePointers, which is not exposed so is wrapped as NodeReferenceCount instead, which has a protected destructor.
2018-06-22 20:49:19 +02:00
rdb 886e1c2f16 general: fix many compilation warnings in GCC 8 2018-06-19 00:37:28 +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
rdb b88bd99704 Various compiler warning fixes 2018-06-12 12:38:07 +02:00