Browse Source

* also check for targets not supporting -gc/checkpointer functionality in
compiler directives, not just on the command line (mantis #25862)

git-svn-id: trunk@27128 -

Jonas Maebe 11 năm trước cách đây
mục cha
commit
9420a5d7a7
8 tập tin đã thay đổi với 499 bổ sung482 xóa
  1. 1 0
      .gitattributes
  2. 3 1
      compiler/msg/errore.msg
  3. 3 2
      compiler/msgidx.inc
  4. 462 460
      compiler/msgtxt.inc
  5. 1 12
      compiler/options.pas
  6. 10 7
      compiler/scandir.pas
  7. 11 0
      compiler/systems.pas
  8. 8 0
      tests/webtbf/tw25862.pp

+ 1 - 0
.gitattributes

@@ -12682,6 +12682,7 @@ tests/webtbf/tw2562.pp svneol=native#text/plain
 tests/webtbf/tw25622.pp svneol=native#text/plain
 tests/webtbf/tw25622a.pp svneol=native#text/plain
 tests/webtbf/tw25788.pp svneol=native#text/pascal
+tests/webtbf/tw25862.pp svneol=native#text/plain
 tests/webtbf/tw2657.pp svneol=native#text/plain
 tests/webtbf/tw2670.pp svneol=native#text/plain
 tests/webtbf/tw2719.pp svneol=native#text/plain

+ 3 - 1
compiler/msg/errore.msg

@@ -136,7 +136,7 @@ general_f_oserror=01025_F_Operating system error: $1
 #
 # Scanner
 #
-# 02094 is the last used one
+# 02095 is the last used one
 #
 % \section{Scanner messages.}
 % This section lists the messages that the scanner emits. The scanner takes
@@ -394,6 +394,8 @@ scan_e_illegal_peflag=02093_E_Illegal argument for SETPEFLAGS
 scan_e_illegal_peoptflag=02094_E_Illegal argument for SETPEOPTFLAGS
 % The given argument for SETPEOPTFLAGS is neither a correct named value nor an
 % ordinal value
+scan_e_unsupported_switch=02095_E_Directive $1 is not supported on this target
+% Not all compiler directives are supported on all targets.
 % \end{description}
 #
 # Parser

+ 3 - 2
compiler/msgidx.inc

@@ -116,6 +116,7 @@ const
   scan_w_setpeoptflags_not_support=02092;
   scan_e_illegal_peflag=02093;
   scan_e_illegal_peoptflag=02094;
+  scan_e_unsupported_switch=02095;
   parser_e_syntax_error=03000;
   parser_e_dont_nest_interrupt=03004;
   parser_w_proc_directive_ignored=03005;
@@ -981,9 +982,9 @@ const
   option_info=11024;
   option_help_pages=11025;
 
-  MsgTxtSize = 70977;
+  MsgTxtSize = 71030;
 
   MsgIdxMax : array[1..20] of longint=(
-    26,95,336,121,88,56,126,27,202,64,
+    26,96,336,121,88,56,126,27,202,64,
     56,20,1,1,1,1,1,1,1,1
   );

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 462 - 460
compiler/msgtxt.inc


+ 1 - 12
compiler/options.pas

@@ -111,17 +111,6 @@ var
 ****************************************************************************}
 
 const
-  { pointer checking (requires special code in FPC_CHECKPOINTER,
-    and can never work for libc-based targets or any other program
-    linking to an external library)
-  }
-  supported_targets_gc = [system_i386_linux,system_powerpc_linux]
-                        + [system_i386_win32]
-                        + [system_i386_GO32V2]
-                        + [system_i386_os2]
-                        + [system_i386_beos,system_i386_haiku]
-                        + [system_powerpc_morphos];
-
   { gprof (requires implementation of g_profilecode in the code generator) }
   supported_targets_pg = [system_i386_linux,system_x86_64_linux,system_mipseb_linux,system_mipsel_linux]
                         + [system_i386_win32]
@@ -1306,7 +1295,7 @@ begin
                        begin
                          if UnsetBool(More, j, opt, false) then
                            exclude(init_settings.localswitches,cs_checkpointer)
-                         else if (target_info.system in supported_targets_gc) then
+                         else if (target_info.system in systems_support_checkpointer) then
                            include(init_settings.localswitches,cs_checkpointer)
                          else
                            UnsupportedPara('-gc');

+ 10 - 7
compiler/scandir.pas

@@ -110,13 +110,11 @@ unit scandir;
           recordpendinglocalswitch(sw,state);
       end;
 
-    procedure do_localswitchdefault(sw:tlocalswitch);
-      var
-        state : char;
+    function do_localswitchdefault(sw:tlocalswitch): char;
       begin
-        state:=current_scanner.readstatedefault;
-        if (sw<>cs_localnone) and (state in ['-','+','*']) then
-          recordpendinglocalswitch(sw,state);
+        result:=current_scanner.readstatedefault;
+        if (sw<>cs_localnone) and (result in ['-','+','*']) then
+          recordpendinglocalswitch(sw,result);
       end;
 
 
@@ -302,8 +300,13 @@ unit scandir;
 
 
     procedure dir_checkpointer;
+      var
+        switch: char;
       begin
-        do_localswitchdefault(cs_checkpointer);
+        switch:=do_localswitchdefault(cs_checkpointer);
+        if (switch='+') and
+           not(target_info.system in systems_support_checkpointer) then
+          Message1(scan_e_unsupported_switch,'CHECKPOINTER+');
       end;
 
 

+ 11 - 0
compiler/systems.pas

@@ -334,6 +334,17 @@ interface
          system_jvm_android32
        ];
 
+       { pointer checking (requires special code in FPC_CHECKPOINTER,
+         and can never work for libc-based targets or any other program
+         linking to an external library)
+       }
+       systems_support_checkpointer = [system_i386_linux,system_powerpc_linux]
+                             + [system_i386_win32]
+                             + [system_i386_GO32V2]
+                             + [system_i386_os2]
+                             + [system_i386_beos,system_i386_haiku]
+                             + [system_powerpc_morphos];
+
        cpu2str : array[TSystemCpu] of string[10] =
             ('','i386','m68k','alpha','powerpc','sparc','vm','ia64','x86_64',
              'mips','arm', 'powerpc64', 'avr', 'mipsel','jvm', 'i8086');

+ 8 - 0
tests/webtbf/tw25862.pp

@@ -0,0 +1,8 @@
+{ %skipcpu=i386,powerpc }
+{ %fail }
+
+{$MODE OBJFPC} {$CHECKPOINTER ON}
+program test;
+
+begin
+end.

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác