Hash :
93121f36
        
        Author :
  
        
        Date :
2019-10-17T08:18:16
        
      
Make invalid extension directive a CHROMEOS warning This change allows extension directive after ESSL1.0 non-preprocessor tokens on CHROMEOS. CHROMEOS kiosks have a video player that violates this spec requirement so just flagging as a warning to prevent failed video playback. Added ANGLE_PLATFORM_CHROMEOS define to build config in order to only make this a warning on CHROMEOS. Split the ESSL1 & ESSL3 cases back out as ESSL3 had always been an error on all platforms in the past and so want to keep it that way. Bug: 1003005 Bug: angleproject:4023 Change-Id: Ia931b3a8dad82dbda4c9c9e49a9c1090116397b5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1866464 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Tobin Ehlis <tobine@google.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
//
// Copyright 2012 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#include "compiler/preprocessor/DiagnosticsBase.h"
#include "common/debug.h"
namespace angle
{
namespace pp
{
Diagnostics::~Diagnostics() {}
void Diagnostics::report(ID id, const SourceLocation &loc, const std::string &text)
{
    print(id, loc, text);
}
bool Diagnostics::isError(ID id)
{
    if ((id > PP_ERROR_BEGIN) && (id < PP_ERROR_END))
        return true;
    if ((id > PP_WARNING_BEGIN) && (id < PP_WARNING_END))
        return false;
    UNREACHABLE();
    return true;
}
const char *Diagnostics::message(ID id)
{
    switch (id)
    {
        // Errors begin.
        case PP_INTERNAL_ERROR:
            return "internal error";
        case PP_OUT_OF_MEMORY:
            return "out of memory";
        case PP_INVALID_CHARACTER:
            return "invalid character";
        case PP_INVALID_NUMBER:
            return "invalid number";
        case PP_INTEGER_OVERFLOW:
            return "integer overflow";
        case PP_FLOAT_OVERFLOW:
            return "float overflow";
        case PP_TOKEN_TOO_LONG:
            return "token too long";
        case PP_INVALID_EXPRESSION:
            return "invalid expression";
        case PP_DIVISION_BY_ZERO:
            return "division by zero";
        case PP_EOF_IN_COMMENT:
            return "unexpected end of file found in comment";
        case PP_UNEXPECTED_TOKEN:
            return "unexpected token";
        case PP_DIRECTIVE_INVALID_NAME:
            return "invalid directive name";
        case PP_MACRO_NAME_RESERVED:
            return "macro name is reserved";
        case PP_MACRO_REDEFINED:
            return "macro redefined";
        case PP_MACRO_PREDEFINED_REDEFINED:
            return "predefined macro redefined";
        case PP_MACRO_PREDEFINED_UNDEFINED:
            return "predefined macro undefined";
        case PP_MACRO_UNTERMINATED_INVOCATION:
            return "unterminated macro invocation";
        case PP_MACRO_UNDEFINED_WHILE_INVOKED:
            return "macro undefined while being invoked";
        case PP_MACRO_TOO_FEW_ARGS:
            return "Not enough arguments for macro";
        case PP_MACRO_TOO_MANY_ARGS:
            return "Too many arguments for macro";
        case PP_MACRO_DUPLICATE_PARAMETER_NAMES:
            return "duplicate macro parameter name";
        case PP_MACRO_INVOCATION_CHAIN_TOO_DEEP:
            return "macro invocation chain too deep";
        case PP_CONDITIONAL_ENDIF_WITHOUT_IF:
            return "unexpected #endif found without a matching #if";
        case PP_CONDITIONAL_ELSE_WITHOUT_IF:
            return "unexpected #else found without a matching #if";
        case PP_CONDITIONAL_ELSE_AFTER_ELSE:
            return "unexpected #else found after another #else";
        case PP_CONDITIONAL_ELIF_WITHOUT_IF:
            return "unexpected #elif found without a matching #if";
        case PP_CONDITIONAL_ELIF_AFTER_ELSE:
            return "unexpected #elif found after #else";
        case PP_CONDITIONAL_UNTERMINATED:
            return "unexpected end of file found in conditional block";
        case PP_INVALID_EXTENSION_NAME:
            return "invalid extension name";
        case PP_INVALID_EXTENSION_BEHAVIOR:
            return "invalid extension behavior";
        case PP_INVALID_EXTENSION_DIRECTIVE:
            return "invalid extension directive";
        case PP_INVALID_VERSION_NUMBER:
            return "invalid version number";
        case PP_INVALID_VERSION_DIRECTIVE:
            return "invalid version directive";
        case PP_VERSION_NOT_FIRST_STATEMENT:
            return "#version directive must occur before anything else, "
                   "except for comments and white space";
        case PP_VERSION_NOT_FIRST_LINE_ESSL3:
            return "#version directive must occur on the first line of the shader";
        case PP_INVALID_LINE_NUMBER:
            return "invalid line number";
        case PP_INVALID_FILE_NUMBER:
            return "invalid file number";
        case PP_INVALID_LINE_DIRECTIVE:
            return "invalid line directive";
        case PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL1:
            return "extension directive must occur before any non-preprocessor tokens in ESSL1";
        case PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL3:
            return "extension directive must occur before any non-preprocessor tokens in ESSL3";
        case PP_UNDEFINED_SHIFT:
            return "shift exponent is negative or undefined";
        case PP_TOKENIZER_ERROR:
            return "internal tokenizer error";
        // Errors end.
        // Warnings begin.
        case PP_EOF_IN_DIRECTIVE:
            return "unexpected end of file found in directive";
        case PP_CONDITIONAL_UNEXPECTED_TOKEN:
            return "unexpected token after conditional expression";
        case PP_UNRECOGNIZED_PRAGMA:
            return "unrecognized pragma";
        case PP_NON_PP_TOKEN_BEFORE_EXTENSION_WEBGL:
            return "extension directive should occur before any non-preprocessor tokens";
        case PP_WARNING_MACRO_NAME_RESERVED:
            return "macro name with a double underscore is reserved - unintented behavior is "
                   "possible";
        // Warnings end.
        default:
            UNREACHABLE();
            return "";
    }
}
}  // namespace pp
}  // namespace angle