Browse Source

* give error when string[0] decl is found

peter 27 years ago
parent
commit
162124d10c
3 changed files with 12 additions and 6 deletions
  1. 1 1
      compiler/msgidx.inc
  2. 6 3
      compiler/pdecl.pas
  3. 5 2
      compiler/ptconst.pas

+ 1 - 1
compiler/msgidx.inc

@@ -88,7 +88,7 @@ type tmsgconst=(
   parser_e_double_caselabel,
   parser_e_double_caselabel,
   parser_e_type_const_not_possible,
   parser_e_type_const_not_possible,
   parser_e_no_overloaded_procvars,
   parser_e_no_overloaded_procvars,
-  parser_e_string_too_long,
+  parser_e_invalid_string_size,
   parser_w_use_extended_syntax_for_objects,
   parser_w_use_extended_syntax_for_objects,
   parser_e_class_id_expected,
   parser_e_class_id_expected,
   parser_e_no_type_not_allowed_here,
   parser_e_no_type_not_allowed_here,

+ 6 - 3
compiler/pdecl.pas

@@ -559,9 +559,9 @@ unit pdecl;
               do_firstpass(p);
               do_firstpass(p);
               if not is_constintnode(p) then
               if not is_constintnode(p) then
                 Message(cg_e_illegal_expression);
                 Message(cg_e_illegal_expression);
-              if (p^.value<0) then
+              if (p^.value<=0) then
                 begin
                 begin
-                   Message(parser_e_string_too_long);
+                   Message(parser_e_invalid_string_size);
                    p^.value:=255;
                    p^.value:=255;
                 end;
                 end;
               consume(RECKKLAMMER);
               consume(RECKKLAMMER);
@@ -2097,7 +2097,10 @@ unit pdecl;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.84  1998-11-17 10:40:15  peter
+  Revision 1.85  1998-11-27 14:34:43  peter
+    * give error when string[0] decl is found
+
+  Revision 1.84  1998/11/17 10:40:15  peter
     * H+ fixes
     * H+ fixes
 
 
   Revision 1.83  1998/11/16 11:28:59  pierre
   Revision 1.83  1998/11/16 11:28:59  pierre

+ 5 - 2
compiler/ptconst.pas

@@ -477,7 +477,7 @@ unit ptconst;
                           datasegment^.concat(new(pai_const,init_8bit(0)));
                           datasegment^.concat(new(pai_const,init_8bit(0)));
                      end;
                      end;
                    if length(s)>0 then
                    if length(s)>0 then
-                     Message(parser_e_string_too_long);
+                     Message(parser_e_invalid_string_size);
                  end;
                  end;
            end;
            end;
          procvardef:
          procvardef:
@@ -647,7 +647,10 @@ unit ptconst;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.29  1998-11-23 18:26:44  pierre
+  Revision 1.30  1998-11-27 14:34:42  peter
+    * give error when string[0] decl is found
+
+  Revision 1.29  1998/11/23 18:26:44  pierre
    * fix for bug0182
    * fix for bug0182
 
 
   Revision 1.28  1998/11/17 10:40:16  peter
   Revision 1.28  1998/11/17 10:40:16  peter