فهرست منبع

* write a proper error message if types are read/written which are not supported in iso mode, resolves #37763

git-svn-id: trunk@46885 -
florian 4 سال پیش
والد
کامیت
60bd9c5ba0
6فایلهای تغییر یافته به همراه453 افزوده شده و 438 حذف شده
  1. 1 0
      .gitattributes
  2. 3 0
      compiler/msg/errore.msg
  3. 3 2
      compiler/msgidx.inc
  4. 431 435
      compiler/msgtxt.inc
  5. 8 1
      compiler/ninl.pas
  6. 7 0
      tests/webtbf/tw37763.pp

+ 1 - 0
.gitattributes

@@ -16577,6 +16577,7 @@ tests/webtbf/tw37460.pp svneol=native#text/pascal
 tests/webtbf/tw37462.pp svneol=native#text/pascal
 tests/webtbf/tw37475.pp svneol=native#text/pascal
 tests/webtbf/tw37476.pp svneol=native#text/pascal
+tests/webtbf/tw37763.pp svneol=native#text/pascal
 tests/webtbf/tw3790.pp svneol=native#text/plain
 tests/webtbf/tw3812.pp svneol=native#text/plain
 tests/webtbf/tw3930a.pp svneol=native#text/plain

+ 3 - 0
compiler/msg/errore.msg

@@ -2064,6 +2064,9 @@ type_e_forward_interface_type_does_not_match=04127_E_The interface type of the f
 type_e_generic_const_type_not_allowed=04128_E_Type not allowed for generic constant parameter: $1
 % Only types that can also be used (indirectly) for untyped constants can be used as a
 % type for a generic constant parameter.
+type_e_cant_read_write_type_in_iso_mode=04129_E_Can't read or write variables of this type in iso mode
+% You are trying to \var{read} or \var{write} a variable from or to a
+% file of type text, which doesn't support that variable's type in the selected language mode (iso mode).
 % \end{description}
 #
 # Symtable

+ 3 - 2
compiler/msgidx.inc

@@ -585,6 +585,7 @@ const
   type_e_cblock_callconv=04126;
   type_e_forward_interface_type_does_not_match=04127;
   type_e_generic_const_type_not_allowed=04128;
+  type_e_cant_read_write_type_in_iso_mode=04129;
   sym_e_id_not_found=05000;
   sym_f_internal_error_in_symtablestack=05001;
   sym_e_duplicate_id=05002;
@@ -1126,9 +1127,9 @@ const
   option_info=11024;
   option_help_pages=11025;
 
-  MsgTxtSize = 85732;
+  MsgTxtSize = 85795;
 
   MsgIdxMax : array[1..20] of longint=(
-    28,106,356,129,99,63,143,36,223,68,
+    28,106,356,130,99,63,143,36,223,68,
     62,20,30,1,1,1,1,1,1,1
   );

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 431 - 435
compiler/msgtxt.inc


+ 8 - 1
compiler/ninl.pas

@@ -765,7 +765,14 @@ implementation
           else
             case para.left.resultdef.typ of
               stringdef :
-                name:=procprefixes[do_read]+tstringdef(para.left.resultdef).stringtypname;
+                begin
+                  name:=procprefixes[do_read]+tstringdef(para.left.resultdef).stringtypname;
+                  if (m_isolike_io in current_settings.modeswitches) and (tstringdef(para.left.resultdef).stringtype<>st_shortstring) then
+                    begin
+                      CGMessagePos(para.fileinfo,type_e_cant_read_write_type_in_iso_mode);
+                      error_para := true;
+                    end;
+                end;
               pointerdef :
                 begin
                   if (not is_pchar(para.left.resultdef)) or do_read then

+ 7 - 0
tests/webtbf/tw37763.pp

@@ -0,0 +1,7 @@
+{ %fail }
+{$MODE ISO}
+program forum(output);
+var f:rawbytestring;
+begin
+writeln(f)
+end.

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است