mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-11-04 06:39:25 +01:00 
			
		
		
		
	* catch EOSError, EIOError and IOutOfMemory exceptions inside the compiler
so a proper error message is written (resolves #19871), EOutOfMemory is not handle perfectly because it could be that the exception handling requires again a memory allocation git-svn-id: trunk@18132 -
This commit is contained in:
		
							parent
							
								
									28126cf0d5
								
							
						
					
					
						commit
						562961fd42
					
				@ -107,20 +107,21 @@ type
 | 
				
			|||||||
  { Special file for bug report }
 | 
					  { Special file for bug report }
 | 
				
			||||||
    reportbugfile : text;
 | 
					    reportbugfile : text;
 | 
				
			||||||
  end;
 | 
					  end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type
 | 
				
			||||||
 | 
					  EControlCAbort=class(Exception)
 | 
				
			||||||
 | 
					    constructor Create;
 | 
				
			||||||
 | 
					  end;
 | 
				
			||||||
 | 
					  ECompilerAbort=class(Exception)
 | 
				
			||||||
 | 
					    constructor Create;
 | 
				
			||||||
 | 
					  end;
 | 
				
			||||||
 | 
					  ECompilerAbortSilent=class(Exception)
 | 
				
			||||||
 | 
					    constructor Create;
 | 
				
			||||||
 | 
					  end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var
 | 
					var
 | 
				
			||||||
  status : tcompilerstatus;
 | 
					  status : tcompilerstatus;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    type
 | 
					 | 
				
			||||||
      EControlCAbort=class(Exception)
 | 
					 | 
				
			||||||
        constructor Create;
 | 
					 | 
				
			||||||
      end;
 | 
					 | 
				
			||||||
      ECompilerAbort=class(Exception)
 | 
					 | 
				
			||||||
        constructor Create;
 | 
					 | 
				
			||||||
      end;
 | 
					 | 
				
			||||||
      ECompilerAbortSilent=class(Exception)
 | 
					 | 
				
			||||||
        constructor Create;
 | 
					 | 
				
			||||||
      end;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
{ Default Functions }
 | 
					{ Default Functions }
 | 
				
			||||||
Function  def_status:boolean;
 | 
					Function  def_status:boolean;
 | 
				
			||||||
Function  def_comment(Level:Longint;const s:ansistring):boolean;
 | 
					Function  def_comment(Level:Longint;const s:ansistring):boolean;
 | 
				
			||||||
 | 
				
			|||||||
@ -281,7 +281,6 @@ begin
 | 
				
			|||||||
     end;
 | 
					     end;
 | 
				
			||||||
     DoneVerbose;
 | 
					     DoneVerbose;
 | 
				
			||||||
  except
 | 
					  except
 | 
				
			||||||
 | 
					 | 
				
			||||||
    on EControlCAbort do
 | 
					    on EControlCAbort do
 | 
				
			||||||
      begin
 | 
					      begin
 | 
				
			||||||
        try
 | 
					        try
 | 
				
			||||||
@ -312,6 +311,36 @@ begin
 | 
				
			|||||||
      begin
 | 
					      begin
 | 
				
			||||||
        DoneVerbose;
 | 
					        DoneVerbose;
 | 
				
			||||||
      end;
 | 
					      end;
 | 
				
			||||||
 | 
					    on EOutOfMemory do
 | 
				
			||||||
 | 
					      begin
 | 
				
			||||||
 | 
					        try
 | 
				
			||||||
 | 
					          Message(general_f_no_memory_left);
 | 
				
			||||||
 | 
					        except
 | 
				
			||||||
 | 
					          on ECompilerAbort do
 | 
				
			||||||
 | 
					            ;
 | 
				
			||||||
 | 
					        end;
 | 
				
			||||||
 | 
					        DoneVerbose;
 | 
				
			||||||
 | 
					      end;
 | 
				
			||||||
 | 
					    on e : EInOutError do
 | 
				
			||||||
 | 
					      begin
 | 
				
			||||||
 | 
					        try
 | 
				
			||||||
 | 
					          Message1(general_f_ioerror,e.message);
 | 
				
			||||||
 | 
					        except
 | 
				
			||||||
 | 
					          on ECompilerAbort do
 | 
				
			||||||
 | 
					            ;
 | 
				
			||||||
 | 
					        end;
 | 
				
			||||||
 | 
					        DoneVerbose;
 | 
				
			||||||
 | 
					      end;
 | 
				
			||||||
 | 
					    on e : EOSError do
 | 
				
			||||||
 | 
					      begin
 | 
				
			||||||
 | 
					        try
 | 
				
			||||||
 | 
					          Message1(general_f_oserror,e.message);
 | 
				
			||||||
 | 
					        except
 | 
				
			||||||
 | 
					          on ECompilerAbort do
 | 
				
			||||||
 | 
					            ;
 | 
				
			||||||
 | 
					        end;
 | 
				
			||||||
 | 
					        DoneVerbose;
 | 
				
			||||||
 | 
					      end;
 | 
				
			||||||
    on Exception do
 | 
					    on Exception do
 | 
				
			||||||
      begin
 | 
					      begin
 | 
				
			||||||
        { General catchall, normally not used }
 | 
					        { General catchall, normally not used }
 | 
				
			||||||
 | 
				
			|||||||
@ -124,6 +124,10 @@ general_i_number_of_hints=01022_I_$1 hint(s) issued
 | 
				
			|||||||
% Total number of hints issued during compilation.
 | 
					% Total number of hints issued during compilation.
 | 
				
			||||||
general_i_number_of_notes=01023_I_$1 note(s) issued
 | 
					general_i_number_of_notes=01023_I_$1 note(s) issued
 | 
				
			||||||
% Total number of notes issued during compilation.
 | 
					% Total number of notes issued during compilation.
 | 
				
			||||||
 | 
					general_f_ioerror=01024_F_I/O error: $1
 | 
				
			||||||
 | 
					% During compilation an I/O error happened which allows no further compilation.
 | 
				
			||||||
 | 
					general_f_oserror=01025_F_Operating system error: $1
 | 
				
			||||||
 | 
					% During compilation an operanting system error happened which allows no further compilation.
 | 
				
			||||||
% \end{description}
 | 
					% \end{description}
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Scanner
 | 
					# Scanner
 | 
				
			||||||
 | 
				
			|||||||
@ -23,6 +23,8 @@ const
 | 
				
			|||||||
  general_i_number_of_warnings=01021;
 | 
					  general_i_number_of_warnings=01021;
 | 
				
			||||||
  general_i_number_of_hints=01022;
 | 
					  general_i_number_of_hints=01022;
 | 
				
			||||||
  general_i_number_of_notes=01023;
 | 
					  general_i_number_of_notes=01023;
 | 
				
			||||||
 | 
					  general_f_ioerror=01024;
 | 
				
			||||||
 | 
					  general_f_oserror=01025;
 | 
				
			||||||
  scan_f_end_of_file=02000;
 | 
					  scan_f_end_of_file=02000;
 | 
				
			||||||
  scan_f_string_exceeds_line=02001;
 | 
					  scan_f_string_exceeds_line=02001;
 | 
				
			||||||
  scan_f_illegal_char=02002;
 | 
					  scan_f_illegal_char=02002;
 | 
				
			||||||
@ -895,9 +897,9 @@ const
 | 
				
			|||||||
  option_info=11024;
 | 
					  option_info=11024;
 | 
				
			||||||
  option_help_pages=11025;
 | 
					  option_help_pages=11025;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  MsgTxtSize = 60714;
 | 
					  MsgTxtSize = 60771;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  MsgIdxMax : array[1..20] of longint=(
 | 
					  MsgIdxMax : array[1..20] of longint=(
 | 
				
			||||||
    24,89,311,103,85,54,111,23,202,63,
 | 
					    26,89,311,103,85,54,111,23,202,63,
 | 
				
			||||||
    49,20,1,1,1,1,1,1,1,1
 | 
					    49,20,1,1,1,1,1,1,1,1
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										1120
									
								
								compiler/msgtxt.inc
									
									
									
									
									
								
							
							
						
						
									
										1120
									
								
								compiler/msgtxt.inc
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Loading…
	
		Reference in New Issue
	
	Block a user