Selaa lähdekoodia

* synchronized -Wxxxxx handling in options.pas and help screen, resolves #19400
* limited -Wxxxxx options to the targets they apply to

git-svn-id: trunk@17664 -

florian 14 vuotta sitten
vanhempi
commit
ebc7a10954
5 muutettua tiedostoa jossa 172 lisäystä ja 89 poistoa
  1. 22 9
      compiler/msg/errore.msg
  2. 1 1
      compiler/msgidx.inc
  3. 39 26
      compiler/msgtxt.inc
  4. 91 41
      compiler/options.pas
  5. 19 12
      compiler/systems.pas

+ 22 - 9
compiler/msg/errore.msg

@@ -3288,19 +3288,27 @@ S*2Tlinux_Linux
 **2*_    with full path              v : Write fpcdebug.txt with
 **2*_                                    lots of debugging info
 **2*_m<x>,<y> : Don't show messages numbered <x> and <y>
-3*1W<x>_Target-specific options (targets)
-A*1W<x>_Target-specific options (targets)
-P*1W<x>_Target-specific options (targets)
-p*1W<x>_Target-specific options (targets)
+**1W<x>_Target-specific options (targets)
+3*2WA_Specify native type application (Windows)
+4*2WA_Specify native type application (Windows)
+A*2WA_Specify native type application (Windows)
 3*2Wb_Create a bundle instead of a library (Darwin)
 P*2Wb_Create a bundle instead of a library (Darwin)
 p*2Wb_Create a bundle instead of a library (Darwin)
-3*2WB_Create a relocatable image (Windows)
+A*2Wb_Create a bundle instead of a library (Darwin)
+4*2Wb_Create a bundle instead of a library (Darwin)
+3*2WB_Create a relocatable image (Windows, Symbian)
+3*2WBxxxx_Set image base to xxxx (Windows, Symbian)
+4*2WB_Create a relocatable image (Windows)
+4*2WBxxxx_Set image base to xxxx (Windows)
 A*2WB_Create a relocatable image (Windows, Symbian)
+A*2WBxxxx_Set image base to xxxx (Windows, Symbian)
 3*2WC_Specify console type application (EMX, OS/2, Windows)
+4*2WC_Specify console type application (EMX, OS/2, Windows)
 A*2WC_Specify console type application (Windows)
 P*2WC_Specify console type application (Classic Mac OS)
 3*2WD_Use DEFFILE to export functions of DLL or EXE (Windows)
+4*2WD_Use DEFFILE to export functions of DLL or EXE (Windows)
 A*2WD_Use DEFFILE to export functions of DLL or EXE (Windows)
 3*2We_Use external resources (Darwin)
 4*2We_Use external resources (Darwin)
@@ -3309,20 +3317,25 @@ P*2We_Use external resources (Darwin)
 p*2We_Use external resources (Darwin)
 3*2WF_Specify full-screen type application (EMX, OS/2)
 3*2WG_Specify graphic type application (EMX, OS/2, Windows)
+4*2WG_Specify graphic type application (EMX, OS/2, Windows)
 A*2WG_Specify graphic type application (Windows)
 P*2WG_Specify graphic type application (Classic Mac OS)
 3*2Wi_Use internal resources (Darwin)
+4*2Wi_Use internal resources (Darwin)
+A*2Wi_Use internal resources (Darwin)
 P*2Wi_Use internal resources (Darwin)
 p*2Wi_Use internal resources (Darwin)
+3*2WI_Turn on/off the usage of import sections (Windows)
+4*2WI_Turn on/off the usage of import sections (Windows)
+A*2WI_Turn on/off the usage of import sections (Windows)
 3*2WN_Do not generate relocation code, needed for debugging (Windows)
+4*2WN_Do not generate relocation code, needed for debugging (Windows)
 A*2WN_Do not generate relocation code, needed for debugging (Windows)
 3*2WR_Generate relocation code (Windows)
+4*2WR_Generate relocation code (Windows)
 A*2WR_Generate relocation code (Windows)
 P*2WT_Specify MPW tool type application (Classic Mac OS)
