Non-Functional: Whitespace, comments, replace accidentally deleted comment.

- fixed ParseHelper.cpp newlines (crlf -> lf)
- removed trailing white space in most source files
- fix some spelling issues
- extra blank lines
- tabs to spaces
- replace #include comment about no location
This commit is contained in:
John Kessenich 2017-01-06 00:34:48 -07:00
parent 3dd32293f4
commit ecba76fe73
60 changed files with 755 additions and 806 deletions

View file

@ -57,7 +57,7 @@ Except as expressly stated in this notice, no other rights or licenses
express or implied, are granted by NVIDIA herein, including but not
limited to any patent rights that may be infringed by your derivative
works or by other works in which the NVIDIA Software may be
incorporated. No hardware is licensed hereunder.
incorporated. No hardware is licensed hereunder.
THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
@ -113,7 +113,7 @@ int TPpContext::CPPdefine(TPpToken* ppToken)
mac.emptyArgs = 1;
do {
token = scanToken(ppToken);
if (mac.args.size() == 0 && token == ')')
if (mac.args.size() == 0 && token == ')')
break;
if (token != PpAtomIdentifier) {
parseContext.ppError(ppToken->loc, "bad argument", "#define", "");
@ -177,7 +177,7 @@ int TPpContext::CPPdefine(TPpToken* ppToken)
newToken = ReadToken(mac.body, &newPpToken);
if (oldToken != newToken || oldPpToken != newPpToken) {
parseContext.ppError(defineLoc, "Macro redefined; different substitutions:", "#define", atomStrings.getString(defAtom));
break;
break;
}
} while (newToken > 0);
}
@ -238,8 +238,8 @@ int TPpContext::CPPelse(int matchelse, TPpToken* ppToken)
int nextAtom = atomStrings.getAtom(ppToken->name);
if (nextAtom == PpAtomIf || nextAtom == PpAtomIfdef || nextAtom == PpAtomIfndef) {
depth++;
ifdepth++;
depth++;
ifdepth++;
elsetracker++;
} else if (nextAtom == PpAtomEndif) {
token = extraTokenCheck(nextAtom, ppToken, scanToken(ppToken));
@ -247,7 +247,7 @@ int TPpContext::CPPelse(int matchelse, TPpToken* ppToken)
--elsetracker;
if (depth == 0) {
// found the #endif we are looking for
if (ifdepth)
if (ifdepth)
--ifdepth;
break;
}
@ -461,7 +461,7 @@ int TPpContext::eval(int token, int precedence, bool shortCircuit, int& res, boo
// Perform evaluation of binary operation, if there is one, otherwise we are done.
while (! err) {
if (token == ')' || token == '\n')
if (token == ')' || token == '\n')
break;
int op;
for (op = NUM_ELEMENTS(binop) - 1; op >= 0; op--) {
@ -523,7 +523,7 @@ int TPpContext::evalToToken(int token, bool shortCircuit, int& res, bool& err, T
}
// Handle #if
int TPpContext::CPPif(TPpToken* ppToken)
int TPpContext::CPPif(TPpToken* ppToken)
{
int token = scanToken(ppToken);
elsetracker++;
@ -554,7 +554,7 @@ int TPpContext::CPPifdef(int defined, TPpToken* ppToken)
if (token != PpAtomIdentifier) {
if (defined)
parseContext.ppError(ppToken->loc, "must be followed by macro name", "#ifdef", "");
else
else
parseContext.ppError(ppToken->loc, "must be followed by macro name", "#ifndef", "");
} else {
MacroSymbol* macro = lookupMacroDef(atomStrings.getAtom(ppToken->name));
@ -617,6 +617,7 @@ int TPpContext::CPPinclude(TPpToken* ppToken)
epilogue << (res->file_data[res->file_length - 1] == '\n'? "" : "\n") <<
"#line " << directiveLoc.line + forNextLine << " " << directiveLoc.getStringNameOrNum() << "\n";
pushInput(new TokenizableIncludeFile(directiveLoc, prologue.str(), res, epilogue.str(), this));
// There's no "current" location anymore.
parseContext.setCurrentColumn(0);
} else {
// things are okay, but there is nothing to process
@ -635,7 +636,7 @@ int TPpContext::CPPinclude(TPpToken* ppToken)
}
// Handle #line
int TPpContext::CPPline(TPpToken* ppToken)
int TPpContext::CPPline(TPpToken* ppToken)
{
// "#line must have, after macro substitution, one of the following forms:
// "#line line
@ -693,7 +694,7 @@ int TPpContext::CPPline(TPpToken* ppToken)
}
// Handle #error
int TPpContext::CPPerror(TPpToken* ppToken)
int TPpContext::CPPerror(TPpToken* ppToken)
{
int token = scanToken(ppToken);
std::string message;
@ -870,7 +871,7 @@ int TPpContext::readCPPline(TPpToken* ppToken)
if (elseSeen[elsetracker])
parseContext.ppError(ppToken->loc, "#elif after #else", "#elif", "");
// this token is really a dont care, but we still need to eat the tokens
token = scanToken(ppToken);
token = scanToken(ppToken);
while (token != '\n' && token != EndOfInput)
token = scanToken(ppToken);
token = CPPelse(0, ppToken);
@ -1004,7 +1005,7 @@ TPpContext::TokenStream* TPpContext::PrescanMacroArg(TokenStream& arg, TPpToken*
return expandedArg;
}
//
//
// Return the next token for a macro expansion, handling macro arguments,
// whose semantics are dependent on being adjacent to ##.
//
@ -1113,7 +1114,7 @@ int TPpContext::tZeroInput::scan(TPpToken* ppToken)
// Check a token to see if it is a macro that should be expanded.
// If it is, and defined, push a tInput that will produce the appropriate expansion
// and return 1.
// If it is, but undefined, and expandUndef is requested, push a tInput that will
// If it is, but undefined, and expandUndef is requested, push a tInput that will
// expand to 0 and return -1.
// Otherwise, return 0 to indicate no expansion, which is not necessarily an error.
//

View file

@ -57,7 +57,7 @@ Except as expressly stated in this notice, no other rights or licenses
express or implied, are granted by NVIDIA herein, including but not
limited to any patent rights that may be infringed by your derivative
works or by other works in which the NVIDIA Software may be
incorporated. No hardware is licensed hereunder.
incorporated. No hardware is licensed hereunder.
THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,

View file

@ -57,7 +57,7 @@ Except as expressly stated in this notice, no other rights or licenses
express or implied, are granted by NVIDIA herein, including but not
limited to any patent rights that may be infringed by your derivative
works or by other works in which the NVIDIA Software may be
incorporated. No hardware is licensed hereunder.
incorporated. No hardware is licensed hereunder.
THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
@ -82,7 +82,7 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace glslang {
TPpContext::TPpContext(TParseContextBase& pc, const std::string& rootFileName, TShader::Includer& inclr) :
TPpContext::TPpContext(TParseContextBase& pc, const std::string& rootFileName, TShader::Includer& inclr) :
preamble(0), strings(0), previous_token('\n'), parseContext(pc), includer(inclr), inComment(false),
rootFileName(rootFileName),
currentSourceFile(rootFileName)

View file

@ -56,7 +56,7 @@ Except as expressly stated in this notice, no other rights or licenses
express or implied, are granted by NVIDIA herein, including but not
limited to any patent rights that may be infringed by your derivative
works or by other works in which the NVIDIA Software may be
incorporated. No hardware is licensed hereunder.
incorporated. No hardware is licensed hereunder.
THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
@ -94,7 +94,7 @@ class TPpToken {
public:
TPpToken() : space(false), ival(0), dval(0.0), i64val(0)
{
loc.init();
loc.init();
name[0] = 0;
}
@ -287,7 +287,7 @@ protected:
static const int maxIfNesting = 64;
int ifdepth; // current #if-#else-#endif nesting in the cpp.c file (pre-processor)
int ifdepth; // current #if-#else-#endif nesting in the cpp.c file (pre-processor)
bool elseSeen[maxIfNesting]; // Keep a track of whether an else has been seen at a particular depth
int elsetracker; // #if-#else and #endif constructs...Counter.
@ -359,11 +359,11 @@ protected:
int extraTokenCheck(int atom, TPpToken* ppToken, int token);
int eval(int token, int precedence, bool shortCircuit, int& res, bool& err, TPpToken * ppToken);
int evalToToken(int token, bool shortCircuit, int& res, bool& err, TPpToken * ppToken);
int CPPif (TPpToken * ppToken);
int CPPif (TPpToken * ppToken);
int CPPifdef(int defined, TPpToken * ppToken);
int CPPinclude(TPpToken * ppToken);
int CPPline(TPpToken * ppToken);
int CPPerror(TPpToken * ppToken);
int CPPline(TPpToken * ppToken);
int CPPerror(TPpToken * ppToken);
int CPPpragma(TPpToken * ppToken);
int CPPversion(TPpToken * ppToken);
int CPPextension(TPpToken * ppToken);
@ -383,7 +383,7 @@ protected:
int ReadToken(TokenStream&, TPpToken*);
void pushTokenStreamInput(TokenStream&, bool pasting = false);
void UngetToken(int token, TPpToken*);
class tTokenInput : public tInput {
public:
tTokenInput(TPpContext* pp, TokenStream* t, bool prepasting) : tInput(pp), tokens(t), lastTokenPastes(prepasting) { }
@ -441,7 +441,7 @@ protected:
return '\\';
} while (ch == '\\');
}
// handle any non-escaped newline
if (ch == '\r' || ch == '\n') {
if (ch == '\r' && input->peek() == '\n')
@ -486,7 +486,7 @@ protected:
TInputScanner* input;
};
// Holds a reference to included file data, as well as a
// Holds a reference to included file data, as well as a
// prologue and an epilogue string. This can be scanned using the tInput
// interface and acts as a single source string.
class TokenizableIncludeFile : public tInput {

View file

@ -57,7 +57,7 @@ Except as expressly stated in this notice, no other rights or licenses
express or implied, are granted by NVIDIA herein, including but not
limited to any patent rights that may be infringed by your derivative
works or by other works in which the NVIDIA Software may be
incorporated. No hardware is licensed hereunder.
incorporated. No hardware is licensed hereunder.
THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,

View file

@ -57,7 +57,7 @@ Except as expressly stated in this notice, no other rights or licenses
express or implied, are granted by NVIDIA herein, including but not
limited to any patent rights that may be infringed by your derivative
works or by other works in which the NVIDIA Software may be
incorporated. No hardware is licensed hereunder.
incorporated. No hardware is licensed hereunder.
THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
@ -224,7 +224,7 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
parseContext.ppError(ppToken->loc, "float literal too long", "", "");
len = 1,str_len=1;
}
} else
} else
ungetChar();
str[len]='\0';

View file

@ -57,7 +57,7 @@ Except as expressly stated in this notice, no other rights or licenses
express or implied, are granted by NVIDIA herein, including but not
limited to any patent rights that may be infringed by your derivative
works or by other works in which the NVIDIA Software may be
incorporated. No hardware is licensed hereunder.
incorporated. No hardware is licensed hereunder.
THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,

View file

@ -57,7 +57,7 @@ Except as expressly stated in this notice, no other rights or licenses
express or implied, are granted by NVIDIA herein, including but not
limited to any patent rights that may be infringed by your derivative
works or by other works in which the NVIDIA Software may be
incorporated. No hardware is licensed hereunder.
incorporated. No hardware is licensed hereunder.
THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,

View file

@ -56,7 +56,7 @@ Except as expressly stated in this notice, no other rights or licenses
express or implied, are granted by NVIDIA herein, including but not
limited to any patent rights that may be infringed by your derivative
works or by other works in which the NVIDIA Software may be
incorporated. No hardware is licensed hereunder.
incorporated. No hardware is licensed hereunder.
THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
@ -128,7 +128,7 @@ enum EFixedAtoms {
#endif
PpAtomConstString,
// Identifiers
// Identifiers
PpAtomIdentifier,
// preprocessor "keywords"