mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 23:05:47 +02:00
Configure gcc-extensions as keywords, rather than macros, bug 226112.
This commit is contained in:
parent
61cc1a811f
commit
52d3320503
7 changed files with 93 additions and 69 deletions
|
@ -4446,4 +4446,15 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
parseAndCheckBindings(code, ParserLanguage.C);
|
parseAndCheckBindings(code, ParserLanguage.C);
|
||||||
parseAndCheckBindings(code, ParserLanguage.CPP);
|
parseAndCheckBindings(code, ParserLanguage.CPP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #define __inline__ __inline__ __attribute__((always_inline))
|
||||||
|
// typedef int __u32;
|
||||||
|
// static __inline__ __u32 f(int x) {
|
||||||
|
// return x;
|
||||||
|
// }
|
||||||
|
public void testRedefinedGCCKeywords_Bug226112() throws Exception {
|
||||||
|
final String code = getAboveComment();
|
||||||
|
parseAndCheckBindings(code, ParserLanguage.C, true);
|
||||||
|
parseAndCheckBindings(code, ParserLanguage.CPP, true);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -12,8 +12,11 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.dom.parser;
|
package org.eclipse.cdt.core.dom.parser;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.parser.GCCKeywords;
|
||||||
|
import org.eclipse.cdt.core.parser.IGCCToken;
|
||||||
import org.eclipse.cdt.core.parser.IMacro;
|
import org.eclipse.cdt.core.parser.IMacro;
|
||||||
import org.eclipse.cdt.core.parser.IPreprocessorDirective;
|
import org.eclipse.cdt.core.parser.IPreprocessorDirective;
|
||||||
|
import org.eclipse.cdt.core.parser.IToken;
|
||||||
import org.eclipse.cdt.core.parser.Keywords;
|
import org.eclipse.cdt.core.parser.Keywords;
|
||||||
import org.eclipse.cdt.core.parser.util.CharArrayIntMap;
|
import org.eclipse.cdt.core.parser.util.CharArrayIntMap;
|
||||||
|
|
||||||
|
@ -23,21 +26,12 @@ import org.eclipse.cdt.core.parser.util.CharArrayIntMap;
|
||||||
public abstract class GNUScannerExtensionConfiguration extends AbstractScannerExtensionConfiguration {
|
public abstract class GNUScannerExtensionConfiguration extends AbstractScannerExtensionConfiguration {
|
||||||
|
|
||||||
private static IMacro[] sAdditionalMacros= new IMacro[] {
|
private static IMacro[] sAdditionalMacros= new IMacro[] {
|
||||||
createMacro("__asm__", "asm"), //$NON-NLS-1$//$NON-NLS-2$
|
|
||||||
createMacro("__complex__", "_Complex"), //$NON-NLS-1$ //$NON-NLS-2$
|
createMacro("__complex__", "_Complex"), //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
createMacro("__const__", "const"), //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
createMacro("__const", "const"), //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
createMacro("__extension__", ""), //$NON-NLS-1$ //$NON-NLS-2$
|
createMacro("__extension__", ""), //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
createMacro("__inline__", "inline"), //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
createMacro("__imag__", "(int)"), //$NON-NLS-1$ //$NON-NLS-2$
|
createMacro("__imag__", "(int)"), //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
createMacro("__null", "(void *)0"), //$NON-NLS-1$ //$NON-NLS-2$
|
createMacro("__null", "(void *)0"), //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
createMacro("__real__", "(int)"), //$NON-NLS-1$ //$NON-NLS-2$
|
createMacro("__real__", "(int)"), //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
createMacro("__restrict__", "restrict"), //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
createMacro("__restrict", "restrict"), //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
createMacro("__volatile__", "volatile"), //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
createMacro("__signed__", "signed"), //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
createMacro("__stdcall", ""), //$NON-NLS-1$ //$NON-NLS-2$
|
createMacro("__stdcall", ""), //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
createMacro("__typeof__", "typeof"), //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
|
|
||||||
createMacro("__builtin_va_arg(ap,type)", "*(type *)ap"), //$NON-NLS-1$//$NON-NLS-2$
|
createMacro("__builtin_va_arg(ap,type)", "*(type *)ap"), //$NON-NLS-1$//$NON-NLS-2$
|
||||||
createMacro("__builtin_constant_p(exp)", "0") //$NON-NLS-1$//$NON-NLS-2$
|
createMacro("__builtin_constant_p(exp)", "0") //$NON-NLS-1$//$NON-NLS-2$
|
||||||
|
@ -47,14 +41,33 @@ public abstract class GNUScannerExtensionConfiguration extends AbstractScannerEx
|
||||||
return sAdditionalMacros;
|
return sAdditionalMacros;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void addAdditionalGNUKeywords(CharArrayIntMap target) {
|
||||||
|
target.put(GCCKeywords.cp__ALIGNOF__, IGCCToken.t___alignof__ );
|
||||||
|
target.put(GCCKeywords.cp__ASM__, IToken.t_asm);
|
||||||
|
target.put(GCCKeywords.cp__ATTRIBUTE__, IGCCToken.t__attribute__ );
|
||||||
|
target.put(GCCKeywords.cp__CONST, IToken.t_const);
|
||||||
|
target.put(GCCKeywords.cp__CONST__, IToken.t_const);
|
||||||
|
target.put(GCCKeywords.cp__DECLSPEC, IGCCToken.t__declspec );
|
||||||
|
target.put(GCCKeywords.cp__INLINE__, IToken.t_inline);
|
||||||
|
target.put(GCCKeywords.cp__RESTRICT, IToken.t_restrict);
|
||||||
|
target.put(GCCKeywords.cp__RESTRICT__, IToken.t_restrict);
|
||||||
|
target.put(GCCKeywords.cp__VOLATILE__, IToken.t_volatile);
|
||||||
|
target.put(GCCKeywords.cp__SIGNED__, IToken.t_signed);
|
||||||
|
target.put(GCCKeywords.cp__TYPEOF__, IGCCToken.t_typeof);
|
||||||
|
target.put(GCCKeywords.cpTYPEOF, IGCCToken.t_typeof );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean support$InIdentifiers() {
|
public boolean support$InIdentifiers() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public char[] supportAdditionalNumericLiteralSuffixes() {
|
public char[] supportAdditionalNumericLiteralSuffixes() {
|
||||||
return "ij".toCharArray(); //$NON-NLS-1$
|
return "ij".toCharArray(); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IMacro[] getAdditionalMacros() {
|
public IMacro[] getAdditionalMacros() {
|
||||||
return sAdditionalMacros;
|
return sAdditionalMacros;
|
||||||
}
|
}
|
||||||
|
@ -62,6 +75,7 @@ public abstract class GNUScannerExtensionConfiguration extends AbstractScannerEx
|
||||||
/*
|
/*
|
||||||
* @see org.eclipse.cdt.internal.core.parser.scanner2.IScannerExtensionConfiguration#getAdditionalPreprocessorKeywords()
|
* @see org.eclipse.cdt.internal.core.parser.scanner2.IScannerExtensionConfiguration#getAdditionalPreprocessorKeywords()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public CharArrayIntMap getAdditionalPreprocessorKeywords() {
|
public CharArrayIntMap getAdditionalPreprocessorKeywords() {
|
||||||
CharArrayIntMap additionalPPKeywords= new CharArrayIntMap(8, IPreprocessorDirective.ppInvalid);
|
CharArrayIntMap additionalPPKeywords= new CharArrayIntMap(8, IPreprocessorDirective.ppInvalid);
|
||||||
additionalPPKeywords.put(Keywords.cINCLUDE_NEXT, IPreprocessorDirective.ppInclude_next);
|
additionalPPKeywords.put(Keywords.cINCLUDE_NEXT, IPreprocessorDirective.ppInclude_next);
|
||||||
|
@ -73,5 +87,4 @@ public abstract class GNUScannerExtensionConfiguration extends AbstractScannerEx
|
||||||
additionalPPKeywords.put(Keywords.cUNASSERT, IPreprocessorDirective.ppIgnore);
|
additionalPPKeywords.put(Keywords.cUNASSERT, IPreprocessorDirective.ppIgnore);
|
||||||
return additionalPPKeywords;
|
return additionalPPKeywords;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2004, 2007 IBM Corporation and others.
|
* Copyright (c) 2004, 2008 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
|
||||||
|
@ -8,12 +8,11 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
* Ed Swartz (Nokia)
|
* Ed Swartz (Nokia)
|
||||||
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.dom.parser.c;
|
package org.eclipse.cdt.core.dom.parser.c;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.parser.GNUScannerExtensionConfiguration;
|
import org.eclipse.cdt.core.dom.parser.GNUScannerExtensionConfiguration;
|
||||||
import org.eclipse.cdt.core.parser.GCCKeywords;
|
|
||||||
import org.eclipse.cdt.core.parser.IGCCToken;
|
|
||||||
import org.eclipse.cdt.core.parser.IMacro;
|
import org.eclipse.cdt.core.parser.IMacro;
|
||||||
import org.eclipse.cdt.core.parser.util.CharArrayIntMap;
|
import org.eclipse.cdt.core.parser.util.CharArrayIntMap;
|
||||||
|
|
||||||
|
@ -23,16 +22,21 @@ import org.eclipse.cdt.core.parser.util.CharArrayIntMap;
|
||||||
public class GCCScannerExtensionConfiguration extends GNUScannerExtensionConfiguration {
|
public class GCCScannerExtensionConfiguration extends GNUScannerExtensionConfiguration {
|
||||||
|
|
||||||
private static IMacro[] sAdditionalMacros;
|
private static IMacro[] sAdditionalMacros;
|
||||||
|
private static CharArrayIntMap sAdditionalKeywords;
|
||||||
static {
|
static {
|
||||||
final IMacro[] macros = GNUScannerExtensionConfiguration.getAdditionalGNUMacros();
|
final IMacro[] macros = GNUScannerExtensionConfiguration.getAdditionalGNUMacros();
|
||||||
sAdditionalMacros= new IMacro[macros.length+1];
|
sAdditionalMacros= new IMacro[macros.length+1];
|
||||||
System.arraycopy(macros, 0, sAdditionalMacros, 0, macros.length);
|
System.arraycopy(macros, 0, sAdditionalMacros, 0, macros.length);
|
||||||
sAdditionalMacros[macros.length]= createMacro("_Pragma(arg)", ""); //$NON-NLS-1$//$NON-NLS-2$
|
sAdditionalMacros[macros.length]= createMacro("_Pragma(arg)", ""); //$NON-NLS-1$//$NON-NLS-2$
|
||||||
|
|
||||||
|
sAdditionalKeywords= new CharArrayIntMap(10, -1);
|
||||||
|
GNUScannerExtensionConfiguration.addAdditionalGNUKeywords(sAdditionalKeywords);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.parser.scanner2.IScannerConfiguration#supportMinAndMaxOperators()
|
* @see org.eclipse.cdt.internal.core.parser.scanner2.IScannerConfiguration#supportMinAndMaxOperators()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean supportMinAndMaxOperators() {
|
public boolean supportMinAndMaxOperators() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -41,6 +45,7 @@ public class GCCScannerExtensionConfiguration extends GNUScannerExtensionConfigu
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.parser.scanner2.IScannerConfiguration#getAdditionalMacros()
|
* @see org.eclipse.cdt.internal.core.parser.scanner2.IScannerConfiguration#getAdditionalMacros()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IMacro[] getAdditionalMacros() {
|
public IMacro[] getAdditionalMacros() {
|
||||||
return sAdditionalMacros;
|
return sAdditionalMacros;
|
||||||
}
|
}
|
||||||
|
@ -48,13 +53,9 @@ public class GCCScannerExtensionConfiguration extends GNUScannerExtensionConfigu
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.parser.scanner2.IScannerConfiguration#getAdditionalKeywords()
|
* @see org.eclipse.cdt.internal.core.parser.scanner2.IScannerConfiguration#getAdditionalKeywords()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public CharArrayIntMap getAdditionalKeywords() {
|
public CharArrayIntMap getAdditionalKeywords() {
|
||||||
CharArrayIntMap result = new CharArrayIntMap( 4, -1 );
|
return sAdditionalKeywords;
|
||||||
result.put( GCCKeywords.cp__ALIGNOF__, IGCCToken.t___alignof__ );
|
|
||||||
result.put( GCCKeywords.cpTYPEOF, IGCCToken.t_typeof );
|
|
||||||
result.put( GCCKeywords.cp__ATTRIBUTE__, IGCCToken.t__attribute__ );
|
|
||||||
result.put( GCCKeywords.cp__DECLSPEC, IGCCToken.t__declspec );
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2004, 2007 IBM Corporation and others.
|
* Copyright (c) 2004, 2008 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
|
||||||
|
@ -9,12 +9,11 @@
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
* Ed Swartz (Nokia)
|
* Ed Swartz (Nokia)
|
||||||
* Anton Leherbauer (Wind River Systems)
|
* Anton Leherbauer (Wind River Systems)
|
||||||
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.dom.parser.cpp;
|
package org.eclipse.cdt.core.dom.parser.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.parser.GNUScannerExtensionConfiguration;
|
import org.eclipse.cdt.core.dom.parser.GNUScannerExtensionConfiguration;
|
||||||
import org.eclipse.cdt.core.parser.GCCKeywords;
|
|
||||||
import org.eclipse.cdt.core.parser.IGCCToken;
|
|
||||||
import org.eclipse.cdt.core.parser.IToken;
|
import org.eclipse.cdt.core.parser.IToken;
|
||||||
import org.eclipse.cdt.core.parser.Keywords;
|
import org.eclipse.cdt.core.parser.Keywords;
|
||||||
import org.eclipse.cdt.core.parser.util.CharArrayIntMap;
|
import org.eclipse.cdt.core.parser.util.CharArrayIntMap;
|
||||||
|
@ -24,9 +23,19 @@ import org.eclipse.cdt.core.parser.util.CharArrayIntMap;
|
||||||
*/
|
*/
|
||||||
public class GPPScannerExtensionConfiguration extends GNUScannerExtensionConfiguration {
|
public class GPPScannerExtensionConfiguration extends GNUScannerExtensionConfiguration {
|
||||||
|
|
||||||
|
private static CharArrayIntMap sAdditionalKeywords;
|
||||||
|
static {
|
||||||
|
sAdditionalKeywords= new CharArrayIntMap(10, -1);
|
||||||
|
GNUScannerExtensionConfiguration.addAdditionalGNUKeywords(sAdditionalKeywords);
|
||||||
|
sAdditionalKeywords.put( Keywords.cRESTRICT, IToken.t_restrict );
|
||||||
|
sAdditionalKeywords.put( Keywords.c_COMPLEX, IToken.t__Complex );
|
||||||
|
sAdditionalKeywords.put( Keywords.c_IMAGINARY, IToken.t__Imaginary );
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.parser.scanner2.IScannerConfiguration#supportMinAndMaxOperators()
|
* @see org.eclipse.cdt.internal.core.parser.scanner2.IScannerConfiguration#supportMinAndMaxOperators()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean supportMinAndMaxOperators() {
|
public boolean supportMinAndMaxOperators() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -34,16 +43,8 @@ public class GPPScannerExtensionConfiguration extends GNUScannerExtensionConfigu
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.parser.scanner2.IScannerConfiguration#getAdditionalKeywords()
|
* @see org.eclipse.cdt.internal.core.parser.scanner2.IScannerConfiguration#getAdditionalKeywords()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public CharArrayIntMap getAdditionalKeywords() {
|
public CharArrayIntMap getAdditionalKeywords() {
|
||||||
CharArrayIntMap additionalCPPKeywords = new CharArrayIntMap( 8, -1 );
|
return sAdditionalKeywords;
|
||||||
additionalCPPKeywords.put( GCCKeywords.cp__ALIGNOF__, IGCCToken.t___alignof__ );
|
|
||||||
additionalCPPKeywords.put( GCCKeywords.cpTYPEOF, IGCCToken.t_typeof );
|
|
||||||
additionalCPPKeywords.put( GCCKeywords.cp__ATTRIBUTE__, IGCCToken.t__attribute__ );
|
|
||||||
additionalCPPKeywords.put( Keywords.cRESTRICT, IToken.t_restrict );
|
|
||||||
additionalCPPKeywords.put( Keywords.c_COMPLEX, IToken.t__Complex );
|
|
||||||
additionalCPPKeywords.put( Keywords.c_IMAGINARY, IToken.t__Imaginary );
|
|
||||||
additionalCPPKeywords.put( GCCKeywords.cp__DECLSPEC, IGCCToken.t__declspec );
|
|
||||||
return additionalCPPKeywords;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2002, 2007 IBM Corporation and others.
|
* Copyright (c) 2002, 2008 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
|
||||||
|
@ -9,7 +9,6 @@
|
||||||
* IBM Rational Software - Initial API and implementation
|
* IBM Rational Software - Initial API and implementation
|
||||||
* Ed Swartz (Nokia)
|
* Ed Swartz (Nokia)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.core.parser;
|
package org.eclipse.cdt.core.parser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,4 +27,13 @@ public class GCCKeywords {
|
||||||
public static final char [] cp__ATTRIBUTE__ = __ATTRIBUTE__.toCharArray();
|
public static final char [] cp__ATTRIBUTE__ = __ATTRIBUTE__.toCharArray();
|
||||||
public static final char [] cp__DECLSPEC = __DECLSPEC.toCharArray();
|
public static final char [] cp__DECLSPEC = __DECLSPEC.toCharArray();
|
||||||
|
|
||||||
|
public static final char [] cp__ASM__= "__asm__".toCharArray(); //$NON-NLS-1$
|
||||||
|
public static final char [] cp__CONST__= "__const__".toCharArray(); //$NON-NLS-1$
|
||||||
|
public static final char [] cp__CONST= "__const".toCharArray(); //$NON-NLS-1$
|
||||||
|
public static final char [] cp__INLINE__= "__inline__".toCharArray(); //$NON-NLS-1$
|
||||||
|
public static final char [] cp__RESTRICT__= "__restrict__".toCharArray(); //$NON-NLS-1$
|
||||||
|
public static final char [] cp__RESTRICT= "__restrict".toCharArray(); //$NON-NLS-1$
|
||||||
|
public static final char [] cp__VOLATILE__= "__volatile__".toCharArray(); //$NON-NLS-1$
|
||||||
|
public static final char [] cp__SIGNED__= "__signed__".toCharArray(); //$NON-NLS-1$
|
||||||
|
public static final char [] cp__TYPEOF__= "__typeof__".toCharArray(); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,24 +36,15 @@ public class CompletionTest_MacroRef_NoPrefix extends CompletionProposalsBaseTe
|
||||||
"__LINE__",
|
"__LINE__",
|
||||||
"__STDC__",
|
"__STDC__",
|
||||||
"__TIME__",
|
"__TIME__",
|
||||||
"__asm__",
|
|
||||||
"__builtin_constant_p(exp)",
|
"__builtin_constant_p(exp)",
|
||||||
"__builtin_va_arg(ap, type)",
|
"__builtin_va_arg(ap, type)",
|
||||||
"__complex__",
|
"__complex__",
|
||||||
"__const",
|
|
||||||
"__const__",
|
|
||||||
"__cplusplus",
|
"__cplusplus",
|
||||||
"__extension__",
|
"__extension__",
|
||||||
"__imag__",
|
"__imag__",
|
||||||
"__inline__",
|
|
||||||
"__null",
|
"__null",
|
||||||
"__real__",
|
"__real__",
|
||||||
"__restrict",
|
|
||||||
"__restrict__",
|
|
||||||
"__signed__",
|
|
||||||
"__stdcall",
|
"__stdcall",
|
||||||
"__volatile__",
|
|
||||||
"__typeof__"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public CompletionTest_MacroRef_NoPrefix(String name) {
|
public CompletionTest_MacroRef_NoPrefix(String name) {
|
||||||
|
@ -69,6 +60,7 @@ public class CompletionTest_MacroRef_NoPrefix extends CompletionProposalsBaseTe
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition()
|
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected int getCompletionPosition() {
|
protected int getCompletionPosition() {
|
||||||
return getBuffer().indexOf("#ifdef ") + 7;
|
return getBuffer().indexOf("#ifdef ") + 7;
|
||||||
}
|
}
|
||||||
|
@ -76,6 +68,7 @@ public class CompletionTest_MacroRef_NoPrefix extends CompletionProposalsBaseTe
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedPrefix()
|
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedPrefix()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected String getExpectedPrefix() {
|
protected String getExpectedPrefix() {
|
||||||
return expectedPrefix;
|
return expectedPrefix;
|
||||||
}
|
}
|
||||||
|
@ -83,6 +76,7 @@ public class CompletionTest_MacroRef_NoPrefix extends CompletionProposalsBaseTe
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedResultsValues()
|
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedResultsValues()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected String[] getExpectedResultsValues() {
|
protected String[] getExpectedResultsValues() {
|
||||||
return expectedResults;
|
return expectedResults;
|
||||||
}
|
}
|
||||||
|
@ -90,6 +84,7 @@ public class CompletionTest_MacroRef_NoPrefix extends CompletionProposalsBaseTe
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileName()
|
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileName()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected String getFileName() {
|
protected String getFileName() {
|
||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
|
@ -97,12 +92,14 @@ public class CompletionTest_MacroRef_NoPrefix extends CompletionProposalsBaseTe
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileFullPath()
|
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileFullPath()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected String getFileFullPath() {
|
protected String getFileFullPath() {
|
||||||
return fileFullPath;
|
return fileFullPath;
|
||||||
}
|
}
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileFullPath()
|
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileFullPath()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected String getHeaderFileFullPath() {
|
protected String getHeaderFileFullPath() {
|
||||||
return headerFileFullPath;
|
return headerFileFullPath;
|
||||||
}
|
}
|
||||||
|
@ -110,6 +107,7 @@ public class CompletionTest_MacroRef_NoPrefix extends CompletionProposalsBaseTe
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileName()
|
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileName()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected String getHeaderFileName() {
|
protected String getHeaderFileName() {
|
||||||
return headerFileName;
|
return headerFileName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,6 +158,7 @@ public class CompletionTests_PlainC extends AbstractContentAssistTest {
|
||||||
/*
|
/*
|
||||||
* @see org.eclipse.cdt.ui.tests.text.contentassist2.AbstractContentAssistTest#setUpProjectContent(org.eclipse.core.resources.IProject)
|
* @see org.eclipse.cdt.ui.tests.text.contentassist2.AbstractContentAssistTest#setUpProjectContent(org.eclipse.core.resources.IProject)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected IFile setUpProjectContent(IProject project) throws Exception {
|
protected IFile setUpProjectContent(IProject project) throws Exception {
|
||||||
fProject= project;
|
fProject= project;
|
||||||
String headerContent= readTaggedComment(HEADER_FILE_NAME);
|
String headerContent= readTaggedComment(HEADER_FILE_NAME);
|
||||||
|
@ -356,23 +357,14 @@ public class CompletionTests_PlainC extends AbstractContentAssistTest {
|
||||||
"__STDC_VERSION_",
|
"__STDC_VERSION_",
|
||||||
"__STDC__",
|
"__STDC__",
|
||||||
"__TIME__",
|
"__TIME__",
|
||||||
"__asm__",
|
|
||||||
"__builtin_constant_p(exp)",
|
"__builtin_constant_p(exp)",
|
||||||
"__builtin_va_arg(ap, type)",
|
"__builtin_va_arg(ap, type)",
|
||||||
"__complex__",
|
"__complex__",
|
||||||
"__const",
|
|
||||||
"__const__",
|
|
||||||
"__extension__",
|
"__extension__",
|
||||||
"__imag__",
|
"__imag__",
|
||||||
"__inline__",
|
|
||||||
"__null",
|
"__null",
|
||||||
"__real__",
|
"__real__",
|
||||||
"__restrict",
|
|
||||||
"__restrict__",
|
|
||||||
"__signed__",
|
|
||||||
"__stdcall",
|
"__stdcall",
|
||||||
"__volatile__",
|
|
||||||
"__typeof__"
|
|
||||||
};
|
};
|
||||||
assertCompletionResults(expected);
|
assertCompletionResults(expected);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue