1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 311030: Using va_args with function pointer.

This commit is contained in:
Markus Schorn 2010-04-30 08:12:21 +00:00
parent 517fc29c67
commit d6fd606c63
2 changed files with 16 additions and 3 deletions

View file

@ -34,6 +34,7 @@ import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTDoStatement;
import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
import org.eclipse.cdt.core.dom.ast.IASTEqualsInitializer;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTExpressionList;
@ -76,6 +77,7 @@ import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
import org.eclipse.cdt.core.dom.ast.IASTWhileStatement;
import org.eclipse.cdt.core.dom.ast.IArrayType;
import org.eclipse.cdt.core.dom.ast.IBasicType;
import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.ICompositeType;
import org.eclipse.cdt.core.dom.ast.IEnumeration;
@ -94,8 +96,6 @@ import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.IValue;
import org.eclipse.cdt.core.dom.ast.IVariable;
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier;
import org.eclipse.cdt.core.dom.ast.c.ICASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.c.ICASTDesignatedInitializer;
@ -7342,4 +7342,17 @@ public class AST2Tests extends AST2BaseTest {
assertEquals("MACRO", t.getImage());
}
}
// typedef __builtin_va_list va_list;
// #define va_arg(v,l) __builtin_va_arg(v,l)
// void test(int c, ...) {
// int (*x)[3];
// va_list list;
// x = va_arg(list, int(*)[3]);
// }
public void testVaArgWithFunctionPtr_311030() throws Exception {
final String code = getAboveComment();
parseAndCheckBindings(code, ParserLanguage.C, true);
parseAndCheckBindings(code, ParserLanguage.CPP, true);
}
}

View file

@ -37,7 +37,7 @@ public abstract class GNUScannerExtensionConfiguration extends AbstractScannerEx
addMacro("__stdcall", "");
addMacro("__thread", "");
addMacro("__builtin_va_arg(ap,type)", "*(type *)ap");
addMacro("__builtin_va_arg(ap,type)", "*(typeof(type) *)ap");
addMacro("__builtin_constant_p(exp)", "0");
addMacro("__builtin_types_compatible_p(x,y)", "__builtin_types_compatible_p(sizeof(x),sizeof(y))");
addMacro("__offsetof__(x)", "(x)");