comment.frag\r
Warning, version 430 is not yet complete; some version-specific features are present, but many are missing.\r
+WARNING: 0:10: 'line continuation' : used at end of comment; the following line is still part of the comment \r
+WARNING: 0:12: 'line continuation' : used at end of comment; the following line is still part of the comment \r
\r
0:? Sequence\r
0:17 Function Definition: main( (void)\r
lineContinuation.vert\r
+WARNING: 0:3: 'line continuation' : used at end of comment; the following line is still part of the comment \r
ERROR: 0:6: '#error' : e1 \r
ERROR: 0:11: '#error' : e2 \r
ERROR: 0:18: '#error' : e3 \r
0:25 'b' (highp 4-component vector of float)\r
0:? Linker Objects\r
0:? 'foo' (highp float)\r
+0:? 'goodDecl' (highp int)\r
0:? 'gl_VertexID' (gl_VertexId highp int)\r
0:? 'gl_InstanceID' (gl_InstanceId highp int)\r
\r
lineContinuation100.vert\r
-ERROR: 0:3: 'line continuation' : not supported for this version or the enabled extensions \r
-ERROR: 0:6: '#error' : e1 \r
+WARNING: 0:3: 'line continuation' : used at end of comment, but this version does not provide line continuation \r
+ERROR: 0:4: '#error' : good error \r
ERROR: 0:8: 'line continuation' : not supported for this version or the enabled extensions \r
ERROR: 0:11: '#error' : e2 \r
ERROR: 0:13: 'line continuation' : not supported for this version or the enabled extensions \r
ERROR: 0:15: 'line continuation' : not supported for this version or the enabled extensions \r
ERROR: 0:18: '#error' : e3 \r
ERROR: 0:24: 'line continuation' : not supported for this version or the enabled extensions \r
-ERROR: 9 compilation errors. No code generated.\r
+ERROR: 8 compilation errors. No code generated.\r
\r
\r
ERROR: node is still EOpNull!\r
// aoeuntheo unatehutna \ antaehnathe
// anteonuth $ natohe " '
// anteonuth natohe
+
+#define FOO int /* \
+*/ goodDecl;
+
+FOO
+
#version 100\r
\r
-// this file cont\\r
-ains no errors other than the #error which are there to see if line numbering for errors is correct\r
+// non-line continuation comment \\r
+#error good error\r
+\r
\r
-#error e1\r
\r
float f\\r
oo; // same as 'float foo;'\r
// source have to figure out how to create revision.h just to get a build\r
// going. However, if it is not updated, it can be a version behind.\r
\r
-#define GLSLANG_REVISION "24390"\r
-#define GLSLANG_DATE "2013/12/06 11:19:22"\r
+#define GLSLANG_REVISION "24391"\r
+#define GLSLANG_DATE "2013/12/06 11:24:47"\r
//
// See if this version/profile allows use of the line-continuation character '\'.
//
-void TParseContext::lineContinuationCheck(TSourceLoc loc)
+bool TParseContext::lineContinuationCheck(TSourceLoc loc, bool endOfComment)
{
- if ((profile == EEsProfile && version >= 300) ||
- (profile != EEsProfile && version >= 420))
- return;
-
const char* message = "line continuation";
+
+ bool lineContinuationAllowed = (profile == EEsProfile && version >= 300) ||
+ (profile != EEsProfile && version >= 420);
+
+ if (endOfComment) {
+ if (lineContinuationAllowed)
+ warn(loc, "used at end of comment; the following line is still part of the comment", message, "");
+ else
+ warn(loc, "used at end of comment, but this version does not provide line continuation", message, "");
+
+ return lineContinuationAllowed;
+ }
+
if (messages & EShMsgRelaxedErrors) {
warn(loc, "not allowed in this version", message, "");
} else {
const char *szExtraInfoFormat, ...);
bool reservedErrorCheck(TSourceLoc, const TString&);
void reservedPpErrorCheck(TSourceLoc, const char* name, const char* op);
- void lineContinuationCheck(TSourceLoc);
+ bool lineContinuationCheck(TSourceLoc, bool endOfComment);
bool builtInName(const TString&);
void handlePragma(TSourceLoc, const TVector<TString>&);
mac.body = new TokenStream;
while (token != '\n') {
if (token == '\\') {
- parseContext.lineContinuationCheck(ppToken->loc);
+ parseContext.lineContinuationCheck(ppToken->loc, false);
token = currentInput->scan(this, currentInput, ppToken);
if (token == '\n' || token == '\r')
token = currentInput->scan(this, currentInput, ppToken);
do {
if (ch == '\\') {
// escaped character
- pp->parseContext.lineContinuationCheck(ppToken->loc);
+ pp->parseContext.lineContinuationCheck(ppToken->loc, false);
ch = pp->currentInput->getch(pp, pp->currentInput, ppToken);
if (ch == '\r' || ch == '\n') {
int nextch = pp->currentInput->getch(pp, pp->currentInput, ppToken);
// allow an escaped newline, otherwise escapes in comments are meaningless
ch = pp->currentInput->getch(pp, pp->currentInput, ppToken);
if (ch == '\r' || ch == '\n') {
- pp->parseContext.lineContinuationCheck(ppToken->loc);
- int nextch = pp->currentInput->getch(pp, pp->currentInput, ppToken);
- if (ch == '\r' && nextch == '\n')
- ch = pp->currentInput->getch(pp, pp->currentInput, ppToken);
- else
- ch = nextch;
+ if (! pp->parseContext.lineContinuationCheck(ppToken->loc, true))
+ pp->currentInput->ungetch(pp, pp->currentInput, ch, ppToken);
+ else {
+ int nextch = pp->currentInput->getch(pp, pp->currentInput, ppToken);
+ if (ch == '\r' && nextch == '\n')
+ ch = pp->currentInput->getch(pp, pp->currentInput, ppToken);
+ else
+ ch = nextch;
+ }
}
}
} while (ch != '\n' && ch != EOF);
ch = pp->currentInput->getch(pp, pp->currentInput, ppToken);
while (ch != '"' && ch != '\n' && ch != EOF) {
if (ch == '\\') {
- pp->parseContext.lineContinuationCheck(ppToken->loc);
+ pp->parseContext.lineContinuationCheck(ppToken->loc, false);
ch = pp->currentInput->getch(pp, pp->currentInput, ppToken);
if (ch == '\n' || ch == '\r' || ch == EOF)
break;