Browse Source

* give an error when trying to define a macro/compiler variable with
an empty name

git-svn-id: trunk@47300 -

Jonas Maebe 4 years ago
parent
commit
38a059f039
6 changed files with 564 additions and 556 deletions
  1. 1 0
      .gitattributes
  2. 1 0
      compiler/msg/errore.msg
  3. 3 2
      compiler/msgidx.inc
  4. 549 554
      compiler/msgtxt.inc
  5. 5 0
      compiler/scanner.pas
  6. 5 0
      tests/tbf/tb0272.pp

+ 1 - 0
.gitattributes

@@ -12658,6 +12658,7 @@ tests/tbf/tb0268.pp svneol=native#text/pascal
 tests/tbf/tb0269.pp svneol=native#text/pascal
 tests/tbf/tb0270.pp svneol=native#text/pascal
 tests/tbf/tb0271.pp svneol=native#text/pascal
+tests/tbf/tb0272.pp svneol=native#text/plain
 tests/tbf/tb0588.pp svneol=native#text/pascal
 tests/tbf/ub0115.pp svneol=native#text/plain
 tests/tbf/ub0149.pp svneol=native#text/plain

+ 1 - 0
compiler/msg/errore.msg

@@ -432,6 +432,7 @@ scan_w_setpeosversion_not_support=02103_W_SETPEOSVERSION is not supported by the
 scan_w_setpesubsysversion_not_support=02104_W_SETPESUBSYSVERSION is not supported by the target OS
 % The \var{\{\$SETPESUBSYSVERSION\}} directive is not supported by the target OS.
 scan_n_changecputype=02105_N_Changed CPU type to be consistent with specified controller
+scan_e_emptymacroname=02106_E_A macro/compiler variable name cannot be empty
 % \end{description}
 #
 # Parser

+ 3 - 2
compiler/msgidx.inc

@@ -129,6 +129,7 @@ const
   scan_w_setpeosversion_not_support=02103;
   scan_w_setpesubsysversion_not_support=02104;
   scan_n_changecputype=02105;
+  scan_e_emptymacroname=02106;
   parser_e_syntax_error=03000;
   parser_e_dont_nest_interrupt=03004;
   parser_w_proc_directive_ignored=03005;
@@ -1133,9 +1134,9 @@ const
   option_info=11024;
   option_help_pages=11025;
 
-  MsgTxtSize = 86403;
+  MsgTxtSize = 86458;
 
   MsgIdxMax : array[1..20] of longint=(
-    28,106,360,130,99,63,145,36,223,68,
+    28,107,360,130,99,63,145,36,223,68,
     62,20,30,1,1,1,1,1,1,1
   );

File diff suppressed because it is too large
+ 549 - 554
compiler/msgtxt.inc


+ 5 - 0
compiler/scanner.pas

@@ -2256,6 +2256,11 @@ type
       begin
         current_scanner.skipspace;
         hs:=current_scanner.readid;
+        if hs='' then
+          begin
+            Message(scan_e_emptymacroname);
+            exit;
+          end;
         mac:=tmacro(search_macro(hs));
         if not assigned(mac) or (mac.owner <> current_module.localmacrosymtable) then
           begin

+ 5 - 0
tests/tbf/tb0272.pp

@@ -0,0 +1,5 @@
+{ %fail }
+{$define #test}
+
+begin
+end.

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