1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 10:46:02 +02:00

Different definitions of __null for C and C++ (bug 240567).

This commit is contained in:
Sergey Prigogin 2008-07-14 01:28:03 +00:00
parent fb4339f87b
commit bfa93d84d0
5 changed files with 19 additions and 17 deletions

View file

@ -4875,15 +4875,14 @@ public class AST2CPPTests extends AST2BaseTest {
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 {

View file

@ -3149,15 +3149,14 @@ public class AST2Tests extends AST2BaseTest {
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() {

View file

@ -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", "");

View file

@ -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$
}

View file

@ -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);