Browse Source

general: Fix a variety of ABI incompatibility issues with opt4 builds

rdb 6 years ago
parent
commit
08572f3c38

+ 9 - 1
panda/src/collide/collisionTraverser.cxx

@@ -351,7 +351,7 @@ traverse(const NodePath &root) {
   CollisionBox::flush_level();
   CollisionBox::flush_level();
 }
 }
 
 
-#ifdef DO_COLLISION_RECORDING
+#if defined(DO_COLLISION_RECORDING) || !defined(CPPPARSER)
 /**
 /**
  * Uses the indicated CollisionRecorder object to start recording the
  * Uses the indicated CollisionRecorder object to start recording the
  * intersection tests made by each subsequent call to traverse() on this
  * intersection tests made by each subsequent call to traverse() on this
@@ -370,6 +370,7 @@ traverse(const NodePath &root) {
  */
  */
 void CollisionTraverser::
 void CollisionTraverser::
 set_recorder(CollisionRecorder *recorder) {
 set_recorder(CollisionRecorder *recorder) {
+#ifdef DO_COLLISION_RECORDING
   if (recorder != _recorder) {
   if (recorder != _recorder) {
     // Remove the old recorder, if any.
     // Remove the old recorder, if any.
     if (_recorder != nullptr) {
     if (_recorder != nullptr) {
@@ -389,6 +390,7 @@ set_recorder(CollisionRecorder *recorder) {
       _recorder->_trav = this;
       _recorder->_trav = this;
     }
     }
   }
   }
+#endif
 }
 }
 
 
 /**
 /**
@@ -399,11 +401,15 @@ set_recorder(CollisionRecorder *recorder) {
  */
  */
 CollisionVisualizer *CollisionTraverser::
 CollisionVisualizer *CollisionTraverser::
 show_collisions(const NodePath &root) {
 show_collisions(const NodePath &root) {
+#ifdef DO_COLLISION_RECORDING
   hide_collisions();
   hide_collisions();
   CollisionVisualizer *viz = new CollisionVisualizer("show_collisions");
   CollisionVisualizer *viz = new CollisionVisualizer("show_collisions");
   _collision_visualizer_np = root.attach_new_node(viz);
   _collision_visualizer_np = root.attach_new_node(viz);
   set_recorder(viz);
   set_recorder(viz);
   return viz;
   return viz;
+#else
+  return nullptr;
+#endif
 }
 }
 
 
 /**
 /**
@@ -411,10 +417,12 @@ show_collisions(const NodePath &root) {
  */
  */
 void CollisionTraverser::
 void CollisionTraverser::
 hide_collisions() {
 hide_collisions() {
+#ifdef DO_COLLISION_RECORDING
   if (!_collision_visualizer_np.is_empty()) {
   if (!_collision_visualizer_np.is_empty()) {
     _collision_visualizer_np.remove_node();
     _collision_visualizer_np.remove_node();
   }
   }
   clear_recorder();
   clear_recorder();
+#endif
 }
 }
 
 
 #endif  // DO_COLLISION_RECORDING
 #endif  // DO_COLLISION_RECORDING

+ 4 - 1
panda/src/collide/collisionTraverser.h

@@ -66,7 +66,7 @@ PUBLISHED:
 
 
   void traverse(const NodePath &root);
   void traverse(const NodePath &root);
 
 
-#ifdef DO_COLLISION_RECORDING
+#if defined(DO_COLLISION_RECORDING) || !defined(CPPPARSER)
   void set_recorder(CollisionRecorder *recorder);
   void set_recorder(CollisionRecorder *recorder);
   INLINE bool has_recorder() const;
   INLINE bool has_recorder() const;
   INLINE CollisionRecorder *get_recorder() const;
   INLINE CollisionRecorder *get_recorder() const;
@@ -134,6 +134,9 @@ private:
 #ifdef DO_COLLISION_RECORDING
 #ifdef DO_COLLISION_RECORDING
   CollisionRecorder *_recorder;
   CollisionRecorder *_recorder;
   NodePath _collision_visualizer_np;
   NodePath _collision_visualizer_np;
+#else
+  CollisionRecorder *_recorder_disabled = nullptr;
+  NodePath _collision_visualizer_np_disabled;
 #endif  // DO_COLLISION_RECORDING
 #endif  // DO_COLLISION_RECORDING
 
 
   // Statistics
   // Statistics

+ 0 - 2
panda/src/express/pStatCollectorForwardBase.cxx

@@ -13,11 +13,9 @@
 
 
 #include "pStatCollectorForwardBase.h"
 #include "pStatCollectorForwardBase.h"
 
 
-#ifdef DO_PSTATS
 /**
 /**
  *
  *
  */
  */
 PStatCollectorForwardBase::
 PStatCollectorForwardBase::
 ~PStatCollectorForwardBase() {
 ~PStatCollectorForwardBase() {
 }
 }
-#endif  // DO_PSTATS

+ 4 - 1
panda/src/express/pStatCollectorForwardBase.h

@@ -27,10 +27,13 @@
  */
  */
 class EXPCL_PANDA_EXPRESS PStatCollectorForwardBase : public ReferenceCount {
 class EXPCL_PANDA_EXPRESS PStatCollectorForwardBase : public ReferenceCount {
 PUBLISHED:
 PUBLISHED:
-#ifdef DO_PSTATS
   virtual ~PStatCollectorForwardBase();
   virtual ~PStatCollectorForwardBase();
+
+#ifdef DO_PSTATS
   virtual void add_level(double level)=0;
   virtual void add_level(double level)=0;
 #else
 #else
+  // We still need to declare a virtual destructor for ABI compatibility, so
+  // that a vtable is created.
   INLINE void add_level(double level) { }
   INLINE void add_level(double level) { }
 #endif
 #endif
 };
 };

+ 1 - 3
panda/src/pgraph/cullResult.h

@@ -85,9 +85,7 @@ private:
   typedef pvector< PT(CullBin) > Bins;
   typedef pvector< PT(CullBin) > Bins;
   Bins _bins;
   Bins _bins;
 
 
-#ifndef NDEBUG
-  bool _show_transparency;
-#endif
+  bool _show_transparency = false;
 
 
 public:
 public:
   static TypeHandle get_class_type() {
   static TypeHandle get_class_type() {

+ 2 - 8
panda/src/pgraph/pandaNode.cxx

@@ -82,9 +82,6 @@ PandaNode(const string &name) :
     pgraph_cat.debug()
     pgraph_cat.debug()
       << "Constructing " << (void *)this << ", " << get_name() << "\n";
       << "Constructing " << (void *)this << ", " << get_name() << "\n";
   }
   }
-#ifndef NDEBUG
-  _unexpected_change_flags = 0;
-#endif // !NDEBUG
 
 
 #ifdef DO_MEMORY_USAGE
 #ifdef DO_MEMORY_USAGE
   MemoryUsage::update_type(this, this);
   MemoryUsage::update_type(this, this);
@@ -135,7 +132,8 @@ PandaNode(const PandaNode &copy) :
   Namable(copy),
   Namable(copy),
   _paths_lock("PandaNode::_paths_lock"),
   _paths_lock("PandaNode::_paths_lock"),
   _dirty_prev_transform(false),
   _dirty_prev_transform(false),
-  _python_tag_data(copy._python_tag_data)
+  _python_tag_data(copy._python_tag_data),
+  _unexpected_change_flags(0)
 {
 {
   if (pgraph_cat.is_debug()) {
   if (pgraph_cat.is_debug()) {
     pgraph_cat.debug()
     pgraph_cat.debug()
@@ -144,10 +142,6 @@ PandaNode(const PandaNode &copy) :
 #ifdef DO_MEMORY_USAGE
 #ifdef DO_MEMORY_USAGE
   MemoryUsage::update_type(this, this);
   MemoryUsage::update_type(this, this);
 #endif
 #endif
-  // Copying a node does not copy its children.
-#ifndef NDEBUG
-  _unexpected_change_flags = 0;
-#endif // !NDEBUG
 
 
   // Need to have this held before we grab any other locks.
   // Need to have this held before we grab any other locks.
   LightMutexHolder holder(_dirty_prev_transforms._lock);
   LightMutexHolder holder(_dirty_prev_transforms._lock);

+ 1 - 3
panda/src/pgraph/pandaNode.h

@@ -532,9 +532,7 @@ private:
   };
   };
   PT(PythonTagData) _python_tag_data;
   PT(PythonTagData) _python_tag_data;
 
 
-#ifndef NDEBUG
-  unsigned int _unexpected_change_flags;
-#endif // !NDEBUG
+  unsigned int _unexpected_change_flags = 0;
 
 
   // This is the data that must be cycled between pipeline stages.
   // This is the data that must be cycled between pipeline stages.
 
 

+ 109 - 0
panda/src/pstatclient/pStatClient.cxx

@@ -1224,6 +1224,48 @@ InternalThread(const string &name, const string &sync_name) :
 
 
 #else  // DO_PSTATS
 #else  // DO_PSTATS
 
 
+void PStatClient::
+set_client_name(const std::string &name) {
+}
+
+std::string PStatClient::
+get_client_name() const {
+  return std::string();
+}
+
+void PStatClient::
+set_max_rate(double rate) {
+}
+
+double PStatClient::
+get_max_rate() const {
+  return 0.0;
+}
+
+PStatCollector PStatClient::
+get_collector(int index) const {
+  return PStatCollector();
+}
+
+std::string PStatClient::
+get_collector_name(int index) const {
+  return std::string();
+}
+
+std::string PStatClient::
+get_collector_fullname(int index) const {
+  return std::string();
+}
+
+PStatThread PStatClient::
+get_thread(int index) const {
+  return PStatThread((PStatClient *)this, 0);
+}
+
+double PStatClient::
+get_real_time() const {
+}
+
 PStatThread PStatClient::
 PStatThread PStatClient::
 get_main_thread() const {
 get_main_thread() const {
   return PStatThread((PStatClient *)this, 0);
   return PStatThread((PStatClient *)this, 0);
@@ -1239,12 +1281,63 @@ make_collector_with_relname(int parent_index, std::string relname) {
   return PStatCollector();
   return PStatCollector();
 }
 }
 
 
+PStatThread PStatClient::
+make_thread(Thread *thread) {
+  return PStatThread((PStatClient *)this, 0);
+}
+
+void PStatClient::
+main_tick() {
+}
+
+void PStatClient::
+thread_tick(const std::string &) {
+}
+
+void PStatClient::
+client_main_tick() {
+}
+
+void PStatClient::
+client_thread_tick(const std::string &sync_name) {
+}
+
+bool PStatClient::
+client_connect(std::string hostname, int port) {
+  return false;
+}
+
+void PStatClient::
+client_disconnect() {
+  return;
+}
+
+bool PStatClient::
+client_is_connected() const {
+  return false;
+}
+
+void PStatClient::
+client_resume_after_pause() {
+  return;
+}
+
 PStatClient *PStatClient::
 PStatClient *PStatClient::
 get_global_pstats() {
 get_global_pstats() {
   static PStatClient global_pstats;
   static PStatClient global_pstats;
   return &global_pstats;
   return &global_pstats;
 }
 }
 
 
+bool PStatClient::
+is_active(int collector_index, int thread_index) const {
+  return false;
+}
+
+bool PStatClient::
+is_started(int collector_index, int thread_index) const {
+  return false;
+}
+
 void PStatClient::
 void PStatClient::
 start(int collector_index, int thread_index) {
 start(int collector_index, int thread_index) {
 }
 }
@@ -1261,5 +1354,21 @@ void PStatClient::
 stop(int collector_index, int thread_index, double as_of) {
 stop(int collector_index, int thread_index, double as_of) {
 }
 }
 
 
+void PStatClient::
+clear_level(int collector_index, int thread_index) {
+}
+
+void PStatClient::
+set_level(int collector_index, int thread_index, double level) {
+}
+
+void PStatClient::
+add_level(int collector_index, int thread_index, double increment) {
+}
+
+double PStatClient::
+get_level(int collector_index, int thread_index) const {
+  return 0.0;
+}
 
 
 #endif // DO_PSTATS
 #endif // DO_PSTATS

+ 35 - 11
panda/src/pstatclient/pStatClient.h

@@ -265,20 +265,43 @@ public:
   PStatClient() { }
   PStatClient() { }
   ~PStatClient() { }
   ~PStatClient() { }
 
 
-PUBLISHED:
-  std::string get_collector_name(int index) const { return std::string(); }
-  std::string get_collector_fullname(int index) const { return std::string(); }
+  void set_client_name(const std::string &name);
+  std::string get_client_name() const;
+  void set_max_rate(double rate);
+  double get_max_rate() const;
+
+  PStatCollector get_collector(int index) const;
+  std::string get_collector_name(int index) const;
+  std::string get_collector_fullname(int index) const;
+
+  INLINE int get_num_threads() const { return 0; }
+  PStatThread get_thread(int index) const;
+  INLINE std::string get_thread_name(int index) const { return ""; }
+  INLINE std::string get_thread_sync_name(int index) const { return ""; }
+  INLINE PT(Thread) get_thread_object(int index) const { return nullptr; }
 
 
   PStatThread get_main_thread() const;
   PStatThread get_main_thread() const;
   PStatThread get_current_thread() const;
   PStatThread get_current_thread() const;
 
 
+  double get_real_time() const;
+
+PUBLISHED:
   INLINE static bool connect(const std::string & = std::string(), int = -1) { return false; }
   INLINE static bool connect(const std::string & = std::string(), int = -1) { return false; }
   INLINE static void disconnect() { }
   INLINE static void disconnect() { }
   INLINE static bool is_connected() { return false; }
   INLINE static bool is_connected() { return false; }
   INLINE static void resume_after_pause() { }
   INLINE static void resume_after_pause() { }
 
 
-  INLINE static void main_tick() { }
-  INLINE static void thread_tick(const std::string &) { }
+  static void main_tick();
+  static void thread_tick(const std::string &);
+
+public:
+  void client_main_tick();
+  void client_thread_tick(const std::string &sync_name);
+  bool client_connect(std::string hostname, int port);
+  void client_disconnect();
+  bool client_is_connected() const;
+
+  void client_resume_after_pause();
 
 
   static PStatClient *get_global_pstats();
   static PStatClient *get_global_pstats();
 
 
@@ -286,19 +309,20 @@ private:
   // These are used by inline PStatCollector methods, so they need to be
   // These are used by inline PStatCollector methods, so they need to be
   // stubbed out for ABI compatibility.
   // stubbed out for ABI compatibility.
   PStatCollector make_collector_with_relname(int parent_index, std::string relname);
   PStatCollector make_collector_with_relname(int parent_index, std::string relname);
+  PStatThread make_thread(Thread *thread);
 
 
-  bool is_active(int collector_index, int thread_index) const { return false; }
-  bool is_started(int collector_index, int thread_index) const { return false; }
+  bool is_active(int collector_index, int thread_index) const;
+  bool is_started(int collector_index, int thread_index) const;
 
 
   void start(int collector_index, int thread_index);
   void start(int collector_index, int thread_index);
   void start(int collector_index, int thread_index, double as_of);
   void start(int collector_index, int thread_index, double as_of);
   void stop(int collector_index, int thread_index);
   void stop(int collector_index, int thread_index);
   void stop(int collector_index, int thread_index, double as_of);
   void stop(int collector_index, int thread_index, double as_of);
 
 
-  void clear_level(int collector_index, int thread_index) { }
-  void set_level(int collector_index, int thread_index, double level) { }
-  void add_level(int collector_index, int thread_index, double increment) { }
-  double get_level(int collector_index, int thread_index) const { return 0.0; }
+  void clear_level(int collector_index, int thread_index);
+  void set_level(int collector_index, int thread_index, double level);
+  void add_level(int collector_index, int thread_index, double increment);
+  double get_level(int collector_index, int thread_index) const;
 };
 };
 
 
 #endif  // DO_PSTATS
 #endif  // DO_PSTATS

+ 2 - 2
panda/src/pstatclient/pStatCollectorForward.cxx

@@ -13,12 +13,12 @@
 
 
 #include "pStatCollectorForward.h"
 #include "pStatCollectorForward.h"
 
 
-#ifdef DO_PSTATS
 /**
 /**
  *
  *
  */
  */
 void PStatCollectorForward::
 void PStatCollectorForward::
 add_level(double increment) {
 add_level(double increment) {
+#ifdef DO_PSTATS
   _col.add_level_now(increment);
   _col.add_level_now(increment);
-}
 #endif  // DO_PSTATS
 #endif  // DO_PSTATS
+}

+ 1 - 1
panda/src/pstatclient/pStatCollectorForward.h

@@ -27,9 +27,9 @@ class EXPCL_PANDA_PSTATCLIENT PStatCollectorForward : public PStatCollectorForwa
 PUBLISHED:
 PUBLISHED:
   INLINE PStatCollectorForward(const PStatCollector &col);
   INLINE PStatCollectorForward(const PStatCollector &col);
 
 
-#ifdef DO_PSTATS
   virtual void add_level(double level);
   virtual void add_level(double level);
 
 
+#ifdef DO_PSTATS
 private:
 private:
   PStatCollector _col;
   PStatCollector _col;
 #endif
 #endif

+ 12 - 4
panda/src/tform/mouseWatcherBase.cxx

@@ -185,7 +185,7 @@ write(std::ostream &out, int indent_level) const {
   }
   }
 }
 }
 
 
