mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
Fix issue building with pre-C++11 compiler
This commit is contained in:
parent
dba5191bc2
commit
a43d6a45c1
@ -43,22 +43,19 @@ ExpansionNode(const string &str, bool paste) :
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: CPPManifest::Constructor
|
// Function: CPPManifest::Constructor
|
||||||
// Access: Public
|
// Access: Public
|
||||||
// Description:
|
// Description: Creates a manifest from a preprocessor definition.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
CPPManifest::
|
CPPManifest::
|
||||||
CPPManifest(const string &args, const cppyyltype &loc) :
|
CPPManifest(const string &args, const cppyyltype &loc) :
|
||||||
_variadic_param(-1),
|
_variadic_param(-1),
|
||||||
_loc(loc),
|
_loc(loc),
|
||||||
_expr((CPPExpression *)NULL)
|
_expr((CPPExpression *)NULL),
|
||||||
|
_vis(V_public)
|
||||||
{
|
{
|
||||||
assert(!args.empty());
|
assert(!args.empty());
|
||||||
assert(!isspace(args[0]));
|
assert(!isspace(args[0]));
|
||||||
|
|
||||||
_expr = (CPPExpression *)NULL;
|
|
||||||
_vis = V_public;
|
|
||||||
|
|
||||||
// First, identify the manifest name.
|
// First, identify the manifest name.
|
||||||
|
|
||||||
size_t p = 0;
|
size_t p = 0;
|
||||||
while (p < args.size() && !isspace(args[p]) && args[p] != '(') {
|
while (p < args.size() && !isspace(args[p]) && args[p] != '(') {
|
||||||
p++;
|
p++;
|
||||||
@ -88,6 +85,51 @@ CPPManifest(const string &args, const cppyyltype &loc) :
|
|||||||
save_expansion(args.substr(p), parameter_names);
|
save_expansion(args.substr(p), parameter_names);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: CPPManifest::Constructor
|
||||||
|
// Access: Public
|
||||||
|
// Description: Creates a custom manifest definition, for example
|
||||||
|
// as specified from a command-line -D option.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
CPPManifest::
|
||||||
|
CPPManifest(const string ¯o, const string &definition) :
|
||||||
|
_variadic_param(-1),
|
||||||
|
_expr((CPPExpression *)NULL),
|
||||||
|
_vis(V_public)
|
||||||
|
{
|
||||||
|
_loc.first_line = 0;
|
||||||
|
_loc.first_column = 0;
|
||||||
|
_loc.last_line = 0;
|
||||||
|
_loc.last_column = 0;
|
||||||
|
|
||||||
|
assert(!macro.empty());
|
||||||
|
assert(!isspace(macro[0]));
|
||||||
|
|
||||||
|
// First, identify the manifest name.
|
||||||
|
size_t p = 0;
|
||||||
|
while (p < macro.size() && !isspace(macro[p]) && macro[p] != '(') {
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
|
||||||
|
_name = macro.substr(0, p);
|
||||||
|
|
||||||
|
vector_string parameter_names;
|
||||||
|
|
||||||
|
if (macro[p] == '(') {
|
||||||
|
// Hmm, parameters.
|
||||||
|
_has_parameters = true;
|
||||||
|
parse_parameters(macro, p, parameter_names);
|
||||||
|
_num_parameters = parameter_names.size();
|
||||||
|
|
||||||
|
p++;
|
||||||
|
} else {
|
||||||
|
_has_parameters = false;
|
||||||
|
_num_parameters = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
save_expansion(definition, parameter_names);
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: CPPManifest::Destructor
|
// Function: CPPManifest::Destructor
|
||||||
// Access: Public
|
// Access: Public
|
||||||
|
@ -32,7 +32,8 @@ class CPPType;
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
class CPPManifest {
|
class CPPManifest {
|
||||||
public:
|
public:
|
||||||
CPPManifest(const string &args, const cppyyltype &loc = {0});
|
CPPManifest(const string &args, const cppyyltype &loc);
|
||||||
|
CPPManifest(const string ¯o, const string &definition);
|
||||||
~CPPManifest();
|
~CPPManifest();
|
||||||
|
|
||||||
static string stringify(const string &source);
|
static string stringify(const string &source);
|
||||||
|
@ -300,7 +300,7 @@ predefine_macro(CPPParser& parser, const string& inoption) {
|
|||||||
macro_name = inoption;
|
macro_name = inoption;
|
||||||
}
|
}
|
||||||
|
|
||||||
CPPManifest *macro = new CPPManifest(macro_name + " " + macro_def);
|
CPPManifest *macro = new CPPManifest(macro_name, macro_def);
|
||||||
parser._manifests[macro->_name] = macro;
|
parser._manifests[macro->_name] = macro;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ predefine_macro(CPPParser &parser, const string &option) {
|
|||||||
|
|
||||||
cerr << "Predefining " << macro_name << " as " << macro_def << "\n";
|
cerr << "Predefining " << macro_name << " as " << macro_def << "\n";
|
||||||
|
|
||||||
CPPManifest *macro = new CPPManifest(macro_name + " " + macro_def);
|
CPPManifest *macro = new CPPManifest(macro_name, macro_def);
|
||||||
parser._manifests[macro->_name] = macro;
|
parser._manifests[macro->_name] = macro;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user