* make use of the noreturn directive for internalerror

* clean up of the internalerror procedure variable in the constexp unit

git-svn-id: trunk@26004 -
This commit is contained in:
florian 2013-11-10 09:01:03 +00:00
parent 1d4a4d0684
commit a0f0d0de40
3 changed files with 13 additions and 5 deletions

View File

@ -41,7 +41,7 @@ type Tconstexprint=record
build trouble when compiling the directory utils, since the cpu directory build trouble when compiling the directory utils, since the cpu directory
isn't searched there. Therefore we use a procvar and make verbose install 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.} 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 {Same issue, avoid dependency on cpuinfo because the cpu directory isn't
searched during utils building.} searched during utils building.}
@ -87,7 +87,14 @@ function tostr(const i:Tconstexprint):shortstring;overload;
implementation 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; operator := (const u:qword):Tconstexprint;

View File

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

View File

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