-#ifndef NDEBUG
+#if !defined(NDEBUG) || !defined(CPPPARSER)
 /**
 /**
  * Enables the visualization of all of the regions handled by this
  * Enables the visualization of all of the regions handled by this
  * MouseWatcherBase.  The supplied NodePath should be the root of the 2-d
  * MouseWatcherBase.  The supplied NodePath should be the root of the 2-d
@@ -193,44 +193,52 @@ write(std::ostream &out, int indent_level) const {
  */
  */
 void MouseWatcherBase::
 void MouseWatcherBase::
 show_regions(const NodePath &render2d, const std::string &bin_name, int draw_order) {
 show_regions(const NodePath &render2d, const std::string &bin_name, int draw_order) {
+#ifndef NDEBUG
   LightMutexHolder holder(_lock);
   LightMutexHolder holder(_lock);
   do_show_regions(render2d, bin_name, draw_order);
   do_show_regions(render2d, bin_name, draw_order);
+#endif
 }
 }
 #endif  // NDEBUG
 #endif  // NDEBUG
 
 
-#ifndef NDEBUG
+#if !defined(NDEBUG) || !defined(CPPPARSER)
 /**
 /**
  * Specifies the color used to draw the region rectangles for the regions
  * Specifies the color used to draw the region rectangles for the regions
  * visualized by show_regions().
  * visualized by show_regions().
  */
  */
 void MouseWatcherBase::
 void MouseWatcherBase::
 set_color(const LColor &color) {
 set_color(const LColor &color) {
+#ifndef NDEBUG
   LightMutexHolder holder(_lock);
   LightMutexHolder holder(_lock);
 
 
   _color = color;
   _color = color;
   do_update_regions();
   do_update_regions();
+#endif
 }
 }
 #endif  // NDEBUG
 #endif  // NDEBUG
 
 
