Skip to content

Commit 08572f3

Browse files
committed
general: Fix a variety of ABI incompatibility issues with opt4 builds
1 parent 099be1f commit 08572f3

13 files changed

+188
-40
lines changed

panda/src/collide/collisionTraverser.cxx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ traverse(const NodePath &root) {
351351
CollisionBox::flush_level();
352352
}
353353

354-
#ifdef DO_COLLISION_RECORDING
354+
#if defined(DO_COLLISION_RECORDING) || !defined(CPPPARSER)
355355
/**
356356
* Uses the indicated CollisionRecorder object to start recording the
357357
* intersection tests made by each subsequent call to traverse() on this
@@ -370,6 +370,7 @@ traverse(const NodePath &root) {
370370
*/
371371
void CollisionTraverser::
372372
set_recorder(CollisionRecorder *recorder) {
373+
#ifdef DO_COLLISION_RECORDING
373374
if (recorder != _recorder) {
374375
// Remove the old recorder, if any.
375376
if (_recorder != nullptr) {
@@ -389,6 +390,7 @@ set_recorder(CollisionRecorder *recorder) {
389390
_recorder->_trav = this;
390391
}
391392
}
393+
#endif
392394
}
393395

394396
/**
@@ -399,22 +401,28 @@ set_recorder(CollisionRecorder *recorder) {
399401
*/
400402
CollisionVisualizer *CollisionTraverser::
401403
show_collisions(const NodePath &root) {
404+
#ifdef DO_COLLISION_RECORDING
402405
hide_collisions();
403406
CollisionVisualizer *viz = new CollisionVisualizer("show_collisions");
404407
_collision_visualizer_np = root.attach_new_node(viz);
405408
set_recorder(viz);
406409
return viz;
410+
#else
411+
return nullptr;
412+
#endif
407413
}
408414

409415
/**
410416
* Undoes the effect of a previous call to show_collisions().
411417
*/
412418
void CollisionTraverser::
413419
hide_collisions() {
420+
#ifdef DO_COLLISION_RECORDING
414421
if (!_collision_visualizer_np.is_empty()) {
415422
_collision_visualizer_np.remove_node();
416423
}
417424
clear_recorder();
425+
#endif
418426
}
419427

420428
#endif // DO_COLLISION_RECORDING

panda/src/collide/collisionTraverser.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class EXPCL_PANDA_COLLIDE CollisionTraverser : public Namable {
6666

6767
void traverse(const NodePath &root);
6868

69-
#ifdef DO_COLLISION_RECORDING
69+
#if defined(DO_COLLISION_RECORDING) || !defined(CPPPARSER)
7070
void set_recorder(CollisionRecorder *recorder);
7171
INLINE bool has_recorder() const;
7272
INLINE CollisionRecorder *get_recorder() const;
@@ -134,6 +134,9 @@ class EXPCL_PANDA_COLLIDE CollisionTraverser : public Namable {
134134
#ifdef DO_COLLISION_RECORDING
135135
CollisionRecorder *_recorder;
136136
NodePath _collision_visualizer_np;
137+
#else
138+
CollisionRecorder *_recorder_disabled = nullptr;
139+
NodePath _collision_visualizer_np_disabled;
137140
#endif // DO_COLLISION_RECORDING
138141

139142
// Statistics

panda/src/express/pStatCollectorForwardBase.cxx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@
1313

1414
#include "pStatCollectorForwardBase.h"
1515

16-
#ifdef DO_PSTATS
1716
/**
1817
*
1918
*/
2019
PStatCollectorForwardBase::
2120
~PStatCollectorForwardBase() {
2221
}
23-
#endif // DO_PSTATS

panda/src/express/pStatCollectorForwardBase.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,13 @@
2727
*/
2828
class EXPCL_PANDA_EXPRESS PStatCollectorForwardBase : public ReferenceCount {
2929
PUBLISHED:
30-
#ifdef DO_PSTATS
3130
virtual ~PStatCollectorForwardBase();
31+
32+
#ifdef DO_PSTATS
3233
virtual void add_level(double level)=0;
3334
#else
35+
// We still need to declare a virtual destructor for ABI compatibility, so
36+
// that a vtable is created.
3437
INLINE void add_level(double level) { }
3538
#endif
3639
};

panda/src/pgraph/cullResult.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,7 @@ class EXPCL_PANDA_PGRAPH CullResult : public ReferenceCount {
8585
typedef pvector< PT(CullBin) > Bins;
8686
Bins _bins;
8787

88-
#ifndef NDEBUG
89-
bool _show_transparency;
90-
#endif
88+
bool _show_transparency = false;
9189

9290
public:
9391
static TypeHandle get_class_type() {

panda/src/pgraph/pandaNode.cxx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,6 @@ PandaNode(const string &name) :
8282
pgraph_cat.debug()
8383
<< "Constructing " << (void *)this << ", " << get_name() << "\n";
8484
}
85-
#ifndef NDEBUG
86-
_unexpected_change_flags = 0;
87-
#endif // !NDEBUG
8885

8986
#ifdef DO_MEMORY_USAGE
9087
MemoryUsage::update_type(this, this);
@@ -135,7 +132,8 @@ PandaNode(const PandaNode &copy) :
135132
Namable(copy),
136133
_paths_lock("PandaNode::_paths_lock"),
137134
_dirty_prev_transform(false),
138-
_python_tag_data(copy._python_tag_data)
135+
_python_tag_data(copy._python_tag_data),
136+
_unexpected_change_flags(0)
139137
{
140138
if (pgraph_cat.is_debug()) {
141139
pgraph_cat.debug()
@@ -144,10 +142,6 @@ PandaNode(const PandaNode &copy) :
144142
#ifdef DO_MEMORY_USAGE
145143
MemoryUsage::update_type(this, this);
146144
#endif
147-
// Copying a node does not copy its children.
148-
#ifndef NDEBUG
149-
_unexpected_change_flags = 0;
150-
#endif // !NDEBUG
151145

152146
// Need to have this held before we grab any other locks.
153147
LightMutexHolder holder(_dirty_prev_transforms._lock);

panda/src/pgraph/pandaNode.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,9 +532,7 @@ class EXPCL_PANDA_PGRAPH PandaNode : public TypedWritableReferenceCount,
532532
};
533533
PT(PythonTagData) _python_tag_data;
534534

535-
#ifndef NDEBUG
536-
unsigned int _unexpected_change_flags;
537-
#endif // !NDEBUG
535+
unsigned int _unexpected_change_flags = 0;
538536

539537
// This is the data that must be cycled between pipeline stages.
540538

panda/src/pstatclient/pStatClient.cxx

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,6 +1224,48 @@ InternalThread(const string &name, const string &sync_name) :
12241224

12251225
#else // DO_PSTATS
12261226

1227+
void PStatClient::
1228+
set_client_name(const std::string &name) {
1229+
}
1230+
1231+
std::string PStatClient::
1232+
get_client_name() const {
1233+
return std::string();
1234+
}
1235+
1236+
void PStatClient::
1237+
set_max_rate(double rate) {
1238+
}
1239+
1240+
double PStatClient::
1241+
get_max_rate() const {
1242+
return 0.0;
1243+
}
1244+
1245+
PStatCollector PStatClient::
1246+
get_collector(int index) const {
1247+
return PStatCollector();
1248+
}
1249+
1250+
std::string PStatClient::
1251+
get_collector_name(int index) const {
1252+
return std::string();
1253+
}
1254+
1255+
std::string PStatClient::
1256+
get_collector_fullname(int index) const {
1257+
return std::string();
1258+
}
1259+
1260+
PStatThread PStatClient::
1261+
get_thread(int index) const {
1262+
return PStatThread((PStatClient *)this, 0);
1263+
}
1264+
1265+
double PStatClient::
1266+
get_real_time() const {
1267+
}
1268+
12271269
PStatThread PStatClient::
12281270
get_main_thread() const {
12291271
return PStatThread((PStatClient *)this, 0);
@@ -1239,12 +1281,63 @@ make_collector_with_relname(int parent_index, std::string relname) {
12391281
return PStatCollector();
12401282
}
12411283

1284+
PStatThread PStatClient::
1285+
make_thread(Thread *thread) {
1286+
return PStatThread((PStatClient *)this, 0);
1287+
}
1288+
1289+
void PStatClient::
1290+
main_tick() {
1291+
}
1292+
1293+
void PStatClient::
1294+
thread_tick(const std::string &) {
1295+
}
1296+
1297+
void PStatClient::
1298+
client_main_tick() {
1299+
}
1300+
1301+
void PStatClient::
1302+
client_thread_tick(const std::string &sync_name) {
1303+
}
1304+
1305+
bool PStatClient::
1306+
client_connect(std::string hostname, int port) {
1307+
return false;
1308+
}
1309+
1310+
void PStatClient::
1311+
client_disconnect() {
1312+
return;
1313+
}
1314+
1315+
bool PStatClient::
1316+
client_is_connected() const {
1317+
return false;
1318+
}
1319+
1320+
void PStatClient::
1321+
client_resume_after_pause() {
1322+
return;
1323+
}
1324+
12421325
PStatClient *PStatClient::
12431326
get_global_pstats() {
12441327
static PStatClient global_pstats;
12451328
return &global_pstats;
12461329
}
12471330

1331+
bool PStatClient::
1332+
is_active(int collector_index, int thread_index) const {
1333+
return false;
1334+
}
1335+
1336+
bool PStatClient::
1337+
is_started(int collector_index, int thread_index) const {
1338+
return false;
1339+
}
1340+
12481341
void PStatClient::
12491342
start(int collector_index, int thread_index) {
12501343
}
@@ -1261,5 +1354,21 @@ void PStatClient::
12611354
stop(int collector_index, int thread_index, double as_of) {
12621355
}
12631356

1357+
void PStatClient::
1358+
clear_level(int collector_index, int thread_index) {
1359+
}
1360+
1361+
void PStatClient::
1362+
set_level(int collector_index, int thread_index, double level) {
1363+
}
1364+
1365+
void PStatClient::
1366+
add_level(int collector_index, int thread_index, double increment) {
1367+
}
1368+
1369+
double PStatClient::
1370+
get_level(int collector_index, int thread_index) const {
1371+
return 0.0;
1372+
}
12641373

12651374
#endif // DO_PSTATS

panda/src/pstatclient/pStatClient.h

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -265,40 +265,64 @@ class EXPCL_PANDA_PSTATCLIENT PStatClient {
265265
PStatClient() { }
266266
~PStatClient() { }
267267

268-
PUBLISHED:
269-
std::string get_collector_name(int index) const { return std::string(); }
270-
std::string get_collector_fullname(int index) const { return std::string(); }
268+
void set_client_name(const std::string &name);
269+
std::string get_client_name() const;
270+
void set_max_rate(double rate);
271+
double get_max_rate() const;
272+
273+
PStatCollector get_collector(int index) const;
274+
std::string get_collector_name(int index) const;
275+
std::string get_collector_fullname(int index) const;
276+
277+
INLINE int get_num_threads() const { return 0; }
278+
PStatThread get_thread(int index) const;
279+
INLINE std::string get_thread_name(int index) const { return ""; }
280+
INLINE std::string get_thread_sync_name(int index) const { return ""; }
281+
INLINE PT(Thread) get_thread_object(int index) const { return nullptr; }
271282

272283
PStatThread get_main_thread() const;
273284
PStatThread get_current_thread() const;
274285

286+
double get_real_time() const;
287+
288+
PUBLISHED:
275289
INLINE static bool connect(const std::string & = std::string(), int = -1) { return false; }
276290
INLINE static void disconnect() { }
277291
INLINE static bool is_connected() { return false; }
278292
INLINE static void resume_after_pause() { }
279293

280-
INLINE static void main_tick() { }
281-
INLINE static void thread_tick(const std::string &) { }
294+
static void main_tick();
295+
static void thread_tick(const std::string &);
296+
297+
public:
298+
void client_main_tick();
299+
void client_thread_tick(const std::string &sync_name);
300+
bool client_connect(std::string hostname, int port);
301+
void client_disconnect();
302+
bool client_is_connected() const;
303+
304+
void client_resume_after_pause();
282305

283306
static PStatClient *get_global_pstats();
284307

285308
private:
286309
// These are used by inline PStatCollector methods, so they need to be
287310
// stubbed out for ABI compatibility.
288311
PStatCollector make_collector_with_relname(int parent_index, std::string relname);
312+
PStatThread make_thread(Thread *thread);
289313

290-
bool is_active(int collector_index, int thread_index) const { return false; }
291-
bool is_started(int collector_index, int thread_index) const { return false; }
314+
bool is_active(int collector_index, int thread_index) const;
315+
bool is_started(int collector_index, int thread_index) const;
292316

293317
void start(int collector_index, int thread_index);
294318
void start(int collector_index, int thread_index, double as_of);
295319
void stop(int collector_index, int thread_index);
296320
void stop(int collector_index, int thread_index, double as_of);
297321

298-
void clear_level(int collector_index, int thread_index) { }
299-
void set_level(int collector_index, int thread_index, double level) { }
300-
void add_level(int collector_index, int thread_index, double increment) { }
301-
double get_level(int collector_index, int thread_index) const { return 0.0; }
322+
void clear_level(int collector_index, int thread_index);
323+
void set_level(int collector_index, int thread_index, double level);
324+
void add_level(int collector_index, int thread_index, double increment);
325+
double get_level(int collector_index, int thread_index) const;
302326
};
303327

304328
#endif // DO_PSTATS

panda/src/pstatclient/pStatCollectorForward.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313

1414
#include "pStatCollectorForward.h"
1515

16-
#ifdef DO_PSTATS
1716
/**
1817
*
1918
*/
2019
void PStatCollectorForward::
2120
add_level(double increment) {
21+
#ifdef DO_PSTATS
2222
_col.add_level_now(increment);
23-
}
2423
#endif // DO_PSTATS
24+
}

0 commit comments

Comments
 (0)