1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Merge branch 'master' into sd90

This commit is contained in:
Andrew Gvozdev 2011-07-07 13:04:23 -04:00
commit 7d021ea6c4
283 changed files with 11003 additions and 944 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
/*/*/bin
/*/*/target

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
<version>8.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>org.eclipse.cdt.gnu.build-feature</artifactId>
<packaging>eclipse-feature</packaging>
</project>

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.cdt.gnu.build.source-feature</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.pde.FeatureBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.FeatureNature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,5 @@
bin.includes = feature.xml,\
eclipse_update_120.jpg,\
epl-v10.html,\
feature.properties,\
license.html

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View file

@ -0,0 +1,328 @@
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 9">
<meta name=Originator content="Microsoft Word 9">
<link rel=File-List
href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
<title>Eclipse Public License - Version 1.0</title>
<!--[if gte mso 9]><xml>
<o:DocumentProperties>
<o:Revision>2</o:Revision>
<o:TotalTime>3</o:TotalTime>
<o:Created>2004-03-05T23:03:00Z</o:Created>
<o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
<o:Pages>4</o:Pages>
<o:Words>1626</o:Words>
<o:Characters>9270</o:Characters>
<o:Lines>77</o:Lines>
<o:Paragraphs>18</o:Paragraphs>
<o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
<o:Version>9.4402</o:Version>
</o:DocumentProperties>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:TrackRevisions/>
</w:WordDocument>
</xml><![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:553679495 -2147483648 8 0 66047 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";}
p
{margin-right:0in;
mso-margin-top-alt:auto;
mso-margin-bottom-alt:auto;
margin-left:0in;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";}
p.BalloonText, li.BalloonText, div.BalloonText
{mso-style-name:"Balloon Text";
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:8.0pt;
font-family:Tahoma;
mso-fareast-font-family:"Times New Roman";}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;
mso-header-margin:.5in;
mso-footer-margin:.5in;
mso-paper-source:0;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body lang=EN-US style='tab-interval:.5in'>
<div class=Section1>
<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
</p>
<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (&quot;AGREEMENT&quot;). ANY USE,
REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
OF THIS AGREEMENT.</span> </p>
<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
<p><span style='font-size:10.0pt'>&quot;Contribution&quot; means:</span> </p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
in the case of the initial Contributor, the initial code and documentation
distributed under this Agreement, and<br clear=left>
b) in the case of each subsequent Contributor:</span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
changes to the Program, and</span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
additions to the Program;</span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
such changes and/or additions to the Program originate from and are distributed
by that particular Contributor. A Contribution 'originates' from a Contributor
if it was added to the Program by such Contributor itself or anyone acting on
such Contributor's behalf. Contributions do not include additions to the
Program which: (i) are separate modules of software distributed in conjunction
with the Program under their own license agreement, and (ii) are not derivative
works of the Program. </span></p>
<p><span style='font-size:10.0pt'>&quot;Contributor&quot; means any person or
entity that distributes the Program.</span> </p>
<p><span style='font-size:10.0pt'>&quot;Licensed Patents &quot; mean patent
claims licensable by a Contributor which are necessarily infringed by the use
or sale of its Contribution alone or when combined with the Program. </span></p>
<p><span style='font-size:10.0pt'>&quot;Program&quot; means the Contributions
distributed in accordance with this Agreement.</span> </p>
<p><span style='font-size:10.0pt'>&quot;Recipient&quot; means anyone who
receives the Program under this Agreement, including all Contributors.</span> </p>
<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
Subject to the terms of this Agreement, each Contributor hereby grants Recipient
a non-exclusive, worldwide, royalty-free copyright license to<span
style='color:red'> </span>reproduce, prepare derivative works of, publicly
display, publicly perform, distribute and sublicense the Contribution of such
Contributor, if any, and such derivative works, in source code and object code
form.</span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
Subject to the terms of this Agreement, each Contributor hereby grants
Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
patent license under Licensed Patents to make, use, sell, offer to sell, import
and otherwise transfer the Contribution of such Contributor, if any, in source
code and object code form. This patent license shall apply to the combination
of the Contribution and the Program if, at the time the Contribution is added
by the Contributor, such addition of the Contribution causes such combination
to be covered by the Licensed Patents. The patent license shall not apply to
any other combinations which include the Contribution. No hardware per se is
licensed hereunder. </span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
Recipient understands that although each Contributor grants the licenses to its
Contributions set forth herein, no assurances are provided by any Contributor
that the Program does not infringe the patent or other intellectual property
rights of any other entity. Each Contributor disclaims any liability to Recipient
for claims brought by any other entity based on infringement of intellectual
property rights or otherwise. As a condition to exercising the rights and
licenses granted hereunder, each Recipient hereby assumes sole responsibility
to secure any other intellectual property rights needed, if any. For example,
if a third party patent license is required to allow Recipient to distribute
the Program, it is Recipient's responsibility to acquire that license before
distributing the Program.</span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
Each Contributor represents that to its knowledge it has sufficient copyright
rights in its Contribution, if any, to grant the copyright license set forth in
this Agreement. </span></p>
<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
Program in object code form under its own license agreement, provided that:</span>
</p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
it complies with the terms and conditions of this Agreement; and</span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
its license agreement:</span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
effectively disclaims on behalf of all Contributors all warranties and
conditions, express and implied, including warranties or conditions of title
and non-infringement, and implied warranties or conditions of merchantability
and fitness for a particular purpose; </span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
effectively excludes on behalf of all Contributors all liability for damages,
including direct, indirect, special, incidental and consequential damages, such
as lost profits; </span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
states that any provisions which differ from this Agreement are offered by that
Contributor alone and not by any other party; and</span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
states that source code for the Program is available from such Contributor, and
informs licensees how to obtain it in a reasonable manner on or through a
medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
<p><span style='font-size:10.0pt'>When the Program is made available in source
code form:</span> </p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
it must be made available under this Agreement; and </span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
copy of this Agreement must be included with each copy of the Program. </span></p>
<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
copyright notices contained within the Program. </span></p>
<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
originator of its Contribution, if any, in a manner that reasonably allows
subsequent Recipients to identify the originator of the Contribution. </span></p>
<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
<p><span style='font-size:10.0pt'>Commercial distributors of software may
accept certain responsibilities with respect to end users, business partners
and the like. While this license is intended to facilitate the commercial use
of the Program, the Contributor who includes the Program in a commercial
product offering should do so in a manner which does not create potential
liability for other Contributors. Therefore, if a Contributor includes the
Program in a commercial product offering, such Contributor (&quot;Commercial
Contributor&quot;) hereby agrees to defend and indemnify every other
Contributor (&quot;Indemnified Contributor&quot;) against any losses, damages and
costs (collectively &quot;Losses&quot;) arising from claims, lawsuits and other
legal actions brought by a third party against the Indemnified Contributor to
the extent caused by the acts or omissions of such Commercial Contributor in
connection with its distribution of the Program in a commercial product
offering. The obligations in this section do not apply to any claims or Losses
relating to any actual or alleged intellectual property infringement. In order
to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
Contributor in writing of such claim, and b) allow the Commercial Contributor
to control, and cooperate with the Commercial Contributor in, the defense and
any related settlement negotiations. The Indemnified Contributor may participate
in any such claim at its own expense.</span> </p>
<p><span style='font-size:10.0pt'>For example, a Contributor might include the
Program in a commercial product offering, Product X. That Contributor is then a
Commercial Contributor. If that Commercial Contributor then makes performance
claims, or offers warranties related to Product X, those performance claims and
warranties are such Commercial Contributor's responsibility alone. Under this
section, the Commercial Contributor would have to defend claims against the
other Contributors related to those performance claims and warranties, and if a
court requires any other Contributor to pay any damages as a result, the
Commercial Contributor must pay those damages.</span> </p>
<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
AGREEMENT, THE PROGRAM IS PROVIDED ON AN &quot;AS IS&quot; BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
responsible for determining the appropriateness of using and distributing the
Program and assumes all risks associated with its exercise of rights under this
Agreement , including but not limited to the risks and costs of program errors,
compliance with applicable laws, damage to or loss of data, programs or
equipment, and unavailability or interruption of operations. </span></p>
<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
or unenforceable under applicable law, it shall not affect the validity or
enforceability of the remainder of the terms of this Agreement, and without
further action by the parties hereto, such provision shall be reformed to the
minimum extent necessary to make such provision valid and enforceable.</span> </p>
<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
against any entity (including a cross-claim or counterclaim in a lawsuit)
alleging that the Program itself (excluding combinations of the Program with
other software or hardware) infringes such Recipient's patent(s), then such
Recipient's rights granted under Section 2(b) shall terminate as of the date
such litigation is filed. </span></p>
<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
shall terminate if it fails to comply with any of the material terms or
conditions of this Agreement and does not cure such failure in a reasonable
period of time after becoming aware of such noncompliance. If all Recipient's
rights under this Agreement terminate, Recipient agrees to cease use and
distribution of the Program as soon as reasonably practicable. However,
Recipient's obligations under this Agreement and any licenses granted by
Recipient relating to the Program shall continue and survive. </span></p>
<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
copies of this Agreement, but in order to avoid inconsistency the Agreement is
copyrighted and may only be modified in the following manner. The Agreement
Steward reserves the right to publish new versions (including revisions) of
this Agreement from time to time. No one other than the Agreement Steward has
the right to modify this Agreement. The Eclipse Foundation is the initial
Agreement Steward. The Eclipse Foundation may assign the responsibility to
serve as the Agreement Steward to a suitable separate entity. Each new version
of the Agreement will be given a distinguishing version number. The Program
(including Contributions) may always be distributed subject to the version of
the Agreement under which it was received. In addition, after a new version of
the Agreement is published, Contributor may elect to distribute the Program
(including its Contributions) under the new version. Except as expressly stated
in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
the intellectual property of any Contributor under this Agreement, whether
expressly, by implication, estoppel or otherwise. All rights in the Program not
expressly granted under this Agreement are reserved.</span> </p>
<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
State of New York and the intellectual property laws of the United States of
America. No party to this Agreement will bring a legal action under this
Agreement more than one year after the cause of action arose. Each party waives
its rights to a jury trial in any resulting litigation.</span> </p>
<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
</div>
</body>
</html>

View file

@ -0,0 +1,166 @@
###############################################################################
# Copyright (c) 2005, 2010 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# IBM Corporation - initial API and implementation
###############################################################################
# feature.properties
# contains externalized strings for feature.xml
# "%foo" in feature.xml corresponds to the key "foo" in this file
# java.io.Properties file (ISO 8859-1 with "\" escapes)
# This file should be translated.
# "featureName" property - name of the feature
featureName=C/C++ GNU Toolchain Build Support Source
# "providerName" property - name of the company that provides the feature
providerName=Eclipse CDT
# "updateSiteName" property - label for the update site
updateSiteName=Eclipse CDT update site
# "description" property - description of the feature
description=Build support for C/C++ GNU toolchain. Source code. Included in C/C++ Development Tools SDK.
# "licenseURL" property - URL of the "Feature License"
# do not translate value - just change to point to a locale-specific HTML page
licenseURL=license.html
copyright=\
Copyright (c) 2002, 2011 QNX Software Systems and others.\n\
All rights reserved. This program and the accompanying materials\n\
are made available under the terms of the Eclipse Public License v1.0\n\
which accompanies this distribution, and is available at\n\
http://www.eclipse.org/legal/epl-v10.html
# "license" property - text of the "Feature Update License"
# should be plain text version of license agreement pointed to be "licenseURL"
license=\
Eclipse Foundation Software User Agreement\n\
February 1, 2011\n\
\n\
Usage Of Content\n\
\n\
THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
\n\
Applicable Licenses\n\
\n\
Unless otherwise indicated, all Content made available by the\n\
Eclipse Foundation is provided to you under the terms and conditions of\n\
the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\
provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
For purposes of the EPL, "Program" will mean the Content.\n\
\n\
Content includes, but is not limited to, source code, object code,\n\
documentation and other files maintained in the Eclipse Foundation source code\n\
repository ("Repository") in software modules ("Modules") and made available\n\
as downloadable archives ("Downloads").\n\
\n\
- Content may be structured and packaged into modules to facilitate delivering,\n\
extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
plug-in fragments ("Fragments"), and features ("Features").\n\
- Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\
in a directory named "plugins".\n\
- A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
Each Feature may be packaged as a sub-directory in a directory named "features".\n\
Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
- Features may also include other Features ("Included Features"). Within a Feature, files\n\
named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
\n\
The terms and conditions governing Plug-ins and Fragments should be\n\
contained in files named "about.html" ("Abouts"). The terms and\n\
conditions governing Features and Included Features should be contained\n\
in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
Licenses may be located in any directory of a Download or Module\n\
including, but not limited to the following locations:\n\
\n\
- The top-level (root) directory\n\
- Plug-in and Fragment directories\n\
- Inside Plug-ins and Fragments packaged as JARs\n\
- Sub-directories of the directory named "src" of certain Plug-ins\n\
- Feature directories\n\
\n\
Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
Provisioning Technology (as defined below), you must agree to a license ("Feature \n\
Update License") during the installation process. If the Feature contains\n\
Included Features, the Feature Update License should either provide you\n\
with the terms and conditions governing the Included Features or inform\n\
you where you can locate them. Feature Update Licenses may be found in\n\
the "license" property of files named "feature.properties" found within a Feature.\n\
Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\
terms and conditions (or references to such terms and conditions) that\n\
govern your use of the associated Content in that directory.\n\
\n\
THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\
TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
\n\
- Eclipse Distribution License Version 1.0 (available at http://www.eclipse.org/licenses/edl-v1.0.html)\n\
- Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
- Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
- Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
- Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
- Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
\n\
IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\
is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
govern that particular Content.\n\
\n\
\n\Use of Provisioning Technology\n\
\n\
The Eclipse Foundation makes available provisioning software, examples of which include,\n\
but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\
the purpose of allowing users to install software, documentation, information and/or\n\
other materials (collectively "Installable Software"). This capability is provided with\n\
the intent of allowing such users to install, extend and update Eclipse-based products.\n\
Information about packaging Installable Software is available at\n\
http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\
\n\
You may use Provisioning Technology to allow other parties to install Installable Software.\n\
You shall be responsible for enabling the applicable license agreements relating to the\n\
Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\
in accordance with the Specification. By using Provisioning Technology in such a manner and\n\
making it available in accordance with the Specification, you further acknowledge your\n\
agreement to, and the acquisition of all necessary rights to permit the following:\n\
\n\
1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\
the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\
extending or updating the functionality of an Eclipse-based product.\n\
2. During the Provisioning Process, the Provisioning Technology may cause third party\n\
Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\
3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\
govern the use of the Installable Software ("Installable Software Agreement") and such\n\
Installable Software Agreement shall be accessed from the Target Machine in accordance\n\
with the Specification. Such Installable Software Agreement must inform the user of the\n\
terms and conditions that govern the Installable Software and must solicit acceptance by\n\
the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\
indication of agreement by the user, the provisioning Technology will complete installation\n\
of the Installable Software.\n\
\n\
Cryptography\n\
\n\
Content may contain encryption software. The country in which you are\n\
currently may have restrictions on the import, possession, and use,\n\
and/or re-export to another country, of encryption software. BEFORE\n\
using any encryption software, please check the country's laws,\n\
regulations and policies concerning the import, possession, or use, and\n\
re-export of encryption software, to see if this is permitted.\n\
\n\
Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n
########### end of license property ##########################################

View file

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="org.eclipse.cdt.gnu.build.source"
label="%featureName"
version="8.0.0.qualifier"
provider-name="%providerName">
<description>
%description
</description>
<copyright>
%copyright
</copyright>
<license url="%licenseURL">
%license
</license>
<url>
<update label="%updateSiteName" url="http://download.eclipse.org/tools/cdt/releases/indigo"/>
</url>
<plugin
id="org.eclipse.cdt.managedbuilder.gnu.ui.source"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>

View file

@ -0,0 +1,108 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Eclipse Foundation Software User Agreement</title>
</head>
<body lang="EN-US">
<h2>Eclipse Foundation Software User Agreement</h2>
<p>February 1, 2011</p>
<h3>Usage Of Content</h3>
<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
(COLLECTIVELY &quot;CONTENT&quot;). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
<h3>Applicable Licenses</h3>
<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
(&quot;EPL&quot;). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code
repository (&quot;Repository&quot;) in software modules (&quot;Modules&quot;) and made available as downloadable archives (&quot;Downloads&quot;).</p>
<ul>
<li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins (&quot;Plug-ins&quot;), plug-in fragments (&quot;Fragments&quot;), and features (&quot;Features&quot;).</li>
<li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&trade; ARchive) in a directory named &quot;plugins&quot;.</li>
<li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named &quot;features&quot;. Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of the Plug-ins
and/or Fragments associated with that Feature.</li>
<li>Features may also include other Features (&quot;Included Features&quot;). Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of Included Features.</li>
</ul>
<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named &quot;about.html&quot; (&quot;Abouts&quot;). The terms and conditions governing Features and
Included Features should be contained in files named &quot;license.html&quot; (&quot;Feature Licenses&quot;). Abouts and Feature Licenses may be located in any directory of a Download or Module
including, but not limited to the following locations:</p>
<ul>
<li>The top-level (root) directory</li>
<li>Plug-in and Fragment directories</li>
<li>Inside Plug-ins and Fragments packaged as JARs</li>
<li>Sub-directories of the directory named &quot;src&quot; of certain Plug-ins</li>
<li>Feature directories</li>
</ul>
<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license (&quot;Feature Update License&quot;) during the
installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
inform you where you can locate them. Feature Update Licenses may be found in the &quot;license&quot; property of files named &quot;feature.properties&quot; found within a Feature.
Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
that directory.</p>
<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
<ul>
<li>Eclipse Distribution License Version 1.0 (available at <a href="http://www.eclipse.org/licenses/edl-v10.html">http://www.eclipse.org/licenses/edl-v1.0.html</a>)</li>
<li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
<li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
<li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
<li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
<li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
</ul>
<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
<h3>Use of Provisioning Technology</h3>
<p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse
Update Manager (&quot;Provisioning Technology&quot;) for the purpose of allowing users to install software, documentation, information and/or
other materials (collectively &quot;Installable Software&quot;). This capability is provided with the intent of allowing such users to
install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a
href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
(&quot;Specification&quot;).</p>
<p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the
applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology
in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the
Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p>
<ol>
<li>A series of actions may occur (&quot;Provisioning Process&quot;) in which a user may execute the Provisioning Technology
on a machine (&quot;Target Machine&quot;) with the intent of installing, extending or updating the functionality of an Eclipse-based
product.</li>
<li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be
accessed and copied to the Target Machine.</li>
<li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable
Software (&quot;Installable Software Agreement&quot;) and such Installable Software Agreement shall be accessed from the Target
Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern
the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such
indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li>
</ol>
<h3>Cryptography</h3>
<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
possession, or use, and re-export of encryption software, to see if this is permitted.</p>
<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
</body>
</html>

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
<version>8.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>org.eclipse.cdt.gnu.build.source-feature</artifactId>
<packaging>eclipse-feature</packaging>
</project>

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
<version>8.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<version>7.1.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.make.core</artifactId>
<packaging>eclipse-plugin</packaging>
</project>

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
<version>8.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<version>7.1.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.make.ui</artifactId>
<packaging>eclipse-plugin</packaging>
</project>

View file

@ -18,6 +18,7 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui.ide,
org.eclipse.cdt.core,
org.eclipse.cdt.managedbuilder.core,
org.eclipse.cdt.managedbuilder.gnu.ui,
org.eclipse.cdt.core.tests;bundle-version="5.0.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5

View file

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
<version>8.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<version>8.0.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.managedbuilder.core.tests</artifactId>
<packaging>eclipse-test-plugin</packaging>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<!-- Yes, the managed build core tests use the UI harness. -->
<useUIHarness>true</useUIHarness>
<argLine>-Xms256m -Xmx512m -XX:MaxPermSize=256M</argLine>
<includes>
<include>**/AllManagedBuildTests.*</include>
</includes>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
</plugins>
</build>
</project>

View file

@ -8,9 +8,9 @@ RM := rm
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include Sources/sub\ sources/subdir.mk
-include Sources/subdir.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)