-3*2WX_Enable executable stack (Linux)
-A*2WX_Enable executable stack (Linux)
-p*2WX_Enable executable stack (Linux)
-P*2WX_Enable executable stack (Linux)
+**2WX_Enable executable stack (Linux)
 **1X_Executable options:
 **2Xc_Pass --shared/-dynamic to the linker (BeOS, Darwin, FreeBSD, Linux)
 **2Xd_Do not use standard library search path (needed for cross compile)

+ 1 - 1
compiler/msgidx.inc

@@ -894,7 +894,7 @@ const
   option_info=11024;
   option_help_pages=11025;
 
-  MsgTxtSize = 59501;
+  MsgTxtSize = 60248;
 
   MsgIdxMax : array[1..20] of longint=(
     24,89,311,103,84,54,111,23,202,63,

+ 39 - 26
compiler/msgtxt.inc

@@ -1,7 +1,7 @@
 {$ifdef Delphi}
-const msgtxt : array[0..000247] of string[240]=(
+const msgtxt : array[0..000251] of string[240]=(
 {$else Delphi}
-const msgtxt : array[0..000247,1..240] of char=(
+const msgtxt : array[0..000251,1..240] of char=(
 {$endif Delphi}
   '01000_T_Compiler: $1'#000+
   '01001_D_Compiler OS: $1'#000+
@@ -1329,66 +1329,79 @@ const msgtxt : array[0..000247,1..240] of char=(
   '**2*_    with full path              v',' : Write fpcdebug.txt with'#010+
   '**2*_                                    lots of debugging info'#010+
   '**2*_m<x>,<y> : Don'#039't show messages numbered <x> and <y>'#010+
-  '3*1W<x>_Target-specific options (targets)'#010+
-  'A*1W<x>_Target-specific options (targets)'#010+
-  'P*1W<x>_','Target-specific options (targets)'#010+
-  'p*1W<x>_Target-specific options (targets)'#010+
+  '**1W<x>_Target-specific options (targets)'#010+
+  '3*2WA_Specify native type application (Windows)'#010+
+  '4*','2WA_Specify native type application (Windows)'#010+
+  'A*2WA_Specify native type application (Windows)'#010+
   '3*2Wb_Create a bundle instead of a library (Darwin)'#010+
   'P*2Wb_Create a bundle instead of a library (Darwin)'#010+
-  'p*2Wb_Create a bundle instead of a library (Darwin)'#010+
-  '3*2WB_Cr','eate a relocatable image (Windows)'#010+
+  'p*2Wb_Create a bundle instead of a library',' (Darwin)'#010+
+  'A*2Wb_Create a bundle instead of a library (Darwin)'#010+
+  '4*2Wb_Create a bundle instead of a library (Darwin)'#010+
+  '3*2WB_Create a relocatable image (Windows, Symbian)'#010+
+  '3*2WBxxxx_Set image base to xxxx (Windows, Symbian)'#010+
+  '4*2WB_Create a relocat','able image (Windows)'#010+
+  '4*2WBxxxx_Set image base to xxxx (Windows)'#010+
   'A*2WB_Create a relocatable image (Windows, Symbian)'#010+
+  'A*2WBxxxx_Set image base to xxxx (Windows, Symbian)'#010+
   '3*2WC_Specify console type application (EMX, OS/2, Windows)'#010+
+  '4*2WC_Specif','y console type application (EMX, OS/2, Windows)'#010+
   'A*2WC_Specify console type application (Windows)'#010+
-  'P*2WC_Specify console type application (Clas','sic Mac OS)'#010+
+  'P*2WC_Specify console type application (Classic Mac OS)'#010+
   '3*2WD_Use DEFFILE to export functions of DLL or EXE (Windows)'#010+
+  '4*2WD_Use DEFFILE to expo','rt functions of DLL or EXE (Windows)'#010+
   'A*2WD_Use DEFFILE to export functions of DLL or EXE (Windows)'#010+
   '3*2We_Use external resources (Darwin)'#010+
   '4*2We_Use external resources (Darwin)'#010+
-  'A*2We_Use external resources',' (Darwin)'#010+
-  'P*2We_Use external resources (Darwin)'#010+
+  'A*2We_Use external resources (Darwin)'#010+
+  'P*2We_Use external resource','s (Darwin)'#010+
   'p*2We_Use external resources (Darwin)'#010+
   '3*2WF_Specify full-screen type application (EMX, OS/2)'#010+
   '3*2WG_Specify graphic type application (EMX, OS/2, Windows)'#010+
-  'A*2WG_Specify graphic type application ','(Windows)'#010+
+  '4*2WG_Specify graphic type application (EMX, OS/2, Windows)'#010+
+  'A*2WG_Specify gr','aphic type application (Windows)'#010+
   'P*2WG_Specify graphic type application (Classic Mac OS)'#010+
   '3*2Wi_Use internal resources (Darwin)'#010+
-  'P*2Wi_Use internal resources (Darwin)'#010+
+  '4*2Wi_Use internal resources (Darwin)'#010+
+  'A*2Wi_Use internal resources (Darwin)'#010+
+  'P*2Wi_Use internal resources (Darwin)',#010+
   'p*2Wi_Use internal resources (Darwin)'#010+
-  '3*2WN_Do not generate relocation code, needed for debugging ','(Windows'+
+  '3*2WI_Turn on/off the usage of import sections (Windows)'#010+
+  '4*2WI_Turn on/off the usage of import sections (Windows)'#010+
+  'A*2WI_Turn on/off the usage of import sections (Windows)'#010+
+  '3*2WN_Do not generate relocati','on code, needed for debugging (Windows'+
   ')'#010+
+  '4*2WN_Do not generate relocation code, needed for debugging (Windows)'#010+
   'A*2WN_Do not generate relocation code, needed for debugging (Windows)'#010+
   '3*2WR_Generate relocation code (Windows)'#010+
+  '4*2WR_Generate relo','cation code (Windows)'#010+
   'A*2WR_Generate relocation code (Windows)'#010+
   'P*2WT_Specify MPW tool type application (Classic Mac OS)'#010+
-  '3*2WX_Enable executab','le stack (Linux)'#010+
-  'A*2WX_Enable executable stack (Linux)'#010+
-  'p*2WX_Enable executable stack (Linux)'#010+
-  'P*2WX_Enable executable stack (Linux)'#010+
+  '**2WX_Enable executable stack (Linux)'#010+
   '**1X_Executable options:'#010+
-  '**2Xc_Pass --shared/-dynamic to the linker (BeOS, Darwin, FreeBSD, Lin'+
-  'ux)'#010+
-  '**2Xd_Do n','ot use standard library search path (needed for cross comp'+
-  'ile)'#010+
+  '**2Xc_Pass --shared/-dynamic to the linker (BeOS, Darwin,',' FreeBSD, L'+
+  'inux)'#010+
+  '**2Xd_Do not use standard library search path (needed for cross compil'+
+  'e)'#010+
   '**2Xe_Use external linker'#010+
   '**2Xg_Create debuginfo in a separate file and add a debuglink section '+
   'to executable'#010+
-  '**2XD_Try to link units dynamically      (defines FPC_LINK_DYNAMIC)',#010+
+  '**2XD_Try to link units dynamically     ',' (defines FPC_LINK_DYNAMIC)'#010+
   '**2Xi_Use internal linker'#010+
   '**2Xm_Generate link map'#010+
   '**2XM<x>_Set the name of the '#039'main'#039' program routine (default i'+
   's '#039'main'#039')'#010+
   '**2XP<x>_Prepend the binutils names with the prefix <x>'#010+
-  '**2Xr<x>_Set the linker'#039's rlink-path to <x> (needed for cross',' co'+
+  '**2Xr<x>_Set the linker'#039's rlink-pa','th to <x> (needed for cross co'+
   'mpile, see the ld manual for more information) (BeOS, Linux)'#010+
   '**2XR<x>_Prepend <x> to all linker search paths (BeOS, Darwin, FreeBSD'+
   ', Linux, Mac OS, Solaris)'#010+
   '**2Xs_Strip all symbols from executable'#010+
-  '**2XS_Try to link units statically (defa','ult, defines FPC_LINK_STATIC'+
+  '**2XS_Try to ','link units statically (default, defines FPC_LINK_STATIC'+
   ')'#010+
   '**2Xt_Link with static libraries (-static is passed to linker)'#010+
   '**2XX_Try to smartlink units             (defines FPC_LINK_SMART)'#010+
   '**1*_'#010+
   '**1?_Show this help'#010+
-  '**1h_Shows this help without waiting'
+  '**1h_Shows this help without',' waiting'
 );

+ 91 - 41
compiler/options.pas

@@ -1463,54 +1463,74 @@ begin
                   case More[j] of
                     'A':
                       begin
-                        if UnsetBool(More, j) then
-                          apptype:=app_native
+                        if target_info.system in systems_all_windows then
+                          begin
+                            if UnsetBool(More, j) then
+                              apptype:=app_cui
+                            else
+                              apptype:=app_native;
+                          end
                         else
-                          apptype:=app_cui;
+                          IllegalPara(opt);
                       end;
                     'b':
                       begin
-                        if (target_info.system in systems_darwin) then
+                        if target_info.system in systems_darwin then
                           begin
                             if not UnsetBool(More, j) then
-                              apptype:=app_bundle
-                            else
                               apptype:=app_cui
+                            else
+                              apptype:=app_bundle
                           end
                         else
                           IllegalPara(opt);
                       end;
                     'B':
                       begin
-                        {  -WB200000 means set trefered base address
-                          to $200000, but does not change relocsection boolean
-                          this way we can create both relocatble and
-                          non relocatable DLL at a specific base address PM }
-                        if (length(More)>j) then
+                        if target_info.system in systems_all_windows+systems_symbian then
                           begin
-                            val('$'+Copy(More,j+1,255),imagebase,code);
-                            if code<>0 then
-                              IllegalPara(opt);
-                            ImageBaseSetExplicity:=true;
+                            {  -WB200000 means set trefered base address
+                              to $200000, but does not change relocsection boolean
+                              this way we can create both relocatble and
+                              non relocatable DLL at a specific base address PM }
+                            if (length(More)>j) then
+                              begin
+                                val('$'+Copy(More,j+1,255),imagebase,code);
+                                if code<>0 then
+                                  IllegalPara(opt);
+                                ImageBaseSetExplicity:=true;
+                              end
+                            else
+                              begin
+                                RelocSection:=true;
+                                RelocSectionSetExplicitly:=true;
+                              end;
+                            break;
                           end
                         else
-                          begin
-                            RelocSection:=true;
-                            RelocSectionSetExplicitly:=true;
-                          end;
-                        break;
+                          IllegalPara(opt);
                       end;
                     'C':
                       begin
-                        if UnsetBool(More, j) then
-                          apptype:=app_gui
+                        if target_info.system in systems_all_windows+systems_os2+systems_macos then
+                          begin
+                            if UnsetBool(More, j) then
+                              apptype:=app_gui
+                            else
+                              apptype:=app_cui;
+                          end
                         else
-                          apptype:=app_cui;
+                          IllegalPara(opt);
                       end;
                     'D':
                       begin
-                        UseDeffileForExports:=not UnsetBool(More, j);
-                        UseDeffileForExportsSetExplicitly:=true;
+                        if target_info.system in systems_all_windows then
+                          begin
+                            UseDeffileForExports:=not UnsetBool(More, j);
+                            UseDeffileForExportsSetExplicitly:=true;
+                          end
+                        else
+                          IllegalPara(opt);
                       end;
                     'e':
                       begin
@@ -1525,22 +1545,37 @@ begin
                       end;
                     'F':
                       begin
-                        if UnsetBool(More, j) then
-                          apptype:=app_cui
+                        if target_info.system in systems_os2 then
+                          begin
+                            if UnsetBool(More, j) then
+                              apptype:=app_cui
+                            else
+                              apptype:=app_fs;
+                          end
                         else
-                          apptype:=app_fs;
+                          IllegalPara(opt);
                       end;
                     'G':
                       begin
-                        if UnsetBool(More, j) then
-                          apptype:=app_cui
+                        if target_info.system in systems_all_windows+systems_os2+systems_macos then
+                          begin
+                            if UnsetBool(More, j) then
+                              apptype:=app_cui
+                            else
+                              apptype:=app_gui;
+                          end
                         else
-                          apptype:=app_gui;
+                          IllegalPara(opt);
                       end;
                     'I':
                       begin
-                        GenerateImportSection:=not UnsetBool(More,j);
-                        GenerateImportSectionSetExplicitly:=true;
+                        if target_info.system in systems_all_windows then
+                          begin
+                            GenerateImportSection:=not UnsetBool(More,j);
+                            GenerateImportSectionSetExplicitly:=true;
+                          end
+                        else
+                          IllegalPara(opt);
                       end;
                     'i':
                       begin
@@ -1555,8 +1590,13 @@ begin
                       end;
                     'N':
                       begin
-                        RelocSection:=UnsetBool(More,j);
-                        RelocSectionSetExplicitly:=true;
+                        if target_info.system in systems_all_windows then
+                          begin
+                            RelocSection:=UnsetBool(More,j);
+                            RelocSectionSetExplicitly:=true;
+                          end
+                        else
+                          IllegalPara(opt);
                       end;
                     'p':
                       begin
@@ -1574,16 +1614,26 @@ begin
                       end;
                     'R':
                       begin
-                        { support -WR+ / -WR- as synonyms to -WR / -WN }
-                        RelocSection:=not UnsetBool(More,j);
-                        RelocSectionSetExplicitly:=true;
+                        if target_info.system in systems_all_windows then
+                          begin
+                            { support -WR+ / -WR- as synonyms to -WR / -WN }
+                            RelocSection:=not UnsetBool(More,j);
+                            RelocSectionSetExplicitly:=true;
+                          end
+                        else
+                          IllegalPara(opt);
                       end;
                     'T':
                       begin
-                        if UnsetBool(More, j) then
-                          apptype:=app_cui
+                        if target_info.system in systems_macos then
+                          begin
+                            if UnsetBool(More, j) then
+                              apptype:=app_cui
+                            else
+                              apptype:=app_tool;
+                          end
                         else
-                          apptype:=app_tool;
+                          IllegalPara(opt);
                       end;
                     'X':
                       begin

+ 19 - 12
compiler/systems.pas

@@ -408,6 +408,7 @@ interface
 
        { all real windows systems, no cripple ones like wince, wdosx et. al. }
        systems_windows = [system_i386_win32,system_x86_64_win64,system_ia64_win64];
+
        { all windows systems }
        systems_all_windows = [system_i386_win32,system_x86_64_win64,system_ia64_win64,
                              system_arm_wince,system_i386_wince];
@@ -421,12 +422,6 @@ interface
        systems_solaris = [system_sparc_solaris, system_i386_solaris,
 			  system_x86_64_solaris];
 
-       { systems supporting Objective-C }
-       systems_objc_supported = systems_darwin;
-
-       { systems using the non-fragile Objective-C ABI }
-       systems_objc_nfabi = [system_powerpc64_darwin,system_x86_64_darwin,system_arm_darwin,system_i386_iphonesim];
-
        { all embedded systems }
        systems_embedded = [system_i386_embedded,system_m68k_embedded,
                            system_alpha_embedded,system_powerpc_embedded,
@@ -435,6 +430,24 @@ interface
                            system_mips_embedded,system_arm_embedded,
                            system_powerpc64_embedded];
 
+       { all symbian systems }
+       systems_symbian = [system_i386_symbian,system_arm_symbian];
+
+       { all classic Mac OS targets }
+       systems_macos = [system_m68k_Mac,system_powerpc_Macos];
+
+       { all OS/2 targets }
+       systems_os2 = [system_i386_OS2,system_i386_emx];
+
+       { all native nt systems }
+       systems_nativent = [system_i386_nativent];
+
+       { systems supporting Objective-C }
+       systems_objc_supported = systems_darwin;
+
+       { systems using the non-fragile Objective-C ABI }
+       systems_objc_nfabi = [system_powerpc64_darwin,system_x86_64_darwin,system_arm_darwin,system_i386_iphonesim];
+
        { all systems supporting exports from programs or units }
        systems_unit_program_exports = [system_i386_win32,
                                          system_i386_wdosx,
@@ -451,12 +464,6 @@ interface
 
        systems_interrupt_table = [{system_arm_embedded}];
 
-       { all symbian systems }
-       systems_symbian = [system_i386_symbian,system_arm_symbian];
-
-       { all native nt systems }
-       systems_nativent = [system_i386_nativent];
-
        { all systems for which istack must be at a 16 byte boundary
          when calling a function }
        systems_need_16_byte_stack_alignment = [