Browse Source

* only allow one "message" modifier per method declaration (mantis #14946)

git-svn-id: trunk@14001 -
Jonas Maebe 15 years ago
parent
commit
3e624d990d
6 changed files with 294 additions and 269 deletions
  1. 1 0
      .gitattributes
  2. 3 1
      compiler/msg/errore.msg
  3. 3 2
      compiler/msgidx.inc
  4. 268 266
      compiler/msgtxt.inc
  5. 2 0
      compiler/pdecsub.pas
  6. 17 0
      tests/webtbf/tw14946.pp

+ 1 - 0
.gitattributes

@@ -8752,6 +8752,7 @@ tests/webtbf/tw1483.pp svneol=native#text/plain
 tests/webtbf/tw14849.pp svneol=native#text/plain
 tests/webtbf/tw14929a.pp svneol=native#text/plain
 tests/webtbf/tw14929b.pp svneol=native#text/plain
+tests/webtbf/tw14946.pp svneol=native#text/plain
 tests/webtbf/tw1599.pp svneol=native#text/plain
 tests/webtbf/tw1599b.pp svneol=native#text/plain
 tests/webtbf/tw1633.pp svneol=native#text/plain

+ 3 - 1
compiler/msg/errore.msg

@@ -366,7 +366,7 @@ scan_w_multiple_main_name_overrides=02086_W_Overriding name of "main" procedure
 #
 # Parser
 #
-# 03257 is the last used one
+# 03258 is the last used one
 #
 % \section{Parser messages}
 % This section lists all parser messages. The parser takes care of the
@@ -1201,6 +1201,8 @@ parser_e_only_virtual_methods_final=03256_E_Only virtual methods can be final
 parser_e_final_can_no_be_overridden=03257_E_Final method can not be overridden: "$1"
 % You are trying to \var{override} a virtual method of a parent class that does
 % not exist.
+parser_e_multiple_messages=03258_E_Only one message can be used per method.
+% It is not possible to associate multiple messages with a single method.
 % \end{description}
 #
 # Type Checking

+ 3 - 2
compiler/msgidx.inc

@@ -345,6 +345,7 @@ const
   parser_e_sealed_class_cannot_have_abstract_methods=03255;
   parser_e_only_virtual_methods_final=03256;
   parser_e_final_can_no_be_overridden=03257;
+  parser_e_multiple_messages=03258;
   type_e_mismatch=04000;
   type_e_incompatible_types=04001;
   type_e_not_equal_types=04002;
@@ -800,9 +801,9 @@ const
   option_info=11024;
   option_help_pages=11025;
 
-  MsgTxtSize = 52086;
+  MsgTxtSize = 52135;
 
   MsgIdxMax : array[1..20] of longint=(
-    24,87,258,91,67,50,108,22,202,62,
+    24,87,259,91,67,50,108,22,202,62,
     48,20,1,1,1,1,1,1,1,1
   );

File diff suppressed because it is too large
+ 268 - 266
compiler/msgtxt.inc


+ 2 - 0
compiler/pdecsub.pas

@@ -1368,6 +1368,8 @@ begin
     internalerror(2003042613);
   if not is_class(tprocdef(pd)._class) then
     Message(parser_e_msg_only_for_classes);
+  if ([po_msgstr,po_msgint]*pd.procoptions)<>[] then
+    Message(parser_e_multiple_messages);
   { check parameter type }
   paracnt:=0;
   pd.parast.SymList.ForEachCall(@check_msg_para,@paracnt);

+ 17 - 0
tests/webtbf/tw14946.pp

@@ -0,0 +1,17 @@
+{ %fail }
+
+{$ifdef fpc}
+{$mode delphi}
+{$endif}
+
+type
+  ta = class
+     procedure MyProc(var Msg); message 1; message 'abc'; 
+  end;
+
+procedure ta.myproc;
+begin
+end;
+
+begin
+end.

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