瀏覽代碼

* for all managed VM targets, reject ord->ptr typecasts (except for 0),
typeof(), typeinfo(), seg(), ofs(), settextbuf(), slice(), resourcestring,
new(), dispose()

git-svn-id: branches/jvmbackend@18747 -

Jonas Maebe 14 年之前
父節點
當前提交
d48fa1d7e2
共有 8 個文件被更改,包括 365 次插入344 次删除
  1. 3 1
      compiler/msg/errore.msg
  2. 3 2
      compiler/msgidx.inc
  3. 338 341
      compiler/msgtxt.inc
  4. 3 0
      compiler/ncnv.pas
  5. 10 0
      compiler/ninl.pas
  6. 2 0
      compiler/pdecl.pas
  7. 2 0
      compiler/pexpr.pas
  8. 4 0
      compiler/pinline.pas

+ 3 - 1
compiler/msg/errore.msg

@@ -375,7 +375,7 @@ scanner_e_illegal_alignment_directive=02088_E_Illegal alignment directive
 #
 # Parser
 #
-# 03318 is the last used one
+# 03319 is the last used one
 #
 % \section{Parser messages}
 % This section lists all parser messages. The parser takes care of the
@@ -1420,6 +1420,8 @@ parser_d_internal_parser_string=03318_D_Parsing internally generated code: $1
 % The compiler sometimes internally constructs Pascal code that is subsequently
 % injected into the program. These messages display such code, in order to help
 % with debugging errors in them.
+parser_e_feature_unsupported_for_vm=03319_E_This language feature is not supported on managed VM targets
+% Certain language features are not supported on targets that are managed virtual machines.
 % \end{description}
 # Type Checking
 #

+ 3 - 2
compiler/msgidx.inc

@@ -410,6 +410,7 @@ const
   parser_e_no_typed_const=03316;
   parser_e_java_no_inherited_constructor=03317;
   parser_d_internal_parser_string=03318;
+  parser_e_feature_unsupported_for_vm=03319;
   type_e_mismatch=04000;
   type_e_incompatible_types=04001;
   type_e_not_equal_types=04002;
@@ -911,9 +912,9 @@ const
   option_info=11024;
   option_help_pages=11025;
 
-  MsgTxtSize = 61956;
+  MsgTxtSize = 62025;
 
   MsgIdxMax : array[1..20] of longint=(
-    26,89,319,107,87,54,111,23,202,63,
+    26,89,320,107,87,54,111,23,202,63,
     49,20,1,1,1,1,1,1,1,1
   );

File diff suppressed because it is too large
+ 338 - 341
compiler/msgtxt.inc


+ 3 - 0
compiler/ncnv.pas

@@ -2490,6 +2490,9 @@ implementation
               if (resultdef.typ=pointerdef) and
                  (convtype<>tc_cchar_2_pchar) then
                 begin
+                   if (target_info.system in systems_managed_vm) and
+                      (tordconstnode(left).value<>0) then
+                     message(parser_e_feature_unsupported_for_vm);
                    hp:=cpointerconstnode.create(TConstPtrUInt(tordconstnode(left).value.uvalue),resultdef);
                    if ([nf_explicit,nf_internal] * flags <> []) then
                      include(hp.flags, nf_explicit);

+ 10 - 0
compiler/ninl.pas

@@ -2371,6 +2371,8 @@ implementation
 
               in_typeof_x:
                 begin
+                  if target_info.system in systems_managed_vm then
+                    message(parser_e_feature_unsupported_for_vm);
                   set_varstate(left,vs_read,[]);
                   resultdef:=voidpointertype;
                 end;
@@ -2499,6 +2501,8 @@ implementation
 
               in_typeinfo_x:
                 begin
+                  if target_info.system in systems_managed_vm then
+                    message(parser_e_feature_unsupported_for_vm);
                    if (left.resultdef.typ=enumdef) and
                       (tenumdef(left.resultdef).has_jumps) then
                      CGMessage(type_e_no_type_info);
@@ -2531,6 +2535,8 @@ implementation
 
               in_seg_x :
                 begin
+                  if target_info.system in systems_managed_vm then
+                    message(parser_e_feature_unsupported_for_vm);
                   set_varstate(left,vs_read,[]);
                   result:=cordconstnode.create(0,s32inttype,false);
                 end;
@@ -2642,6 +2648,8 @@ implementation
 
               in_settextbuf_file_x :
                 begin
+                  if target_info.system in systems_managed_vm then
+                    message(parser_e_feature_unsupported_for_vm);
                   resultdef:=voidtype;
                   { now we know the type of buffer }
                   hp:=ccallparanode.create(cordconstnode.create(
@@ -2696,6 +2704,8 @@ implementation
 
               in_slice_x:
                 begin
+                  if target_info.system in systems_managed_vm then
+                    message(parser_e_feature_unsupported_for_vm);
                   result:=nil;
                   resultdef:=tcallparanode(left).left.resultdef;
                   if (resultdef.typ <> arraydef) then

+ 2 - 0
compiler/pdecl.pas

@@ -746,6 +746,8 @@ implementation
          sp : pchar;
          sym : tsym;
       begin
+         if target_info.system in systems_managed_vm then
+           message(parser_e_feature_unsupported_for_vm);
          consume(_RESOURCESTRING);
          if not(symtablestack.top.symtabletype in [staticsymtable,globalsymtable]) then
            message(parser_e_resourcestring_only_sg);

+ 2 - 0
compiler/pexpr.pas

@@ -553,6 +553,8 @@ implementation
 
           in_ofs_x :
             begin
+              if target_info.system in systems_managed_vm then
+                message(parser_e_feature_unsupported_for_vm);
               consume(_LKLAMMER);
               in_args:=true;
               p1:=comp_expr(true,false);

+ 4 - 0
compiler/pinline.pas

@@ -75,6 +75,8 @@ implementation
         destructorpos,
         storepos : tfileposinfo;
       begin
+        if target_info.system in systems_managed_vm then
+          message(parser_e_feature_unsupported_for_vm);
         consume(_LKLAMMER);
         p:=comp_expr(true,false);
         { calc return type }
@@ -352,6 +354,8 @@ implementation
         srsymtable : TSymtable;
         again  : boolean; { dummy for do_proc_call }
       begin
+        if target_info.system in systems_managed_vm then
+          message(parser_e_feature_unsupported_for_vm);
         consume(_LKLAMMER);
         p1:=factor(false,false);
         if p1.nodetype<>typen then

Some files were not shown because too many files changed in this diff