-#ifndef NDEBUG
+#if !defined(NDEBUG) || !defined(CPPPARSER)
 /**
 /**
  * Stops the visualization created by a previous call to show_regions().
  * Stops the visualization created by a previous call to show_regions().
  */
  */
 void MouseWatcherBase::
 void MouseWatcherBase::
 hide_regions() {
 hide_regions() {
+#ifndef NDEBUG
   LightMutexHolder holder(_lock);
   LightMutexHolder holder(_lock);
   do_hide_regions();
   do_hide_regions();
+#endif
 }
 }
 #endif  // NDEBUG
 #endif  // NDEBUG
 
 
-#ifndef NDEBUG
+#if !defined(NDEBUG) || !defined(CPPPARSER)
 /**
 /**
  * Refreshes the visualization created by show_regions().
  * Refreshes the visualization created by show_regions().
  */
  */
 void MouseWatcherBase::
 void MouseWatcherBase::
 update_regions() {
 update_regions() {
+#ifndef NDEBUG
   LightMutexHolder holder(_lock);
   LightMutexHolder holder(_lock);
   do_update_regions();
   do_update_regions();
+#endif
 }
 }
 #endif  // NDEBUG
 #endif  // NDEBUG
 
 

+ 8 - 3
panda/src/tform/mouseWatcherBase.h

