diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCBindingResolutionBugs.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCBindingResolutionBugs.java index 4124bdc0396..ffb32ea2685 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCBindingResolutionBugs.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCBindingResolutionBugs.java @@ -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 * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -411,4 +411,64 @@ public class IndexCBindingResolutionBugs extends IndexBindingResolutionTestBase IBinding b = getBindingFromASTName("value =", 5); 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); + } } diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionBugs.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionBugs.java index afce606f7ac..b19a8fbae1f 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionBugs.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionBugs.java @@ -1209,4 +1209,64 @@ public class IndexCPPBindingResolutionBugs extends IndexBindingResolutionTestBas IType t= ptrMbr.getMemberOfClass(); 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,0,0,0,0,0,0,0,0,0,0,0,0, + // 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + // 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + // 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + // 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + // 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + // 0,0,0,0,0,0,0,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); + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ITypeMarshalBuffer.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ITypeMarshalBuffer.java index a25152b3397..b9586a5f6c4 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ITypeMarshalBuffer.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ITypeMarshalBuffer.java @@ -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 * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -36,8 +36,8 @@ public interface ITypeMarshalBuffer { CoreException unmarshallingError(); IType unmarshalType() throws CoreException; - byte getByte() throws CoreException; - short getShort() throws CoreException; + int getByte() throws CoreException; + int getShort() throws CoreException; IValue getValue() throws CoreException; void marshalType(IType type) throws CoreException; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CFunctionType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CFunctionType.java index 0a7a7d21e58..2750acc26c0 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CFunctionType.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CFunctionType.java @@ -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 * are made available under the terms of the Eclipse Public License v1.0 * 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 { int len; if (((firstByte & ITypeMarshalBuffer.FLAG4) != 0)) { - len= buffer.getShort() & 0xffff; + len= buffer.getShort(); } else { len= (firstByte & (ITypeMarshalBuffer.FLAG4-1))/ITypeMarshalBuffer.FLAG1; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/TypeMarshalBuffer.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/TypeMarshalBuffer.java index 4e3bcceb10f..33c25c49484 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/TypeMarshalBuffer.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/db/TypeMarshalBuffer.java @@ -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 * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -105,10 +105,10 @@ public class TypeMarshalBuffer implements ITypeMarshalBuffer { fBuffer[fPos++]= b; } - public byte getByte() throws CoreException { + public int getByte() throws CoreException { if (fPos+1 > fBuffer.length) throw unmarshallingError(); - return fBuffer[fPos++]; + return 0xff & fBuffer[fPos++]; } public CoreException unmarshallingError() { @@ -124,10 +124,12 @@ public class TypeMarshalBuffer implements ITypeMarshalBuffer { fBuffer[fPos++]= (byte)(value); } - public short getShort() throws CoreException { + public int getShort() throws CoreException { if (fPos+2 > fBuffer.length) 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) { @@ -147,8 +149,8 @@ public class TypeMarshalBuffer implements ITypeMarshalBuffer { } public IValue getValue() throws CoreException { - short replen= getShort(); - short unknwonLen= getShort(); + int replen= getShort(); + int unknwonLen= getShort(); char[] rep= new char[replen]; for (int i = 0; i < replen; i++) { diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCLinkage.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCLinkage.java index 95f59a9c5da..b8f1c653d20 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCLinkage.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/c/PDOMCLinkage.java @@ -338,7 +338,7 @@ class PDOMCLinkage extends PDOMLinkage implements IIndexCBindingConstants { @Override public IType unmarshalType(ITypeMarshalBuffer buffer) throws CoreException { - int firstByte= buffer.getByte() & 0xff; + int firstByte= buffer.getByte(); switch((firstByte & ITypeMarshalBuffer.KIND_MASK)) { case ITypeMarshalBuffer.ARRAY: return CArrayType.unmarshal(firstByte, buffer); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java index e752c99f450..a5fed4b947e 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPLinkage.java @@ -985,7 +985,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants { @Override public IType unmarshalType(ITypeMarshalBuffer buffer) throws CoreException { - int firstByte= buffer.getByte() & 0xff; + int firstByte= buffer.getByte(); switch((firstByte & ITypeMarshalBuffer.KIND_MASK)) { case ITypeMarshalBuffer.ARRAY: return CPPArrayType.unmarshal(firstByte, buffer);