gfx/angle/src/compiler/preprocessor/DiagnosticsBase.cpp

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 //
     2 // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
     3 // Use of this source code is governed by a BSD-style license that can be
     4 // found in the LICENSE file.
     5 //
     7 #include "DiagnosticsBase.h"
     9 #include <cassert>
    11 namespace pp
    12 {
    14 Diagnostics::~Diagnostics()
    15 {
    16 }
    18 void Diagnostics::report(ID id,
    19                          const SourceLocation& loc,
    20                          const std::string& text)
    21 {
    22     // TODO(alokp): Keep a count of errors and warnings.
    23     print(id, loc, text);
    24 }
    26 Diagnostics::Severity Diagnostics::severity(ID id)
    27 {
    28     if ((id > ERROR_BEGIN) && (id < ERROR_END))
    29         return ERROR;
    31     if ((id > WARNING_BEGIN) && (id < WARNING_END))
    32         return WARNING;
    34     assert(false);
    35     return ERROR;
    36 }
    38 std::string Diagnostics::message(ID id)
    39 {
    40     switch (id)
    41     {
    42       // Errors begin.
    43       case INTERNAL_ERROR:
    44           return "internal error";
    45       case OUT_OF_MEMORY:
    46           return "out of memory";
    47       case INVALID_CHARACTER:
    48           return "invalid character";
    49       case INVALID_NUMBER:
    50           return "invalid number";
    51       case INTEGER_OVERFLOW:
    52           return "integer overflow";
    53       case FLOAT_OVERFLOW:
    54           return "float overflow";
    55       case TOKEN_TOO_LONG:
    56           return "token too long";
    57       case INVALID_EXPRESSION:
    58           return "invalid expression";
    59       case DIVISION_BY_ZERO:
    60           return "division by zero";
    61       case EOF_IN_COMMENT:
    62           return "unexpected end of file found in comment";
    63       case UNEXPECTED_TOKEN:
    64           return "unexpected token";
    65       case DIRECTIVE_INVALID_NAME:
    66           return "invalid directive name";
    67       case MACRO_NAME_RESERVED:
    68           return "macro name is reserved";
    69       case MACRO_REDEFINED:
    70           return "macro redefined";
    71       case MACRO_PREDEFINED_REDEFINED:
    72           return "predefined macro redefined";
    73       case MACRO_PREDEFINED_UNDEFINED:
    74           return "predefined macro undefined";
    75       case MACRO_UNTERMINATED_INVOCATION:
    76           return "unterminated macro invocation";
    77       case MACRO_TOO_FEW_ARGS:
    78           return "Not enough arguments for macro";
    79       case MACRO_TOO_MANY_ARGS:
    80           return "Too many arguments for macro";
    81       case CONDITIONAL_ENDIF_WITHOUT_IF:
    82           return "unexpected #endif found without a matching #if";
    83       case CONDITIONAL_ELSE_WITHOUT_IF:
    84           return "unexpected #else found without a matching #if";
    85       case CONDITIONAL_ELSE_AFTER_ELSE:
    86           return "unexpected #else found after another #else";
    87       case CONDITIONAL_ELIF_WITHOUT_IF:
    88           return "unexpected #elif found without a matching #if";
    89       case CONDITIONAL_ELIF_AFTER_ELSE:
    90           return "unexpected #elif found after #else";
    91       case CONDITIONAL_UNTERMINATED:
    92           return "unexpected end of file found in conditional block";
    93       case INVALID_EXTENSION_NAME:
    94           return "invalid extension name";
    95       case INVALID_EXTENSION_BEHAVIOR:
    96           return "invalid extension behavior";
    97       case INVALID_EXTENSION_DIRECTIVE:
    98           return "invalid extension directive";
    99       case INVALID_VERSION_NUMBER:
   100           return "invalid version number";
   101       case INVALID_VERSION_DIRECTIVE:
   102           return "invalid version directive";
   103       case VERSION_NOT_FIRST_STATEMENT:
   104         return "#version directive must occur before anything else, "
   105                "except for comments and white space";
   106       case INVALID_LINE_NUMBER:
   107           return "invalid line number";
   108       case INVALID_FILE_NUMBER:
   109           return "invalid file number";
   110       case INVALID_LINE_DIRECTIVE:
   111           return "invalid line directive";
   112       // Errors end.
   113       // Warnings begin.
   114       case EOF_IN_DIRECTIVE:
   115           return "unexpected end of file found in directive";
   116       case CONDITIONAL_UNEXPECTED_TOKEN:
   117           return "unexpected token after conditional expression";
   118       case UNRECOGNIZED_PRAGMA:
   119           return "unrecognized pragma";
   120       // Warnings end.
   121       default:
   122           assert(false);
   123           return "";
   124     }
   125 }
   127 }  // namespace pp

mercurial