src/tests/preprocessor_tests/define_test.cpp


Log

Author Commit Date CI Message
Jamie Madill c09ae15c 2019-02-01T14:16:32 Enable -Wextra-semi and -Wextra-semi-stmt. This will prevent users from accidentally making semicolon errors in the future. Bug: chromium:926235 Change-Id: I79a6fa376fb1ad8f0fcf1b65b1f572a035d1f4e9 Reviewed-on: https://chromium-review.googlesource.com/c/1446493 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Nico Weber <thakis@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill b980c563 2018-11-27T11:34:27 Reformat all cpp and h files. This applies git cl format --full to all ANGLE sources. Bug: angleproject:2986 Change-Id: Ib504e618c1589332a37e97696cdc3515d739308f Reviewed-on: https://chromium-review.googlesource.com/c/1351367 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Jamie Madill c3bef3e7 2018-10-03T07:35:09 Allow 'defined' in define in non-WebGL. This is needed to pass dEQP conformance. Several of the harder dEQP tests around this behaviour are excluded from the mustpass list. This is presumably because the behaviours weren't implemented portably. Nevertheless we need to support conformant behaviour for GLES 2.0 Contexts for the most simple uses. This also leaves the error behaviour intact for WebGL specs. Bug: angleproject:1335 Change-Id: Ia80b4f71475efa928488ee6c2ee35c566d4602d4 Reviewed-on: https://chromium-review.googlesource.com/c/1242013 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Geoff Lang 197d5294 2018-04-25T14:29:00 Wrap all preprocessor code in the angle namespace. BUG=836820 BUG=801364 Change-Id: I08b6a2f9f12b689e09df6efd916c313e71e8a051 Reviewed-on: https://chromium-review.googlesource.com/1028581 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Olli Etuaho 47c27e82 2017-01-17T15:29:35 Manage preprocessor Macro objects with shared pointers This ensures that pointers to Macros that are removed from the macro set stay valid. Pointers to undef'd macros may need to be referred to if reenabling the macros has been deferred. BUG=chromium:681324 TEST=angle_unittests Change-Id: Ibbbabbcbd6b0a84254cda717ae63712e6d404ebd Reviewed-on: https://chromium-review.googlesource.com/427948 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho f1cf5e63 2016-11-22T17:36:49 Prevent stack overflow in macro expansion Add a configurable limit for how many nested MacroExpander objects can be created in the preprocessor, so that stack overflow can be prevented in case of malicious shaders. By default the limit is set to 1000. In unit tests the limit is set lower to make the test run faster. Includes refactoring of most of the preprocessor tests so that they use utility functions provided by the test class instead of repeating the same code for initializing the preprocessor. BUG=angleproject:1600 TEST=angle_unittests Change-Id: I23b5140d9f2dc52df96111650db63150f7238494 Reviewed-on: https://chromium-review.googlesource.com/413986 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Olli Etuaho 78b0c91d 2016-11-21T14:23:06 Fix infinite recursion in macro expansion BUG=angleproject:1600 TEST=angle_unittests Change-Id: I72bf81ec060f36255a0f13b132a4fd69b89672ff Reviewed-on: https://chromium-review.googlesource.com/412744 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Corentin Wallez 449a8030 2016-10-26T08:05:54 MacroExpander: bump expansionCount before peeking for "(" BUG=658555 Change-Id: I578b8aff37a116fd7b2b387388311a27bb8a2809 Reviewed-on: https://chromium-review.googlesource.com/403848 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Corentin Wallez d2f195b5 2016-09-19T15:53:33 preprocessor: Fix use after free when #undef the macro being invoked BUG=chromium:648031 BUG=angleproject:1522 Change-Id: I825cea9e736a2c99133408249cfcd525431d31de Reviewed-on: https://chromium-review.googlesource.com/386853 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 461e3af8 2016-07-21T18:15:34 preprocessor: Fix negative shift with bad ids. Fix this by producing an error on undefined or negative shifts. BUG=629518 Change-Id: Idfca5ed3fc8e557f6178408f3426a5ef2ce7cf14 Reviewed-on: https://chromium-review.googlesource.com/362020 Reviewed-by: Antoine Labour <piman@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Olli Etuaho 2f6ddf31 2015-09-22T16:10:07 Allow double underscore in macro names Double underscore is allowed according to GLSL ES 3.10, and based on Khronos discussions the intent is that this should also apply to older specs. The dEQP tests also check this, and WebGL tests that check the opposite were recently removed. The error is changed into a warning. BUG=angleproject:989 TEST=angle_unittests dEQP-GLES3.functional.shaders.preprocessor.* (2 tests start passing) dEQP-GLES2.functional.shaders.preprocessor.* (2 tests start passing) Change-Id: I582c01b4adc8fc416354351e02b776f2cc602408 Reviewed-on: https://chromium-review.googlesource.com/300965 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tryjob-Request: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho 261f5379 2015-09-18T10:34:31 Support parsing defined operator generated by macro expansion dEQP tests enforce that the defined operator should be parsed even when it is generated as a result of macro expansion, even though this is undefined according to the C++ preprocessor spec. Implement support for this by putting the parsing for the defined operator inside MacroExpander. The operator gets processed right after it is generated by macro expansion. Parsing the defined operator is toggled with a boolean according to the context where MacroExpander is used. BUG=angleproject:989 TEST=angle_unittests, dEQP-GLES3.functional.shaders.preprocessor.* - 2 tests start passing: dEQP-GLES3.functional.shaders.preprocessor.conditional_inclusion.basic_2* Change-Id: I780e63bd4558253657d898685d62339017564a06 Reviewed-on: https://chromium-review.googlesource.com/300970 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Olli Etuaho e6432c85 2015-09-08T14:21:38 Fix preprocessor macro replacement list location According to the dEQP tests, a macro replacement list generated by a function-like macro invocation should get its location from the closing parenthesis of the invocation. The tests check this by using __LINE__ in a macro with a multi-line invocation. It's not quite clear from the spec that the enforced behavior is expected as opposed to the replacement list getting its location from the macro name, but a minor correction to the preprocessor makes the dEQP tests pass. Newlines in the preprocessor unit tests are generated according to the source locations in the token list produced by the preprocessor, so the expectations of a few tests also need to be updated. BUG=angleproject:989 TEST=dEQP-GLES3.functional.shaders.preprocessor.predefined_macros.* (2 start passing with this change), angle_unittests Change-Id: I4cc9da09bd0985310a05ebf6def680916a46308a Reviewed-on: https://chromium-review.googlesource.com/297990 Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Corentin Wallez 2728f992 2015-08-31T16:24:10 Make unittest #includes start from src This is will help avoid adding many include directories for the GN build. BUG=angleproject:929 Change-Id: If8f7e98526df3560b8e410ec86271a2da0c6889d Reviewed-on: https://chromium-review.googlesource.com/296480 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Geoff Lang 4c8cae60 2015-05-01T16:46:16 Revert "Don't mark all macros with double underscores as reserved." Fails a WebGL CTS test. BUG=angleproject:989 This reverts commit 942e36254a1e3537371c39f3f23d1ce12f4c87e8. Change-Id: I9f833366d5b69535ef74e358ac21efaccb1f1a3d Reviewed-on: https://chromium-review.googlesource.com/268751 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang 942e3625 2015-04-30T11:00:01 Don't mark all macros with double underscores as reserved. Only __FILE__, __LINE__, __VERSION__ and GL_ES are reserved but it is still not recommended to use a name with double underscores because it may be used by the "underlying software layers". Updated the tests to reflect that it is OK to define macros with double underscores but it is not valid to make assumptions about their values. Fixes: dEQP-GLES2.functional.shaders.preprocessor.basic.identifier_with_double_underscore_vertex dEQP-GLES2.functional.shaders.preprocessor.basic.identifier_with_double_underscore_fragment BUG=angleproject:898 Change-Id: I77054d04c9935eedcdbb7304dc0c3b60b53994f9 Reviewed-on: https://chromium-review.googlesource.com/268434 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 559a2e8c 2015-03-16T17:25:51 Move the ANGLE tests project to src/ *re-re-land with fix for Chrome's angle tests* BUG=angleproject:945 Change-Id: I3c64e2edc776c299791440f65f22450855eb6dfa Reviewed-on: https://chromium-review.googlesource.com/260448 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 96e3f556 2015-03-16T21:24:20 Revert "Move the ANGLE tests project to src/" Still causing build issues on Chrome. This reverts commit 64a3b2a92fe3bbd28972638e6759fae0b98d81b9. Change-Id: I8d40fe3dfd0a877343357153a02b8ef66d571c64 Reviewed-on: https://chromium-review.googlesource.com/260425 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 64a3b2a9 2015-03-16T11:00:20 Move the ANGLE tests project to src/ *re-land with fix for Chromium build* BUG=angleproject:945 Change-Id: I82bff1760e681987fb26e479734aa62fb845898a Reviewed-on: https://chromium-review.googlesource.com/260362 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 5491fe66 2015-03-16T17:56:18 Revert "Move the ANGLE tests project to src/" Causing build break in Chromium. This reverts commit 71c2d85c4af2f6cb213d4f3e15f0ae16b63790f3. Change-Id: Iedf001c1f4c60a759f69009610fbce978d193d17 Reviewed-on: https://chromium-review.googlesource.com/260370 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 71c2d85c 2015-03-16T10:47:04 Move the ANGLE tests project to src/ BUG=angleproject:945 Change-Id: I2eb44ac43f65b916ddd838d39e6aae62580d7fa0 Reviewed-on: https://chromium-review.googlesource.com/258903 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Brandon Jones <bajones@chromium.org>