View file

@ -8,9 +8,9 @@ RM := rm
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include Sources/sub\ sources/subdir.mk
-include Sources/subdir.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)

View file

@ -8,9 +8,9 @@ RM := rm
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include Sources/sub\ sources/subdir.mk
-include Sources/subdir.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)

View file

@ -8,8 +8,8 @@ RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include Functions/subdir.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)

View file

@ -8,8 +8,8 @@ RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include Functions/subdir.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)

View file

@ -8,10 +8,10 @@ RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include source2/source21/subdir.mk
-include source2/subdir.mk
-include source1/subdir.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)

View file

@ -8,9 +8,9 @@ RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include module/subdir.mk
-include Sources/subdir.mk
-include subdir.mk
-include objects.mk
-include ../makefile.defs

View file

@ -8,8 +8,8 @@ RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include Functions/subdir.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)

View file

@ -8,10 +8,10 @@ RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include source2/source21/subdir.mk
-include source2/subdir.mk
-include source1/subdir.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)

View file

@ -8,8 +8,8 @@ RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include sub\ folder\ with\ spaces/subdir.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)

View file

@ -8,8 +8,8 @@ RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include ABC/subdir.mk
-include subdir.mk
-include objects.mk
-include ../makefile.defs

View file

@ -8,15 +8,15 @@ RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include dir1/dd/ff/subdir.mk
-include dir1/dd/excluded_c/subdir.mk
-include dir1/dd/excluded_c/asd/subdir.mk
-include d1_1/subdir.mk
-include dir1/dd/excluded_c/subdir.mk
-include d1_1/d2_1/subdir.mk
-include d1/subdir.mk
-include d1/d2/subdir.mk
-include d1_1/subdir.mk
-include d1/d2/d3/subdir.mk
-include d1/d2/subdir.mk
-include d1/subdir.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)

View file

@ -8,15 +8,15 @@ RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include dir1/dd/ff/subdir.mk
-include dir1/dd/excluded_c/subdir.mk
-include dir1/dd/excluded_c/asd/subdir.mk
-include d1_1/subdir.mk
-include dir1/dd/excluded_c/subdir.mk
-include d1_1/d2_1/subdir.mk
-include d1/subdir.mk
-include d1/d2/subdir.mk
-include d1_1/subdir.mk
-include d1/d2/d3/subdir.mk
-include d1/d2/subdir.mk
-include d1/subdir.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
<version>8.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<version>8.0.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.managedbuilder.core</artifactId>
<packaging>eclipse-plugin</packaging>
</project>

View file

