From 38d02fadf9b98d504acd438957ac20847f1398fb Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 23 Mar 2015 19:27:29 +0100 Subject: [PATCH] Fix various interrogate issues with parsing PhysX headers --- dtool/src/cppparser/cppBison.yxx | 40 +++++++++++++++++++------ dtool/src/cppparser/cppPreprocessor.cxx | 2 +- panda/src/physx/physx_includes.h | 1 + panda/src/pnmimage/pnmimage_base.h | 3 -- 4 files changed, 33 insertions(+), 13 deletions(-) diff --git a/dtool/src/cppparser/cppBison.yxx b/dtool/src/cppparser/cppBison.yxx index 9cf217d404..87c4f5cd17 100644 --- a/dtool/src/cppparser/cppBison.yxx +++ b/dtool/src/cppparser/cppBison.yxx @@ -495,17 +495,21 @@ declaration: CPPDeclaration *getter = $5->find_symbol(current_scope, global_scope, current_lexer); if (getter == (CPPDeclaration *)NULL || getter->get_subtype() != CPPDeclaration::ST_function_group) { yyerror("Reference to non-existent or invalid getter: " + $5->get_fully_scoped_name(), @1); - } - CPPDeclaration *setter = $7->find_symbol(current_scope, global_scope, current_lexer); - if (setter == (CPPDeclaration *)NULL || setter->get_subtype() != CPPDeclaration::ST_function_group) { - yyerror("Reference to non-existent or invalid setter: " + $7->get_fully_scoped_name(), @1); - } + } else { + CPPDeclaration *setter = $7->find_symbol(current_scope, global_scope, current_lexer); + CPPFunctionGroup *setter_func = NULL; - CPPMakeProperty *make_property = new CPPMakeProperty($3, getter->as_function_group(), - setter->as_function_group(), - current_scope, @1.file); - current_scope->add_declaration(make_property, global_scope, current_lexer, @1); + if (setter == (CPPDeclaration *)NULL || setter->get_subtype() != CPPDeclaration::ST_function_group) { + yyerror("Reference to non-existent or invalid setter: " + $7->get_fully_scoped_name(), @1); + } else { + setter_func = setter->as_function_group(); + } + + CPPMakeProperty *make_property = new CPPMakeProperty($3, getter->as_function_group(), + setter_func, current_scope, @1.file); + current_scope->add_declaration(make_property, global_scope, current_lexer, @1); + } } | KW_MAKE_SEQ '(' name ',' name ',' name ')' ';' { @@ -1662,6 +1666,24 @@ type_decl: } | enum_keyword name ':' enum_element_type { + CPPType *type = $2->find_type(current_scope, global_scope, false, current_lexer); + if (type != NULL) { + $$ = type; + } else { + CPPExtensionType *et = + CPPType::new_type(new CPPExtensionType($1, $2, current_scope, @1.file)) + ->as_extension_type(); + CPPScope *scope = $2->get_scope(current_scope, global_scope); + if (scope != NULL) { + scope->define_extension_type(et); + } + $$ = et; + } +} + | enum_keyword name +{ + yywarning(string("C++ does not permit forward declaration of untyped enum ") + $2->get_fully_scoped_name(), @1); + CPPType *type = $2->find_type(current_scope, global_scope, false, current_lexer); if (type != NULL) { $$ = type; diff --git a/dtool/src/cppparser/cppPreprocessor.cxx b/dtool/src/cppparser/cppPreprocessor.cxx index 42a786e729..482a8cbabe 100644 --- a/dtool/src/cppparser/cppPreprocessor.cxx +++ b/dtool/src/cppparser/cppPreprocessor.cxx @@ -200,7 +200,7 @@ CPPPreprocessor() { _warning_count = 0; _error_count = 0; - _error_abort = true; + _error_abort = false; #ifdef CPP_VERBOSE_LEX _token_index = 0; #endif diff --git a/panda/src/physx/physx_includes.h b/panda/src/physx/physx_includes.h index 91e16eb67e..0f8c4f2e79 100644 --- a/panda/src/physx/physx_includes.h +++ b/panda/src/physx/physx_includes.h @@ -50,6 +50,7 @@ // PhysX headers +#include "Nxp.h" #include "NxPhysics.h" #include "NxExtended.h" #include "NxStream.h" diff --git a/panda/src/pnmimage/pnmimage_base.h b/panda/src/pnmimage/pnmimage_base.h index 4cf1e5a83c..9adea47dd9 100644 --- a/panda/src/pnmimage/pnmimage_base.h +++ b/panda/src/pnmimage/pnmimage_base.h @@ -46,9 +46,6 @@ PUBLISHED: static int size() { return 3; } gray operator [](int i) const { nassertr(i >= 0 && i < 3, 0); return *(&r + i); } gray &operator [](int i) { nassertr(i >= 0 && i < 3, r); return *(&r + i); } -#ifdef HAVE_PYTHON - void __setitem__(int i, gray v) { operator[](i) = v; } -#endif pixel operator + (const pixel &other) const { return pixel(r + other.r, g + other.g, b + other.b); } pixel operator - (const pixel &other) const