@@ -53,7 +53,7 @@ PUBLISHED:
   void output(std::ostream &out) const;
   void output(std::ostream &out) const;
   void write(std::ostream &out, int indent_level = 0) const;
   void write(std::ostream &out, int indent_level = 0) const;
 
 
-#ifndef NDEBUG
+#if !defined(NDEBUG) || !defined(CPPPARSER)
   void show_regions(const NodePath &render2d,
   void show_regions(const NodePath &render2d,
                     const std::string &bin_name, int draw_order);
                     const std::string &bin_name, int draw_order);
   void set_color(const LColor &color);
   void set_color(const LColor &color);
@@ -84,15 +84,20 @@ protected:
   LightMutex _lock;
   LightMutex _lock;
 
 
 private:
 private:
+  typedef pvector< PT(PandaNode) > Vizzes;
+
 #ifndef NDEBUG
 #ifndef NDEBUG
   PandaNode *make_viz_region(MouseWatcherRegion *region);
   PandaNode *make_viz_region(MouseWatcherRegion *region);
 
 
-  typedef pvector< PT(PandaNode) > Vizzes;
   Vizzes _vizzes;
   Vizzes _vizzes;
-
   bool _show_regions;
   bool _show_regions;
   NodePath _show_regions_root;
   NodePath _show_regions_root;
   LColor _color;
   LColor _color;
+#else
+  Vizzes _vizzes_disabled;
+  bool _show_regions_disabled = false;
+  NodePath _show_regions_root_disabled;
+  LColor _color_disabled;
 #endif  // NDEBUG
 #endif  // NDEBUG
 
 
 public:
 public: