From fa1c480508855a422b968a438606eaaf71b254e7 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 3 Jul 2017 12:56:23 +0200 Subject: [PATCH] general: clean up use of override keyword --- dtool/src/dtoolbase/dtoolbase_cc.h | 8 ----- panda/src/egg/eggLine.h | 10 +++--- panda/src/egg/eggNurbsCurve.h | 8 ++--- panda/src/egg/eggNurbsSurface.h | 10 +++--- panda/src/egg/eggPatch.h | 8 ++--- panda/src/egg/eggPoint.h | 10 +++--- panda/src/egg/eggPolygon.h | 10 +++--- panda/src/egg/eggTriangleFan.h | 14 ++++----- panda/src/egg/eggTriangleStrip.h | 12 +++---- panda/src/glstuff/glCgShaderContext_src.I | 34 -------------------- panda/src/glstuff/glCgShaderContext_src.cxx | 14 +++++++++ panda/src/glstuff/glCgShaderContext_src.h | 26 +++++++-------- panda/src/glstuff/glShaderContext_src.I | 35 --------------------- panda/src/glstuff/glShaderContext_src.cxx | 22 ++++++++++--- panda/src/glstuff/glShaderContext_src.h | 32 ++++++++++--------- 15 files changed, 104 insertions(+), 149 deletions(-) diff --git a/dtool/src/dtoolbase/dtoolbase_cc.h b/dtool/src/dtoolbase/dtoolbase_cc.h index 7ccca03e24..eb84f1fccd 100644 --- a/dtool/src/dtoolbase/dtoolbase_cc.h +++ b/dtool/src/dtoolbase/dtoolbase_cc.h @@ -37,7 +37,6 @@ using namespace std; #define ALWAYS_INLINE_CONSTEXPR constexpr #define NOEXCEPT noexcept #define FINAL final -#define OVERRIDE override #define MOVE(x) x #define DEFAULT_CTOR = default #define DEFAULT_DTOR = default @@ -167,7 +166,6 @@ template typename remove_reference::type &&move(T &&t) { # endif # if __has_extension(cxx_override_control) && (__cplusplus >= 201103L) # define FINAL final -# define OVERRIDE override # endif # if __has_extension(cxx_defaulted_functions) # define DEFAULT_CTOR = default @@ -198,7 +196,6 @@ template typename remove_reference::type &&move(T &&t) { // Starting at GCC 4.7 # if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) # define FINAL final -# define OVERRIDE override # endif // GCC defines several macros which we can query. List of all supported @@ -212,11 +209,9 @@ template typename remove_reference::type &&move(T &&t) { # define NOEXCEPT noexcept # define USE_MOVE_SEMANTICS # define FINAL final -# define OVERRIDE override # define MOVE(x) move(x) #elif defined(_MSC_VER) && _MSC_VER >= 1600 // Visual Studio 2010 # define NOEXCEPT throw() -# define OVERRIDE override # define USE_MOVE_SEMANTICS # define FINAL sealed # define MOVE(x) move(x) @@ -245,9 +240,6 @@ template typename remove_reference::type &&move(T &&t) { #ifndef FINAL # define FINAL #endif -#ifndef OVERRIDE -# define OVERRIDE -#endif #ifndef DEFAULT_CTOR # define DEFAULT_CTOR {} #endif diff --git a/panda/src/egg/eggLine.h b/panda/src/egg/eggLine.h index 72ea411cdc..27ee84a785 100644 --- a/panda/src/egg/eggLine.h +++ b/panda/src/egg/eggLine.h @@ -29,9 +29,9 @@ PUBLISHED: INLINE EggLine &operator = (const EggLine ©); virtual ~EggLine(); - virtual EggLine *make_copy() const OVERRIDE; + virtual EggLine *make_copy() const override; - virtual void write(ostream &out, int indent_level) const OVERRIDE; + virtual void write(ostream &out, int indent_level) const override; INLINE bool has_thick() const; INLINE double get_thick() const; @@ -39,7 +39,7 @@ PUBLISHED: INLINE void clear_thick(); protected: - virtual int get_num_lead_vertices() const OVERRIDE; + virtual int get_num_lead_vertices() const override; private: double _thick; @@ -54,10 +54,10 @@ public: register_type(_type_handle, "EggLine", EggCompositePrimitive::get_class_type()); } - virtual TypeHandle get_type() const OVERRIDE { + virtual TypeHandle get_type() const override { return get_class_type(); } - virtual TypeHandle force_init_type() OVERRIDE { + virtual TypeHandle force_init_type() override { init_type(); return get_class_type(); } diff --git a/panda/src/egg/eggNurbsCurve.h b/panda/src/egg/eggNurbsCurve.h index 4225549736..bcd6f1de0c 100644 --- a/panda/src/egg/eggNurbsCurve.h +++ b/panda/src/egg/eggNurbsCurve.h @@ -29,7 +29,7 @@ PUBLISHED: INLINE EggNurbsCurve(const EggNurbsCurve ©); INLINE EggNurbsCurve &operator = (const EggNurbsCurve ©); - virtual EggNurbsCurve *make_copy() const OVERRIDE; + virtual EggNurbsCurve *make_copy() const override; void setup(int order, int num_knots); @@ -50,7 +50,7 @@ PUBLISHED: INLINE double get_knot(int k) const; MAKE_SEQ(get_knots, get_num_knots, get_knot); - virtual void write(ostream &out, int indent_level) const OVERRIDE; + virtual void write(ostream &out, int indent_level) const override; MAKE_PROPERTY(order, get_order, set_order); MAKE_PROPERTY(degree, get_degree); @@ -72,10 +72,10 @@ public: register_type(_type_handle, "EggNurbsCurve", EggCurve::get_class_type()); } - virtual TypeHandle get_type() const OVERRIDE { + virtual TypeHandle get_type() const override { return get_class_type(); } - virtual TypeHandle force_init_type() OVERRIDE { + virtual TypeHandle force_init_type() override { init_type(); return get_class_type(); } diff --git a/panda/src/egg/eggNurbsSurface.h b/panda/src/egg/eggNurbsSurface.h index 83900282f0..bc3d752307 100644 --- a/panda/src/egg/eggNurbsSurface.h +++ b/panda/src/egg/eggNurbsSurface.h @@ -36,7 +36,7 @@ PUBLISHED: INLINE EggNurbsSurface(const EggNurbsSurface ©); INLINE EggNurbsSurface &operator = (const EggNurbsSurface ©); - virtual EggNurbsSurface *make_copy() const OVERRIDE; + virtual EggNurbsSurface *make_copy() const override; void setup(int u_order, int v_order, int num_u_knots, int num_v_knots); @@ -75,14 +75,14 @@ PUBLISHED: MAKE_SEQ(get_v_knots, get_num_v_knots, get_v_knot); INLINE EggVertex *get_cv(int ui, int vi) const; - virtual void write(ostream &out, int indent_level) const OVERRIDE; + virtual void write(ostream &out, int indent_level) const override; public: Curves _curves_on_surface; Trims _trims; protected: - virtual void r_apply_texmats(EggTextureCollection &textures) OVERRIDE; + virtual void r_apply_texmats(EggTextureCollection &textures) override; private: typedef vector_double Knots; @@ -101,10 +101,10 @@ public: register_type(_type_handle, "EggNurbsSurface", EggSurface::get_class_type()); } - virtual TypeHandle get_type() const OVERRIDE { + virtual TypeHandle get_type() const override { return get_class_type(); } - virtual TypeHandle force_init_type() OVERRIDE { + virtual TypeHandle force_init_type() override { init_type(); return get_class_type(); } diff --git a/panda/src/egg/eggPatch.h b/panda/src/egg/eggPatch.h index 4358149131..9b31d6e91f 100644 --- a/panda/src/egg/eggPatch.h +++ b/panda/src/egg/eggPatch.h @@ -28,9 +28,9 @@ PUBLISHED: INLINE EggPatch(const EggPatch ©); INLINE EggPatch &operator = (const EggPatch ©); - virtual EggPatch *make_copy() const OVERRIDE; + virtual EggPatch *make_copy() const override; - virtual void write(ostream &out, int indent_level) const OVERRIDE; + virtual void write(ostream &out, int indent_level) const override; public: static TypeHandle get_class_type() { @@ -41,10 +41,10 @@ public: register_type(_type_handle, "EggPatch", EggPrimitive::get_class_type()); } - virtual TypeHandle get_type() const OVERRIDE { + virtual TypeHandle get_type() const override { return get_class_type(); } - virtual TypeHandle force_init_type() OVERRIDE { + virtual TypeHandle force_init_type() override { init_type(); return get_class_type(); } diff --git a/panda/src/egg/eggPoint.h b/panda/src/egg/eggPoint.h index 93ed683133..994727e32e 100644 --- a/panda/src/egg/eggPoint.h +++ b/panda/src/egg/eggPoint.h @@ -28,7 +28,7 @@ PUBLISHED: INLINE EggPoint(const EggPoint ©); INLINE EggPoint &operator = (const EggPoint ©); - virtual EggPoint *make_copy() const OVERRIDE; + virtual EggPoint *make_copy() const override; INLINE bool has_thick() const; INLINE double get_thick() const; @@ -40,9 +40,9 @@ PUBLISHED: INLINE void set_perspective(bool perspective); INLINE void clear_perspective(); - virtual bool cleanup() OVERRIDE; + virtual bool cleanup() override; - virtual void write(ostream &out, int indent_level) const OVERRIDE; + virtual void write(ostream &out, int indent_level) const override; private: enum Flags { @@ -64,10 +64,10 @@ public: register_type(_type_handle, "EggPoint", EggPrimitive::get_class_type()); } - virtual TypeHandle get_type() const OVERRIDE { + virtual TypeHandle get_type() const override { return get_class_type(); } - virtual TypeHandle force_init_type() OVERRIDE { + virtual TypeHandle force_init_type() override { init_type(); return get_class_type(); } diff --git a/panda/src/egg/eggPolygon.h b/panda/src/egg/eggPolygon.h index 5d25c554be..aacd677c13 100644 --- a/panda/src/egg/eggPolygon.h +++ b/panda/src/egg/eggPolygon.h @@ -27,9 +27,9 @@ PUBLISHED: INLINE EggPolygon(const EggPolygon ©); INLINE EggPolygon &operator = (const EggPolygon ©); - virtual EggPolygon *make_copy() const OVERRIDE; + virtual EggPolygon *make_copy() const override; - virtual bool cleanup() OVERRIDE; + virtual bool cleanup() override; bool calculate_normal(LNormald &result, CoordinateSystem cs = CS_default) const; bool is_planar() const; @@ -39,7 +39,7 @@ PUBLISHED: INLINE bool triangulate_into(EggGroupNode *container, bool convex_also) const; PT(EggPolygon) triangulate_in_place(bool convex_also); - virtual void write(ostream &out, int indent_level) const OVERRIDE; + virtual void write(ostream &out, int indent_level) const override; private: bool decomp_concave(EggGroupNode *container, int asum, int x, int y) const; @@ -55,10 +55,10 @@ public: register_type(_type_handle, "EggPolygon", EggPrimitive::get_class_type()); } - virtual TypeHandle get_type() const OVERRIDE { + virtual TypeHandle get_type() const override { return get_class_type(); } - virtual TypeHandle force_init_type() OVERRIDE { + virtual TypeHandle force_init_type() override { init_type(); return get_class_type(); } diff --git a/panda/src/egg/eggTriangleFan.h b/panda/src/egg/eggTriangleFan.h index f2ca8e32b5..31c8a9e4a4 100644 --- a/panda/src/egg/eggTriangleFan.h +++ b/panda/src/egg/eggTriangleFan.h @@ -29,14 +29,14 @@ PUBLISHED: INLINE EggTriangleFan &operator = (const EggTriangleFan ©); virtual ~EggTriangleFan(); - virtual EggTriangleFan *make_copy() const OVERRIDE; + virtual EggTriangleFan *make_copy() const override; - virtual void write(ostream &out, int indent_level) const OVERRIDE; - virtual void apply_first_attribute() OVERRIDE; + virtual void write(ostream &out, int indent_level) const override; + virtual void apply_first_attribute() override; protected: - virtual int get_num_lead_vertices() const OVERRIDE; - virtual bool do_triangulate(EggGroupNode *container) const OVERRIDE; + virtual int get_num_lead_vertices() const override; + virtual bool do_triangulate(EggGroupNode *container) const override; public: static TypeHandle get_class_type() { @@ -47,10 +47,10 @@ public: register_type(_type_handle, "EggTriangleFan", EggCompositePrimitive::get_class_type()); } - virtual TypeHandle get_type() const OVERRIDE { + virtual TypeHandle get_type() const override { return get_class_type(); } - virtual TypeHandle force_init_type() OVERRIDE { + virtual TypeHandle force_init_type() override { init_type(); return get_class_type(); } diff --git a/panda/src/egg/eggTriangleStrip.h b/panda/src/egg/eggTriangleStrip.h index a84d0cd751..e74f248c47 100644 --- a/panda/src/egg/eggTriangleStrip.h +++ b/panda/src/egg/eggTriangleStrip.h @@ -29,13 +29,13 @@ PUBLISHED: INLINE EggTriangleStrip &operator = (const EggTriangleStrip ©); virtual ~EggTriangleStrip(); - virtual EggTriangleStrip *make_copy() const OVERRIDE; + virtual EggTriangleStrip *make_copy() const override; - virtual void write(ostream &out, int indent_level) const OVERRIDE; + virtual void write(ostream &out, int indent_level) const override; protected: - virtual int get_num_lead_vertices() const OVERRIDE; - virtual bool do_triangulate(EggGroupNode *container) const OVERRIDE; + virtual int get_num_lead_vertices() const override; + virtual bool do_triangulate(EggGroupNode *container) const override; public: static TypeHandle get_class_type() { @@ -46,10 +46,10 @@ public: register_type(_type_handle, "EggTriangleStrip", EggCompositePrimitive::get_class_type()); } - virtual TypeHandle get_type() const OVERRIDE { + virtual TypeHandle get_type() const override { return get_class_type(); } - virtual TypeHandle force_init_type() OVERRIDE { + virtual TypeHandle force_init_type() override { init_type(); return get_class_type(); } diff --git a/panda/src/glstuff/glCgShaderContext_src.I b/panda/src/glstuff/glCgShaderContext_src.I index b2c176f7d1..08c947f0fb 100644 --- a/panda/src/glstuff/glCgShaderContext_src.I +++ b/panda/src/glstuff/glCgShaderContext_src.I @@ -10,37 +10,3 @@ * @author rdb * @date 2014-06-27 */ - -#ifndef OPENGLES_1 - -/** - * Returns true if the shader is "valid", ie, if the compilation was - * successful. The compilation could fail if there is a syntax error in the - * shader, or if the current video card isn't shader-capable, or if no shader - * languages are compiled into panda. - */ -INLINE bool CLP(CgShaderContext):: -valid() { - if (_shader->get_error_flag()) return false; - if (_shader->get_language() != Shader::SL_Cg) return false; - return (_cg_program != 0); -} - -/** - * Returns true if the shader may need to access standard vertex attributes as - * passed by glVertexPointer and the like. - */ -INLINE bool CLP(CgShaderContext):: -uses_standard_vertex_arrays() { - return false; -} - -/** - * Always true, for now. - */ -INLINE bool CLP(CgShaderContext):: -uses_custom_vertex_arrays() { - return true; -} - -#endif // OPENGLES_1 diff --git a/panda/src/glstuff/glCgShaderContext_src.cxx b/panda/src/glstuff/glCgShaderContext_src.cxx index d8f7231a34..9f6e242968 100644 --- a/panda/src/glstuff/glCgShaderContext_src.cxx +++ b/panda/src/glstuff/glCgShaderContext_src.cxx @@ -357,6 +357,20 @@ release_resources() { _glgsg->report_my_gl_errors(); } +/** + * Returns true if the shader is "valid", ie, if the compilation was + * successful. The compilation could fail if there is a syntax error in the + * shader, or if the current video card isn't shader-capable, or if no shader + * languages are compiled into panda. + */ +bool CLP(CgShaderContext):: +valid() { + if (_shader == nullptr || _shader->get_error_flag()) { + return false; + } + return (_cg_program != 0); +} + /** * This function is to be called to enable a new shader. It also initializes * all of the shader's input parameters. diff --git a/panda/src/glstuff/glCgShaderContext_src.h b/panda/src/glstuff/glCgShaderContext_src.h index 49d451d442..d5bc721e61 100644 --- a/panda/src/glstuff/glCgShaderContext_src.h +++ b/panda/src/glstuff/glCgShaderContext_src.h @@ -33,25 +33,25 @@ public: ~CLP(CgShaderContext)(); ALLOC_DELETED_CHAIN(CLP(CgShaderContext)); - INLINE bool valid(void); - void bind() OVERRIDE; - void unbind() OVERRIDE; + bool valid(void) override; + void bind() override; + void unbind() override; void set_state_and_transform(const RenderState *state, const TransformState *modelview_transform, const TransformState *camera_transform, - const TransformState *projection_transform) OVERRIDE; + const TransformState *projection_transform) override; - void issue_parameters(int altered) OVERRIDE; + void issue_parameters(int altered) override; void update_transform_table(const TransformTable *table); void update_slider_table(const SliderTable *table); - void disable_shader_vertex_arrays() OVERRIDE; - bool update_shader_vertex_arrays(ShaderContext *prev, bool force) OVERRIDE; - void disable_shader_texture_bindings() OVERRIDE; - void update_shader_texture_bindings(ShaderContext *prev) OVERRIDE; + void disable_shader_vertex_arrays() override; + bool update_shader_vertex_arrays(ShaderContext *prev, bool force) override; + void disable_shader_texture_bindings() override; + void update_shader_texture_bindings(ShaderContext *prev) override; - INLINE bool uses_standard_vertex_arrays(void); - INLINE bool uses_custom_vertex_arrays(void); + bool uses_standard_vertex_arrays(void) override { return false; } + bool uses_custom_vertex_arrays(void) override { return true; } // Special values for location to indicate conventional attrib slots. enum ConventionalAttrib { @@ -95,10 +95,10 @@ public: register_type(_type_handle, CLASSPREFIX_QUOTED "CgShaderContext", ShaderContext::get_class_type()); } - virtual TypeHandle get_type() const OVERRIDE { + virtual TypeHandle get_type() const override { return get_class_type(); } - virtual TypeHandle force_init_type() OVERRIDE {init_type(); return get_class_type();} + virtual TypeHandle force_init_type() override {init_type(); return get_class_type();} private: static TypeHandle _type_handle; diff --git a/panda/src/glstuff/glShaderContext_src.I b/panda/src/glstuff/glShaderContext_src.I index 00b8460ba8..aa14237510 100644 --- a/panda/src/glstuff/glShaderContext_src.I +++ b/panda/src/glstuff/glShaderContext_src.I @@ -10,38 +10,3 @@ * @author jyelon * @date 2005-09-01 */ - -/** - * Returns true if the shader is "valid", ie, if the compilation was - * successful. The compilation could fail if there is a syntax error in the - * shader, or if the current video card isn't shader-capable, or if no shader - * languages are compiled into panda. - */ -INLINE bool CLP(ShaderContext):: -valid() { - if (_shader->get_error_flag()) return false; - if (_shader->get_language() != Shader::SL_GLSL) { - return false; - } - if (_glsl_program != 0) { - return true; - } - return false; -} - -/** - * Returns true if the shader may need to access standard vertex attributes as - * passed by glVertexPointer and the like. - */ -INLINE bool CLP(ShaderContext):: -uses_standard_vertex_arrays() { - return _uses_standard_vertex_arrays; -} - -/** - * Always true, for now. - */ -INLINE bool CLP(ShaderContext):: -uses_custom_vertex_arrays() { - return true; -} diff --git a/panda/src/glstuff/glShaderContext_src.cxx b/panda/src/glstuff/glShaderContext_src.cxx index d81d86bfff..1afa11d2b8 100644 --- a/panda/src/glstuff/glShaderContext_src.cxx +++ b/panda/src/glstuff/glShaderContext_src.cxx @@ -1821,6 +1821,20 @@ release_resources() { _glgsg->report_my_gl_errors(); } +/** + * Returns true if the shader is "valid", ie, if the compilation was + * successful. The compilation could fail if there is a syntax error in the + * shader, or if the current video card isn't shader-capable, or if no shader + * languages are compiled into panda. + */ +bool CLP(ShaderContext):: +valid() { + if (_shader->get_error_flag()) { + return false; + } + return (_glsl_program != 0); +} + /** * This function is to be called to enable a new shader. It also initializes * all of the shader's input parameters. @@ -2177,7 +2191,7 @@ update_slider_table(const SliderTable *table) { */ void CLP(ShaderContext):: disable_shader_vertex_arrays() { - if (!valid()) { + if (_glsl_program == 0) { return; } @@ -2200,7 +2214,7 @@ disable_shader_vertex_arrays() { */ bool CLP(ShaderContext):: update_shader_vertex_arrays(ShaderContext *prev, bool force) { - if (!valid()) { + if (_glsl_program == 0) { return true; } @@ -2373,7 +2387,7 @@ update_shader_vertex_arrays(ShaderContext *prev, bool force) { */ void CLP(ShaderContext):: disable_shader_texture_bindings() { - if (!valid()) { + if (_glsl_program == 0) { return; } @@ -2473,7 +2487,7 @@ void CLP(ShaderContext):: update_shader_texture_bindings(ShaderContext *prev) { // if (prev) { prev->disable_shader_texture_bindings(); } - if (!valid()) { + if (_glsl_program == 0) { return; } diff --git a/panda/src/glstuff/glShaderContext_src.h b/panda/src/glstuff/glShaderContext_src.h index 97c9b5940c..9ecfe9ed39 100644 --- a/panda/src/glstuff/glShaderContext_src.h +++ b/panda/src/glstuff/glShaderContext_src.h @@ -40,26 +40,30 @@ public: void reflect_uniform(int i, char *name_buffer, GLsizei name_buflen); bool get_sampler_texture_type(int &out, GLenum param_type); - INLINE bool valid(void); - void bind() OVERRIDE; - void unbind() OVERRIDE; + bool valid(void) override; + void bind() override; + void unbind() override; void set_state_and_transform(const RenderState *state, const TransformState *modelview_transform, const TransformState *camera_transform, - const TransformState *projection_transform) OVERRIDE; + const TransformState *projection_transform) override; - void issue_parameters(int altered) OVERRIDE; + void issue_parameters(int altered) override; void update_transform_table(const TransformTable *table); void update_slider_table(const SliderTable *table); - void disable_shader_vertex_arrays() OVERRIDE; - bool update_shader_vertex_arrays(ShaderContext *prev, bool force) OVERRIDE; - void disable_shader_texture_bindings() OVERRIDE; - void update_shader_texture_bindings(ShaderContext *prev) OVERRIDE; - void update_shader_buffer_bindings(ShaderContext *prev) OVERRIDE; + void disable_shader_vertex_arrays() override; + bool update_shader_vertex_arrays(ShaderContext *prev, bool force) override; + void disable_shader_texture_bindings() override; + void update_shader_texture_bindings(ShaderContext *prev) override; + void update_shader_buffer_bindings(ShaderContext *prev) override; - INLINE bool uses_standard_vertex_arrays(void); - INLINE bool uses_custom_vertex_arrays(void); + bool uses_standard_vertex_arrays(void) override { + return _uses_standard_vertex_arrays; + } + bool uses_custom_vertex_arrays(void) override { + return true; + } private: bool _validated; @@ -128,10 +132,10 @@ public: register_type(_type_handle, CLASSPREFIX_QUOTED "ShaderContext", ShaderContext::get_class_type()); } - virtual TypeHandle get_type() const OVERRIDE { + virtual TypeHandle get_type() const override { return get_class_type(); } - virtual TypeHandle force_init_type() OVERRIDE {init_type(); return get_class_type();} + virtual TypeHandle force_init_type() override {init_type(); return get_class_type();} private: static TypeHandle _type_handle;