Merge pull request #736 from dariomanesku/master

Run preprocessor before determining input/output.
This commit is contained in:
Branimir Karadžić 2016-03-29 20:32:45 -07:00
commit 2b073ce00a

View File

@ -1058,6 +1058,20 @@ namespace bgfx
memset(&data[size+1], 0, padding);
fclose(file);
if (!raw)
{
// To avoid commented code being recognized as used feature,
// first preprocess pass is used to strip all comments before
// substituting code.
preprocessor.run(data);
delete [] data;
size = (uint32_t)preprocessor.m_preprocessed.size();
data = new char[size+padding+1];
memcpy(data, preprocessor.m_preprocessed.c_str(), size);
memset(&data[size], 0, padding+1);
}
strNormalizeEol(data);
input = const_cast<char*>(bx::strws(data) );
@ -1090,21 +1104,6 @@ namespace bgfx
input = const_cast<char*>(bx::strws(input) );
}
if (!raw)
{
// To avoid commented code being recognized as used feature,
// first preprocess pass is used to strip all comments before
// substituting code.
preprocessor.run(input);
delete [] data;
size = (uint32_t)preprocessor.m_preprocessed.size();
data = new char[size+padding+1];
memcpy(data, preprocessor.m_preprocessed.c_str(), size);
memset(&data[size], 0, padding+1);
input = data;
}
}
if (raw)