Author: raja
Date: 2005-10-28 09:58:16 -0400 (Fri, 28 Oct 2005)
New Revision: 52321
Modified:
trunk/mcs/errors/known-issues-gmcs
trunk/mcs/gmcs/ChangeLog
trunk/mcs/gmcs/attribute.cs
trunk/mcs/gmcs/codegen.cs
trunk/mcs/gmcs/driver.cs
trunk/mcs/gmcs/ecore.cs
trunk/mcs/gmcs/expression.cs
trunk/mcs/gmcs/parameter.cs
trunk/mcs/gmcs/pending.cs
trunk/mcs/gmcs/statement.cs
trunk/mcs/gmcs/support.cs
trunk/mcs/gmcs/typemanager.cs
trunk/mcs/tests/known-issues-gmcs
Log:
*** merged revisions from mcs: 52236, 52240, 52241, 52271, 52276, 52300, 52302
Modified: trunk/mcs/errors/known-issues-gmcs
===================================================================
--- trunk/mcs/errors/known-issues-gmcs 2005-10-28 13:50:44 UTC (rev 52320)
+++ trunk/mcs/errors/known-issues-gmcs 2005-10-28 13:58:16 UTC (rev 52321)
@@ -11,10 +11,8 @@
# csXXXX.cs NO ERROR : error test case doesn't report any error. An
exception is considered
# as NO ERROR and CS5001 is automatically ignored.
-cs0103-3.cs NO ERROR
cs0229-2.cs
cs0229.cs NO ERROR
-cs0246-14.cs NO ERROR
cs0525.cs
cs0526.cs
cs0547-2.cs # new in GMCS; grammar issue
@@ -31,9 +29,7 @@
cs0619-8.cs NO ERROR
cs1013.cs # new in GMCS; grammar issue
cs1041.cs # new in GMCS; grammar issue
-cs1058.cs NO ERROR
cs1501-5.cs
-cs1502-5.cs NO ERROR
cs1507.cs
cs1508-2.cs NO ERROR
cs1508.cs NO ERROR
Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog 2005-10-28 13:50:44 UTC (rev 52320)
+++ trunk/mcs/gmcs/ChangeLog 2005-10-28 13:58:16 UTC (rev 52321)
@@ -1,3 +1,53 @@
+2005-10-28 Korn�l P�l <[EMAIL PROTECTED]>
+
+ * driver.cs: Use Encoding.Default as default code page instead
+ of ISO-28591.
+
+2005-10-27 Raja R Harinath <[EMAIL PROTECTED]>
+
+ Fix #76085.
+ * expression.cs (Invocation.Error_InvalidArguments): Handle
+ __arglist parameters.
+ (Invocation.VerifyArgumentsCompat): Likewise.
+ * support.cs (ReflectionParameters.GetSignatureForError): Print
+ __arglist parameters.
+ (InternalParamters.GetSignatureForError): Likewise.
+ * parameter.cs (Parameters.GetSignatureForError): Likewise.
+
+2005-10-26 Marek Safar <[EMAIL PROTECTED]>
+
+ * attribute.cs (GetPropertyValue): Made public.
+
+ * codegen.cs (AssemblyClass): ResolveClsCompliance renamed to
+ Resolve.
+ Add new property WrapNonExceptionThrows to handle 2.0 assembly
+ attribute.
+ (AssemblyClass.Emit): Emit RuntimeCompatibilityAttribute when it
+ is not defined.
+
+ * driver.cs: Reflect method name change.
+
+ * statement.cs (Try.Resolve): Warn when try has both general
+ exception handlers.
+
+ * typemanager.cs: runtime_compatibility_attr_type new predefined
+ type.
+
+2005-10-26 Raja R Harinath <[EMAIL PROTECTED]>
+
+ Fix #76419.
+ * pending.cs (InterfaceMethod): Allow tm.args [i] to be null --
+ treat it as an empty parameter list.
+
+2005-10-26 Raja R Harinath <[EMAIL PROTECTED]>
+
+ Fix #76271.
+ * ecore.cs (SimpleName.DoSimpleNameResolve): Make fall-back
+ ResolveAsTypeStep silent.
+ * statement.cs (Block.AddConstant): Mark block as used.
+ (Block.ResolveMeta): Avoid piling on error messages
+ if a constant initializer resolution fails.
+
2005-10-25 Raja R Harinath <[EMAIL PROTECTED]>
* namespace.cs (RootNamespace.VerifyUsingForAll, Namespace.VerifyUsing):
Modified: trunk/mcs/gmcs/attribute.cs
===================================================================
--- trunk/mcs/gmcs/attribute.cs 2005-10-28 13:50:44 UTC (rev 52320)
+++ trunk/mcs/gmcs/attribute.cs 2005-10-28 13:58:16 UTC (rev 52321)
@@ -958,7 +958,7 @@
return value;
}
- object GetPropertyValue (string name)
+ public object GetPropertyValue (string name)
{
if (prop_info_arr == null)
return null;
Modified: trunk/mcs/gmcs/codegen.cs
===================================================================
--- trunk/mcs/gmcs/codegen.cs 2005-10-28 13:50:44 UTC (rev 52320)
+++ trunk/mcs/gmcs/codegen.cs 2005-10-28 13:58:16 UTC (rev 52321)
@@ -1018,6 +1018,8 @@
public AssemblyName Name;
bool is_cls_compliant;
+ bool wrap_non_exception_throws;
+
public Attribute ClsCompliantAttribute;
ListDictionary declarative_security;
@@ -1027,7 +1029,7 @@
public AssemblyClass (): base ()
{
- is_cls_compliant = false;
+ wrap_non_exception_throws = true;
}
public bool IsClsCompliant {
@@ -1036,6 +1038,12 @@
}
}
+ public bool WrapNonExceptionThrows {
+ get {
+ return wrap_non_exception_throws;
+ }
+ }
+
public override AttributeTargets AttributeTargets {
get {
return AttributeTargets.Assembly;
@@ -1047,13 +1055,21 @@
return is_cls_compliant;
}
- public void ResolveClsCompliance ()
+ public void Resolve ()
{
ClsCompliantAttribute = ResolveAttribute
(TypeManager.cls_compliant_attribute_type);
- if (ClsCompliantAttribute == null)
- return;
+ if (ClsCompliantAttribute != null) {
+ is_cls_compliant =
ClsCompliantAttribute.GetClsCompliantAttributeValue (null);
+ }
- is_cls_compliant =
ClsCompliantAttribute.GetClsCompliantAttributeValue (null);
+#if NET_2_0
+ Attribute a = ResolveAttribute
(TypeManager.runtime_compatibility_attr_type);
+ if (a != null) {
+ object val = a.GetPropertyValue
("WrapNonExceptionThrows");
+ if (val != null)
+ wrap_non_exception_throws = (bool)val;
+ }
+#endif
}
// fix bug #56621
@@ -1290,6 +1306,19 @@
Report.RuntimeMissingSupport
(Location.Null, "assembly permission setting");
}
}
+
+ // FIXME: Does this belong inside SRE.AssemblyBuilder
instead?
+ if (OptAttributes == null || !OptAttributes.Contains
(TypeManager.runtime_compatibility_attr_type, null)) {
+ if (RootContext.StdLib) {
+ ConstructorInfo ci =
TypeManager.runtime_compatibility_attr_type.GetConstructor
(TypeManager.NoTypes);
+ PropertyInfo pi =
TypeManager.runtime_compatibility_attr_type.GetProperty
("WrapNonExceptionThrows");
+ Builder.SetCustomAttribute (new
CustomAttributeBuilder (ci, new object [0],
+ new PropertyInfo [] { pi }, new
object[] { true } ));
+ } else {
+ // FIXME: Do something appropriate for
'mscorlib'
+ Report.Warning (-31, "FIXME: Did not
emit 'RuntimeComatibilityAttribute' for mscorlib");
+ }
+ }
}
public override string[] ValidAttributeTargets {
Modified: trunk/mcs/gmcs/driver.cs
===================================================================
--- trunk/mcs/gmcs/driver.cs 2005-10-28 13:50:44 UTC (rev 52320)
+++ trunk/mcs/gmcs/driver.cs 2005-10-28 13:58:16 UTC (rev 52321)
@@ -99,7 +99,6 @@
//
// Encoding.
//
- static Encoding default_encoding;
static Encoding encoding;
static public void Reset ()
@@ -114,7 +113,7 @@
win32ResourceFile = win32IconFile = null;
defines = null;
output_file = null;
- encoding = default_encoding = null;
+ encoding = null;
first_source = null;
}
@@ -1345,7 +1344,7 @@
encoding = new UTF8Encoding();
break;
case "reset":
- encoding = default_encoding;
+ encoding = Encoding.Default;
break;
default:
try {
@@ -1444,14 +1443,7 @@
int i;
bool parsing_options = true;
- try {
- // Latin1
- default_encoding = Encoding.GetEncoding (28591);
- } catch (Exception) {
- // iso-8859-1
- default_encoding = Encoding.GetEncoding (1252);
- }
- encoding = default_encoding;
+ encoding = Encoding.Default;
references = new ArrayList ();
external_aliases = new Hashtable ();
@@ -1692,9 +1684,10 @@
if (Report.Errors > 0){
return false;
}
+
+ CodeGen.Assembly.Resolve ();
if (RootContext.VerifyClsCompliance) {
- CodeGen.Assembly.ResolveClsCompliance ();
if (CodeGen.Assembly.IsClsCompliant) {
AttributeTester.VerifyModulesClsCompliance ();
TypeManager.LoadAllImportedTypes ();
Modified: trunk/mcs/gmcs/ecore.cs
===================================================================
--- trunk/mcs/gmcs/ecore.cs 2005-10-28 13:50:44 UTC (rev 52320)
+++ trunk/mcs/gmcs/ecore.cs 2005-10-28 13:58:16 UTC (rev 52321)
@@ -2132,7 +2132,7 @@
almost_matched_type = ec.ContainerType;
almost_matched = (ArrayList)
almostMatchedMembers.Clone ();
}
- e = ResolveAsTypeStep (ec, false);
+ e = ResolveAsTypeStep (ec, true);
}
if (e == null) {
Modified: trunk/mcs/gmcs/expression.cs
===================================================================
--- trunk/mcs/gmcs/expression.cs 2005-10-28 13:50:44 UTC (rev 52320)
+++ trunk/mcs/gmcs/expression.cs 2005-10-28 13:58:16 UTC (rev 52321)
@@ -4953,21 +4953,19 @@
Report.Error (1594, loc, "Delegate `{0}' has
some invalid arguments",
TypeManager.CSharpName (delegate_type));
- string par_desc = expected_par.ParameterDesc (idx);
+ Parameter.Modifier mod = expected_par.ParameterModifier
(idx);
- if (a.Modifier != expected_par.ParameterModifier (idx))
{
- if ((expected_par.ParameterModifier (idx) &
(Parameter.Modifier.REF | Parameter.Modifier.OUT)) == 0)
+ if (mod != Parameter.Modifier.ARGLIST && mod !=
a.Modifier) {
+ if ((mod & (Parameter.Modifier.REF |
Parameter.Modifier.OUT)) == 0)
Report.Error (1615, loc, "Argument
`{0}' should not be passed with the `{1}' keyword",
idx + 1,
Parameter.GetModifierSignature (a.Modifier));
else
Report.Error (1620, loc, "Argument
`{0}' must be passed with the `{1}' keyword",
- idx + 1,
Parameter.GetModifierSignature (expected_par.ParameterModifier (idx)));
- return;
+ idx + 1,
Parameter.GetModifierSignature (mod));
+ } else {
+ Report.Error (1503, loc, "Argument {0}: Cannot
convert from `{1}' to `{2}'",
+ idx + 1, Argument.FullDesc (a),
expected_par.ParameterDesc (idx));
}
-
- Report.Error (1503, loc,
- String.Format ("Argument {0}: Cannot
convert from `{1}' to `{2}'",
- idx + 1, Argument.FullDesc
(a), par_desc));
}
public static bool VerifyArgumentsCompat (EmitContext ec,
ArrayList Arguments,
@@ -4988,15 +4986,18 @@
if (pm == Parameter.Modifier.PARAMS){
if ((pm & ~Parameter.Modifier.PARAMS)
!= a.Modifier) {
if (!may_fail)
- Error_InvalidArguments (
- loc, j, method,
delegate_type,
- a, pd);
+ Error_InvalidArguments
(loc, j, method, delegate_type, a, pd);
return false;
}
if (chose_params_expanded)
parameter_type =
TypeManager.GetElementType (parameter_type);
- } else if (pm == Parameter.Modifier.ARGLIST){
+ } else if (pm == Parameter.Modifier.ARGLIST) {
+ if (!(a.Expr is Arglist)) {
+ if (!may_fail)
+ Error_InvalidArguments
(loc, j, method, delegate_type, a, pd);
+ return false;
+ }
continue;
} else {
//
@@ -5004,9 +5005,7 @@
//
if (pd.ParameterModifier (j) !=
a.Modifier){
if (!may_fail)
- Error_InvalidArguments (
- loc, j, method,
delegate_type,
- a, pd);
+ Error_InvalidArguments
(loc, j, method, delegate_type, a, pd);
return false;
}
}
Modified: trunk/mcs/gmcs/parameter.cs
===================================================================
--- trunk/mcs/gmcs/parameter.cs 2005-10-28 13:50:44 UTC (rev 52320)
+++ trunk/mcs/gmcs/parameter.cs 2005-10-28 13:58:16 UTC (rev 52321)
@@ -668,6 +668,16 @@
sb.Append (", ");
}
}
+ if (ArrayParameter != null) {
+ if (sb.Length > 0)
+ sb.Append (", ");
+ sb.Append (ArrayParameter.GetSignatureForError
());
+ }
+ if (HasArglist) {
+ if (sb.Length > 0)
+ sb.Append (", ");
+ sb.Append ("__arglist");
+ }
sb.Append (')');
return sb.ToString ();
Modified: trunk/mcs/gmcs/pending.cs
===================================================================
--- trunk/mcs/gmcs/pending.cs 2005-10-28 13:50:44 UTC (rev 52320)
+++ trunk/mcs/gmcs/pending.cs 2005-10-28 13:58:16 UTC (rev 52321)
@@ -416,25 +416,35 @@
} else if ((need_proxy == null) &&
(name != mname))
continue;
- if (!TypeManager.IsEqual (ret_type,
m.ReturnType)){
- if (!((ret_type == null &&
m.ReturnType == TypeManager.void_type) ||
- (m.ReturnType == null &&
ret_type == TypeManager.void_type)))
- continue;
- }
+ if (!TypeManager.IsEqual (ret_type,
m.ReturnType) &&
+ !(ret_type == null && m.ReturnType
== TypeManager.void_type) &&
+ !(m.ReturnType == null && ret_type
== TypeManager.void_type))
+ continue;
//
// Check if we have the same parameters
//
- if (tm.args [i].Length != arg_len)
+
+ if (tm.args [i] == null && arg_len != 0)
continue;
+ if (tm.args [i] != null && tm.args
[i].Length != arg_len)
+ continue;
- int j, top = args.Count;
+ int j;
- for (j = 0; j < top; j++)
- if (!TypeManager.IsEqual
(tm.args [i][j], args.ParameterType (j)) ||
- tm.mods [i][j] !=
args.ParameterModifier (j))
+ for (j = 0; j < arg_len; j++) {
+ if (!TypeManager.IsEqual
(tm.args [i][j], args.ParameterType (j)))
break;
- if (j != top)
+ if (tm.mods [i][j] ==
args.ParameterModifier (j))
+ continue;
+ // The modifiers are different,
but if one of them
+ // is a PARAMS modifier, and
the other isn't, ignore
+ // the difference.
+ if (tm.mods [i][j] !=
Parameter.Modifier.PARAMS &&
+ args.ParameterModifier (j)
!= Parameter.Modifier.PARAMS)
+ break;
+ }
+ if (j != arg_len)
continue;
if (op != Operation.Lookup){
Modified: trunk/mcs/gmcs/statement.cs
===================================================================
--- trunk/mcs/gmcs/statement.cs 2005-10-28 13:50:44 UTC (rev 52320)
+++ trunk/mcs/gmcs/statement.cs 2005-10-28 13:58:16 UTC (rev 52321)
@@ -1563,6 +1563,9 @@
constants = new Hashtable ();
constants.Add (name, value);
+
+ // A block is considered used if we perform an
initialization in a local declaration, even if it is constant.
+ Use ();
return true;
}
@@ -1743,8 +1746,15 @@
if (cv == null)
continue;
+ // Don't let 'const int Foo = Foo;'
succeed.
+ // Removing the name from 'constants'
ensures that we get a LocalVariableReference below,
+ // which in turn causes the 'must be
constant' error to be triggered.
+ constants.Remove (name);
+
ec.CurrentBlock = this;
Expression e = cv.Resolve (ec);
+ if (e == null)
+ continue;
Constant ce = e as Constant;
if (ce == null){
@@ -1756,7 +1766,6 @@
if (e == null)
continue;
- constants.Remove (name);
constants.Add (name, e);
}
}
@@ -3676,6 +3685,14 @@
Report.Debug (1, "END OF CATCH BLOCKS",
ec.CurrentBranching);
if (General != null){
+ if (CodeGen.Assembly.WrapNonExceptionThrows) {
+ foreach (Catch c in Specific){
+ if (c.CatchType ==
TypeManager.exception_type) {
+ Report.Warning (1058,
1, c.loc, "A previous catch clause already catches all exceptions. All
non-exceptions thrown will be wrapped in a
`System.Runtime.CompilerServices.RuntimeWrappedException'");
+ }
+ }
+ }
+
ec.CurrentBranching.CreateSibling (
General.Block,
FlowBranching.SiblingType.Catch);
Modified: trunk/mcs/gmcs/support.cs
===================================================================
--- trunk/mcs/gmcs/support.cs 2005-10-28 13:50:44 UTC (rev 52320)
+++ trunk/mcs/gmcs/support.cs 2005-10-28 13:58:16 UTC (rev 52321)
@@ -78,6 +78,11 @@
sb.Append (", ");
sb.Append (ParameterDesc (i));
}
+ if (is_varargs) {
+ if (pi.Length > 0)
+ sb.Append (", ");
+ sb.Append ("__arglist");
+ }
sb.Append (')');
return sb.ToString ();
}
@@ -140,7 +145,7 @@
if (pos >= pi.Length - 1 && last_arg_is_params)
sb.Append ("params ");
-
+
sb.Append (TypeManager.CSharpName (partype).Replace
("&", ""));
return sb.ToString ();
@@ -241,6 +246,11 @@
sb.Append (", ");
sb.Append (ParameterDesc (i));
}
+ if (has_varargs) {
+ if (count > 0)
+ sb.Append (", ");
+ sb.Append ("__arglist");
+ }
sb.Append (')');
return sb.ToString ();
}
@@ -295,7 +305,6 @@
return "out";
if (p.ModFlags == Parameter.Modifier.PARAMS)
return "params";
-
return "";
}
Modified: trunk/mcs/gmcs/typemanager.cs
===================================================================
--- trunk/mcs/gmcs/typemanager.cs 2005-10-28 13:50:44 UTC (rev 52320)
+++ trunk/mcs/gmcs/typemanager.cs 2005-10-28 13:58:16 UTC (rev 52321)
@@ -104,6 +104,7 @@
///
/// .NET 2.0
///
+ static internal Type runtime_compatibility_attr_type;
static internal Type compiler_generated_attr_type;
static internal Type fixed_buffer_attr_type;
static internal Type default_charset_type;
@@ -977,6 +978,7 @@
fixed_buffer_attr_type = CoreLookupType
("System.Runtime.CompilerServices", "FixedBufferAttribute");
default_charset_type = CoreLookupType
("System.Runtime.InteropServices", "DefaultCharSetAttribute");
internals_visible_attr_type = CoreLookupType
("System.Runtime.CompilerServices", "InternalsVisibleToAttribute");
+ runtime_compatibility_attr_type = CoreLookupType
("System.Runtime.CompilerServices", "RuntimeCompatibilityAttribute");
//
// When compiling corlib, store the "real" types here.
//
Modified: trunk/mcs/tests/known-issues-gmcs
===================================================================
--- trunk/mcs/tests/known-issues-gmcs 2005-10-28 13:50:44 UTC (rev 52320)
+++ trunk/mcs/tests/known-issues-gmcs 2005-10-28 13:58:16 UTC (rev 52321)
@@ -4,7 +4,6 @@
# csXXXX.cs : test case causes error
# csXXXX.cs IGNORE : adds test to ignore list
-gtest-214.cs
test-442.cs IGNORE # Causes runtime to crash
test-464.cs
test-50.cs IGNORE # Windows-only test
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches