2
0
Эх сурвалжийг харах

* make use of the noreturn directive for internalerror
* clean up of the internalerror procedure variable in the constexp unit

git-svn-id: trunk@26004 -

florian 11 жил өмнө
parent
commit
a0f0d0de40

+ 8 - 1
compiler/constexp.pas

@@ -41,7 +41,7 @@ type  Tconstexprint=record
  build trouble when compiling the directory utils, since the cpu directory
  isn't searched there. Therefore we use a procvar and make verbose install
  the errorhandler. A dependency from verbose on this unit is no problem.}
-var   internalerror:errorproc;
+var   internalerrorproc:errorproc;
 
 {Same issue, avoid dependency on cpuinfo because the cpu directory isn't
  searched during utils building.}
@@ -87,7 +87,14 @@ function tostr(const i:Tconstexprint):shortstring;overload;
 implementation
 {****************************************************************************}
 
+{ use a separate procedure here instead of calling internalerrorproc directly because
+  - procedure variables cannot have a noreturn directive
+  - having a procedure and a procedure variable with the same name in the interfaces of different units is confusing }
+procedure internalerror(i:longint);{$ifndef VER2_6}noreturn;{$endif VER2_6}
 
+begin
+  internalerrorproc(i);
+end;
 
 operator := (const u:qword):Tconstexprint;
 

+ 1 - 0
compiler/optloop.pas

@@ -36,6 +36,7 @@ unit optloop;
     uses
       cutils,cclasses,
       globtype,globals,constexp,
+      verbose,
       symdef,symsym,
       defutil,
       cpuinfo,

+ 4 - 4
compiler/verbose.pas

@@ -89,7 +89,7 @@ interface
     function  ErrorCount:longint;
     procedure SetErrorFlags(const s:string);
     procedure GenerateError;
-    procedure Internalerror(i:longint);
+    procedure Internalerror(i:longint);{$ifndef VER2_6}noreturn;{$endif VER2_6}
     procedure Comment(l:longint;s:ansistring);
     function  MessagePchar(w:longint):pchar;
     procedure Message(w:longint;onqueue:tmsgqueueevent=nil);
@@ -538,7 +538,7 @@ implementation
                       { Enable writing of notes, to avoid getting errors without any message }
                       status.verbosity:=status.verbosity or V_Note;
                     end;
-                   
+
                 end;
               'h','H' :
                 begin
@@ -565,7 +565,7 @@ implementation
       end;
 
 
-    procedure internalerror(i : longint);
+    procedure internalerror(i : longint);{$ifndef VER2_6}noreturn;{$endif VER2_6}
       begin
         UpdateStatus;
         do_internalerror(i);
@@ -1017,7 +1017,7 @@ implementation
 
 
 initialization
-  constexp.internalerror:=@internalerror;
+  constexp.internalerrorproc:=@internalerror;
 finalization
   { Be sure to close the redirect files to flush all data }
   DoneRedirectFile;