Remove extraInfo parameter from compiler diagnostic functions

This makes error messages more consistent. It was not clear what was
supposed to go to the extraInfo parameter, and previously it was
mostly being misused, resulting in poorly formatted error messages.
Sometimes the order of parameters to the diagnostic functions like
error() and warning() was wrong altogether. The diagnostics API is
simpler when there's only the "reason" and "token" parameters that
have clear meaning and that are separated by consistent punctuation
in the output.

Fixes error messages like

"redifinition interface block member"

to be grammatically reasonable like the rest of the error messages. For
other error messages, punctuation is added to make them clearer. Example:

"invalid layout qualifier location requires an argument"

is changed to

"invalid layout qualifier: location requires an argument".

Extra spaces are also removed from the beginning of error messages.

BUG=angleproject:1670
BUG=angleproject:911
TEST=angle_unittests

Change-Id: Id5fb1a1f2892fad2b796aaef47ffb07e9d79759c
Reviewed-on: https://chromium-review.googlesource.com/420789
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/Diagnostics.cpp b/src/compiler/translator/Diagnostics.cpp
index b365dd0..256c938 100644
--- a/src/compiler/translator/Diagnostics.cpp
+++ b/src/compiler/translator/Diagnostics.cpp
@@ -26,8 +26,7 @@
 void TDiagnostics::writeInfo(Severity severity,
                              const pp::SourceLocation &loc,
                              const std::string &reason,
-                             const std::string &token,
-                             const std::string &extra)
+                             const std::string &token)
 {
     TPrefixType prefix = EPrefixNone;
     switch (severity)
@@ -49,39 +48,28 @@
     /* VC++ format: file(linenum) : error #: 'token' : extrainfo */
     sink.prefix(prefix);
     sink.location(loc.file, loc.line);
-    sink << "'" << token << "' : " << reason << " " << extra << "\n";
-}
-
-void TDiagnostics::error(const TSourceLoc &loc,
-                         const char *reason,
-                         const char *token,
-                         const char *extraInfo)
-{
-    pp::SourceLocation srcLoc;
-    srcLoc.file = loc.first_file;
-    srcLoc.line = loc.first_line;
-    writeInfo(pp::Diagnostics::PP_ERROR, srcLoc, reason, token, extraInfo);
+    sink << "'" << token << "' : " << reason << "\n";
 }
 
 void TDiagnostics::error(const TSourceLoc &loc, const char *reason, const char *token)
 {
-    error(loc, reason, token, "");
+    pp::SourceLocation srcLoc;
+    srcLoc.file = loc.first_file;
+    srcLoc.line = loc.first_line;
+    writeInfo(pp::Diagnostics::PP_ERROR, srcLoc, reason, token);
 }
 
-void TDiagnostics::warning(const TSourceLoc &loc,
-                           const char *reason,
-                           const char *token,
-                           const char *extraInfo)
+void TDiagnostics::warning(const TSourceLoc &loc, const char *reason, const char *token)
 {
     pp::SourceLocation srcLoc;
     srcLoc.file = loc.first_file;
     srcLoc.line = loc.first_line;
-    writeInfo(pp::Diagnostics::PP_WARNING, srcLoc, reason, token, extraInfo);
+    writeInfo(pp::Diagnostics::PP_WARNING, srcLoc, reason, token);
 }
 
 void TDiagnostics::print(ID id, const pp::SourceLocation &loc, const std::string &text)
 {
-    writeInfo(severity(id), loc, message(id), text, "");
+    writeInfo(severity(id), loc, message(id), text);
 }
 
 }  // namespace sh