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
|
@ -4875,15 +4875,14 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
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 *) {
|
// void f1(int*) {
|
||||||
// return 0;
|
|
||||||
// }
|
// }
|
||||||
// int foo3() {
|
// void f2() {
|
||||||
// return foo2(__null);
|
// f1(__null);
|
||||||
// }
|
// }
|
||||||
public void testBug99262B() throws Exception {
|
public void testBug240567() throws Exception {
|
||||||
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.CPP, true, true );
|
BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), true);
|
||||||
assertTrue(((IASTIdExpression)((IASTFunctionCallExpression)((IASTReturnStatement)((IASTCompoundStatement)((IASTFunctionDefinition)tu.getDeclarations()[1]).getBody()).getStatements()[0]).getReturnValue()).getFunctionNameExpression()).getName().resolveBinding() instanceof IFunction);
|
bh.assertNonProblem("f1(__null", 2, ICPPFunction.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBug100408() throws Exception {
|
public void testBug100408() throws Exception {
|
||||||
|
|
|
@ -3149,15 +3149,14 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
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 *) {
|
// void f1(int*) {
|
||||||
// return 0;
|
|
||||||
// }
|
// }
|
||||||
// int foo3() {
|
// void f2() {
|
||||||
// return foo2(__null);
|
// f1(__null);
|
||||||
// }
|
// }
|
||||||
public void testBug99262B() throws Exception {
|
public void testBug240567() throws Exception {
|
||||||
IASTTranslationUnit tu = parse(getAboveComment(), ParserLanguage.C, true, true );
|
BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), false);
|
||||||
assertTrue(((IASTIdExpression)((IASTFunctionCallExpression)((IASTReturnStatement)((IASTCompoundStatement)((IASTFunctionDefinition)tu.getDeclarations()[1]).getBody()).getStatements()[0]).getReturnValue()).getFunctionNameExpression()).getName().resolveBinding() instanceof IFunction);
|
bh.assertNonProblem("f1(__null", 2, IFunction.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
// void f() {
|
// void f() {
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
* Anton Leherbauer (Wind River Systems)
|
* Anton Leherbauer (Wind River Systems)
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
|
* Sergey Prigogin (Google)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.dom.parser;
|
package org.eclipse.cdt.core.dom.parser;
|
||||||
|
|
||||||
|
@ -32,7 +33,6 @@ public abstract class GNUScannerExtensionConfiguration extends AbstractScannerEx
|
||||||
addMacro("__complex__", "_Complex");
|
addMacro("__complex__", "_Complex");
|
||||||
addMacro("__extension__", "");
|
addMacro("__extension__", "");
|
||||||
addMacro("__imag__", "(int)");
|
addMacro("__imag__", "(int)");
|
||||||
addMacro("__null", "(void *)0");
|
|
||||||
addMacro("__real__", "(int)");
|
addMacro("__real__", "(int)");
|
||||||
addMacro("__stdcall", "");
|
addMacro("__stdcall", "");
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
* Ed Swartz (Nokia)
|
* Ed Swartz (Nokia)
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
|
* Sergey Prigogin (Google)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.dom.parser.c;
|
package org.eclipse.cdt.core.dom.parser.c;
|
||||||
|
|
||||||
|
@ -28,6 +29,7 @@ public class GCCScannerExtensionConfiguration extends GNUScannerExtensionConfigu
|
||||||
}
|
}
|
||||||
|
|
||||||
public GCCScannerExtensionConfiguration() {
|
public GCCScannerExtensionConfiguration() {
|
||||||
|
addMacro("__null", "(void *)0"); //$NON-NLS-1$//$NON-NLS-2$
|
||||||
addMacro("_Pragma(arg)", ""); //$NON-NLS-1$//$NON-NLS-2$
|
addMacro("_Pragma(arg)", ""); //$NON-NLS-1$//$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
* Ed Swartz (Nokia)
|
* Ed Swartz (Nokia)
|
||||||
* Anton Leherbauer (Wind River Systems)
|
* Anton Leherbauer (Wind River Systems)
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
|
* Sergey Prigogin (Google)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.dom.parser.cpp;
|
package org.eclipse.cdt.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
@ -31,6 +32,7 @@ public class GPPScannerExtensionConfiguration extends GNUScannerExtensionConfigu
|
||||||
}
|
}
|
||||||
|
|
||||||
public GPPScannerExtensionConfiguration() {
|
public GPPScannerExtensionConfiguration() {
|
||||||
|
addMacro("__null", "0"); //$NON-NLS-1$//$NON-NLS-2$
|
||||||
addKeyword(Keywords.cRESTRICT, IToken.t_restrict);
|
addKeyword(Keywords.cRESTRICT, IToken.t_restrict);
|
||||||
addKeyword(Keywords.c_COMPLEX, IToken.t__Complex);
|
addKeyword(Keywords.c_COMPLEX, IToken.t__Complex);
|
||||||
addKeyword(Keywords.c_IMAGINARY, IToken.t__Imaginary);
|
addKeyword(Keywords.c_IMAGINARY, IToken.t__Imaginary);
|
||||||
|
|
Loading…
Add table
Reference in a new issue