mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 18:56:02 +02:00
Different definitions of __null for C and C++ (bug 240567).
This commit is contained in:
parent
fb4339f87b
commit
bfa93d84d0
5 changed files with 19 additions and 17 deletions
|
@ -4872,18 +4872,17 @@ public class AST2CPPTests extends AST2BaseTest {
|
|||
}
|
||||
|
||||
public void testBug99262() throws Exception {
|
||||
parse("void foo() {void *f; f=__null;}", ParserLanguage.CPP, true, true ); //$NON-NLS-1$
|
||||
parse("void foo() {void *f; f=__null;}", ParserLanguage.CPP, true, true); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
// int foo2(void *) {
|
||||
// return 0;
|
||||
// void f1(int*) {
|
||||
// }
|
||||
// int foo3() {
|
||||
// return foo2(__null);
|
||||
// void f2() {
|
||||
// f1(__null);
|
||||
// }
|
||||
public void testBug99262B() throws Exception {
|
||||
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.CPP, true, true );
|
||||
assertTrue(((IASTIdExpression)((IASTFunctionCallExpression)((IASTReturnStatement)((IASTCompoundStatement)((IASTFunctionDefinition)tu.getDeclarations()[1]).getBody()).getStatements()[0]).getReturnValue()).getFunctionNameExpression()).getName().resolveBinding() instanceof IFunction);
|
||||
public void testBug240567() throws Exception {
|
||||
BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), true);
|
||||
bh.assertNonProblem("f1(__null", 2, ICPPFunction.class);
|
||||
}
|
||||
|
||||
public void testBug100408() throws Exception {
|
||||
|
|
|
@ -3146,18 +3146,17 @@ public class AST2Tests extends AST2BaseTest {
|
|||
}
|
||||
|
||||
public void testBug99262() throws Exception {
|
||||
parse("void foo() {void *f; f=__null;}", ParserLanguage.C, true, true ); //$NON-NLS-1$
|
||||
parse("void foo() {void *f; f=__null;}", ParserLanguage.C, true, true); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
// int foo2(void *) {
|
||||
// return 0;
|
||||
// void f1(int*) {
|
||||
// }
|
||||
// int foo3() {
|
||||
// return foo2(__null);
|
||||
// void f2() {
|
||||
// f1(__null);
|
||||
// }
|
||||
public void testBug99262B() throws Exception {
|
||||
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C, true, true );
|
||||
assertTrue(((IASTIdExpression)((IASTFunctionCallExpression)((IASTReturnStatement)((IASTCompoundStatement)((IASTFunctionDefinition)tu.getDeclarations()[1]).getBody()).getStatements()[0]).getReturnValue()).getFunctionNameExpression()).getName().resolveBinding() instanceof IFunction);
|
||||
public void testBug240567() throws Exception {
|
||||
BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), false);
|
||||
bh.assertNonProblem("f1(__null", 2, IFunction.class);
|
||||
}
|
||||
|
||||
// void f() {
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
* IBM - Initial API and implementation
|
||||
* Anton Leherbauer (Wind River Systems)
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.parser;
|
||||
|
||||
|
@ -32,7 +33,6 @@ public abstract class GNUScannerExtensionConfiguration extends AbstractScannerEx
|
|||
addMacro("__complex__", "_Complex");
|
||||
addMacro("__extension__", "");
|
||||
addMacro("__imag__", "(int)");
|
||||
addMacro("__null", "(void *)0");
|
||||
addMacro("__real__", "(int)");
|
||||
addMacro("__stdcall", "");
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
* IBM - Initial API and implementation
|
||||
* Ed Swartz (Nokia)
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.parser.c;
|
||||
|
||||
|
@ -28,6 +29,7 @@ public class GCCScannerExtensionConfiguration extends GNUScannerExtensionConfigu
|
|||
}
|
||||
|
||||
public GCCScannerExtensionConfiguration() {
|
||||
addMacro("__null", "(void *)0"); //$NON-NLS-1$//$NON-NLS-2$
|
||||
addMacro("_Pragma(arg)", ""); //$NON-NLS-1$//$NON-NLS-2$
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
* Ed Swartz (Nokia)
|
||||
* Anton Leherbauer (Wind River Systems)
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.parser.cpp;
|
||||
|
||||
|
@ -31,6 +32,7 @@ public class GPPScannerExtensionConfiguration extends GNUScannerExtensionConfigu
|
|||
}
|
||||
|
||||
public GPPScannerExtensionConfiguration() {
|
||||
addMacro("__null", "0"); //$NON-NLS-1$//$NON-NLS-2$
|
||||
addKeyword(Keywords.cRESTRICT, IToken.t_restrict);
|
||||
addKeyword(Keywords.c_COMPLEX, IToken.t__Complex);
|
||||
addKeyword(Keywords.c_IMAGINARY, IToken.t__Imaginary);
|
||||
|
|
Loading…
Add table
Reference in a new issue