Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
de84839
putil: Don't use deprecated is_literal_type in C++17
rdb May 15, 2026
9761335
CMake: Remove fatal error message when compiling for C++17
rdb May 15, 2026
e1c9833
linmath: Work around GCC<10.1 ABI bug in C++17 mode
rdb May 15, 2026
c3b8a6b
build: Drop support for macOS versions older than 10.13
rdb May 15, 2026
0689a49
dtoolbase: use ulock on macOS unconditionally now that we require 10.13
rdb May 15, 2026
f7e5f7f
emscripten: Fix missing std:: prefix for string use
rdb May 17, 2026
36f68b6
tests: Add various unit tests for downloader module
rdb May 17, 2026
1494ac5
express: Fix unstandardized name used adding subfile to .zip file
rdb May 17, 2026
fedaee8
build: Update interrogate to 0.11.2
rdb May 15, 2026
d9fbe3d
build: Update C++ version from C++14 to C++17
rdb May 15, 2026
6d5131e
dtool: Replace various uses of const string ref with string_view
rdb May 15, 2026
5efb314
putil: Make UpdateSeq a literal type again
rdb May 15, 2026
99b8d64
Remove feature checks for library stream features long mandated by C++
rdb May 15, 2026
746182f
display: Clean up ugly SFINAE using C++17 if constexpr
rdb May 15, 2026
31e69cf
general: Use C++17 [[fallthrough]] annotation instead of comments
rdb May 15, 2026
93d0d48
general: Use std::launder to fix some "technically UB" cases
rdb May 17, 2026
ef98101
tests: Add more dcparser unit tests
rdb May 17, 2026
611c05a
workflow: Disable building with OpenEXR on macOS for now
rdb May 17, 2026
97b8aa4
general: Reduction of unnecessary string copies (using string_view)
rdb May 18, 2026
7210ab8
general: Use C++17 std::clamp instead of min/max for code clarity
rdb May 18, 2026
b451359
general: Add C++17 [[nodiscard]] on various important sites
rdb May 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ jobs:
mv panda3d-1.10.16/thirdparty thirdparty
rmdir panda3d-1.10.16
(cd thirdparty/darwin-libs-a && rm -rf rocket)
(cd thirdparty/darwin-libs-a && rm -rf openexr)

- name: Set up XCode (macOS)
if: runner.os == 'macOS'
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if(APPLE)
# Needed for enable_language(OBJCXX)
cmake_minimum_required(VERSION 3.16)

set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Minimum macOS version to target")
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13" CACHE STRING "Minimum macOS version to target")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")

