Skip to content

Commit

Permalink
Try to fix missing compiler messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
VladD2 committed Jan 27, 2020
1 parent f7ebf8f commit 4dec65b
Show file tree
Hide file tree
Showing 2 changed files with 418 additions and 419 deletions.
55 changes: 23 additions & 32 deletions ncc/main.n
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* 3. The name of the University may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
Expand Down Expand Up @@ -55,7 +55,7 @@ namespace Nemerle.CommandlineCompiler

Platform : int = Environment.OSVersion.Platform :> int;
IsUnix : bool = IO.Path.DirectorySeparatorChar == '/';

public Main() : void
{
def is64bitProcess = IntPtr.Size == 8;
Expand All @@ -65,24 +65,24 @@ namespace Nemerle.CommandlineCompiler
Environment.Is64BitOperatingSystem
#else
if (!IsUnix)
{
Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE") == "AMD64" ||
{
Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE") == "AMD64" ||
Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432") == "AMD64"
}
else
{
def unameProcess = Process();
unameProcess.StartInfo.UseShellExecute = false;
unameProcess.StartInfo.CreateNoWindow = false;
unameProcess.StartInfo.CreateNoWindow = false;
unameProcess.StartInfo.FileName = "/bin/uname";
unameProcess.StartInfo.Arguments = "-m";
unameProcess.StartInfo.RedirectStandardOutput = true;

if (unameProcess.Start())
{
def output = unameProcess.StandardOutput.ReadToEnd();
unameProcess.WaitForExit();

unameProcess.ExitCode == 0 && output.Contains("x64")
}
else
Expand Down Expand Up @@ -149,7 +149,7 @@ namespace Nemerle.CommandlineCompiler
else
main_with_catching()
}

needs_bigger_stack() : bool
{
typeof(object).Assembly.GetType("System.RuntimeType") != null ||
Expand All @@ -168,35 +168,26 @@ namespace Nemerle.CommandlineCompiler
}
catch
{
| e is IO.FileNotFoundException =>
Message.Error (e.Message)
| e is Recovery =>
bomb (e, "got Recovery exception")
| e is BailOutException =>
bomb (e, "got bail out exception")
| e is ArgumentException =>
bomb (e, "got ArgumentException (" + e.Message + ")")
| e is MatchFailureException =>
bomb (e, "got MatchFailureException exception")
| e is ICE =>
bomb (e, e.Message)
| e is AssertionException =>
bomb (e, e.Message)
| _ is AssemblyFindException =>
Environment.Exit (3);
| e =>
bomb (e, $ "got some unknown exception of type $(e.GetType()): $(e.Message)")
| e is IO.FileNotFoundException => bomb(e, e.Message)
| e is Recovery => bomb(e, "got Recovery exception")
| e is BailOutException => bomb(e, "got bail out exception")
| e is ArgumentException => bomb(e, "got ArgumentException (" + e.Message + ")")
| e is MatchFailureException => bomb(e, "got MatchFailureException exception")
| e is ICE => bomb(e, e.Message)
| e is AssertionException => bomb(e, e.Message)
| e is AssemblyFindException => bomb(e, e.Message, exitValue=3)
| e => bomb(e, $ "got some unknown exception of type $(e.GetType()): $(e.Message)")
}

Message.MaybeBailout();
}
bomb (e : Exception, msg : string) : void

bomb(e : Exception, msg : string, exitValue : int = 2) : void
{
Manager.KillProgressBar ();
Message.MaybeBailout (true);
Message.Error (sprintf ("internal compiler error: %s\n%s\n", msg, e.StackTrace));
Environment.Exit(2);
Manager.KillProgressBar();
Message.MaybeBailout(true);
Message.Error($<#internal compiler error: $msg. $(e.StackTrace.Replace("\r\n", "¦").Replace("\n", "¦"))#>);
Environment.Exit(exitValue);
}

parse_command_line() : void
Expand Down
Loading

0 comments on commit 4dec65b

Please sign in to comment.