mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 379474 - remote C/C++ project with XL toolchain generates a parse
error in stdio.h, preventing proper AST gen and Indexing
This commit is contained in:
parent
95a7d718df
commit
586d5ad43d
4 changed files with 42 additions and 7 deletions
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: %pluginName
|
Bundle-Name: %pluginName
|
||||||
Bundle-SymbolicName: org.eclipse.cdt.make.xlc.core;singleton:=true
|
Bundle-SymbolicName: org.eclipse.cdt.make.xlc.core;singleton:=true
|
||||||
Bundle-Version: 5.2.0.qualifier
|
Bundle-Version: 5.2.1.qualifier
|
||||||
Bundle-Vendor: %providerName
|
Bundle-Vendor: %providerName
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
Require-Bundle: org.eclipse.cdt.make.core,
|
Require-Bundle: org.eclipse.cdt.make.core,
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<version>5.2.0-SNAPSHOT</version>
|
<version>5.2.1-SNAPSHOT</version>
|
||||||
<artifactId>org.eclipse.cdt.make.xlc.core</artifactId>
|
<artifactId>org.eclipse.cdt.make.xlc.core</artifactId>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2010 IBM Corporation and others.
|
* Copyright (c) 2007, 2012 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -1400,7 +1400,10 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
if (projectSymbols != null) {
|
if (projectSymbols != null) {
|
||||||
|
|
||||||
for (String symbol : projectSymbols) {
|
for (String symbol : projectSymbols) {
|
||||||
symbols.put(symbol, "1"); //$NON-NLS-1$
|
if (symbol.matches("_Builtin")) //$NON-NLS-1$
|
||||||
|
symbols.put(symbol,""); //$NON-NLS-1$
|
||||||
|
else
|
||||||
|
symbols.put(symbol, "1"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2011 IBM Corporation and others.
|
* Copyright (c) 2006, 2012 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -24,9 +24,12 @@ import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser;
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes;
|
import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes;
|
||||||
import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
|
import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
|
||||||
import org.eclipse.cdt.make.xlc.core.activator.Activator;
|
import org.eclipse.cdt.make.xlc.core.activator.Activator;
|
||||||
|
import org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
import org.eclipse.cdt.core.CCProjectNature;
|
||||||
|
import org.eclipse.cdt.core.CProjectNature;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses output of ppuxlc -E -v specs.c or ppuxlc -E -v specs.cpp command
|
* Parses output of ppuxlc -E -v specs.c or ppuxlc -E -v specs.cpp command
|
||||||
|
@ -47,8 +50,12 @@ public class XlCSpecsConsoleParser implements IScannerInfoConsoleParser {
|
||||||
final Pattern includePattern = Pattern
|
final Pattern includePattern = Pattern
|
||||||
.compile("-(?:qgcc_c_stdinc|qc_stdinc|qgcc_cpp_stdinc|qcpp_stdinc)=(.*)"); //$NON-NLS-1$
|
.compile("-(?:qgcc_c_stdinc|qc_stdinc|qgcc_cpp_stdinc|qcpp_stdinc)=(.*)"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
final Pattern C_includePattern = Pattern.compile("-(?:qgcc_c_stdinc|qc_stdinc)=(.*)"); //$NON-NLS-1$
|
||||||
|
final Pattern CXX_includePattern = Pattern.compile("-(?:qgcc_cpp_stdinc|qcpp_stdinc)=(.*)"); //$NON-NLS-1$
|
||||||
|
|
||||||
// xlC compiler constants
|
// xlC compiler constants
|
||||||
protected final static String [] compilerConstants = {
|
protected final static String [] compilerConstants = {
|
||||||
|
"_Builtin", //$NON-NLS-1$
|
||||||
"__IBMCPP__", //$NON-NLS-1$
|
"__IBMCPP__", //$NON-NLS-1$
|
||||||
"__xlC__", //$NON-NLS-1$
|
"__xlC__", //$NON-NLS-1$
|
||||||
"__IBMC__", //$NON-NLS-1$
|
"__IBMC__", //$NON-NLS-1$
|
||||||
|
@ -61,7 +68,18 @@ public class XlCSpecsConsoleParser implements IScannerInfoConsoleParser {
|
||||||
|
|
||||||
protected List<String> symbols = new ArrayList<String>();
|
protected List<String> symbols = new ArrayList<String>();
|
||||||
|
|
||||||
protected List<String> includes = new ArrayList<String>();
|
protected List<String> includes = new ArrayList<String>();
|
||||||
|
protected List<String> c_includes = new ArrayList<String>();
|
||||||
|
protected List<String> cpp_includes = new ArrayList<String>();
|
||||||
|
|
||||||
|
boolean c_lang; // if language is C only search for the C include paths from the XL Compiler, otherwise get the C++ ones.
|
||||||
|
public boolean isC_lang() {
|
||||||
|
return c_lang;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setC_lang(boolean c_lang) {
|
||||||
|
this.c_lang = c_lang;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
|
@ -77,6 +95,20 @@ public class XlCSpecsConsoleParser implements IScannerInfoConsoleParser {
|
||||||
IScannerInfoCollector collector, IMarkerGenerator markerGenerator) {
|
IScannerInfoCollector collector, IMarkerGenerator markerGenerator) {
|
||||||
this.fProject = project;
|
this.fProject = project;
|
||||||
this.fCollector = collector;
|
this.fCollector = collector;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (project.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||||
|
// use C++ pattern
|
||||||
|
c_lang = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// use C pattern
|
||||||
|
c_lang = true;
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -119,7 +151,7 @@ public class XlCSpecsConsoleParser implements IScannerInfoConsoleParser {
|
||||||
} else {
|
} else {
|
||||||
// if it is not a symbol, check to see if it is an
|
// if it is not a symbol, check to see if it is an
|
||||||
// include
|
// include
|
||||||
Matcher includeMatcher = includePattern.matcher(args[i]);
|
Matcher includeMatcher = c_lang ? C_includePattern.matcher(args[i]) : CXX_includePattern.matcher(args[i]);
|
||||||
if (includeMatcher.matches()) {
|
if (includeMatcher.matches()) {
|
||||||
// if it is a set of include paths, split it
|
// if it is a set of include paths, split it
|
||||||
String[] includePaths = includeMatcher.group(1).split(
|
String[] includePaths = includeMatcher.group(1).split(
|
||||||
|
|
Loading…
Add table
Reference in a new issue