Merge pull request #679 from jack-pappas/patch-6
authorAlex Rønne Petersen <alex@alexrp.com>
Tue, 2 Jul 2013 09:18:47 +0000 (02:18 -0700)
committerAlex Rønne Petersen <alex@alexrp.com>
Tue, 2 Jul 2013 09:18:47 +0000 (02:18 -0700)
Enable sigaltstack and dtrace on FreeBSD

mcs/mcs/assembly.cs
mcs/mcs/typemanager.cs

index 3a7cb71aaa8172736a13af9dd9ea5ad1e413bfec..b2e4e9a20181b84e86a02b000a20ffed083fdd32 100644 (file)
@@ -1179,15 +1179,27 @@ namespace Mono.CSharp
                                if (loaded.Contains (key))
                                        continue;
 
-                               // A corlib assembly is the first assembly which contains System.Object
-                               if (corlib_assembly == null && HasObjectType (a)) {
-                                       corlib_assembly = a;
-                                       continue;
-                               }
-
                                loaded.Add (key);
                        }
 
+                       if (corlib_assembly == null) {
+                               //
+                               // Requires second pass because HasObjectType can trigger assembly load event
+                               //
+                               for (int i = 0; i < loaded.Count; ++i) {
+                                       var assembly = loaded [i];
+
+                                       //
+                                       // corlib assembly is the first referenced assembly which contains System.Object
+                                       //
+                                       if (HasObjectType (assembly.Item2)) {
+                                               corlib_assembly = assembly.Item2;
+                                               loaded.RemoveAt (i);
+                                               break;
+                                       }
+                               }
+                       }
+
                        foreach (var entry in module.Compiler.Settings.AssemblyReferencesAliases) {
                                a = LoadAssemblyFile (entry.Item2, false);
                                if (a == null)
index 6eb7648ce537b162b61e8a9727d995a32d49d8d7..b77dfef531fb6c6e9fddc1914ffa2641302857dd 100644 (file)
@@ -835,15 +835,22 @@ namespace Mono.CSharp
                        }
 
                        if (best_match == null && reportErrors) {
-                               Location loc;
-                               if (found[0].MemberDefinition is MemberCore) {
-                                       loc = ((MemberCore) found[0].MemberDefinition).Location;
+                               var found_member = found[0];
+
+                               if (found_member.Kind == MemberKind.MissingType) {
+                                       // CSC: should be different error number
+                                       module.Compiler.Report.Error (518, "The predefined type `{0}.{1}' is defined in an assembly that is not referenced.", ns, name);
                                } else {
-                                       loc = Location.Null;
-                                       module.Compiler.Report.SymbolRelatedToPreviousError (found[0]);
-                               }
+                                       Location loc;
+                                       if (found_member.MemberDefinition is MemberCore) {
+                                               loc = ((MemberCore) found_member.MemberDefinition).Location;
+                                       } else {
+                                               loc = Location.Null;
+                                               module.Compiler.Report.SymbolRelatedToPreviousError (found_member);
+                                       }
 
-                               module.Compiler.Report.Error (520, loc, "The predefined type `{0}.{1}' is not declared correctly", ns, name);
+                                       module.Compiler.Report.Error (520, loc, "The predefined type `{0}.{1}' is not declared correctly", ns, name);
+                               }
                        }
 
                        return best_match;