mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 09:23:03 -04:00
Fix some preprocessor expressions in Interrogate
This commit is contained in:
parent
16bfd3750f
commit
9178ed2871
@ -687,7 +687,7 @@ push_string(const string &input, bool lock_position) {
|
||||
// string and return the new string.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
string CPPPreprocessor::
|
||||
expand_manifests(const string &input_expr) {
|
||||
expand_manifests(const string &input_expr, bool expand_undefined) {
|
||||
// Get a copy of the expression string we can modify.
|
||||
string expr = input_expr;
|
||||
|
||||
@ -722,6 +722,10 @@ expand_manifests(const string &input_expr) {
|
||||
expand_manifest_inline(expr, q, p, (*mi).second);
|
||||
manifest_found = true;
|
||||
}
|
||||
} else if (expand_undefined && ident != "true" && ident != "false") {
|
||||
// It is not found. Expand it to 0.
|
||||
expr = expr.substr(0, q) + "0" + expr.substr(p);
|
||||
p = q + 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -751,7 +755,7 @@ expand_manifests(const string &input_expr) {
|
||||
CPPExpression *CPPPreprocessor::
|
||||
parse_expr(const string &input_expr, CPPScope *current_scope,
|
||||
CPPScope *global_scope) {
|
||||
string expr = expand_manifests(input_expr);
|
||||
string expr = expand_manifests(input_expr, true);
|
||||
|
||||
CPPExpressionParser ep(current_scope, global_scope);
|
||||
ep._verbose = 0;
|
||||
@ -1380,7 +1384,7 @@ handle_include_directive(const string &args, int first_line,
|
||||
// might not filter out quotes and angle brackets properly, we'll
|
||||
// only expand manifests if we don't begin with a quote or bracket.
|
||||
if (!expr.empty() && (expr[0] != '"' && expr[0] != '<')) {
|
||||
expr = expand_manifests(expr);
|
||||
expr = expand_manifests(expr, false);
|
||||
}
|
||||
|
||||
if (!expr.empty()) {
|
||||
|
@ -106,7 +106,7 @@ protected:
|
||||
bool push_file(const CPPFile &file);
|
||||
bool push_string(const string &input, bool lock_position);
|
||||
|
||||
string expand_manifests(const string &input_expr);
|
||||
string expand_manifests(const string &input_expr, bool expand_undefined);
|
||||
CPPExpression *parse_expr(const string &expr, CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
|
||||
|
@ -39,10 +39,13 @@ typedef unsigned short ushort;
|
||||
typedef unsigned char uchar;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define NULL 0
|
||||
#define NULL 0L
|
||||
#else
|
||||
#define NULL ((void *)0)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// One day, we might extend interrogate to be able to parse this,
|
||||
// but we currently don't need it.
|
||||
#define alignas(x)
|
||||
|
||||
#endif
|
||||
|
@ -1020,7 +1020,6 @@ def CompileCxx(obj,src,opts):
|
||||
if (opt=="ALWAYS") or (opt in opts): cmd += " /I" + BracketNameWithQuotes(dir)
|
||||
for (opt,var,val) in DEFSYMBOLS:
|
||||
if (opt=="ALWAYS") or (opt in opts): cmd += " /D" + var + "=" + val
|
||||
if (opts.count('NOFLOATWARN')): cmd += ' /wd4244 /wd4305'
|
||||
if (opts.count('MSFORSCOPE')): cmd += ' /Zc:forScope-'
|
||||
|
||||
if (optlevel==1): cmd += " /MDd /Zi /RTCs /GS"
|
||||
@ -1070,7 +1069,6 @@ def CompileCxx(obj,src,opts):
|
||||
if (opt=="ALWAYS") or (opt in opts): cmd += " /I" + BracketNameWithQuotes(dir)
|
||||
for (opt,var,val) in DEFSYMBOLS:
|
||||
if (opt=="ALWAYS") or (opt in opts): cmd += " /D" + var + "=" + val
|
||||
if (opts.count('NOFLOATWARN')): cmd += ' /wd4244 /wd4305'
|
||||
if (opts.count('MSFORSCOPE')): cmd += ' /Zc:forScope-'
|
||||
|
||||
if (optlevel==1): cmd += " /MDd /Zi /RTCs /GS"
|
||||
@ -1339,14 +1337,15 @@ def CompileIgate(woutd,wsrc,opts):
|
||||
cmd = 'interrogate'
|
||||
|
||||
cmd += ' -srcdir %s -I%s -Dvolatile -Dmutable' % (srcdir, srcdir)
|
||||
cmd += ' -DCPPPARSER -D__STDC__=1 -D__cplusplus=201103L'
|
||||
if (COMPILER=="MSVC"):
|
||||
cmd += ' -DCPPPARSER -D__STDC__=1 -D__cplusplus -D__inline -D_X86_ -DWIN32_VC -DWIN32 -D_WIN32'
|
||||
cmd += ' -D__inline -D_X86_ -DWIN32_VC -DWIN32 -D_WIN32'
|
||||
if GetTargetArch() == 'x64':
|
||||
cmd += ' -DWIN64_VC -DWIN64 -D_WIN64'
|
||||
# NOTE: this 1600 value is the version number for VC2010.
|
||||
cmd += ' -D_MSC_VER=1600 -D"_declspec(param)=" -D_near -D_far -D__near -D__far -D__stdcall'
|
||||
cmd += ' -D_MSC_VER=1600 -D"__declspec(param)=" -D__cdecl -D_near -D_far -D__near -D__far -D__stdcall'
|
||||
if (COMPILER=="GCC"):
|
||||
cmd += ' -DCPPPARSER -D__STDC__=1 -D__cplusplus -D__inline -D__const=const -D__attribute__\(x\)='
|
||||
cmd += ' -D__inline -D__const=const -D__attribute__\(x\)='
|
||||
if GetTargetArch() in ("x86_64", "amd64"):
|
||||
cmd += ' -D_LP64'
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user