src/compiler/translator/glslang_lex.cpp


Log

Author Commit Date CI Message
Olli Etuaho f541f529 2015-10-13T12:21:01 Fix parsing integers larger than 0x7FFFFFFF Parsing should accept all values between 0 and 0xFFFFFFFF as specified in ESSL 3.00 section 4.1.3. When a signed literal is parsed, it's interpreted as if it specifies the bit pattern of a two's complement integer. For example, parsing "0xFFFFFFFF" results in -1. Decimal literals behave the same way, so for example parsing "3000000000" results in -1294967296. This change affects parsing of literals in ESSL 1.00 as well. In ESSL 3.00, an out-of-range integer literal now generates a compiler error. Unit tests are added based on examples in the ESSL 3.00 spec and one example in GLSL 4.5 spec that ESSL should match. BUG=541550 TEST=angle_unittests Change-Id: I82f8ef5cfa2881019a3f80d77ff99707d61c000d Reviewed-on: https://chromium-review.googlesource.com/305420 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@google.com>
Corentin Wallez e2adce1b 2015-06-19T23:06:32 Workaround for some STLs not parsing floats with a suffix BUG=angleproject:1046 BUG=angleproject:891 Change-Id: I01c3f024142e573385a5f40d721171ad752ffd19 Reviewed-on: https://chromium-review.googlesource.com/278210 Reviewed-by: Brandon Jones <bajones@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Jamie Madill 6e06b1f4 2015-05-14T10:01:17 Make TParseContext a class, with private data. *re-land with build fix* BUG=angleproject:995 Change-Id: I67d3ded8f6c705b54fb372857e07ce1a86b58475 Reviewed-on: https://chromium-review.googlesource.com/271162 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Jamie Madill 749fe340 2015-05-13T21:07:55 Revert "Make TParseContext a class, with private data." Causing build errors on Linux: FAILED: ninja -t msvc -e environment.x86 -- C:\b\build\goma/gomacc "C:\b\depot_tools\win_toolchain\vs2013_files\VC\bin\amd64_x86\cl.exe" /nologo /showIncludes /FC @obj\third_party\angle\src\compiler\translator\translator_lib.ParseContext.obj.rsp /c ..\..\third_party\angle\src\compiler\translator\ParseContext.cpp /Foobj\third_party\angle\src\compiler\translator\translator_lib.ParseContext.obj /Fdobj\third_party\angle\src\translator_lib.cc.pdb c:\b\build\slave\gpu_win_builder__dbg_\build\src\third_party\angle\src\compiler\translator\validateglobalinitializer.h(11) : error C2220: warning treated as error - no 'object' file generated c:\b\build\slave\gpu_win_builder__dbg_\build\src\third_party\angle\src\compiler\translator\validateglobalinitializer.h(11) : warning C4099: 'TParseContext' : type name first seen using 'class' now seen using 'struct' c:\b\build\slave\gpu_win_builder__dbg_\build\src\third_party\angle\src\compiler\translator\parsecontext.h(28) : see declaration of 'TParseContext' BUG=angleproject:995 This reverts commit 6c0c2987fba9dcf2a8d432534c9548092281bfa4. Change-Id: I49a8b7df9bc8b7c4892bf3af5e2c7a6444fba890 Reviewed-on: https://chromium-review.googlesource.com/270767 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 6c0c2987 2015-05-13T13:50:04 Make TParseContext a class, with private data. BUG=angleproject:995 Change-Id: Ie077e3a4f0fd5ef840aa35edeb41d15a98b7c0ff Reviewed-on: https://chromium-review.googlesource.com/270628 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 2dc8bf8b 2015-04-30T15:56:52 translator: Fix C++11-deprecated register usage. Define 'register' as an empty string if we're in a modern version of C++. BUG=255186 BUG=angleproject:463 Change-Id: Ied044fb87a9b05c91cb419c54295c39f0f0ab776 Reviewed-on: https://chromium-review.googlesource.com/268512 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Jamie Madill b96687df 2015-04-30T15:56:51 translator: Regenerate with Bison 3.0.4. BUG=angleproject:463 Change-Id: If89a29de8fb006e8e3b0483ac5df21c8833ce974 Reviewed-on: https://chromium-review.googlesource.com/268511 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Scott Graham a825fdce 2015-04-14T16:05:47 Disable macro redefinition warning for vs2015 From flexint.h (because VS2015 has some of c99, but doesn't define __STDC_VERSION__ yet. Change-Id: Iff82f4c72dd816dcc1959abb218442a848ea592a c:\program files (x86)\microsoft visual studio 14.0\vc\include\stdint.h(48): error C2220: warning treated as error - no 'object' file generated c:\program files (x86)\microsoft visual studio 14.0\vc\include\stdint.h(48): warning C4005: 'INT8_MIN': macro redefinition d:\src\cr3\src\out\debug\glslang_lex.cpp(83): note: see previous definition of 'INT8_MIN' c:\program files (x86)\microsoft visual studio 14.0\vc\include\stdint.h(49): warning C4005: 'INT16_MIN': macro redefinition d:\src\cr3\src\out\debug\glslang_lex.cpp(86): note: see previous definition of 'INT16_MIN' c:\program files (x86)\microsoft visual studio 14.0\vc\include\stdint.h(50): warning C4005: 'INT32_MIN': macro redefinition d:\src\cr3\src\out\debug\glslang_lex.cpp(89): note: see previous definition of 'INT32_MIN' c:\program files (x86)\microsoft visual studio 14.0\vc\include\stdint.h(52): warning C4005: 'INT8_MAX': macro redefinition d:\src\cr3\src\out\debug\glslang_lex.cpp(92): note: see previous definition of 'INT8_MAX' c:\program files (x86)\microsoft visual studio 14.0\vc\include\stdint.h(53): warning C4005: 'INT16_MAX': macro redefinition d:\src\cr3\src\out\debug\glslang_lex.cpp(95): note: see previous definition of 'INT16_MAX' c:\program files (x86)\microsoft visual studio 14.0\vc\include\stdint.h(54): warning C4005: 'INT32_MAX': macro redefinition d:\src\cr3\src\out\debug\glslang_lex.cpp(98): note: see previous definition of 'INT32_MAX' c:\program files (x86)\microsoft visual studio 14.0\vc\include\stdint.h(56): warning C4005: 'UINT8_MAX': macro redefinition d:\src\cr3\src\out\debug\glslang_lex.cpp(101): note: see previous definition of 'UINT8_MAX' c:\program files (x86)\microsoft visual studio 14.0\vc\include\stdint.h(57): warning C4005: 'UINT16_MAX': macro redefinition d:\src\cr3\src\out\debug\glslang_lex.cpp(104): note: see previous definition of 'UINT16_MAX' c:\program files (x86)\microsoft visual studio 14.0\vc\include\stdint.h(58): warning C4005: 'UINT32_MAX': macro redefinition d:\src\cr3\src\out\debug\glslang_lex.cpp(107): note: see previous definition of 'UINT32_MAX' Reviewed-on: https://chromium-review.googlesource.com/265594 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho e16eae36 2015-04-10T11:48:55 Fix structQualifierErrorCheck calls in glslang.y structQualifierErrorCheck is called incorrectly in glslang.y. Remove one unnecessary call entirely and change another call to samplerErrorCheck. This will enable further changes to merge structQualifierErrorCheck into singleDeclarationErrorCheck. TEST=angle_unittests BUG=angleproject:969 Change-Id: Ib43233e275fbf4db7e5fda6df6b45a655bdee8a2 Reviewed-on: https://chromium-review.googlesource.com/265200 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Minmin Gong 794e0009 2015-04-07T18:31:54 Fix and enable warning C4244 (Conversion from 'type1' to 'type2', possible loss of data) Change-Id: Id0e06d7d6600344d858f00dabc219d79289bbc82 Reviewed-on: https://chromium-review.googlesource.com/265020 Tested-by: Minmin Gong <mgong@microsoft.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill b3584fb4 2015-04-09T17:34:21 Revert "Fix and enable warning C4244 (Conversion from 'type1' to 'type2', possible loss of data)" Causing a build failure on Mac/Clang: ./Tokenizer.cpp:551:7: error: extra tokens at end of #else directive [-Werror,-Wextra-tokens] #else if defined(_MSC_VER) http://build.chromium.org/p/chromium.gpu.fyi/builders/GPU%20Mac%20Builder/builds/29136 This reverts commit 3b26e231d99154814eb428f75a67bbe7a21adadc. Change-Id: I2d11ddcc18130d908fd2ec3d6f5ab890cfccd5e7 Reviewed-on: https://chromium-review.googlesource.com/264983 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Minmin Gong 3b26e231 2015-04-07T18:31:54 Fix and enable warning C4244 (Conversion from 'type1' to 'type2', possible loss of data) Change-Id: I73d9a2b9ad16f032be974b9c819de0dc1247c2ea Reviewed-on: https://chromium-review.googlesource.com/264533 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho f40319e9 2015-03-10T14:33:00 Add basic support for array constructors Add limited support for parsing array constructors and writing them out as GLSL code. Still missing from this version: HLSL output, array support in initializer lists, arrays with implicit size. BUG=angleproject:941 Change-Id: I7febf80923c4cd0b730399f1f49f9456cf3668e9 Reviewed-on: https://chromium-review.googlesource.com/260572 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Austin Kinross c8ef69d2 2015-03-18T16:43:22 Fix C4702 issues (unreachable code) in ANGLE, excluding <xtree> Change-Id: Ia7603139af266fd7b14efc8c3465225738456e67 Reviewed-on: https://chromium-review.googlesource.com/261038 Tested-by: Austin Kinross <aukinros@microsoft.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 2728eda4 2015-03-16T10:23:50 Revert "A special state to track field selection is not necessary." This reverts commit f8dc4fb66d2ee473b6ba37626f02756422863f6c. The special state to track field selection is actually necessary to avoid reduce/reduce conflicts when array constructors are added to the grammar. BUG=angleproject:941 TEST=WebGL conformance tests, angle_unittests Change-Id: I55476483c9e83241e8978cd58f05ef303c7c8680 Reviewed-on: https://chromium-review.googlesource.com/260260 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Nicolas Capens <capn@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Jamie Madill 185de884 2014-12-22T15:17:52 Update ANGLE's translator to Bison 3. BUG=angle:462 Change-Id: I2c1c18027dee1c3b4efb87374caaadbf58367841 Reviewed-on: https://chromium-review.googlesource.com/236930 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Zhenyao Mo 7faf1a14 2014-04-25T18:03:56 Fix a mem corruption in ANGLE translator. Basically outside TCompile::compile(), the global parse context is invalid, and should never be queried. BUG=angle:568 TEST=webgl conformance tests, no crash Change-Id: I5573ce2bf3bf838ab24f59dda00948f60a0b023d Reviewed-on: https://chromium-review.googlesource.com/197178 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Tested-by: Zhenyao Mo <zmo@chromium.org>
Jamie Madill 9f45240c 2014-04-11T14:17:34 Regenerate the compiled lexer. The lexer was missing some recent changes. BUG=angle:593 Change-Id: I8fa598e5a4ae35ebc9f9a48789632b6a326bc4d3 Reviewed-on: https://chromium-review.googlesource.com/194136 Reviewed-by: Nicolas Capens <nicolascapens@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 5c55caf3 2014-02-18T15:27:18 Fix bugged tokens marked as reserved/free in ES2. We had accidentally marked 'smoooth', 'centroid' and 'case' as reserved in ES2, when they are available as identifiers. Additionally 'sampler2DShadow' was marked as free, instead of reserved. BUG=angle:550 Change-Id: I33ec1b790ad5b4d9a6f4d2ea2e91cec1ca8e7320 Reviewed-on: https://chromium-review.googlesource.com/186970 Reviewed-by: Nicolas Capens <nicolascapens@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 6b9cb259 2013-10-17T10:45:47 Rename ParseHelper.cpp/h to ParseContext.cpp/h. TRAC #24002 Signed-off-by: Shannon Woods Signed-off-by: Geoff Lang
Geoff Lang 17732823 2013-08-29T13:46:49 Moved the compiler source files into directories based on their project and added a compiler.gypi to generate the compiler projects.