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

Bug 319258: Functions with 255 parameters.

This commit is contained in:
Markus Schorn 2010-07-08 12:18:18 +00:00
parent bbbd5e5fa7
commit 884e65041d
7 changed files with 137 additions and 15 deletions

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2009 Wind River Systems, Inc. and others. * Copyright (c) 2006, 2010 Wind River Systems, Inc. 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
@ -411,4 +411,64 @@ public class IndexCBindingResolutionBugs extends IndexBindingResolutionTestBase
IBinding b = getBindingFromASTName("value =", 5); IBinding b = getBindingFromASTName("value =", 5);
assertTrue(b instanceof IField); assertTrue(b instanceof IField);
} }
// void f255(
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
// void f256(
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
// void test() {
// f255(
// 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
// 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
// 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
// 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
// 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
// 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
// 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
// 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
// f256(
// 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
// 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
// 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
// 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
// 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
// 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
// 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
// 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
// }
public void testFunctionsWithManyParameters_Bug319186() throws Exception {
getBindingFromASTName("f255", 0);
getBindingFromASTName("f256", 0);
}
} }

View file

@ -1209,4 +1209,64 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas
IType t= ptrMbr.getMemberOfClass(); IType t= ptrMbr.getMemberOfClass();
assertInstance(t, IProblemBinding.class); assertInstance(t, IProblemBinding.class);
} }
// void f255(
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
// void f256(
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
// int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
// void test() {
// f255(
// 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
// 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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Name("f256", 0);
}
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2009 Wind River Systems, Inc. and others. * Copyright (c) 2009, 2010 Wind River Systems, Inc. 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
@ -36,8 +36,8 @@ public interface ITypeMarshalBuffer {
CoreException unmarshallingError(); CoreException unmarshallingError();
IType unmarshalType() throws CoreException; IType unmarshalType() throws CoreException;
byte getByte() throws CoreException; int getByte() throws CoreException;
short getShort() throws CoreException; int getShort() throws CoreException;
IValue getValue() throws CoreException; IValue getValue() throws CoreException;
void marshalType(IType type) throws CoreException; void marshalType(IType type) throws CoreException;

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2009 IBM Corporation and others. * Copyright (c) 2004, 2010 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
@ -94,7 +94,7 @@ public class CFunctionType implements IFunctionType, ISerializableType {
public static IType unmarshal(int firstByte, ITypeMarshalBuffer buffer) throws CoreException { public static IType unmarshal(int firstByte, ITypeMarshalBuffer buffer) throws CoreException {
int len; int len;
if (((firstByte & ITypeMarshalBuffer.FLAG4) != 0)) { if (((firstByte & ITypeMarshalBuffer.FLAG4) != 0)) {
len= buffer.getShort() & 0xffff; len= buffer.getShort();
} else { } else {
len= (firstByte & (ITypeMarshalBuffer.FLAG4-1))/ITypeMarshalBuffer.FLAG1; len= (firstByte & (ITypeMarshalBuffer.FLAG4-1))/ITypeMarshalBuffer.FLAG1;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2009 Wind River Systems, Inc. and others. * Copyright (c) 2009, 2010 Wind River Systems, Inc. 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
@ -105,10 +105,10 @@ public class TypeMarshalBuffer implements ITypeMarshalBuffer {
fBuffer[fPos++]= b; fBuffer[fPos++]= b;
} }
public byte getByte() throws CoreException { public int getByte() throws CoreException {
if (fPos+1 > fBuffer.length) if (fPos+1 > fBuffer.length)
throw unmarshallingError(); throw unmarshallingError();
return fBuffer[fPos++]; return 0xff & fBuffer[fPos++];
} }
public CoreException unmarshallingError() { public CoreException unmarshallingError() {
@ -124,10 +124,12 @@ public class TypeMarshalBuffer implements ITypeMarshalBuffer {
fBuffer[fPos++]= (byte)(value); fBuffer[fPos++]= (byte)(value);
} }
public short getShort() throws CoreException { public int getShort() throws CoreException {
if (fPos+2 > fBuffer.length) if (fPos+2 > fBuffer.length)
throw unmarshallingError(); throw unmarshallingError();
return (short) (((fBuffer[fPos++] << 8) | (fBuffer[fPos++] & 0xff))); final int byte1 = 0xff & fBuffer[fPos++];
final int byte2 = 0xff & fBuffer[fPos++];
return (((byte1 << 8) | (byte2 & 0xff)));
} }
private void putRecordPointer(long record) { private void putRecordPointer(long record) {
@ -147,8 +149,8 @@ public class TypeMarshalBuffer implements ITypeMarshalBuffer {
} }
public IValue getValue() throws CoreException { public IValue getValue() throws CoreException {
short replen= getShort(); int replen= getShort();
short unknwonLen= getShort(); int unknwonLen= getShort();
char[] rep= new char[replen]; char[] rep= new char[replen];
for (int i = 0; i < replen; i++) { for (int i = 0; i < replen; i++) {

View file

@ -338,7 +338,7 @@ class PDOMCLinkage extends PDOMLinkage implements IIndexCBindingConstants {
@Override @Override
public IType unmarshalType(ITypeMarshalBuffer buffer) throws CoreException { public IType unmarshalType(ITypeMarshalBuffer buffer) throws CoreException {
int firstByte= buffer.getByte() & 0xff; int firstByte= buffer.getByte();
switch((firstByte & ITypeMarshalBuffer.KIND_MASK)) { switch((firstByte & ITypeMarshalBuffer.KIND_MASK)) {
case ITypeMarshalBuffer.ARRAY: case ITypeMarshalBuffer.ARRAY:
return CArrayType.unmarshal(firstByte, buffer); return CArrayType.unmarshal(firstByte, buffer);

View file

@ -985,7 +985,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
@Override @Override
public IType unmarshalType(ITypeMarshalBuffer buffer) throws CoreException { public IType unmarshalType(ITypeMarshalBuffer buffer) throws CoreException {
int firstByte= buffer.getByte() & 0xff; int firstByte= buffer.getByte();
switch((firstByte & ITypeMarshalBuffer.KIND_MASK)) { switch((firstByte & ITypeMarshalBuffer.KIND_MASK)) {
case ITypeMarshalBuffer.ARRAY: case ITypeMarshalBuffer.ARRAY:
return CPPArrayType.unmarshal(firstByte, buffer); return CPPArrayType.unmarshal(firstByte, buffer);