src/compiler/preprocessor/MacroExpander.cpp


Log

Author Commit Date CI Message
Stuart Morgan 9d737966 2019-08-14T12:25:12 Standardize copyright notices to project style For all "ANGLE Project" copyrights, standardize to the format specified by the style guide. Changes: - "Copyright (c)" and "Copyright(c)" changed to just "Copyright". - Removed the second half of date ranges ("Y1Y1-Y2Y2"->"Y1Y1"). - Fixed a small number of files that had no copyright date using the initial commit year from the version control history. - Fixed one instance of copyright being "The ANGLE Project" rather than "The ANGLE Project Authors" These changes are applied both to the copyright of source file, and where applicable to copyright statements that are generated by templates. BUG=angleproject:3811 Change-Id: I973dd65e4ef9deeba232d5be74c768256a0eb2e5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1754397 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jonah Ryan-Davis d4c09dd3 2019-01-29T11:22:54 Fix unnecessary copy of for loop variables in ANGLE Bug: angleproject:3075 Change-Id: I34dd5d4ecded6def5a2b46369277312af0de7c8c Reviewed-on: https://chromium-review.googlesource.com/c/1443572 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
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>
Jamie Madill acf2f3ad 2017-11-21T19:22:44 Apply Chromium style fixes. This addresses several minor code quality issues that are validated in Chromium, but not yet applied to ANGLE: * constructors and destructors must be defined out-of-line * auto is not allowed for simple pointer types * use override everywhere instead of virtual * virtual functions must also be defined out-of-line Slightly reduces binary size for me (~2k on Win, 150k on Linux). Bug: angleproject:1569 Change-Id: I073ca3365188caf5f29fb28d9eb207903c1843e6 Reviewed-on: https://chromium-review.googlesource.com/779959 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@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>
Jamie Madill f832c9dd 2016-12-12T17:38:48 Fix style in the preprocessor. Again using git cl format. BUG=angleproject:650 Change-Id: I8898d00bfc6a50db50bffd2cc30c3eda7c08c6c2 Reviewed-on: https://chromium-review.googlesource.com/419097 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
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 054f7ed0 2016-09-20T17:15:59 preprocessor: Miscellaneous cleanups - Use full header paths in includes - Use ASSERT instead of assert - Use angle::NonCopyable instead of PP_DISALLOW_COPY_AND_ASSIGN - Use range-for in a couple places - Remove pp_utils.h BUG=angleproject:1522 Change-Id: If107fef89e8465bca65cf664926d1051c5d1e232 Reviewed-on: https://chromium-review.googlesource.com/387212 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Corentin Wallez 2bd9c443 2016-09-20T16:39:18 preprocessor: add a limit to the number of token expanded BUG=angleproject:1522 BUG=chromium:648074 Change-Id: Ibf0858aaeb81933dd221ac82a49160169b48a495 Reviewed-on: https://chromium-review.googlesource.com/387211 Reviewed-by: Geoff Lang <geofflang@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>
Olli Etuaho 1b2f1629 2016-03-04T15:06:51 Forbid defined operator generated by macro expansion After lengthy debate, the GLES working group recommended that this should be an error in WebGL, though old specs were not updated. Make ANGLE follow the WebGL spec and generate an error in this case. This is a partial revert of the patch which added support for defined operator generated by macro expansion. The preprocessor unit tests added by the reverted commit are kept, but their expectations are changed. This breaks some dEQP tests that are not in line with the WebGL spec. BUG=angleproject:1335 TEST=angle_unittests, WebGL conformance tests Change-Id: I7d8a1d42c61367197f2aed4ca4de9297cc48acfc Reviewed-on: https://chromium-review.googlesource.com/352471 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: 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 e5a1f271 2015-08-21T02:58:25 Use override in all the places where it is possible This will avoid -Winconsistent-overrides in the future. Done using the -Wsuggest-override warning of GCC 5.1 BUG= Change-Id: I707a649dc368f5dd1e139fd144370abcac0b6263 Reviewed-on: https://chromium-review.googlesource.com/294920 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
Zhenyao Mo b5e17750 2014-10-22T10:57:10 Get rid of use of "static const std::string". BUG=angle:807 TEST=angle_unittests Change-Id: Ifa4d713deeb25d52a7aafc362a7e4630024fd511 Reviewed-on: https://chromium-review.googlesource.com/225004 Tested-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Zhenyao Mo d526f989 2014-05-13T14:51:19 Fix code style violation in compiler/preprocessor BUG=angle:650 TEST=no behavior change Change-Id: Ib52f15f6471fc7897b66d11baee11216cf08158a Reviewed-on: https://chromium-review.googlesource.com/199591 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Zhenyao Mo <zmo@chromium.org>
Shannon Woods 7f2d7945 2013-11-19T15:07:58 Manual merge of Ehsan Akhgari's patch to rename Diagnostics enums to avoid collision with Windows.h (See https://chromium-review.googlesource.com/#/c/177181/3) Change-Id: I2978d06ec96789b3ee1696b65a84c2a9f31f7ba4
daniel@transgaming.com b3077d08 2013-01-11T04:12:09 Upstream various build fixes from WebKit to ANGLE to make updating ANGLE in WebKit easier. a) http://trac.webkit.org/changeset/127747 b) http://trac.webkit.org/changeset/128539 c) http://trac.webkit.org/changeset/122870 - Specifically, items #3 and #4 in this changeset's commit message. Review URL: https://codereview.appspot.com/7040045 Author: maxvujovic@gmail.com ------ Upodate preprocessor.vcxproj to reflect changes in r1640. Review URL: https://codereview.appspot.com/7061044 git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1703 736b8ea6-26fd-11df-bfd4-992fa37f6226
daniel@transgaming.com a16a55f7 2012-12-20T20:51:54 Add explicit std:: namespace to code from <cXYZ> includes. Some platforms seem to implicitly include the <XYZ.h> headers which also add some types and functions (like strlen, size_t,...) into the global namespace. On other platforms though, this can result in compile errors, which is noticeable in WebKit on e.g. QNX. See also: https://bugs.webkit.org/show_bug.cgi?id=95468 https://codereview.appspot.com/6843083/ Contributed by Milian Wolff, Klaralvdavens Datakonsult AB. git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1565 736b8ea6-26fd-11df-bfd4-992fa37f6226
daniel@transgaming.com b401a92b 2012-10-26T18:58:24 Move the new preprocessor out of the 'new' directory. TRAC #21966 Signed-off-by: Daniel Koch Author: Nicolas Capens git-svn-id: https://angleproject.googlecode.com/svn/trunk@1326 736b8ea6-26fd-11df-bfd4-992fa37f6226