Commit Graph

2359 Commits

Author SHA1 Message Date
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
rdb 4fe7fe4c88 interrogate: fix int8_t / signed char range checking on Android 2018-06-12 11:08:02 +02:00
rdb ac4b8d1e1d Fix various compilation warnings 2018-06-11 14:53:25 +02:00
rdb 1c476203fc interrogate: remove Dtool_AddToDictionary (let me know if anyone uses this)
If any code is relying on this, please let me know and I will add it back.  It appears to be redundant, though, since one can access DtoolClassDict directly.

Symbol kept around temporarily in order to keep ABI compatibility for a short while as people may not update their interrogate and Panda in sync, but it can soon be removed.
2018-06-11 13:43:30 +02:00
rdb 3cc88cd304 interrogate: clean up py_panda.h a bit more
Inching towards reducing code in py_panda and eventually having no Python-specific code in interrogatedb anymore.
2018-06-11 13:39:45 +02:00
Sam Edwards bc596797a3 general: Resolve some warnings unique to Windows 2018-06-10 02:25:10 -06:00
rdb fa6d8b4b39 cppparser: fix class with array member not seen as copy-constructible 2018-06-09 10:29:34 +02:00
rdb acac93a1d1 parse_file: show various additional type traits 2018-06-09 10:29:19 +02:00
rdb 7086a6a2db parser-inc: add missing ios_base::iostate 2018-06-09 10:21:28 +02:00
rdb a76747cba5 parser-inc: C++ headers: cassert, cerrno, fstream, new, cstdlib, csetjmp 2018-06-09 10:18:28 +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
Sam Edwards e72fab9520 dtoolutil: Add missing declaration for init_libdtoolutil() 2018-06-07 01:47:38 -06:00
rdb 4e7edf8a53 parser-inc: add missing include to <string> header 2018-06-06 12:22:31 +02:00
rdb c166daf0f3 interrogate: fix detection of special std types 2018-06-06 12:22:23 +02:00
rdb 3a698e5a81 dtoolutil: use std:: qualification when exposing std types 2018-06-06 11:48:52 +02:00
rdb 036d2c2548 parser-inc: properly namespace iostream definitions 2018-06-06 11:27:46 +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
rdb 5582e174b6 cppparser: fix issue with typedefs to forward declared templates
I don't know if this is the right solution, but it does fix an issue accessing std::ios::openmode caused by the ios typedef being defined before ios_base is fully specified.
2018-06-04 17:30:02 +02:00
rdb be282627a8 express: make PointerTo directly initializable from nullptr 2018-06-04 11:21:18 +02:00
Sam Edwards 9fefa1d2e6 interrogate: Fix missing namespace qualification 2018-06-03 17:40:33 -06:00
Sam Edwards 5e82671084 general: Do away with TYPENAME macro 2018-06-03 16:36:34 -06:00
Sam Edwards a9ffb9630b dtool: Generate code using nullptr over NULL/0 2018-06-03 16:36:07 -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
Sam Edwards d422d74abb general: Clean up asserts which were abusing NULL 2018-06-03 16:26:44 -06:00
rdb e0245d2777 First step towards eliminating `using namespace std;` (#335) 2018-06-03 20:32:23 +02:00
rdb 21d8c29645 More warning fixes 2018-06-03 06:45:35 -04: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
rdb db5dd98d33 general: further warning fixes, use -Wno-unused-variable if NDEBUG
Disabling unused variable checking is needed in NDEBUG builds because of the heavy use of temporary variables in asserts.
2018-05-30 22:51:04 +02:00
Sam Edwards 1c6ae84cdc dtoolutil: Remove HAVE_OPEN_MASK
Rationale:
1. Per standard, fstream::open takes 2 arguments.
   If platforms add a third, they're out of spec.
2. The only platform I could find that takes a file
   mask specifically as the third argument is IRIX,
   which Panda hasn't targeted in forever.
3. The mask being requested isn't even particularly
   interesting - falling back to a platform default
   is best.
4. When USE_PANDAFILESTREAM is defined, pfstream
   is implemented as PandaFileStream, which doesn't
   have a three-argument open() and breaks immediately.
5. makepanda doesn't ever define HAVE_OPEN_MASK
6. It's been broken for so long that, if it were
   important to anybody, it would have been fixed by now.
2018-05-30 12:04:06 -06: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 3029780f88 dtoolutil: Don't assume RTLD_DI_ORIGIN and RTLD_SELF are present, fall back to using RTLD_DI_LINKMAP if necessary
Closes #334
2018-05-30 11:04:12 +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 a251c6dd8f general: Change HAVE_LOCKF to PHAVE_LOCKF
HAVE_LOCKF is already defined by pyconfig.h in
(at least) Python 3.6 - changing the macro name
here avoids warnings
2018-05-27 14:06:14 -06: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 3b4d12cb99 interrogate: also fall back to compare_to in Python 2
This is to create the same behaviour in Python 2 and 3.
2018-05-21 11:55:46 +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 6175e79c57 cppparser: fix infinite recursion stack overflow with enum classes 2018-05-06 22:21:24 +02:00
rdb 666591ff48 cppparser: fix compile warnings on MSVC 2018-05-06 22:19:33 +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
rdb 7125a3e587 interrogate: allow passing None for args that have NULL as default value 2018-04-05 20:49:13 +02:00
rdb 552a649ef3 interrogate: add back NULL definition, fixes some keyword arguments
I am not sure why the definition of NULL was removed; it might have been by mistake, but in any case it broke code like this:

    img = PNMImage(w, h, color_space=CS_srgb)

since it would not understand the default value (NULL) for the argument preceding color_space.
2018-04-04 21:50:02 +02:00
rdb e9ae7dcc40 Use vector_uchar instead of string for binary network/file data
This distinction allows us to better support Python 3, since it will raise exceptions when trying to put arbitrary binary data in a str object.

This also adds some convenience functions for efficiently initializing a Datagram or PTA_uchar from a vector_uchar.
2018-04-02 23:17:14 +02:00