@ -22,6 +22,7 @@ import java.io.Reader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@ -1207,16 +1208,18 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedMakeMessages.getResourceString(SRC_LISTS) + NEWLINE);
buffer.append("-include sources.mk" + NEWLINE); //$NON-NLS-1$
// add an include for each subdir
buffer.append("-include subdir.mk" + NEWLINE); //$NON-NLS-1$
for (IResource res : getSubdirList()) {
IContainer subDir = (IContainer)res;
// Add includes for each subdir in child-subdir-first order (required for makefile rule matching to work).
List<String> subDirList = new ArrayList<String>();
for (IContainer subDir : getSubdirList()) {
IPath projectRelativePath = subDir.getProjectRelativePath();
if(!projectRelativePath.toString().equals("")) //$NON-NLS-1$
buffer.append("-include " + escapeWhitespaces(projectRelativePath.toString()) + SEPARATOR + "subdir.mk"+ NEWLINE); //$NON-NLS-1$ //$NON-NLS-2$
subDirList.add(0, projectRelativePath.toString());
}
Collections.sort(subDirList, Collections.reverseOrder());
for (String dir : subDirList) {
buffer.append("-include " + escapeWhitespaces(dir) + SEPARATOR + "subdir.mk"+ NEWLINE); //$NON-NLS-1$ //$NON-NLS-2$
}
buffer.append("-include subdir.mk" + NEWLINE); //$NON-NLS-1$
buffer.append("-include objects.mk" + NEWLINE + NEWLINE); //$NON-NLS-1$

View file

@ -1328,6 +1328,14 @@
valueType="includePath"
browseType="directory">
</option>
<option
browseType="file"
category="gnu.cpp.compiler.category.dirs"
command="-include"
id="gnu.cpp.compiler.option.include.files"
name="%Option.Posix.InclFiles"
valueType="includeFiles">
</option>
<optionCategory
owner="cdt.managedbuild.tool.gnu.cpp.compiler"
name="%OptionCategory.Optimize"

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
<version>8.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<version>8.0.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.managedbuilder.gnu.ui</artifactId>
<packaging>eclipse-plugin</packaging>
</project>

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
<version>8.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<version>8.0.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.managedbuilder.ui.tests</artifactId>
<packaging>eclipse-test-plugin</packaging>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<useUIHarness>true</useUIHarness>
<argLine>-Xms256m -Xmx512m -XX:MaxPermSize=256M</argLine>
<includes>
<include>**/AllManagedBuildUITests.*</include>
</includes>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
<version>8.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<version>8.0.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.managedbuilder.ui</artifactId>
<packaging>eclipse-plugin</packaging>
</project>

View file

@ -14,6 +14,6 @@ output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
OSGI-INF/l10n/bundle.properties,\
OSGI-INF/,\
about.html
src.includes = about.html

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
<version>8.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<version>1.0.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.codan.checkers.ui</artifactId>
<packaging>eclipse-plugin</packaging>
</project>

View file

@ -1,5 +1,5 @@
###############################################################################
# Copyright (c) 2010 Alena Laskavaia and others.
# Copyright (c) 2010, 2011 Alena Laskavaia and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@ -111,6 +111,10 @@ checker.name.AbstractClassCreation = Abstract class cannot be instantiated
problem.name.AbstractClassCreation = Abstract class cannot be instantiated
problem.messagePattern.AbstractClassCreation = The type ''{0}'' must implement the inherited pure virtual method ''{1}''
problem.description.AbstractClassCreation = All inherited pure virtual methods must be implemented to allow instantiation of the class
checker.name.ClassMembersInitialization = Class members should be properly initialized
problem.name.ClassMembersInitialization = Class members should be properly initialized
problem.messagePattern.ClassMembersInitialization = Member ''{0}'' was not initialized in this constructor
problem.description.ClassMembersInitialization = Class members should be properly initialized to avoid random behavior
checker.name.UnusedSymbolInFileScopeChecker = Unused symbols and declarations in file scope
problem.description.UnusedVariableDeclarationProblem = Finds unused global variable declarations in file scope

View file

@ -14,6 +14,6 @@ output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
OSGI-INF/l10n/bundle.properties,\
OSGI-INF/,\
about.html
src.includes = about.html

View file

@ -384,5 +384,19 @@
name="%problem.name.UnusedStaticFunctionProblem">
</problem>
</checker>
<checker
class="org.eclipse.cdt.codan.internal.checkers.ClassMembersInitializationChecker"
id="org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization"
name="%checker.name.ClassMembersInitialization">
<problem
category="org.eclipse.cdt.codan.core.categories.ProgrammingProblems"
defaultEnabled="true"
defaultSeverity="Warning"
description="%problem.description.ClassMembersInitialization"
id="org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization"
messagePattern="%problem.messagePattern.ClassMembersInitialization"
name="%problem.name.ClassMembersInitialization">
</problem>
</checker>
</extension>
</plugin>

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
<version>8.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<version>1.0.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.codan.checkers</artifactId>
<packaging>eclipse-plugin</packaging>
</project>

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009,2010 Alena Laskavaia
* Copyright (c) 2009, 2011 Alena Laskavaia
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -20,6 +20,7 @@ public class CheckersMessages extends NLS {
public static String CaseBreakChecker_EmptyCaseDescription;
public static String CaseBreakChecker_LastCaseDescription;
public static String CatchByReference_ReportForUnknownType;
public static String ClassMembersInitializationChecker_SkipConstructorsWithFCalls;
public static String NamingConventionFunctionChecker_LabelNamePattern;
public static String NamingConventionFunctionChecker_ParameterMethods;
public static String ReturnChecker_Param0;

View file

@ -1,5 +1,5 @@
###############################################################################
# Copyright (c) 2010 Alena Laskavaia and others.
# Copyright (c) 2010, 2011 Alena Laskavaia and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@ -11,6 +11,7 @@
CaseBreakChecker_DefaultNoBreakCommentDescription=Comment text to suppress the problem (regular expression):
CaseBreakChecker_EmptyCaseDescription=Check also empty case statement (except if last)
CaseBreakChecker_LastCaseDescription=Check also the last case statement
ClassMembersInitializationChecker_SkipConstructorsWithFCalls=Skip constructors with initialization function calls
CatchByReference_ReportForUnknownType=Report a problem if type cannot be resolved
NamingConventionFunctionChecker_LabelNamePattern=Name Pattern
NamingConventionFunctionChecker_ParameterMethods=Also check C++ method names

View file

@ -0,0 +1,222 @@
/*******************************************************************************
* Copyright (c) 2011 Anton Gorenkov
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Anton Gorenkov - initial implementation
*******************************************************************************/
package org.eclipse.cdt.codan.internal.checkers;
import java.util.Stack;
import java.util.HashSet;
import java.util.Set;
import org.eclipse.cdt.codan.core.cxx.model.AbstractIndexAstChecker;
import org.eclipse.cdt.codan.core.model.IProblemWorkingCopy;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
import org.eclipse.cdt.core.dom.ast.IASTInitializerClause;
import org.eclipse.cdt.core.dom.ast.IASTLiteralExpression;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.IBasicType;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.ICompositeType;
import org.eclipse.cdt.core.dom.ast.IEnumeration;
import org.eclipse.cdt.core.dom.ast.IField;
import org.eclipse.cdt.core.dom.ast.IPointerType;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDefinition;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUnaryExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVariableReadWriteFlags;
import org.eclipse.cdt.internal.core.pdom.dom.PDOMName;
/**
* Checks that class members of simple types (int, float, pointers,
* enumeration types, ...) are properly initialized in constructor.
* Not initialized members may cause to unstable or random behavior
* of methods that are working with their value.
*
* @author Anton Gorenkov
*
*/
public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
public static final String ER_ID = "org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization"; //$NON-NLS-1$
public static final String PARAM_SKIP = "skip"; //$NON-NLS-1$
public void processAst(IASTTranslationUnit ast) {
ast.accept(new OnEachClass());
}
class OnEachClass extends ASTVisitor {
// NOTE: Classes can be nested and even can be declared in constructors of the other classes
private Stack< Set<IField> > constructorsStack = new Stack< Set<IField> >();
OnEachClass() {
shouldVisitDeclarations = true;
shouldVisitNames = true;
shouldVisitExpressions = skipConstructorsWithFCalls();
}
public int visit(IASTDeclaration declaration) {
ICPPConstructor constructor = getConstructor(declaration);
if (constructor != null) {
Set<IField> fieldsInConstructor = constructorsStack.push(new HashSet<IField>());
// Add all class fields
for (IField field : constructor.getClassOwner().getDeclaredFields()) {
if (isSimpleType(field.getType()) && !field.isStatic()) {
fieldsInConstructor.add(field);
}
}
}
return PROCESS_CONTINUE;
}
public int leave(IASTDeclaration declaration) {
if (getConstructor(declaration) != null) {
for (IField field : constructorsStack.pop()) {
reportProblem(ER_ID, declaration, field.getName());
}
}
return PROCESS_CONTINUE;
}
public int visit(IASTExpression expression) {
if (!constructorsStack.empty() && expression instanceof IASTFunctionCallExpression) {
Set<IField> actualContructorFields = constructorsStack.peek();
if (!actualContructorFields.isEmpty()) {
boolean skipCurrentConstructor = false;
IASTFunctionCallExpression fCall = (IASTFunctionCallExpression)expression;
IASTExpression fNameExp = fCall.getFunctionNameExpression();
if (fNameExp instanceof IASTIdExpression) {
IASTIdExpression fName = (IASTIdExpression)fNameExp;
IBinding fBinding = fName.getName().resolveBinding();
if (fBinding instanceof ICPPMethod) {
ICPPMethod method = (ICPPMethod)fBinding;
ICompositeType constructorOwner = actualContructorFields.iterator().next().getCompositeTypeOwner();
if (constructorOwner == method.getClassOwner() && !method.getType().isConst()) {
skipCurrentConstructor = true;
}
} else if (fBinding instanceof ICPPFunction) {
for (IASTInitializerClause argument : fCall.getArguments()) {
if (referencesThis(argument)) {
skipCurrentConstructor = true;
break;
}
}
}
}
if (skipCurrentConstructor) {
constructorsStack.peek().clear();
}
}
}
return PROCESS_CONTINUE;
}
/** Checks whether expression references this (directly, by pointer or by reference)
*
*/
public boolean referencesThis(IASTNode expr) {
if (expr instanceof IASTLiteralExpression) {
IASTLiteralExpression litArg = (IASTLiteralExpression)expr;
if (litArg.getKind() == IASTLiteralExpression.lk_this) {
return true;
}
} else if (expr instanceof ICPPASTUnaryExpression) {
ICPPASTUnaryExpression unExpr = (ICPPASTUnaryExpression)expr;
switch (unExpr.getOperator()) {
case ICPPASTUnaryExpression.op_amper:
case ICPPASTUnaryExpression.op_star:
case ICPPASTUnaryExpression.op_bracketedPrimary:
return referencesThis(unExpr.getOperand());
}
}
return false;
}
public int visit(IASTName name) {
if (!constructorsStack.empty()) {
Set<IField> actualContructorFields = constructorsStack.peek();
if (!actualContructorFields.isEmpty()) {
IBinding binding = name.resolveBinding();
if (actualContructorFields.contains(binding)) {
if ((CPPVariableReadWriteFlags.getReadWriteFlags(name) & PDOMName.WRITE_ACCESS) != 0) {
actualContructorFields.remove(binding);
}
}
}
}
return PROCESS_CONTINUE;
}
/** Checks whether class member of the specified type should be initialized
*
* @param type Type to check
* @return true if type is:
* - basic type (int, float, ...)
* - pointer
* - enum
* - reference (should be initialized in initialization list)
* - typedef to the another native type.
*
* @note: Not supported types (but maybe should be):
* - array
* - union
* - unknown type (need user preference?)
* - template parameter (need user preference?)
*/
private boolean isSimpleType(IType type) {
return (type instanceof IBasicType ||
type instanceof IPointerType ||
type instanceof IEnumeration ||
type instanceof ICPPReferenceType ||
(type instanceof ITypedef && isSimpleType( ((ITypedef)type).getType()) ) );
}
/** Checks that specified declaration is a class constructor
* (it is a class member and its name is equal to class name)
*/
private ICPPConstructor getConstructor(IASTDeclaration decl) {
if (decl instanceof ICPPASTFunctionDefinition) {
ICPPASTFunctionDefinition functionDefinition = (ICPPASTFunctionDefinition)decl;
IBinding binding = functionDefinition.getDeclarator().getName().resolveBinding();
if (binding instanceof ICPPConstructor) {
ICPPConstructor constructor = (ICPPConstructor) binding;
if (constructor.getClassOwner().getKey()!=ICPPClassType.k_union) {
return constructor;
}
}
}
return null;
}
}
@Override
public void initPreferences(IProblemWorkingCopy problem) {
super.initPreferences(problem);
addPreference(problem, PARAM_SKIP, CheckersMessages.ClassMembersInitializationChecker_SkipConstructorsWithFCalls, Boolean.TRUE);
}
public boolean skipConstructorsWithFCalls() {
return (Boolean) getPreference(getProblemById(ER_ID, getFile()), PARAM_SKIP);
}
}

View file

@ -31,6 +31,7 @@ import org.eclipse.cdt.core.dom.ast.IASTForStatement;
import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
import org.eclipse.cdt.core.dom.ast.IASTIfStatement;
import org.eclipse.cdt.core.dom.ast.IASTLabelStatement;
import org.eclipse.cdt.core.dom.ast.IASTNamedTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTReturnStatement;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
@ -130,6 +131,18 @@ public class ReturnChecker extends AbstractAstFunctionChecker {
return false;
}
public boolean isMain(IASTFunctionDefinition func) {
try {
String functionName = func.getDeclarator().getName().getRawSignature();
if (functionName.equals("main")) { //$NON-NLS-1$
return true;
}
} catch (Exception e) {
// well, not main
}
return false;
}
/*
* (non-Javadoc)
*
@ -143,13 +156,17 @@ public class ReturnChecker extends AbstractAstFunctionChecker {
ReturnStmpVisitor visitor = new ReturnStmpVisitor(func);
func.accept(visitor);
boolean nonVoid = !isVoid(func);
if (nonVoid) {
if (nonVoid && !isMain(func)) {
// there a return but maybe it is only on one branch
IASTStatement body = func.getBody();
if (body instanceof IASTCompoundStatement) {
IASTStatement[] statements = ((IASTCompoundStatement) body).getStatements();
if (statements.length > 0) {
IASTStatement last = statements[statements.length - 1];
// get nested statement if this is a label
while (last instanceof IASTLabelStatement) {
last = ((IASTLabelStatement) last).getNestedStatement();
}
// now check if last statement if complex (for optimization reasons, building CFG is expensive)
if (isCompoundStatement(last)) {
if (endsWithNoExitNode(func))
@ -158,8 +175,7 @@ public class ReturnChecker extends AbstractAstFunctionChecker {
reportNoRet(func, visitor.hasret);
}
} else {
reportNoRet(func, false);
reportNoRet(func, false);
}
}
}
@ -187,7 +203,7 @@ public class ReturnChecker extends AbstractAstFunctionChecker {
*/
private boolean isCompoundStatement(IASTStatement last) {
return last instanceof IASTIfStatement || last instanceof IASTWhileStatement || last instanceof IASTDoStatement
|| last instanceof IASTForStatement || last instanceof IASTSwitchStatement;
|| last instanceof IASTForStatement || last instanceof IASTSwitchStatement || last instanceof IASTCompoundStatement;
}
protected boolean isFuncExitStatement(IASTStatement statement) {

View file

@ -13,6 +13,6 @@ source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
OSGI-INF/l10n/bundle.properties,\
about.html
about.html,\
OSGI-INF/
src.includes = about.html

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
<version>8.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<version>1.0.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.codan.core.cxx</artifactId>
<packaging>eclipse-plugin</packaging>
</project>

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
<version>8.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<version>1.0.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.codan.core.tests</artifactId>
<packaging>eclipse-test-plugin</packaging>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<useUIHarness>false</useUIHarness>
<argLine>-Xms256m -Xmx512m -XX:MaxPermSize=256M</argLine>
<includes>
<include>**/AutomatedIntegrationSuite.*</include>
</includes>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,480 @@
/*******************************************************************************
* Copyright (c) 2011 Anton Gorenkov
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Anton Gorenkov - initial implementation
*******************************************************************************/
package org.eclipse.cdt.codan.core.internal.checkers;
import org.eclipse.cdt.codan.core.test.CheckerTestCase;
import org.eclipse.cdt.codan.internal.checkers.ClassMembersInitializationChecker;
/**
* Test for {@see ClassMembersInitializationChecker} class
*
*/
public class ClassMembersInitializationCheckerTest extends CheckerTestCase {
@Override
public boolean isCpp() {
return true;
}
@Override
public void setUp() throws Exception {
super.setUp();
enableProblems(ClassMembersInitializationChecker.ER_ID);
}
private void disableSkipConstructorsWithFCalls() {
setPreferenceValue(ClassMembersInitializationChecker.ER_ID, ClassMembersInitializationChecker.PARAM_SKIP, false);
}
public void checkMultiErrorsOnLine(int line, int count) {
for (int i = 0; i < count; ++i) {
checkErrorLine(line);
}
assertEquals(count, markers.length);
}
// class C {
// int m;
// C() : m(0) {} // No warnings.
// };
public void testInitializationListShouldBeChecked() {
loadCodeAndRun(getAboveComment());
checkNoErrors();
}
// class C {
// int m;
// C() { m = 0; } // No warnings.
// };
public void testAssignmentsInContructorShouldBeChecked() {
loadCodeAndRun(getAboveComment());
checkNoErrors();
}
// class C {
// int m;
// unsigned int ui;
// float f;
// double d;
// bool b;
// char c;
// long l;
// C() {} // 7 warnings for: m, ui, f, d, b, c, l.
// };
public void testBasicTypesShouldBeInitialized() {
loadCodeAndRun(getAboveComment());
checkMultiErrorsOnLine(9, 7);
}
// class Value {};
// class C {
// int* i;
// Value* v;
// C() {} // 2 warnings for: i, v.
// }
public void testPointersShouldBeInitialized() {
loadCodeAndRun(getAboveComment());
checkMultiErrorsOnLine(5, 2);
}
// class Value {};
// class C {
// int& i;
// Value& v;
// C() {} // 2 warnings for: i, v.
// }
public void testReferencesShouldBeInitialized() {
loadCodeAndRun(getAboveComment());
checkMultiErrorsOnLine(5, 2);
}
// enum Enum { v1, v2 };
// class C {
// Enum e;
// C() {} // 1 warning for: e.
// }
public void testEnumsShouldBeInitialized() {
loadCodeAndRun(getAboveComment());
checkMultiErrorsOnLine(4, 1);
}
// enum Enum { v1, v2 };
// class Value {};
// typedef int IntTypedef;
// typedef int* IntPtrTypedef;
// typedef int& IntRefTypedef;
// typedef Enum EnumTypedef;
// typedef Value ValueTypedef;
// class C {
// IntTypedef i;
// IntPtrTypedef ip;
// IntRefTypedef ir;
// EnumTypedef e;
// ValueTypedef v;
// C() {} // 5 warnings for: i, ip, ir, e.
// }
public void testTypedefsShouldBeInitialized() {
loadCodeAndRun(getAboveComment());
checkMultiErrorsOnLine(14, 4);
}
// class C {
// C() : i1(0) {} // 1 warning for: i2.
// C(int) : i2(0) {} // 1 warning for: i1.
// int i1, i2;
// };
public void testAFewConstructorsHandling() {
loadCodeAndRun(getAboveComment());
checkErrorLines(2, 3);
}
// template <typename T1, typename T2>
// class C {
// C() : i1(0), t1(T1()) {} // 1 warning for: i2.
// int i1, i2;
// T1 t1;
// T2 t2;
// };
public void testTemplateClassHandling() {
loadCodeAndRun(getAboveComment());
checkErrorLines(3);
}
// class C {
// template <typename T>
// C() : i1(0) {} // 1 warning for: i2.
// int i1, i2;
// };
public void testTemplateConstructorHandling() {
loadCodeAndRun(getAboveComment());
checkErrorLines(3);
}
// class C {
// C(); // No warnings.
// int i;
// };
public void testTemplateConstructorDeclarationOnlyHandling() {
loadCodeAndRun(getAboveComment());
checkNoErrors();
}
// class C {
// C();
// int i1, i2;
// };
// C::C() : i1(0) {} // 1 warning for: i2.
public void testExternalContructorHandling() {
loadCodeAndRun(getAboveComment());
checkErrorLines(5);
}
// template <typename T1, typename T2>
// class C {
// C();
// int i1, i2;
// T1 t1;
// T2 t2;
// };
// C::C() : i1(0), t1(T1()) {} // 1 warning for: i2.
public void testExternalContructorOfTemplateClassHandling() {
loadCodeAndRun(getAboveComment());
checkErrorLines(8);
}
// class C {
// template <typename T>
// C();
// int i1, i2;
// };
// template <typename T>
// C::C() : i1(0) {} // 1 warning for: i2.
public void testExternalTemplateContructorHandling() {
loadCodeAndRun(getAboveComment());
checkErrorLines(7);
}
// template <typename T1, typename T2>
// class C {
// template <typename T>
// C();
// int i1, i2;
// T1 t1;
// T2 t2;
// };
// template <typename T1, typename T2>
// template <typename T>
// C<T1,T2>::C() : i1(0), t1(T1()) {} // 1 warning for: i2.
public void testExternalTemplateContructorOfTemplateClassHandling() {
loadCodeAndRun(getAboveComment());
checkErrorLines(11);
}
// class C {
// class NestedC {
// NestedC() : i(0) {} // No warnings.
// int i;
// };
// C() {} // 1 warning for: i.
// int i;
// };
public void testNestedClassesHandling() {
loadCodeAndRun(getAboveComment());
checkErrorLines(6);
}
// class C {
// C() // 1 warning for: i.
// {
// class NestedC {
// NestedC() { i = 0; } // No warnings.
// int i;
// };
// }
// int i;
// };
public void testNestedClassInConstructorHandling() {
loadCodeAndRun(getAboveComment());
checkErrorLines(2);
}
// class C {
// C();
// int i;
// };
//
// C::C() // 1 warning for: i.
// {
// class NestedC { // No warnings.
// NestedC() { i = 0; }
// int i;
// };
// }
public void testNestedClassInExternalConstructorHandling() {
loadCodeAndRun(getAboveComment());
checkErrorLines(6);
}
// class C {
// C() // 1 warning for: i.
// {
// class NestedC {
// NestedC() { i = 0; } // No warnings.
// void C() { i = 0; } // No warnings.
// int i;
// };
// }
// int i;
// };
public void testNestedClassWithMethodNamedAsAnotherClassHandling() {
loadCodeAndRun(getAboveComment());
checkErrorLines(2);
}
// class C {
// C() {} // 1 warning for: i.
// int someFunction() { i = 0; } // No warnings.
// int i;
// };
public void testAssignmentIsNotInConstructor() {
loadCodeAndRun(getAboveComment());
checkErrorLines(2);
}
// class CBase {
// CBase() : i1(0) {} // No warnings.
// int i1;
// };
// class CDerived : public CBase {
// CDerived() : i2(0) {} // No warnings.
// int i2;
// };
public void testBaseClassMemberShouldNotBeTakenIntoAccount() {
loadCodeAndRun(getAboveComment());
checkNoErrors();
}
// class C {
// C() {} // No warnings.
// static int i1, i2;
// };
// int C::i1 = 0;
// // NOTE: Static members are always initialized with 0, so there should not be warning on C::i2
// int C::i2;
public void testNoErrorsOnStaticMembers() {
loadCodeAndRun(getAboveComment());
checkNoErrors();
}
// void func(int & a) { a = 0; }
// class C {
// C() { func(i); } // No warnings.
// int i;
// };
public void testNoErrorsOnFunctionCallInitialization() {
loadCodeAndRun(getAboveComment());
checkNoErrors();
}
// void func(const int & a) {}
// class C {
// C() { func(i); } // 1 warning for: i.
// int i;
// };
public void testNoErrorsOnReadingFunctionCall() {
loadCodeAndRun(getAboveComment());
checkErrorLines(3);
}
// class C {
// C() { (i1) = 0; *&i2 = 0; } // No warnings.
// int i1, i2;
// };
public void testNoErrorsOnComplexAssignment() {
loadCodeAndRun(getAboveComment());
checkNoErrors();
}
// class C {
// C() : i1(0) { // No warnings.
// i2 = i1;
// int someVar = 0;
// i3 = someVar;
// }
// int i1, i2, i3;
// };
public void testNoErrorsOnChainInitialization() {
loadCodeAndRun(getAboveComment());
checkNoErrors();
}
// class A { protected: A(){} public: int a; }; // 1 warning for: a.
// class C: public A {
// C() {
// a = 1;
// }
// };
public void testErrorOnProtectedConstructor() {
loadCodeAndRun(getAboveComment());
checkErrorLines(1);
}
// struct S {
// int i;
// S() {} // 1 warning for: i.
// };
public void testCheckStructs() {
loadCodeAndRun(getAboveComment());
checkErrorLines(3);
}
// union U {
// int a;
// char b;
// U() { // No warnings.
// a=0;
// }
// };
public void testSkipUnions() {
loadCodeAndRun(getAboveComment());
checkNoErrors();
}
// class C {
// int c;
// };
public void testNoErrorsIfThereIsNoConstructorsDefined() {
loadCodeAndRun(getAboveComment());
checkNoErrors();
}
// class C {
// int i;
// C(bool b) { // No warnings.
// if (b)
// i = 0;
// // else - 'i' will be not initialized
// }
// };
public void testNoErrorsIfMemberWasInitializedInOneOfTheIfBranch() {
loadCodeAndRun(getAboveComment());
checkNoErrors();
}
// class A {
// int a;
// A(int a) { setA(a); } // No warnings.
// A() { getA(); } // 1 warning for: a.
// void setA(int a) {
// this->a = a;
// }
// int getA() const {
// return a;
// }
// };
public void testUsingMethodsInConstructorWithPreference() {
loadCodeAndRun(getAboveComment());
checkErrorLines(4);
}
// class A;
// void initializeA1(A*);
// void initializeA2(A**);
// void initializeA3(A&);
//
// class A {
// int a;
// A() { initializeA1(this); } // No warnings.
// A(int a) { initializeA2(&this); } // No warnings.
// A(float a) { initializeA3(*this); } // No warnings.
// A(double a) { initializeA3(*(this)); } // No warnings.
// };
public void testUsingConstMethodsInConstructorWithPreference() {
loadCodeAndRun(getAboveComment());
checkNoErrors();
}
// class A {
// int a;
// A(int a) { setA(a); } // 1 warning for: a.
// A() { getA(); } // 1 warning for: a.
// void setA(int a) {
// this->a = a;
// }
// int getA() const {
// return a;
// }
// };
public void testUsingMethodsInConstructorWithoutPreference() {
disableSkipConstructorsWithFCalls();
loadCodeAndRun(getAboveComment());
checkErrorLines(3,4);
}
// class A;
// void initializeA1(A*);
// void initializeA2(A**);
// void initializeA3(A&);
//
// class A {
// int a;
// A() { initializeA1(this); } // 1 warning for: a.
// A(int a) { initializeA2(&this); } // 1 warning for: a.
// A(float a) { initializeA3(*this); } // 1 warning for: a.
// A(double a) { initializeA3(*(this)); } // 1 warning for: a.
// };
public void testUsingConstMethodsInConstructorWithoutPreference() {
disableSkipConstructorsWithFCalls();
loadCodeAndRun(getAboveComment());
checkErrorLines(8,9,10,11);
}
}

View file

@ -255,4 +255,38 @@ public class ReturnCheckerTest extends CheckerTestCase {
loadCodeAndRunCpp(getAboveComment());
checkErrorLine(1);
}
// int f345687() {
// {
// return 0;
// }
// }
public void testNextedBlock_Bug345687() {
loadCodeAndRunCpp(getAboveComment());
checkNoErrors();
}
// int
// fp_goto(int a)
// {
// if (a) {
// goto end;
// }
// end:
// return (a);
// }
public void testGoto_Bug346559() {
loadCodeAndRun(getAboveComment());
checkNoErrors();
}
// int main()
// {
// char c; // added so function body is non-empty
// // no error since return value in main is optional
// }
public void testMainFunction() {
loadCodeAndRunCpp(getAboveComment());
checkNoErrors();
}
}

View file

@ -20,6 +20,7 @@ import org.eclipse.cdt.codan.core.internal.checkers.AssignmentInConditionChecker
import org.eclipse.cdt.codan.core.internal.checkers.AssignmentToItselfCheckerTest;
import org.eclipse.cdt.codan.core.internal.checkers.CaseBreakCheckerTest;
import org.eclipse.cdt.codan.core.internal.checkers.CatchByReferenceTest;
import org.eclipse.cdt.codan.core.internal.checkers.ClassMembersInitializationCheckerTest;
import org.eclipse.cdt.codan.core.internal.checkers.FormatStringCheckerTest;
import org.eclipse.cdt.codan.core.internal.checkers.NonVirtualDestructorCheckerTest;
import org.eclipse.cdt.codan.core.internal.checkers.ProblemBindingCheckerTest;
@ -56,6 +57,7 @@ public class AutomatedIntegrationSuite extends TestSuite {
suite.addTestSuite(AssignmentToItselfCheckerTest.class);
suite.addTestSuite(CaseBreakCheckerTest.class);
suite.addTestSuite(CatchByReferenceTest.class);
suite.addTestSuite(ClassMembersInitializationCheckerTest.class);
suite.addTestSuite(FormatStringCheckerTest.class);
suite.addTestSuite(NonVirtualDestructorCheckerTest.class);
suite.addTestSuite(ProblemBindingCheckerTest.class);

View file

@ -15,8 +15,7 @@ bin.includes = META-INF/,\
.,\
plugin.xml,\
schema/,\
OSGI-INF/l10n/bundle.properties,\
about.html,\
OSGI-INF/
src.includes = schema/,\
about.html
src.includes = about.html,\
schema/

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
<version>8.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<version>2.0.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.codan.core</artifactId>
<packaging>eclipse-plugin</packaging>
</project>

View file

@ -14,6 +14,6 @@ output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
OSGI-INF/l10n/bundle.properties,\
about.html
about.html,\
OSGI-INF/
src.includes = about.html

View file

@ -14,6 +14,6 @@ output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
OSGI-INF/l10n/bundle.properties,\
about.html
about.html,\
OSGI-INF/
src.includes = about.html

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
<version>8.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<version>2.0.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.codan.ui.cxx</artifactId>
<packaging>eclipse-plugin</packaging>
</project>

View file

@ -14,8 +14,8 @@ output.. = bin/
bin.includes = plugin.xml,\
META-INF/,\
.,\
OSGI-INF/l10n/bundle.properties,\
schema/,\
icons/,\
about.html
about.html,\
OSGI-INF/
src.includes = about.html

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
<version>8.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<version>2.0.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.codan.ui</artifactId>
<packaging>eclipse-plugin</packaging>
</project>

Binary file not shown.

View file

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
<version>8.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<version>5.1.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.core.aix</artifactId>
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<resolver>p2</resolver>
<pomDependencies>consider</pomDependencies>
<environments>
<environment>
<os>aix</os>
<ws>gtk</ws>
<arch>ppc</arch>
</environment>
</environments>
</configuration>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
<version>8.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<version>5.1.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.core.linux.ia64</artifactId>
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<resolver>p2</resolver>
<pomDependencies>consider</pomDependencies>
<environments>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>ia64</arch>
</environment>
</environments>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-source-plugin</artifactId>
<version>${tycho-version}</version>
<executions>
<execution>
<id>plugin-source</id>
<phase>none</phase>
</execution>
<execution>
<id>attach-source</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
<version>8.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<version>5.1.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.core.linux.ppc</artifactId>
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<resolver>p2</resolver>
<pomDependencies>consider</pomDependencies>
<environments>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>ppc</arch>
</environment>
</environments>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-source-plugin</artifactId>
<version>${tycho-version}</version>
<executions>
<execution>
<id>plugin-source</id>
<phase>none</phase>
</execution>
<execution>
<id>attach-source</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
<version>8.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<version>5.1.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.core.linux.ppc64</artifactId>
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<resolver>p2</resolver>
<pomDependencies>consider</pomDependencies>
<environments>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>ppc64</arch>
</environment>
</environments>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-source-plugin</artifactId>
<version>${tycho-version}</version>
<executions>
<execution>
<id>plugin-source</id>
<phase>none</phase>
</execution>
<execution>
<id>attach-source</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
<version>8.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<version>5.2.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.core.linux.x86</artifactId>
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<resolver>p2</resolver>
<pomDependencies>consider</pomDependencies>
<environments>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>x86</arch>
</environment>
</environments>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-source-plugin</artifactId>
<version>${tycho-version}</version>
<executions>
<execution>
<id>plugin-source</id>
<phase>none</phase>
</execution>
<execution>
<id>attach-source</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
<version>8.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<version>5.2.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.core.linux.x86_64</artifactId>
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<resolver>p2</resolver>
<pomDependencies>consider</pomDependencies>
<environments>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>x86_64</arch>
</environment>
</environments>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-source-plugin</artifactId>
<version>${tycho-version}</version>
<executions>
<execution>
<id>plugin-source</id>
<phase>none</phase>
</execution>
<execution>
<id>attach-source</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

Binary file not shown.

View file

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
<version>8.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<version>5.2.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.core.linux</artifactId>
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<resolver>p2</resolver>
<pomDependencies>consider</pomDependencies>
<environments>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>x86</arch>
</environment>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>x86_64</arch>
</environment>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>ppc</arch>
</environment>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>ppc64</arch>
</environment>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>ia64</arch>
</environment>
</environments>
</configuration>
</plugin>
</plugins>
</build>
</project>

Binary file not shown.

View file

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
<version>8.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<version>5.2.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.core.macosx</artifactId>
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<resolver>p2</resolver>
<pomDependencies>consider</pomDependencies>
<environments>
<environment>
<os>macosx</os>
<ws>cocoa</ws>
<arch>x86</arch>
</environment>
<environment>
<os>macosx</os>
<ws>cocoa</ws>
<arch>x86_64</arch>
</environment>
</environments>
</configuration>
</plugin>
</plugins>
</build>
</project>

Binary file not shown.

View file

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
<version>8.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<version>5.2.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.core.solaris</artifactId>
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<resolver>p2</resolver>
<pomDependencies>consider</pomDependencies>
<environments>
<environment>
<os>solaris</os>
<ws>gtk</ws>
<arch>sparc</arch>
</environment>
</environments>
</configuration>
</plugin>
</plugins>
</build>
</project>

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: org.eclipse.cdt.core.tests
Bundle-SymbolicName: org.eclipse.cdt.core.tests; singleton:=true
Bundle-Version: 5.3.0.qualifier
Bundle-Version: 5.4.0.qualifier
Bundle-Activator: org.eclipse.cdt.core.testplugin.CTestPlugin
Export-Package: org.eclipse.cdt.core.cdescriptor.tests,
org.eclipse.cdt.core.envvar,

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2010 Broadcom Corporation and others.
* Copyright (c) 2010, 2011 Broadcom Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,6 +7,7 @@
*
* Contributors:
* James Blackburn (Broadcom Corp) - initial API and implementation
* Wind River Systems - Bug 348569
*******************************************************************************/
package org.eclipse.cdt.core.model.tests;
@ -57,7 +58,7 @@ public class Bug311189 extends BaseTestCase {
final IPathEntry sourceEntry = new SourceEntry(srcFolder.getFullPath(), new IPath[0]);
// create a source folder and set it as a source entry
srcFolder.create(true, false, null);
srcFolder.create(true, true, null);
CoreModel.setRawPathEntries(CoreModel.getDefault().create(project), new IPathEntry[] {sourceEntry}, null);
IPathEntry[] rawEntries = CoreModel.getPathEntryStore(project).getRawPathEntries();
assertTrue ("Path entry unset!", Arrays.asList(rawEntries).contains(sourceEntry));
@ -69,7 +70,7 @@ public class Bug311189 extends BaseTestCase {
Job.getJobManager().beginRule(project, null);
// Delete the source folder, and re-recreate it
srcFolder.delete(true, null);
srcFolder.create(true, false, null);
srcFolder.create(true, true, null);
} finally {
Job.getJobManager().endRule(project);
}

View file

@ -5327,6 +5327,18 @@ public class AST2CPPTests extends AST2BaseTest {
parse( getAboveComment(), ParserLanguage.CPP, true, true );
}
// namespace outer {
// namespace inner {
// class foo{};
// }
// using namespace inner __attribute__((__strong__));
// }
// outer::foo x;
// outer::inner::foo y;
public void testAttributeInUsingDirective_351228() throws Exception {
parseAndCheckBindings();
}
// class C {
// public:
// int i;
@ -9391,4 +9403,64 @@ public class AST2CPPTests extends AST2BaseTest {
assertTrue(qn.isDeclaration());
assertTrue(qn.getLastName().isDeclaration());
}
// struct S{
// void foo(){}
// };
// void test(){
// S s[1];
// s->foo();
// }
public void testMemberAccessForArray_347298() throws Exception {
parseAndCheckBindings();
}
// struct X {};
// struct Y : X {
// Y(){}
// Y(Y const & y){}
// };
// void test() {
// Y y;
// Y y2 = y;
// X x = y2;
// }
public void testReferenceToCopyConstructor() throws Exception {
IASTTranslationUnit tu= parseAndCheckBindings();
ICPPASTFunctionDefinition fdef= getDeclaration(tu, 2);
IASTDeclarationStatement dst= getStatement(fdef, 0);
IASTDeclarator dtor= ((IASTSimpleDeclaration) dst.getDeclaration()).getDeclarators()[0];
IBinding ctor= ((IASTImplicitNameOwner) dtor).getImplicitNames()[0].resolveBinding();
assertTrue(ctor instanceof ICPPConstructor);
assertEquals(0, ((ICPPConstructor) ctor).getType().getParameterTypes().length);
dst= getStatement(fdef, 1);
dtor= ((IASTSimpleDeclaration) dst.getDeclaration()).getDeclarators()[0];
ctor= ((IASTImplicitNameOwner) dtor).getImplicitNames()[0].resolveBinding();
assertTrue(ctor instanceof ICPPConstructor);
assertEquals(1, ((ICPPConstructor) ctor).getType().getParameterTypes().length);
dst= getStatement(fdef, 2);
dtor= ((IASTSimpleDeclaration) dst.getDeclaration()).getDeclarators()[0];
ctor= ((IASTImplicitNameOwner) dtor).getImplicitNames()[0].resolveBinding();
assertTrue(ctor instanceof ICPPConstructor);
assertEquals(1, ((ICPPConstructor) ctor).getType().getParameterTypes().length);
}
// struct Foo {
// void Method(int) {}
// void Method() const {}
// };
// template<typename Arg> struct Callback {
// Callback(void (Foo::*function)(Arg arg)) {
// }
// };
// typedef Callback<int> MyCallback;
// void xx() {
// MyCallback x= MyCallback(&Foo::Method); // Invalid overload of 'Foo::Method'
// }
public void testTypedefAsClassNameWithFunctionPtrArgument_350345() throws Exception {
parseAndCheckBindings();
}
}

View file

@ -58,6 +58,7 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTNullStatement;
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTPointerOperator;
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorIfdefStatement;
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorMacroDefinition;
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorMacroExpansion;
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorPragmaStatement;
@ -7321,4 +7322,19 @@ public class AST2Tests extends AST2BaseTest {
bh.assertNonProblem("a;", 1);
}
// #ifdef A // active, not taken.
// #ifdef B // inactive, not taken.
// #endif // inactive
// #endif // active
public void testInactivePreprocessingStatements() throws Exception {
IASTTranslationUnit tu= parseAndCheckBindings(getAboveComment());
IASTPreprocessorStatement[] stmts= tu.getAllPreprocessorStatements();
assertTrue(stmts[0].isActive());
assertFalse(stmts[1].isActive());
assertFalse(stmts[2].isActive());
assertTrue(stmts[3].isActive());
assertFalse(((IASTPreprocessorIfdefStatement) stmts[0]).taken());
assertFalse(((IASTPreprocessorIfdefStatement) stmts[1]).taken());
}
}

View file

@ -288,6 +288,19 @@ public class BasicCompletionTest extends CompletionTestBase {
checkNonPrefixCompletion(code, true, expected);
}
// struct A {
// A(int, char, int){}
// };
// struct B : A {
// B();
// };
// B::B() : A
public void testCompletionInCtorOfMemberInitializer_351009() throws Exception {
String code = getAboveComment();
String[] expected= {"A"};
checkNonPrefixCompletion(code, true, expected);
}
// struct S {};
// void foo() {
// S b

View file

@ -67,9 +67,9 @@ public class IndexNamesTests extends BaseTestCase {
return fCProject.getProject();
}
protected StringBuffer[] getContentsForTest(int blocks) throws IOException {
public String getComment() throws IOException {
return TestSourceReader.getContentsForTest(
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), blocks);
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), 1)[0].toString();
}
protected IFile createFile(IContainer container, String fileName, String contents) throws Exception {
@ -102,7 +102,7 @@ public class IndexNamesTests extends BaseTestCase {
// };
public void testNestingWithFunction() throws Exception {
waitForIndexer();
String content= getContentsForTest(1)[0].toString();
String content= getComment();
IFile file= createFile(getProject().getProject(), "test.cpp", content);
waitUntilFileIsIndexed(file, 4000);
@ -161,7 +161,7 @@ public class IndexNamesTests extends BaseTestCase {
// };
public void testNestingWithMethod() throws Exception {
waitForIndexer();
String content= getContentsForTest(1)[0].toString();
String content= getComment();
IFile file= createFile(getProject().getProject(), "test.cpp", content);
waitUntilFileIsIndexed(file, 4000);
@ -257,7 +257,7 @@ public class IndexNamesTests extends BaseTestCase {
// }
public void testCouldBePolymorphicMethodCall_Bug156691() throws Exception {
waitForIndexer();
String content= getContentsForTest(1)[0].toString();
String content= getComment();
IFile file= createFile(getProject().getProject(), "test.cpp", content);
waitUntilFileIsIndexed(file, 4000);
@ -315,7 +315,7 @@ public class IndexNamesTests extends BaseTestCase {
// }
public void testReadWriteFlagsC() throws Exception {
waitForIndexer();
String content= getContentsForTest(1)[0].toString();
String content= getComment();
IFile file= createFile(getProject().getProject(), "test.c", content);
waitUntilFileIsIndexed(file, 4000);
@ -329,16 +329,15 @@ public class IndexNamesTests extends BaseTestCase {
IIndexFile ifile= fIndex.getFile(linkageID, IndexLocationFactory.getWorkspaceIFL(file));
IIndexName[] names= ifile.findNames(0, Integer.MAX_VALUE);
int j= 0;
for (int i = 0; i < names.length; i++) {
IIndexName indexName = names[i];
for (IIndexName indexName : names) {
final String name = indexName.toString();
final char c0= name.length() > 0 ? name.charAt(0) : 0;
if ((c0 == '_' || c0 == 'r' || c0 == 'w') && indexName.isReference()) {
boolean isRead= name.charAt(0) == 'r' || name.charAt(0) == 'u';
boolean isWrite= name.charAt(isRead ? 1 : 0) == 'w' || name.charAt(0) == 'u';
String msg= "i=" + i + ", " + name + ":";
assertEquals(msg, isRead, indexName.isReadAccess());
assertEquals(msg, isWrite, indexName.isWriteAccess());
boolean isRead= name.charAt(0) == 'r';
boolean isWrite= c0 == 'w' || (isRead && name.length() > 1 && name.charAt(1) == 'w');
String msg= name + "(j=" + j + "):";
assertEquals("Read access for " + msg, isRead, indexName.isReadAccess());
assertEquals("Write access for " + msg, isWrite, indexName.isWriteAccess());
j++;
}
else {
@ -352,50 +351,99 @@ public class IndexNamesTests extends BaseTestCase {
}
}
// int _i, ri, wi, rwi, rfind, ui;
// int* rp; int* wp; int* rwp; int* up;
// int* const rpc= 0;
// const int * const rcpc= 0;
// const int* cip= &ri;
// int* bla= &rwi;
// void fi(int);
// void fp(int*);
// void fr(int&);
// void fcp(const int*);
// void fcr(const int&);
// void fpp(int**);
// void fpr(int*&);
// void fcpp(int const**);
// void fcpr(int const*&);
// void fpcp(int *const*);
// void fpcr(int *const&);
// void fcpcp(int const *const*);
// void fcpcr(int const *const&);
//
// int _i, ri, wi, rwi;
// int* rp; int* wp; int* rwp;
// int* const rpc= 0;
// const int * const rcpc= 0;
// const int* rwcp= &ri;
// void fi(int);
// void fp(int*);
// void fr(int&);
// void fcp(const int*);
// void fcr(const int&);
// void fpp(int**);
// void fpr(int*&);
// void fcpp(int const**);
// void fcpr(int const*&);
// void fpcp(int *const*);
// void fpcr(int *const&);
// void fcpcp(int const *const*);
// void fcpcr(int const *const&);
// int test() {
// _i;
// _i;
// wi= ri, _i, _i; // expr-list
// rwi %= ri; // assignment
// ri ? _i : _i; // conditional
// (ri ? wi : wi)= ri; // conditional
// if (ri) _i;
// for(wi=1; ri>ri; rwi++) _i;
// rwi %= ri; // assignment
// ri ? _i : _i; // conditional
// (ri ? wi : wi)= ri; // conditional
// if (ri) _i;
// for(wi=1; ri>ri; rwi++) _i;
// do {_i;} while (ri);
// while(ri) {_i;};
// switch(ri) {case ri: _i;};
// fi(ri); fp(&rwi); fcp(&ri);
// fi(*rp); fp(rp); fcp(rp); fpp(&rwp); fcpp(&up); fpcp(&rpc); fcpcp(&rcpc);
// fr(rwi); fcr(ri); fpr(&ui);
// fcpr(&ui); fpcr(&rwi); fcpcr(&ri);
// fpr(rwp); fcpr(up); fpcr(rp); fcpcr(rp);
// return ri;
// while(ri) {_i;};
// switch(ri) {case ri: _i;};
// fi(ri); fp(&rwi); fcp(&ri);
// fi(*rp); fp(rp); fcp(rp); fpp(&rwp); fcpp(&rwcp); fpcp(&rpc); fcpcp(&rcpc);
// fr(rwi); fcr(ri);
// fpcr(&rwi); fcpcr(&ri);
// fpr(rwp); fcpr(rwcp); fpcr(rp); fcpcr(rp);
// return ri;
// }
public void testReadWriteFlagsCpp() throws Exception {
waitForIndexer();
String content= getContentsForTest(1)[0].toString();
String content= getComment();
IFile file= createFile(getProject().getProject(), "test.cpp", content);
waitUntilFileIsIndexed(file, 4000);
checkReadWriteFlags(file, ILinkage.CPP_LINKAGE_ID, 47);
checkReadWriteFlags(file, ILinkage.CPP_LINKAGE_ID, 48);
}
// int _i, ri, wi, rwi;
// void f(int&, int);
// void g(int, int&);
// void test() {
// f(rwi, ri);
// g(ri, rwi);
// }
public void testRWInSecondArg() throws Exception {
waitForIndexer();
String content= getComment();
IFile file= createFile(getProject().getProject(), "testRWInSecondArg.cpp", content);
waitUntilFileIsIndexed(file, 4000);
checkReadWriteFlags(file, ILinkage.CPP_LINKAGE_ID, 4);
}
// struct A {
// A(int p) {}
// };
// int r;
// A a(r); // Should be read-access
// void test() {
// A b(r); // Should be read-access
// }
public void testRWInConstructorCall_328528() throws Exception {
waitForIndexer();
String content= getComment();
IFile file= createFile(getProject().getProject(), "testRWInConstructorCall.cpp", content);
waitUntilFileIsIndexed(file, 4000);
checkReadWriteFlags(file, ILinkage.CPP_LINKAGE_ID, 2);
}
// struct A {
// A(int p) {}
// };
// int r;
// int a[2] = {0, r}; // Should be read-access
// void test() {
// int b[2] = {0, r}; // Should be read-access
// }
public void testRWInArrayInitializer_328528() throws Exception {
waitForIndexer();
String content= getComment();
IFile file= createFile(getProject().getProject(), "testRWInArrayInitializer.cpp", content);
waitUntilFileIsIndexed(file, 4000);
checkReadWriteFlags(file, ILinkage.CPP_LINKAGE_ID, 2);
}
}

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
<version>8.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<version>5.4.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.core.tests</artifactId>
<packaging>eclipse-test-plugin</packaging>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<useUIHarness>false</useUIHarness>
<argLine>-Xms256m -Xmx512m -XX:MaxPermSize=256M</argLine>
<includes>
<include>**/AutomatedIntegrationSuite.*</include>
</includes>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
</plugins>
</build>
</project>

Binary file not shown.

View file

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
<version>8.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<version>5.2.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.core.win32</artifactId>
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<resolver>p2</resolver>
<pomDependencies>consider</pomDependencies>
<environments>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86</arch>
</environment>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86_64</arch>
</environment>
</environments>
</configuration>
</plugin>
</plugins>
</build>
</project>

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.core; singleton:=true
Bundle-Version: 5.3.0.qualifier
Bundle-Version: 5.4.0.qualifier
Bundle-Activator: org.eclipse.cdt.core.CCorePlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2009 QNX Software Systems and others.
* Copyright (c) 2000, 2011 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -723,6 +723,7 @@ public class CProject extends Openable implements ICProject {
@Override
protected void closing(Object info) throws CModelException {
if (info instanceof CProjectInfo) {
CModelManager.getDefault().removeBinaryRunner(this);
CProjectInfo pinfo = (CProjectInfo)info;
if (pinfo.vBin != null) {
pinfo.vBin.close();
@ -731,7 +732,6 @@ public class CProject extends Openable implements ICProject {
pinfo.vLib.close();
}
pinfo.resetCaches();
CModelManager.getDefault().removeBinaryRunner(this);
}
super.closing(info);
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2010 Intel Corporation and others.
* Copyright (c) 2007, 2011 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -8,9 +8,11 @@
* Contributors:
* Intel Corporation - Initial API and implementation
* Broadcom Corporation - Bug 311189 and clean-up
* Wind River Systems - Bug 348569
*******************************************************************************/
package org.eclipse.cdt.internal.core.settings.model;
import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@ -30,6 +32,7 @@ import org.eclipse.cdt.core.settings.model.ICSourceEntry;
import org.eclipse.cdt.core.settings.model.WriteAccessException;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
import org.eclipse.cdt.core.settings.model.util.ResourceChangeHandlerBase;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@ -204,11 +207,14 @@ public class ResourceChangeHandler extends ResourceChangeHandlerBase implements
// Bug 311189 -- if the resource still exists now, don't treat as a remove!
if (to == null) {
// Workaround for platform Bug 317783
if (from.getWorkspace().validateFiltered(from).isOK())
from.refreshLocal(IResource.DEPTH_ZERO, null);
if (from.exists())
continue;
// Workaround for platform Bug 317783
if (from.getWorkspace().validateFiltered(from).isOK()) {
URI uri = from.getLocationURI();
if (uri != null && EFS.getStore(uri).fetchInfo().exists())
continue;
}
}
ICProjectDescription prjDesc = getProjectDescription(from);

View file

@ -13,6 +13,7 @@ package org.eclipse.cdt.core.dom.ast.cpp;
import org.eclipse.cdt.core.dom.ast.IASTFieldReference;
import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
import org.eclipse.cdt.core.dom.ast.IType;
/**
* Certain field references in C++ require the use the keyword template to
@ -45,4 +46,10 @@ public interface ICPPASTFieldReference extends IASTFieldReference, IASTImplicitN
* @since 5.3
*/
public ICPPASTFieldReference copy(CopyStyle style);
/**
* Returns the type of the field owner.
* @since 5.4
*/
public IType getFieldOwnerType();
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2010 Wind River Systems, Inc. and others.
* Copyright (c) 2007, 2011 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -28,6 +28,8 @@ import org.eclipse.cdt.core.dom.ast.IASTForStatement;
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
import org.eclipse.cdt.core.dom.ast.IASTIfStatement;
import org.eclipse.cdt.core.dom.ast.IASTInitializerClause;
import org.eclipse.cdt.core.dom.ast.IASTInitializerList;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTProblemExpression;
import org.eclipse.cdt.core.dom.ast.IASTProblemStatement;
@ -37,6 +39,7 @@ import org.eclipse.cdt.core.dom.ast.IASTSwitchStatement;
import org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression;
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
import org.eclipse.cdt.core.dom.ast.IASTWhileStatement;
import org.eclipse.cdt.core.dom.ast.IArrayType;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IFunctionType;
import org.eclipse.cdt.core.dom.ast.IType;
@ -58,23 +61,22 @@ public abstract class VariableReadWriteFlags {
}
protected int rwAnyNode(IASTNode node, int indirection) {
final IASTNode parent= node.getParent();
final IASTNode parent = node.getParent();
if (parent instanceof IASTExpression) {
return rwInExpression(node, (IASTExpression) parent, indirection);
return rwInExpression((IASTExpression) parent, node, indirection);
} else if (parent instanceof IASTStatement) {
return rwInStatement((IASTStatement) parent, node, indirection);
} else if (parent instanceof IASTEqualsInitializer) {
return rwInEqualsInitializer((IASTEqualsInitializer) parent, indirection);
} else if (parent instanceof IASTArrayModifier) {
return READ; // dimension
} else if (parent instanceof IASTInitializerList) {
return rwInInitializerList((IASTInitializerList) parent, indirection);
}
else if (parent instanceof IASTStatement) {
return rwInStatement(node, (IASTStatement) parent, indirection);
}
else if (parent instanceof IASTEqualsInitializer) {
return rwInInitializerExpression(indirection, parent);
}
else if (parent instanceof IASTArrayModifier) {
return READ; // dimension
}
return READ | WRITE; // fallback
return READ | WRITE; // fallback
}
protected int rwInInitializerExpression(int indirection, IASTNode parent) {
protected int rwInEqualsInitializer(IASTEqualsInitializer parent, int indirection) {
IASTNode grand= parent.getParent();
if (grand instanceof IASTDeclarator) {
IBinding binding= ((IASTDeclarator) grand).getName().getBinding();
@ -85,7 +87,24 @@ public abstract class VariableReadWriteFlags {
return READ | WRITE; // fallback
}
protected int rwInExpression(IASTNode node, IASTExpression expr, int indirection) {
protected int rwInInitializerList(IASTInitializerList parent, int indirection) {
IASTNode grand= parent.getParent();
if (grand instanceof IASTEqualsInitializer) {
IASTNode grandGrand= grand.getParent();
if (grandGrand instanceof IASTDeclarator) {
IBinding binding= ((IASTDeclarator) grandGrand).getName().resolveBinding();
if (binding instanceof IVariable) {
IType type= ((IVariable) binding).getType();
if (type instanceof IArrayType) {
return rwAssignmentToType(type, indirection);
}
}
}
}
return READ | WRITE; // fallback
}
protected int rwInExpression(IASTExpression expr, IASTNode node, int indirection) {
if (expr instanceof IASTBinaryExpression) {
return rwInBinaryExpression(node, (IASTBinaryExpression) expr, indirection);
}
@ -108,14 +127,8 @@ public abstract class VariableReadWriteFlags {
return rwAnyNode(expr, indirection);
}
if (expr instanceof IASTExpressionList) {
final IASTExpressionList exprList = (IASTExpressionList)expr;
final IASTNode grand= expr.getParent();
if (grand instanceof IASTFunctionCallExpression && expr.getPropertyInParent() == IASTFunctionCallExpression.ARGUMENT) {
final IASTFunctionCallExpression funcCall = (IASTFunctionCallExpression) grand;
return rwArgumentForFunctionCall(node, exprList, funcCall, indirection);
}
// only the first expression is passed on.
final IASTExpression[] expressions = exprList.getExpressions();
// Only the first expression is passed on.
final IASTExpression[] expressions = ((IASTExpressionList) expr).getExpressions();
if (expressions.length > 0 && expressions[0] == node) {
return rwAnyNode(expr, indirection);
}
@ -131,7 +144,7 @@ public abstract class VariableReadWriteFlags {
if (node.getPropertyInParent() == IASTFunctionCallExpression.FUNCTION_NAME) {
return READ;
}
return rwArgumentForFunctionCall((IASTFunctionCallExpression) expr, 0, indirection);
return rwArgumentForFunctionCall((IASTFunctionCallExpression) expr, node, indirection);
}
if (expr instanceof IASTIdExpression) {
return rwAnyNode(expr, indirection);
@ -143,37 +156,38 @@ public abstract class VariableReadWriteFlags {
return 0;
}
return READ | WRITE; // fall back
return READ | WRITE; // fall back
}
protected int rwArgumentForFunctionCall(IASTNode node, final IASTExpressionList exprList,
final IASTFunctionCallExpression funcCall, int indirection) {
final IASTExpression[] expressions = exprList.getExpressions();
for (int i = 0; i < expressions.length; i++) {
if (expressions[i] == node) {
return rwArgumentForFunctionCall(funcCall, i, indirection);
}
}
return READ | WRITE;// fallback
}
protected int rwArgumentForFunctionCall(final IASTFunctionCallExpression func, int parameterIdx, int indirection) {
final IASTExpression functionNameExpression = func.getFunctionNameExpression();
if (functionNameExpression != null) {
final IType type= functionNameExpression.getExpressionType();
if (type instanceof IFunctionType) {
IType[] ptypes= ((IFunctionType) type).getParameterTypes();
if (ptypes != null && ptypes.length > parameterIdx) {
return rwAssignmentToType(ptypes[parameterIdx], indirection);
protected int rwArgumentForFunctionCall(final IASTFunctionCallExpression funcCall, IASTNode argument, int indirection) {
final IASTInitializerClause[] args = funcCall.getArguments();
for (int i = 0; i < args.length; i++) {
if (args[i] == argument) {
final IASTExpression functionNameExpression = funcCall.getFunctionNameExpression();
if (functionNameExpression != null) {
final IType type= functionNameExpression.getExpressionType();
if (type instanceof IFunctionType) {
return rwArgumentForFunctionCall((IFunctionType) type, i, indirection);
}
}
break;
}
}
return READ | WRITE; // fallback
return READ | WRITE; // fallback
}
protected int rwArgumentForFunctionCall(IFunctionType type, int parameterIdx, int indirection) {
IType[] ptypes= type.getParameterTypes();
if (ptypes != null && ptypes.length > parameterIdx) {
return rwAssignmentToType(ptypes[parameterIdx], indirection);
}
return READ | WRITE; // Fallback
}
protected abstract int rwAssignmentToType(IType type, int indirection);
protected int rwInStatement(IASTNode node, IASTStatement stmt, int indirection) {
protected int rwInStatement(IASTStatement stmt, IASTNode node, int indirection) {
if (stmt instanceof IASTCaseStatement) {
if (node.getPropertyInParent() == IASTCaseStatement.EXPRESSION) {
return READ;
@ -314,6 +328,6 @@ public abstract class VariableReadWriteFlags {
}
return READ;
}
return READ; // fallback
return READ; // fallback
}
}

View file

@ -10,8 +10,8 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
import org.eclipse.cdt.core.dom.ast.IASTEqualsInitializer;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTExpressionList;
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
@ -45,35 +45,27 @@ public final class CVariableReadWriteFlags extends VariableReadWriteFlags {
}
@Override
protected int rwInExpression(IASTNode node, IASTExpression expr, int indirection) {
protected int rwInExpression(IASTExpression expr, IASTNode node, int indirection) {
if (expr instanceof ICASTTypeIdInitializerExpression) {
return 0;
}
return super.rwInExpression(node, expr, indirection);
return super.rwInExpression(expr, node, indirection);
}
@Override
protected int rwInInitializerExpression(int indirection, IASTNode parent) {
protected int rwInEqualsInitializer(IASTEqualsInitializer parent, int indirection) {
if (indirection == 0) {
return READ;
}
return super.rwInInitializerExpression(indirection, parent);
return super.rwInEqualsInitializer(parent, indirection);
}
@Override
protected int rwArgumentForFunctionCall(IASTFunctionCallExpression func, int parameterIdx,int indirection) {
protected int rwArgumentForFunctionCall(IASTFunctionCallExpression funcCall, IASTNode argument, int indirection) {
if (indirection == 0) {
return READ;
}
return super.rwArgumentForFunctionCall(func, parameterIdx, indirection);
}
@Override
protected int rwArgumentForFunctionCall(IASTNode node, IASTExpressionList exprList, IASTFunctionCallExpression funcCall, int indirection) {
if (indirection == 0) {
return READ;
}
return super.rwArgumentForFunctionCall(node, exprList, funcCall, indirection);
return super.rwArgumentForFunctionCall(funcCall, argument, indirection);
}
@Override

View file

@ -21,14 +21,15 @@ import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.ICPPASTCompletionContext;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorInitializer;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDefinition;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.core.parser.util.CharArraySet;
@ -160,11 +161,16 @@ public class CPPASTConstructorChainInitializer extends ASTNode implements
private CharArraySet getBaseClasses(IASTName name) {
CharArraySet result= new CharArraySet(2);
for (IASTNode parent = name.getParent(); parent != null; parent = parent.getParent()) {
if (parent instanceof ICPPASTCompositeTypeSpecifier) {
ICPPASTCompositeTypeSpecifier specifier = (ICPPASTCompositeTypeSpecifier) parent;
for (ICPPASTBaseSpecifier bs : specifier.getBaseSpecifiers()) {
result.put(bs.getName().getLastName().getSimpleID());
}
if (parent instanceof ICPPASTFunctionDefinition) {
ICPPASTFunctionDefinition fdef= (ICPPASTFunctionDefinition) parent;
IBinding method= fdef.getDeclarator().getName().resolveBinding();
if (method instanceof ICPPMethod) {
ICPPClassType cls= ((ICPPMethod) method).getClassOwner();
for (ICPPBase base : cls.getBases()) {
result.put(base.getBaseClassSpecifierName().getSimpleID());
}
return result;
}
}
}
return result;

View file

@ -17,12 +17,11 @@ import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE;
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.PRVALUE;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.glvalueType;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.prvalueType;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.ALLCVQ;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.CVTYPE;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.REF;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.TDEF;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.typeFromFunctionCall;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
@ -41,6 +40,7 @@ import org.eclipse.cdt.core.dom.ast.ISemanticProblem;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.IVariable;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFieldReference;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
@ -139,11 +139,7 @@ public class CPPASTFieldReference extends ASTNode implements ICPPASTFieldReferen
// collect the function bindings
List<ICPPFunction> functionBindings = new ArrayList<ICPPFunction>();
try {
CPPSemantics.getFieldOwnerType(this, functionBindings);
} catch (DOMException e) {
return implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
}
getFieldOwnerType(functionBindings);
if (functionBindings.isEmpty())
return implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY;
@ -319,4 +315,62 @@ public class CPPASTFieldReference extends ASTNode implements ICPPASTFieldReferen
public IBinding[] findBindings(IASTName n, boolean isPrefix) {
return findBindings(n, isPrefix, null);
}
/**
* For a pointer dereference expression e1->e2, return the type that e1 ultimately evaluates to
* after chaining overloaded class member access operators <code>operator->()</code> calls.
*/
public IType getFieldOwnerType() {
return getFieldOwnerType(null);
}
/*
* Also collects the function bindings if requested.
*/
private IType getFieldOwnerType(Collection<ICPPFunction> functionBindings) {
final IASTExpression owner = getFieldOwner();
if (owner == null)
return null;
IType type= owner.getExpressionType();
if (!isPointerDereference())
return type;
// bug 205964: as long as the type is a class type, recurse.
// Be defensive and allow a max of 20 levels.
for (int j = 0; j < 20; j++) {
// for unknown types we cannot determine the overloaded -> operator
IType classType= getUltimateTypeUptoPointers(type);
if (classType instanceof ICPPUnknownType)
return CPPUnknownClass.createUnnamedInstance();
if (!(classType instanceof ICPPClassType))
break;
/*
* 13.5.6-1: An expression x->m is interpreted as (x.operator->())->m for a
* class object x of type T
*
* Construct an AST fragment for x.operator-> which the lookup routines can
* examine for type information.
*/
ICPPFunction op = CPPSemantics.findOverloadedOperator(this, type, (ICPPClassType) classType);
if (op == null)
break;
if (functionBindings != null)
functionBindings.add(op);
type= typeFromFunctionCall(op);
type= SemanticUtil.mapToAST(type, owner);
}
IType prValue= prvalueType(type);
if (prValue instanceof IPointerType) {
return glvalueType(((IPointerType) prValue).getType());
}
return new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION);
}
}

View file

@ -16,9 +16,7 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp;
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.LVALUE;
import static org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory.PRVALUE;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.*;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.CVTYPE;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.REF;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.TDEF;
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.getUltimateTypeUptoPointers;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.DOMException;
@ -28,7 +26,6 @@ import org.eclipse.cdt.core.dom.ast.IASTImplicitName;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
import org.eclipse.cdt.core.dom.ast.IArrayType;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IFunction;
import org.eclipse.cdt.core.dom.ast.IPointerType;
@ -46,7 +43,6 @@ import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
import org.eclipse.cdt.internal.core.dom.parser.ProblemType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
/**
* Unary expression in c++
@ -249,15 +245,15 @@ public class CPPASTUnaryExpression extends ASTNode implements ICPPASTUnaryExpres
if (op == op_star) {
IType type= operand.getExpressionType();
type = SemanticUtil.getNestedType(type, TDEF | REF | CVTYPE);
if (type instanceof ISemanticProblem) {
return type;
}
if (type instanceof IPointerType || type instanceof IArrayType) {
type = prvalueType(type);
if (type instanceof IPointerType) {
type= ((ITypeContainer) type).getType();
return glvalueType(type);
}
if (type instanceof ISemanticProblem) {
return type;
}
type= getUltimateTypeUptoPointers(type);
if (type instanceof ICPPUnknownType) {
// mstodo Type of unknown
return CPPUnknownClass.createUnnamedInstance();

View file

@ -1859,6 +1859,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
throwBacktrack(offset, endOffset - offset);
}
__attribute__();
switch (LT(1)) {
case IToken.tSEMI:
case IToken.tEOC:

View file

@ -23,7 +23,6 @@ import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUti
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@ -362,13 +361,13 @@ public class CPPSemantics {
}
}
if (binding instanceof ICPPClassType) {
if (convertClassToConstructor(data.astName)) {
if (binding instanceof IIndexBinding) {
binding= data.tu.mapToAST((ICPPClassType) binding);
if (binding instanceof IType) {
IType t = getNestedType((IType) binding, TDEF);
if (t instanceof ICPPClassType && convertClassToConstructor(data.astName)) {
ICPPClassType cls= (ICPPClassType) t;
if (cls instanceof IIndexBinding) {
cls= data.tu.mapToAST(cls);
}
ICPPClassType cls= (ICPPClassType) binding;
try {
if (data.astName instanceof ICPPASTTemplateId && cls instanceof ICPPClassTemplate) {
if (data.tu != null) {
@ -2922,69 +2921,6 @@ public class CPPSemantics {
return result;
}
/**
* For a pointer dereference expression e1->e2, return the type that e1 ultimately evaluates to
* when chaining overloaded class member access operators <code>operator->()</code> calls.
* @param fieldReference
* @return the type the field owner expression ultimately evaluates to when chaining overloaded
* class member access operators <code>operator->()</code> calls.
* @throws DOMException
*/
public static IType getFieldOwnerType(ICPPASTFieldReference fieldReference) throws DOMException {
return getFieldOwnerType(fieldReference, null);
}
/*
* Also collects the function bindings if requested.
*/
public static IType getFieldOwnerType(ICPPASTFieldReference fieldReference, Collection<ICPPFunction> functionBindings) throws DOMException {
final IASTExpression owner = fieldReference.getFieldOwner();
if (owner == null)
return null;
IType type= SemanticUtil.getNestedType(owner.getExpressionType(), TDEF|REF);
if (!fieldReference.isPointerDereference())
return type;
// bug 205964: as long as the type is a class type, recurse.
// Be defensive and allow a max of 10 levels.
boolean foundOperator= false;
for (int j = 0; j < 10; j++) {
IType uTemp= getUltimateTypeUptoPointers(type);
if (uTemp instanceof IPointerType)
return type;
// for unknown types we cannot determine the overloaded -> operator
if (uTemp instanceof ICPPUnknownType)
return CPPUnknownClass.createUnnamedInstance();
if (!(uTemp instanceof ICPPClassType))
break;
/*
* 13.5.6-1: An expression x->m is interpreted as (x.operator->())->m for a
* class object x of type T
*
* Construct an AST fragment for x.operator-> which the lookup routines can
* examine for type information.
*/
IASTExpression arg = createArgForType(fieldReference, type);
ICPPFunction op = findOverloadedOperator(fieldReference, new IASTExpression[] {arg}, uTemp, OverloadableOperator.ARROW, LookupMode.NO_GLOBALS);
if (op == null)
break;
if (functionBindings != null)
functionBindings.add(op);
type= SemanticUtil.getNestedType(op.getType().getReturnType(), TDEF|REF);
type= SemanticUtil.mapToAST(type, owner);
foundOperator= true;
}
return foundOperator ? type : null;
}
public static ICPPFunction findOverloadedOperator(IASTArraySubscriptExpression exp) {
final IASTExpression arrayExpression = exp.getArrayExpression();
IASTInitializerClause[] args = {arrayExpression, exp.getArgument()};
@ -3111,7 +3047,12 @@ public class CPPSemantics {
sourceType= new InitializerListType((ICPPASTInitializerList) initClause);
}
if (sourceType != null) {
Cost c= Conversions.checkImplicitConversionSequence(type, sourceType, isLValue, UDCMode.ALLOWED, Context.ORDINARY);
Cost c;
if (calculateInheritanceDepth(sourceType, classType) >= 0) {
c = Conversions.copyInitializationOfClass(isLValue, sourceType, classType, false);
} else {
c = Conversions.checkImplicitConversionSequence(type, sourceType, isLValue, UDCMode.ALLOWED, Context.ORDINARY);
}
if (c.converts()) {
ICPPFunction f = c.getUserDefinedConversion();
if (f instanceof ICPPConstructor)
@ -3279,6 +3220,14 @@ public class CPPSemantics {
return findOverloadedOperator(dummy, args, op1type, OverloadableOperator.COMMA, LookupMode.LIMITED_GLOBALS);
}
/**
* Returns the operator->() function
*/
public static ICPPFunction findOverloadedOperator(ICPPASTFieldReference fieldRef, IType cvQualifiedType, ICPPClassType classType) {
IASTExpression arg = CPPSemantics.createArgForType(fieldRef, cvQualifiedType);
return findOverloadedOperator(fieldRef, new IASTExpression[] {arg}, classType, OverloadableOperator.ARROW, LookupMode.NO_GLOBALS);
}
private static enum LookupMode {NO_GLOBALS, LIMITED_GLOBALS, ALL_GLOBALS}
private static ICPPFunction findOverloadedOperator(IASTExpression parent, IASTInitializerClause[] args, IType methodLookupType,
OverloadableOperator operator, LookupMode mode) {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2009 Wind River Systems, Inc. and others.
* Copyright (c) 2007, 2011 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,16 +7,24 @@
*
* Contributors:
* Markus Schorn - initial API and implementation
* Patrick Hofer - [Bug 328528]
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTImplicitName;
import org.eclipse.cdt.core.dom.ast.IASTImplicitNameOwner;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IPointerType;
import org.eclipse.cdt.core.dom.ast.IQualifierType;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.IVariable;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorInitializer;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUnaryExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
import org.eclipse.cdt.internal.core.dom.parser.VariableReadWriteFlags;
@ -34,6 +42,47 @@ public final class CPPVariableReadWriteFlags extends VariableReadWriteFlags {
return INSTANCE.rwAnyNode(variable, 0);
}
@Override
protected int rwAnyNode(IASTNode node, int indirection) {
final IASTNode parent = node.getParent();
if (parent instanceof ICPPASTConstructorInitializer) {
return rwInCtorInitializer(node, indirection, (ICPPASTConstructorInitializer) parent);
}
return super.rwAnyNode(node, indirection);
}
private int rwInCtorInitializer(IASTNode node, int indirection, ICPPASTConstructorInitializer parent) {
IASTNode grand= parent.getParent();
if (grand instanceof IASTDeclarator) {
// Look for a constructor being called.
if (grand instanceof IASTImplicitNameOwner) {
IASTImplicitName[] names = ((IASTImplicitNameOwner) grand).getImplicitNames();
for (IASTImplicitName in : names) {
IBinding b= in.resolveBinding();
if (b instanceof ICPPConstructor) {
final ICPPConstructor ctor = (ICPPConstructor) b;
int idx= 0;
for (IASTNode child : parent.getArguments()) {
if (child == node) {
return rwArgumentForFunctionCall(ctor.getType(), idx, indirection);
}
idx++;
}
}
}
}
// Allow for initialization of primitive types.
if (parent.getArguments().length == 1) {
IBinding binding= ((IASTDeclarator) grand).getName().getBinding();
if (binding instanceof IVariable) {
IType type= ((IVariable) binding).getType();
return rwAssignmentToType(type, indirection);
}
}
}
return READ | WRITE; // fallback
}
@Override
protected int rwInUnaryExpression(IASTNode node, IASTUnaryExpression expr, int indirection) {
switch (expr.getOperator()) {

View file

@ -1065,9 +1065,12 @@ public class CPPVisitor extends ASTQueries {
for (; i < names.length; i++) {
if (names[i] == name) break;
}
final IASTTranslationUnit tu = parent.getTranslationUnit();
if (i == 0) {
if (qname.isFullyQualified()) {
return parent.getTranslationUnit().getScope();
if (tu == null)
return null;
return tu.getScope();
}
if (qname.getParent() instanceof ICPPASTFieldReference) {
name= qname;
@ -1091,8 +1094,8 @@ public class CPPVisitor extends ASTQueries {
boolean done= true;
IScope scope= null;
if (binding instanceof ICPPClassType) {
if (binding instanceof IIndexBinding) {
binding= (((CPPASTTranslationUnit) parent.getTranslationUnit())).mapToAST((ICPPClassType) binding);
if (binding instanceof IIndexBinding && tu != null) {
binding= (((CPPASTTranslationUnit) tu)).mapToAST((ICPPClassType) binding);
}
scope= ((ICPPClassType) binding).getCompositeScope();
} else if (binding instanceof ICPPNamespace) {
@ -1121,19 +1124,16 @@ public class CPPVisitor extends ASTQueries {
data.usesEnclosingScope= false;
}
final ICPPASTFieldReference fieldReference = (ICPPASTFieldReference) parent;
IType type = CPPSemantics.getFieldOwnerType(fieldReference);
if (fieldReference.isPointerDereference()) {
type= getUltimateType(type, false);
} else {
type= getUltimateTypeUptoPointers(type);
}
IType type = fieldReference.getFieldOwnerType();
type= getUltimateTypeUptoPointers(type);
if (type instanceof ICPPClassType) {
if (type instanceof IIndexBinding) {
type= (((CPPASTTranslationUnit) fieldReference.getTranslationUnit())).mapToAST((ICPPClassType) type);
}
type= SemanticUtil.mapToAST(type, fieldReference);
return ((ICPPClassType) type).getCompositeScope();
} else if (type instanceof ICPPUnknownBinding) {
return ((ICPPUnknownBinding) type).asScope();
} else {
// mstodo introduce problem category
return new CPPScope.CPPScopeProblem(name, ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION);
}
} else if (parent instanceof IASTGotoStatement || parent instanceof IASTLabelStatement) {
while (!(parent instanceof IASTFunctionDefinition)) {

View file

@ -22,7 +22,6 @@ import java.util.List;
import java.util.Map;
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
@ -42,7 +41,6 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IPointerType;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.c.ICASTFieldDesignator;
@ -401,41 +399,30 @@ public class LookupData {
nameParent= name.getParent();
}
try {
final ASTNodeProperty prop = name.getPropertyInParent();
if (prop == CPPSemantics.STRING_LOOKUP_PROPERTY) {
return null;
}
if (prop == IASTFieldReference.FIELD_NAME) {
ICPPASTFieldReference fieldRef = (ICPPASTFieldReference) nameParent;
IType implied= CPPSemantics.getFieldOwnerType(fieldRef);
if (fieldRef.isPointerDereference()) {
implied= SemanticUtil.getUltimateTypeUptoPointers(implied);
if (implied instanceof IPointerType)
return ((IPointerType) implied).getType();
}
return implied;
}
if (prop == IASTIdExpression.ID_NAME) {
IScope scope = CPPVisitor.getContainingScope(name);
if (scope instanceof ICPPClassScope) {
return ((ICPPClassScope) scope).getClassType();
}
return CPPVisitor.getImpliedObjectType(scope);
}
if (prop == IASTDeclarator.DECLARATOR_NAME) {
if (forExplicitFunctionInstantiation()) {
IScope scope = CPPVisitor.getContainingScope(astName);
if (scope instanceof ICPPClassScope) {
return ((ICPPClassScope) scope).getClassType();
}
}
}
return null;
} catch (DOMException e) {
return e.getProblem();
}
final ASTNodeProperty prop = name.getPropertyInParent();
if (prop == CPPSemantics.STRING_LOOKUP_PROPERTY) {
return null;
}
if (prop == IASTFieldReference.FIELD_NAME) {
ICPPASTFieldReference fieldRef = (ICPPASTFieldReference) nameParent;
return fieldRef.getFieldOwnerType();
}
if (prop == IASTIdExpression.ID_NAME) {
IScope scope = CPPVisitor.getContainingScope(name);
if (scope instanceof ICPPClassScope) {
return ((ICPPClassScope) scope).getClassType();
}
return CPPVisitor.getImpliedObjectType(scope);
}
if (prop == IASTDeclarator.DECLARATOR_NAME) {
if (forExplicitFunctionInstantiation()) {
IScope scope = CPPVisitor.getContainingScope(astName);
if (scope instanceof ICPPClassScope) {
return ((ICPPClassScope) scope).getClassType();
}
}
}
return null;
}
public boolean forFriendship() {

View file

@ -680,7 +680,9 @@ public class CIndex implements IIndex {
HashMap<IIndexFileLocation, IIndexFile> result= new HashMap<IIndexFileLocation, IIndexFile>();
for (IIndexFragment fragment : fFragments) {
for (IIndexFragmentFile file : fragment.getAllFiles()) {
result.put(file.getLocation(), file);
if (file.hasContent()) {
result.put(file.getLocation(), file);
}
}
}
return result.values().toArray(new IIndexFile[result.size()]);

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Andrew Ferguson (Symbian) - Initial implementation
* Markus Schorn (Wind River Systems)
* Andrew Ferguson (Symbian) - Initial implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.index.composite;
@ -43,16 +43,6 @@ public abstract class AbstractCompositeFactory implements ICompositesFactory {
);
}
/*
* @see org.eclipse.cdt.internal.core.index.composite.ICompositesFactory#getCompositeBindings(org.eclipse.cdt.core.index.IIndex, org.eclipse.cdt.internal.core.index.IIndexFragmentBinding[])
*/
public final IIndexBinding[] getCompositeBindings(IIndexFragmentBinding[] bindings) {
IIndexBinding[] result = new IIndexBinding[bindings.length];
for(int i=0; i<result.length; i++)
result[i] = getCompositeBinding(bindings[i]);
return result;
}
protected final IType[] getCompositeTypes(IType[] types) {
// Don't create a new array until it's really needed.
IType[] result = types;
@ -71,13 +61,20 @@ public abstract class AbstractCompositeFactory implements ICompositesFactory {
return result;
}
/*
* @see org.eclipse.cdt.internal.core.index.composite.cpp.ICompositesFactory#getComposites(org.eclipse.cdt.core.index.IIndex, org.eclipse.cdt.internal.core.index.IIndexFragmentBinding[][])
/**
* @see ICompositesFactory#getCompositeBindings(IIndexFragmentBinding[][])
*/
public final IIndexBinding[] getCompositeBindings(IIndexFragmentBinding[][] fragmentBindings) {
return getCompositeBindings(mergeBindingArrays(fragmentBindings));
}
private final IIndexBinding[] getCompositeBindings(IIndexFragmentBinding[] bindings) {
IIndexBinding[] result = new IIndexBinding[bindings.length];
for (int i = 0; i < result.length; i++)
result[i] = getCompositeBinding(bindings[i]);
return result;
}
public final IIndexFragmentBinding[] findEquivalentBindings(IBinding binding) {
CIndex cindex= (CIndex) index;
try {
@ -96,9 +93,13 @@ public abstract class AbstractCompositeFactory implements ICompositesFactory {
*/
protected IIndexFragmentBinding[] mergeBindingArrays(IIndexFragmentBinding[][] fragmentBindings) {
TreeSet<IIndexFragmentBinding> ts = new TreeSet<IIndexFragmentBinding>(fragmentComparator);
for (IIndexFragmentBinding[] fragmentBinding : fragmentBindings)
for (IIndexFragmentBinding element : fragmentBinding)
ts.add(element);
for (IIndexFragmentBinding[] array : fragmentBindings) {
if (array != null) {
for (IIndexFragmentBinding element : array) {
ts.add(element);
}
}
}
return ts.toArray(new IIndexFragmentBinding[ts.size()]);
}
@ -113,20 +114,20 @@ public abstract class AbstractCompositeFactory implements ICompositesFactory {
* @return the representative binding as defined above
*/
protected IIndexFragmentBinding findOneBinding(IBinding binding, boolean allowDeclaration) {
try{
try {
IIndexFragmentBinding[] ibs= findEquivalentBindings(binding);
IBinding def= null;
IBinding dec= ibs.length>0 ? ibs[0] : null;
IIndexFragmentBinding def= null;
IIndexFragmentBinding dec= ibs.length > 0 ? ibs[0] : null;
for (IIndexFragmentBinding ib : ibs) {
if(ib.hasDefinition()) {
if (ib.hasDefinition()) {
def= ib;
} else if(allowDeclaration && ib.hasDeclaration()) {
} else if (allowDeclaration && ib.hasDeclaration()) {
dec= ib;
}
}
return (IIndexFragmentBinding) (def == null ? dec : def);
} catch(CoreException ce) {
CCorePlugin.log(ce);
return def == null ? dec : def;
} catch (CoreException e) {
CCorePlugin.log(e);
}
throw new CompositingNotImplementedError();
}
@ -141,7 +142,7 @@ public abstract class AbstractCompositeFactory implements ICompositesFactory {
public int compare(IIndexFragmentBinding f1, IIndexFragmentBinding f2) {
for (IIndexFragmentBindingComparator comparator : comparators) {
int cmp= comparator.compare(f1, f2);
if(cmp!=Integer.MIN_VALUE) {
if (cmp != Integer.MIN_VALUE) {
return cmp;
}
}

View file

@ -127,15 +127,15 @@ class ASTComment extends ASTPreprocessorNode implements IASTComment {
abstract class ASTDirectiveWithCondition extends ASTPreprocessorNode {
protected final int fConditionOffset;
private final boolean fActive;
public ASTDirectiveWithCondition(IASTTranslationUnit parent, int startNumber, int condNumber, int endNumber, boolean active) {
private final boolean fTaken;
public ASTDirectiveWithCondition(IASTTranslationUnit parent, int startNumber, int condNumber, int endNumber, boolean taken) {
super(parent, IASTTranslationUnit.PREPROCESSOR_STATEMENT, startNumber, endNumber);
fConditionOffset= condNumber;
fActive= active;
fTaken= taken;
}
public boolean taken() {
return fActive;
return fTaken;
}
public String getConditionString() {
@ -154,19 +154,19 @@ class ASTEndif extends ASTPreprocessorNode implements IASTPreprocessorEndifState
}
class ASTElif extends ASTDirectiveWithCondition implements IASTPreprocessorElifStatement {
public ASTElif(IASTTranslationUnit parent, int startNumber, int condNumber, int condEndNumber, boolean active) {
super(parent, startNumber, condNumber, condEndNumber, active);
public ASTElif(IASTTranslationUnit parent, int startNumber, int condNumber, int condEndNumber, boolean taken) {
super(parent, startNumber, condNumber, condEndNumber, taken);
}
}
class ASTElse extends ASTPreprocessorNode implements IASTPreprocessorElseStatement {
private final boolean fActive;
public ASTElse(IASTTranslationUnit parent, int startNumber, int endNumber, boolean active) {
private final boolean fTaken;
public ASTElse(IASTTranslationUnit parent, int startNumber, int endNumber, boolean taken) {
super(parent, IASTTranslationUnit.PREPROCESSOR_STATEMENT, startNumber, endNumber);
fActive= active;
fTaken= taken;
}
public boolean taken() {
return fActive;
return fTaken;
}
}
@ -204,8 +204,8 @@ class ASTIfdef extends ASTDirectiveWithCondition implements IASTPreprocessorIfde
}
class ASTIf extends ASTDirectiveWithCondition implements IASTPreprocessorIfStatement {
public ASTIf(IASTTranslationUnit parent, int startNumber, int condNumber, int condEndNumber, boolean active) {
super(parent, startNumber, condNumber, condEndNumber, active);
public ASTIf(IASTTranslationUnit parent, int startNumber, int condNumber, int condEndNumber, boolean taken) {
super(parent, startNumber, condNumber, condEndNumber, taken);
}
}
@ -304,7 +304,6 @@ class ASTMacroDefinition extends ASTPreprocessorNode implements IASTPreprocessor
private final ASTPreprocessorName fName;
protected final int fExpansionNumber;
private final int fExpansionOffset;
private final boolean fActive;
/**
* Regular constructor.
@ -314,8 +313,9 @@ class ASTMacroDefinition extends ASTPreprocessorNode implements IASTPreprocessor
super(parent, IASTTranslationUnit.PREPROCESSOR_STATEMENT, startNumber, endNumber);
fExpansionNumber= expansionNumber;
fExpansionOffset= -1;
fActive= active;
fName= new ASTPreprocessorDefinition(this, IASTPreprocessorMacroDefinition.MACRO_NAME, nameNumber, nameEndNumber, macro.getNameCharArray(), macro);
if (!active)
setInactive();
}
/**
@ -327,7 +327,6 @@ class ASTMacroDefinition extends ASTPreprocessorNode implements IASTPreprocessor
fName= new ASTBuiltinName(this, IASTPreprocessorMacroDefinition.MACRO_NAME, floc, macro.getNameCharArray(), macro);
fExpansionNumber= -1;
fExpansionOffset= expansionOffset;
fActive= true;
}
@ -388,11 +387,6 @@ class ASTMacroDefinition extends ASTPreprocessorNode implements IASTPreprocessor
public String toString() {
return getName().toString() + '=' + getExpansion();
}
@Override
final public boolean isActive() {
return fActive;
}
}
class ASTMacroParameter extends ASTPreprocessorNode implements IASTFunctionStyleMacroParameter {

View file

@ -1380,7 +1380,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
final int nameEndOffset = name.getEndOffset();
final int endOffset= lexer.currentToken().getEndOffset();
boolean isActive= false;
boolean isTaken= false;
PreprocessorMacro macro= null;
final Conditional conditional= fCurrentContext.newBranch(BranchKind.eIf, withinExpansion);
if (conditional.canHaveActiveBranch(withinExpansion)) {
@ -1394,19 +1394,23 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
} else {
final char[] namechars= name.getCharImage();
macro= fMacroDictionary.get(namechars);
isActive= (macro == null) == isIfndef;
isTaken= (macro == null) == isIfndef;
if (macro == null) {
macro = new UndefinedMacro(namechars);
}
}
}
ASTPreprocessorNode stmt;
if (isIfndef) {
fLocationMap.encounterPoundIfndef(offset, nameOffset, nameEndOffset, endOffset, isActive, macro);
stmt= fLocationMap.encounterPoundIfndef(offset, nameOffset, nameEndOffset, endOffset, isTaken, macro);
} else {
fLocationMap.encounterPoundIfdef(offset, nameOffset, nameEndOffset, endOffset, isActive, macro);
stmt= fLocationMap.encounterPoundIfdef(offset, nameOffset, nameEndOffset, endOffset, isTaken, macro);
}
return fCurrentContext.setBranchState(conditional, isActive, withinExpansion, offset);
if (!conditional.isActive(withinExpansion))
stmt.setInactive();
return fCurrentContext.setBranchState(conditional, isTaken, withinExpansion, offset);
}
private CodeState executeIf(Lexer lexer, int startOffset, boolean isElif, boolean withinExpansion) throws OffsetLimitReachedException {
@ -1418,7 +1422,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
return fCurrentContext.getCodeState();
}
boolean isActive= false;
boolean isTaken= false;
IASTName[] refs= IASTName.EMPTY_NAME_ARRAY;
int condOffset= lexer.nextToken().getOffset();
int condEndOffset, endOffset;
@ -1433,7 +1437,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
} else {
try {
fExpressionEvaluator.clearMacrosInDefinedExpression();
isActive= fExpressionEvaluator.evaluate(condition, fMacroDictionary, fLocationMap);
isTaken= fExpressionEvaluator.evaluate(condition, fMacroDictionary, fLocationMap);
refs = fExpressionEvaluator.clearMacrosInDefinedExpression();
} catch (EvalException e) {
handleProblem(e.getProblemID(), e.getProblemArg(), condOffset, endOffset);
@ -1444,12 +1448,16 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
endOffset= lexer.currentToken().getEndOffset();
}
ASTPreprocessorNode stmt;
if (isElif) {
fLocationMap.encounterPoundElif(startOffset, condOffset, condEndOffset, endOffset, isActive, refs);
stmt= fLocationMap.encounterPoundElif(startOffset, condOffset, condEndOffset, endOffset, isTaken, refs);
} else {
fLocationMap.encounterPoundIf(startOffset, condOffset, condEndOffset, endOffset, isActive, refs);
stmt= fLocationMap.encounterPoundIf(startOffset, condOffset, condEndOffset, endOffset, isTaken, refs);
}
return fCurrentContext.setBranchState(cond, isActive, withinExpansion, startOffset);
if (!cond.isActive(withinExpansion))
stmt.setInactive();
return fCurrentContext.setBranchState(cond, isTaken, withinExpansion, startOffset);
}
private CodeState executeElse(final Lexer lexer, final int startOffset,boolean withinExpansion)
@ -1461,9 +1469,11 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
return fCurrentContext.getCodeState();
}
final boolean isActive= cond.canHaveActiveBranch(withinExpansion);
fLocationMap.encounterPoundElse(startOffset, endOffset, isActive);
return fCurrentContext.setBranchState(cond, isActive, withinExpansion, startOffset);
final boolean isTaken= cond.canHaveActiveBranch(withinExpansion);
ASTElse stmt = fLocationMap.encounterPoundElse(startOffset, endOffset, isTaken);
if (!cond.isActive(withinExpansion))
stmt.setInactive();
return fCurrentContext.setBranchState(cond, isTaken, withinExpansion, startOffset);
}
private CodeState executeEndif(Lexer lexer, int startOffset, boolean withinExpansion) throws OffsetLimitReachedException {
@ -1472,7 +1482,9 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
if (cond == null) {
handleProblem(IProblem.PREPROCESSOR_UNBALANCE_CONDITION, Keywords.cENDIF, startOffset, endOffset);
} else {
fLocationMap.encounterPoundEndIf(startOffset, endOffset);
ASTEndif stmt = fLocationMap.encounterPoundEndIf(startOffset, endOffset);
if (!cond.isActive(withinExpansion))
stmt.setInactive();
}
return fCurrentContext.setBranchEndState(cond, withinExpansion, startOffset);
}

View file

@ -248,19 +248,21 @@ public class LocationMap implements ILocationResolver {
fProblems.add(problem);
}
public void encounterPoundElse(int startOffset, int endOffset, boolean isActive) {
public ASTElse encounterPoundElse(int startOffset, int endOffset, boolean isActive) {
startOffset= getSequenceNumberForOffset(startOffset);
endOffset= getSequenceNumberForOffset(endOffset);
fDirectives.add(new ASTElse(fTranslationUnit, startOffset, endOffset, isActive));
final ASTElse astElse = new ASTElse(fTranslationUnit, startOffset, endOffset, isActive);
fDirectives.add(astElse);
return astElse;
}
public void encounterPoundElif(int startOffset, int condOffset, int condEndOffset, int endOffset, boolean isActive,
public ASTElif encounterPoundElif(int startOffset, int condOffset, int condEndOffset, int endOffset, boolean taken,
IASTName[] macrosInDefinedExpression) {
startOffset= getSequenceNumberForOffset(startOffset);
condOffset= getSequenceNumberForOffset(condOffset);
condEndOffset= getSequenceNumberForOffset(condEndOffset);
// compatible with 4.0: endOffset= getSequenceNumberForOffset(endOffset);
final ASTElif elif = new ASTElif(fTranslationUnit, startOffset, condOffset, condEndOffset, isActive);
final ASTElif elif = new ASTElif(fTranslationUnit, startOffset, condOffset, condEndOffset, taken);
fDirectives.add(elif);
for (IASTName element : macrosInDefinedExpression) {
@ -269,13 +271,15 @@ public class LocationMap implements ILocationResolver {
name.setPropertyInParent(IASTPreprocessorStatement.MACRO_NAME);
addMacroReference(name);
}
return elif;
}
public void encounterPoundEndIf(int startOffset, int endOffset) {
public ASTEndif encounterPoundEndIf(int startOffset, int endOffset) {
startOffset= getSequenceNumberForOffset(startOffset);
endOffset= getSequenceNumberForOffset(endOffset);
fDirectives.add(new ASTEndif(fTranslationUnit, startOffset, endOffset));
final ASTEndif stmt = new ASTEndif(fTranslationUnit, startOffset, endOffset);
fDirectives.add(stmt);
return stmt;
}
public void encounterPoundError(int startOffset, int condOffset, int condEndOffset, int endOffset) {
@ -298,7 +302,7 @@ public class LocationMap implements ILocationResolver {
fDirectives.add(new ASTPragmaOperator(fTranslationUnit, startNumber, condNumber, condEndNumber, endNumber));
}
public void encounterPoundIfdef(int startOffset, int condOffset, int condEndOffset, int endOffset, boolean taken, IMacroBinding macro) {
public ASTIfdef encounterPoundIfdef(int startOffset, int condOffset, int condEndOffset, int endOffset, boolean taken, IMacroBinding macro) {
startOffset= getSequenceNumberForOffset(startOffset);
condOffset= getSequenceNumberForOffset(condOffset);
condEndOffset= getSequenceNumberForOffset(condEndOffset);
@ -306,9 +310,10 @@ public class LocationMap implements ILocationResolver {
final ASTIfdef ifdef = new ASTIfdef(fTranslationUnit, startOffset, condOffset, condEndOffset, taken, macro);
fDirectives.add(ifdef);
addMacroReference(ifdef.getMacroReference());
return ifdef;
}
public void encounterPoundIfndef(int startOffset, int condOffset, int condEndOffset, int endOffset, boolean taken, IMacroBinding macro) {
public ASTIfndef encounterPoundIfndef(int startOffset, int condOffset, int condEndOffset, int endOffset, boolean taken, IMacroBinding macro) {
startOffset= getSequenceNumberForOffset(startOffset);
condOffset= getSequenceNumberForOffset(condOffset);
condEndOffset= getSequenceNumberForOffset(condEndOffset);
@ -316,15 +321,16 @@ public class LocationMap implements ILocationResolver {
final ASTIfndef ifndef = new ASTIfndef(fTranslationUnit, startOffset, condOffset, condEndOffset, taken, macro);
fDirectives.add(ifndef);
addMacroReference(ifndef.getMacroReference());
return ifndef;
}
public void encounterPoundIf(int startOffset, int condOffset, int condEndOffset, int endOffset, boolean isActive,
public ASTIf encounterPoundIf(int startOffset, int condOffset, int condEndOffset, int endOffset, boolean taken,
IASTName[] macrosInDefinedExpression) {
startOffset= getSequenceNumberForOffset(startOffset);
condOffset= getSequenceNumberForOffset(condOffset);
condEndOffset= getSequenceNumberForOffset(condEndOffset);
// not using endOffset, compatible with 4.0: endOffset= getSequenceNumberForOffset(endOffset);
final ASTIf astif = new ASTIf(fTranslationUnit, startOffset, condOffset, condEndOffset, isActive);
final ASTIf astif = new ASTIf(fTranslationUnit, startOffset, condOffset, condEndOffset, taken);
fDirectives.add(astif);
for (IASTName element : macrosInDefinedExpression) {
ASTMacroReferenceName name = (ASTMacroReferenceName) element;
@ -332,6 +338,7 @@ public class LocationMap implements ILocationResolver {
name.setPropertyInParent(IASTPreprocessorStatement.MACRO_NAME);
addMacroReference(name);
}
return astif;
}
public void encounterPoundDefine(int startOffset, int nameOffset, int nameEndOffset, int expansionOffset, int endOffset, boolean isActive, IMacroBinding macrodef) {

View file

@ -23,7 +23,7 @@ final class ScannerContext {
enum BranchKind {eIf, eElif, eElse, eEnd}
enum CodeState {eActive, eParseInactive, eSkipInactive}
final static class Conditional {
private CodeState fInitialState;
private final CodeState fInitialState;
private BranchKind fLast;
private boolean fTakeElse= true;
Conditional(CodeState state) {
@ -31,7 +31,11 @@ final class ScannerContext {
fLast= BranchKind.eIf;
}
boolean canHaveActiveBranch(boolean withinExpansion) {
return fTakeElse && (fInitialState == CodeState.eActive || withinExpansion);
return fTakeElse && isActive(withinExpansion);
}
public boolean isActive(boolean withinExpansion) {
return withinExpansion || fInitialState == CodeState.eActive;
}
}

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
<version>8.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<version>5.4.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.core</artifactId>
<packaging>eclipse-plugin</packaging>
</project>

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.cdt</groupId>
<artifactId>cdt-parent</artifactId>
<version>8.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<version>5.3.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.ui.tests</artifactId>
<packaging>eclipse-test-plugin</packaging>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<useUIHarness>true</useUIHarness>
<argLine>-Xms256m -Xmx512m -XX:MaxPermSize=256M</argLine>
<includes>
<include>**/AutomatedSuite.*</include>
</includes>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
</plugins>
</build>
</project>

Some files were not shown because too many files have changed in this diff Show more