if(CMAKE_VERSION VERSION_LESS "3.19" AND NOT CMAKE_OSX_SYSROOT)
Expand Down
11 changes: 5 additions & 6 deletions direct/src/dcparser/dcArrayParameter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -203,20 +203,19 @@ validate_num_nested_fields(int num_nested_fields) const {
* identifier.
*/
void DCArrayParameter::
output_instance(std::ostream &out, bool brief, const string &prename,
const string &name, const string &postname) const {
output_instance(std::ostream &out, bool brief, std::string_view prename,
std::string_view name, std::string_view postname) const {
if (get_typedef() != nullptr) {
output_typedef_name(out, brief, prename, name, postname);

} else {
std::ostringstream strm;

strm << "[";
strm << postname << "[";
_array_size_range.output(strm);
strm << "]";

_element_type->output_instance(out, brief, prename, name,
postname + strm.str());
_element_type->output_instance(out, brief, prename, name, strm.str());
}
}

Expand All @@ -234,7 +233,7 @@ generate_hash(HashGenerator &hashgen) const {
* Packs the indicated numeric or string value into the stream.
*/
void DCArrayParameter::
pack_string(DCPackData &pack_data, const string &value,
pack_string(DCPackData &pack_data, std::string_view value,
bool &pack_error, bool &range_error) const {
// We can only pack a string if the array element type is char or int8.
DCSimpleParameter *simple_type = _element_type->as_simple_parameter();
Expand Down
6 changes: 3 additions & 3 deletions direct/src/dcparser/dcArrayParameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ class EXPCL_DIRECT_DCPARSER DCArrayParameter : public DCParameter {
virtual DCPackerInterface *get_nested_field(int n) const;
virtual bool validate_num_nested_fields(int num_nested_fields) const;

virtual void output_instance(std::ostream &out, bool brief, const std::string &prename,
const std::string &name, const std::string &postname) const;
virtual void output_instance(std::ostream &out, bool brief, std::string_view prename,
std::string_view name, std::string_view postname) const;
virtual void generate_hash(HashGenerator &hashgen) const;
virtual void pack_string(DCPackData &pack_data, const std::string &value,
virtual void pack_string(DCPackData &pack_data, std::string_view value,
bool &pack_error, bool &range_error) const;
virtual void pack_blob(DCPackData &pack_data, const vector_uchar &value,
bool &pack_error, bool &range_error) const;
Expand Down
4 changes: 2 additions & 2 deletions direct/src/dcparser/dcAtomicField.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ using std::string;
*
*/
DCAtomicField::
DCAtomicField(const string &name, DCClass *dclass,
DCAtomicField(string name, DCClass *dclass,
bool bogus_field) :
DCField(name, dclass)
DCField(std::move(name), dclass)
{
_bogus_field = bogus_field;
}
Expand Down
2 changes: 1 addition & 1 deletion direct/src/dcparser/dcAtomicField.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*/
class EXPCL_DIRECT_DCPARSER DCAtomicField : public DCField {
public:
DCAtomicField(const std::string &name, DCClass *dclass, bool bogus_field);
DCAtomicField(std::string name, DCClass *dclass, bool bogus_field);
virtual ~DCAtomicField();

PUBLISHED:
Expand Down
12 changes: 6 additions & 6 deletions direct/src/dcparser/dcClass.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ class SortFieldsByIndex {
*
*/
DCClass::
DCClass(DCFile *dc_file, const string &name, bool is_struct, bool bogus_class) :
DCClass(DCFile *dc_file, string name, bool is_struct, bool bogus_class) :
#ifdef WITHIN_PANDA
_class_update_pcollector(_update_pcollector, name),
_class_generate_pcollector(_generate_pcollector, name),
#endif
_dc_file(dc_file),
_name(name),
_name(std::move(name)),
_is_struct(is_struct),
_bogus_class(bogus_class)
{
Expand Down Expand Up @@ -181,7 +181,7 @@ get_field(int n) const {
* class. Returns NULL if there is no such field defined.
*/
DCField *DCClass::
get_field_by_name(const string &name) const {
get_field_by_name(std::string_view name) const {
FieldsByName::const_iterator ni;
ni = _fields_by_name.find(name);
if (ni != _fields_by_name.end()) {
Expand Down Expand Up @@ -402,8 +402,8 @@ write(std::ostream &out, bool brief, int indent_level) const {
* stream.
*/
void DCClass::
output_instance(std::ostream &out, bool brief, const string &prename,
const string &name, const string &postname) const {
output_instance(std::ostream &out, bool brief, std::string_view prename,
std::string_view name, std::string_view postname) const {
if (_is_struct) {
out << "struct";
} else {
Expand Down Expand Up @@ -552,7 +552,7 @@ rebuild_inherited_fields() {
* adding a new definition below.
*/
void DCClass::
shadow_inherited_field(const string &name) {
shadow_inherited_field(std::string_view name) {
Fields::iterator fi;
for (fi = _inherited_fields.begin(); fi != _inherited_fields.end(); ++fi) {
DCField *field = (*fi);
Expand Down
22 changes: 11 additions & 11 deletions direct/src/dcparser/dcClass.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class DCParameter;
*/
class EXPCL_DIRECT_DCPARSER DCClass : public DCDeclaration {
public:
DCClass(DCFile *dc_file, const std::string &name,
DCClass(DCFile *dc_file, std::string name,
bool is_struct, bool bogus_class);
~DCClass();

Expand All @@ -66,7 +66,7 @@ class EXPCL_DIRECT_DCPARSER DCClass : public DCDeclaration {
int get_num_fields() const;
DCField *get_field(int n) const;

DCField *get_field_by_name(const std::string &name) const;
DCField *get_field_by_name(std::string_view name) const;
DCField *get_field_by_index(int index_number) const;

int get_num_inherited_fields() const;
Expand Down Expand Up @@ -94,9 +94,9 @@ class EXPCL_DIRECT_DCPARSER DCClass : public DCDeclaration {
EXTENSION(void receive_update_all_required(PyObject *distobj, DatagramIterator &di) const);
EXTENSION(void receive_update_other(PyObject *distobj, DatagramIterator &di) const);

EXTENSION(void direct_update(PyObject *distobj, const std::string &field_name,
EXTENSION(void direct_update(PyObject *distobj, std::string_view field_name,
const vector_uchar &value_blob));
EXTENSION(void direct_update(PyObject *distobj, const std::string &field_name,
EXTENSION(void direct_update(PyObject *distobj, std::string_view field_name,
const Datagram &datagram));
EXTENSION(bool pack_required_field(Datagram &datagram, PyObject *distobj,
const DCField *field) const);
Expand All @@ -105,13 +105,13 @@ class EXPCL_DIRECT_DCPARSER DCClass : public DCDeclaration {



EXTENSION(Datagram client_format_update(const std::string &field_name,
EXTENSION(Datagram client_format_update(std::string_view field_name,
DOID_TYPE do_id, PyObject *args) const);
EXTENSION(Datagram ai_format_update(const std::string &field_name,
EXTENSION(Datagram ai_format_update(std::string_view field_name,
DOID_TYPE do_id,
CHANNEL_TYPE to_id, CHANNEL_TYPE from_id,
PyObject *args) const);
EXTENSION(Datagram ai_format_update_msg_type(const std::string &field_name,
EXTENSION(Datagram ai_format_update_msg_type(std::string_view field_name,
DOID_TYPE do_id,
CHANNEL_TYPE to_id,
CHANNEL_TYPE from_id,
Expand All @@ -131,8 +131,8 @@ class EXPCL_DIRECT_DCPARSER DCClass : public DCDeclaration {
public:
virtual void output(std::ostream &out, bool brief) const;
virtual void write(std::ostream &out, bool brief, int indent_level) const;
void output_instance(std::ostream &out, bool brief, const std::string &prename,
const std::string &name, const std::string &postname) const;
void output_instance(std::ostream &out, bool brief, std::string_view prename,
std::string_view name, std::string_view postname) const;
void generate_hash(HashGenerator &hashgen) const;
void clear_inherited_fields();
void rebuild_inherited_fields();
Expand All @@ -142,7 +142,7 @@ class EXPCL_DIRECT_DCPARSER DCClass : public DCDeclaration {
void set_number(int number);

private:
void shadow_inherited_field(const std::string &name);
void shadow_inherited_field(std::string_view name);

#ifdef WITHIN_PANDA
mutable PStatCollector _class_update_pcollector;
Expand All @@ -166,7 +166,7 @@ class EXPCL_DIRECT_DCPARSER DCClass : public DCDeclaration {
typedef pvector<DCField *> Fields;
Fields _fields, _inherited_fields;

typedef pmap<std::string, DCField *> FieldsByName;
typedef pmap<std::string, DCField *, std::less<>> FieldsByName;
FieldsByName _fields_by_name;

typedef pmap<int, DCField *> FieldsByIndex;
Expand Down
4 changes: 2 additions & 2 deletions direct/src/dcparser/dcClassParameter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ get_nested_field(int n) const {
* identifier.
*/
void DCClassParameter::
output_instance(std::ostream &out, bool brief, const std::string &prename,
const std::string &name, const std::string &postname) const {
output_instance(std::ostream &out, bool brief, std::string_view prename,
std::string_view name, std::string_view postname) const {
if (get_typedef() != nullptr) {
output_typedef_name(out, brief, prename, name, postname);

Expand Down
4 changes: 2 additions & 2 deletions direct/src/dcparser/dcClassParameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class EXPCL_DIRECT_DCPARSER DCClassParameter : public DCParameter {
public:
virtual DCPackerInterface *get_nested_field(int n) const final;

virtual void output_instance(std::ostream &out, bool brief, const std::string &prename,
const std::string &name, const std::string &postname) const;
virtual void output_instance(std::ostream &out, bool brief, std::string_view prename,
std::string_view name, std::string_view postname) const;
virtual void generate_hash(HashGenerator &hashgen) const;

protected:
Expand Down
10 changes: 5 additions & 5 deletions direct/src/dcparser/dcClass_ext.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ receive_update_other(PyObject *distobj, DatagramIterator &di) const {
* Processes an update for a named field from a packed value blob.
*/
void Extension<DCClass>::
direct_update(PyObject *distobj, const std::string &field_name,
direct_update(PyObject *distobj, std::string_view field_name,
const vector_uchar &value_blob) {
DCField *field = _this->get_field_by_name(field_name);
nassertv_always(field != nullptr);
Expand All @@ -245,7 +245,7 @@ direct_update(PyObject *distobj, const std::string &field_name,
* Processes an update for a named field from a packed datagram.
*/
void Extension<DCClass>::
direct_update(PyObject *distobj, const std::string &field_name,
direct_update(PyObject *distobj, std::string_view field_name,
const Datagram &datagram) {
DCField *field = _this->get_field_by_name(field_name);
nassertv_always(field != nullptr);
Expand Down Expand Up @@ -432,7 +432,7 @@ pack_required_field(DCPacker &packer, PyObject *distobj,
* the indicated distributed object from the client.
*/
Datagram Extension<DCClass>::
client_format_update(const std::string &field_name, DOID_TYPE do_id,
client_format_update(std::string_view field_name, DOID_TYPE do_id,
PyObject *args) const {
DCField *field = _this->get_field_by_name(field_name);
if (field == nullptr) {
Expand All @@ -451,7 +451,7 @@ client_format_update(const std::string &field_name, DOID_TYPE do_id,
* the indicated distributed object from the AI.
*/
Datagram Extension<DCClass>::
ai_format_update(const std::string &field_name, DOID_TYPE do_id,
ai_format_update(std::string_view field_name, DOID_TYPE do_id,
CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, PyObject *args) const {
DCField *field = _this->get_field_by_name(field_name);
if (field == nullptr) {
Expand All @@ -471,7 +471,7 @@ ai_format_update(const std::string &field_name, DOID_TYPE do_id,
* AI.
*/
Datagram Extension<DCClass>::
ai_format_update_msg_type(const std::string &field_name, DOID_TYPE do_id,
ai_format_update_msg_type(std::string_view field_name, DOID_TYPE do_id,
CHANNEL_TYPE to_id, CHANNEL_TYPE from_id,
int msg_type, PyObject *args) const {
DCField *field = _this->get_field_by_name(field_name);
Expand Down
10 changes: 5 additions & 5 deletions direct/src/dcparser/dcClass_ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ class Extension<DCClass> : public ExtensionBase<DCClass> {
void receive_update_all_required(PyObject *distobj, DatagramIterator &di) const;
void receive_update_other(PyObject *distobj, DatagramIterator &di) const;

void direct_update(PyObject *distobj, const std::string &field_name,
void direct_update(PyObject *distobj, std::string_view field_name,
const vector_uchar &value_blob);
void direct_update(PyObject *distobj, const std::string &field_name,
void direct_update(PyObject *distobj, std::string_view field_name,
const Datagram &datagram);
bool pack_required_field(Datagram &datagram, PyObject *distobj,
const DCField *field) const;
Expand All @@ -53,11 +53,11 @@ class Extension<DCClass> : public ExtensionBase<DCClass> {



Datagram client_format_update(const std::string &field_name,
Datagram client_format_update(std::string_view field_name,
DOID_TYPE do_id, PyObject *args) const;
Datagram ai_format_update(const std::string &field_name, DOID_TYPE do_id,
Datagram ai_format_update(std::string_view field_name, DOID_TYPE do_id,
CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, PyObject *args) const;
Datagram ai_format_update_msg_type(const std::string &field_name, DOID_TYPE do_id,
Datagram ai_format_update_msg_type(std::string_view field_name, DOID_TYPE do_id,
CHANNEL_TYPE to_id, CHANNEL_TYPE from_id, int msg_type, PyObject *args) const;
Datagram ai_format_generate(PyObject *distobj, DOID_TYPE do_id,
ZONEID_TYPE parent_id, ZONEID_TYPE zone_id,
Expand Down
14 changes: 7 additions & 7 deletions direct/src/dcparser/dcField.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ DCField() :
*
*/
DCField::
DCField(const std::string &name, DCClass *dclass) :
DCPackerInterface(name),
DCField(std::string name, DCClass *dclass) :
DCPackerInterface(std::move(name)),
_dclass(dclass)
#ifdef WITHIN_PANDA
,
_field_update_pcollector(dclass->_class_update_pcollector, name)
_field_update_pcollector(dclass->_class_update_pcollector, get_name())
#endif
{
_number = -1;
Expand Down Expand Up @@ -169,10 +169,10 @@ format_data(const vector_uchar &packed_data, bool show_field_names) {
* the corresponding packed data. Returns empty string if there is an error.
*/
vector_uchar DCField::
parse_string(const std::string &formatted_string) {
parse_string(std::string formatted_string) {
DCPacker packer;
packer.begin_pack(this);
if (!packer.parse_and_pack(formatted_string)) {
if (!packer.parse_and_pack(std::move(formatted_string))) {
// Parse error.
return vector_uchar();
}
Expand Down Expand Up @@ -241,8 +241,8 @@ pack_default_value(DCPackData &pack_data, bool &) const {
* Sets the name of this field.
*/
void DCField::
set_name(const std::string &name) {
DCPackerInterface::set_name(name);
set_name(std::string name) {
DCPackerInterface::set_name(std::move(name));
if (_dclass != nullptr) {
_dclass->_dc_file->mark_inherited_fields_stale();
}
Expand Down
6 changes: 3 additions & 3 deletions direct/src/dcparser/dcField.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class HashGenerator;
class EXPCL_DIRECT_DCPARSER DCField : public DCPackerInterface, public DCKeywordList {
public:
DCField();
DCField(const std::string &name, DCClass *dclass);
DCField(std::string name, DCClass *dclass);
virtual ~DCField();

PUBLISHED:
Expand All @@ -55,7 +55,7 @@ class EXPCL_DIRECT_DCPARSER DCField : public DCPackerInterface, public DCKeyword
virtual const DCParameter *as_parameter() const;

std::string format_data(const vector_uchar &packed_data, bool show_field_names = true);
vector_uchar parse_string(const std::string &formatted_string);
vector_uchar parse_string(std::string formatted_string);

bool validate_ranges(const vector_uchar &packed_data) const;

Expand Down Expand Up @@ -94,7 +94,7 @@ class EXPCL_DIRECT_DCPARSER DCField : public DCPackerInterface, public DCKeyword
virtual void write(std::ostream &out, bool brief, int indent_level) const=0;
virtual void generate_hash(HashGenerator &hashgen) const;
virtual bool pack_default_value(DCPackData &pack_data, bool &pack_error) const;
virtual void set_name(const std::string &name);
virtual void set_name(std::string name);

INLINE void set_number(int number);
INLINE void set_class(DCClass *dclass);
Expand Down
Loading
Loading