Browse Source

* initmodeswitches is changed is you change the compiler mode from the
command line (the -S<x> switches didn't work anymore for changing the
compiler mode) (merged from fixes branch)

Jonas Maebe 25 years ago
parent
commit
fa38093530
3 changed files with 28 additions and 10 deletions
  1. 11 3
      compiler/globals.pas
  2. 10 5
      compiler/options.pas
  3. 7 2
      compiler/scandir.inc

+ 11 - 3
compiler/globals.pas

@@ -245,7 +245,7 @@ interface
     function  GetEnvPChar(const envname:string):pchar;
     function  GetEnvPChar(const envname:string):pchar;
     procedure FreeEnvPChar(p:pchar);
     procedure FreeEnvPChar(p:pchar);
 
 
-    Function SetCompileMode(const s:string):boolean;
+    Function SetCompileMode(const s:string; changeInit: boolean):boolean;
 
 
     procedure InitGlobals;
     procedure InitGlobals;
     procedure DoneGlobals;
     procedure DoneGlobals;
@@ -995,7 +995,7 @@ implementation
       {$endif}
       {$endif}
 
 
 
 
-    Function SetCompileMode(const s:string):boolean;
+    Function SetCompileMode(const s:string; changeInit: boolean):boolean;
       var
       var
         b : boolean;
         b : boolean;
       begin
       begin
@@ -1019,6 +1019,9 @@ implementation
           aktmodeswitches:=gpcmodeswitches
           aktmodeswitches:=gpcmodeswitches
         else
         else
          b:=false;
          b:=false;
+        
+        if b and changeInit then
+          initmodeswitches := aktmodeswitches;
 
 
         if b then
         if b then
          begin
          begin
@@ -1172,7 +1175,12 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.13  2000-09-24 21:33:46  peter
+  Revision 1.14  2000-09-26 10:50:41  jonas
+    * initmodeswitches is changed is you change the compiler mode from the
+      command line (the -S<x> switches didn't work anymore for changing the
+      compiler mode) (merged from fixes branch)
+
+  Revision 1.13  2000/09/24 21:33:46  peter
     * message updates merges
     * message updates merges
 
 
   Revision 1.12  2000/09/24 21:19:50  peter
   Revision 1.12  2000/09/24 21:19:50  peter

+ 10 - 5
compiler/options.pas

@@ -705,10 +705,10 @@ begin
               'S' : begin
               'S' : begin
                       for j:=1 to length(more) do
                       for j:=1 to length(more) do
                        case more[j] of
                        case more[j] of
-                        '2' : SetCompileMode('OBJFPC');
+                        '2' : SetCompileMode('OBJFPC',true);
                         'a' : initlocalswitches:=InitLocalswitches+[cs_do_assertion];
                         'a' : initlocalswitches:=InitLocalswitches+[cs_do_assertion];
                         'c' : initmoduleswitches:=initmoduleswitches+[cs_support_c_operators];
                         'c' : initmoduleswitches:=initmoduleswitches+[cs_support_c_operators];
-                        'd' : SetCompileMode('DELPHI');
+                        'd' : SetCompileMode('DELPHI',true);
                         'e' : begin
                         'e' : begin
                                 SetErrorFlags(more);
                                 SetErrorFlags(more);
                                 break;
                                 break;
@@ -717,8 +717,8 @@ begin
                         'h' : initlocalswitches:=initlocalswitches+[cs_ansistrings];
                         'h' : initlocalswitches:=initlocalswitches+[cs_ansistrings];
                         'i' : initmoduleswitches:=initmoduleswitches+[cs_support_inline];
                         'i' : initmoduleswitches:=initmoduleswitches+[cs_support_inline];
                         'm' : initmoduleswitches:=initmoduleswitches+[cs_support_macro];
                         'm' : initmoduleswitches:=initmoduleswitches+[cs_support_macro];
-                        'o' : SetCompileMode('TP');
-                        'p' : SetCompileMode('GPC');
+                        'o' : SetCompileMode('TP',true);
+                        'p' : SetCompileMode('GPC',true);
                         's' : initglobalswitches:=initglobalswitches+[cs_constructor_name];
                         's' : initglobalswitches:=initglobalswitches+[cs_constructor_name];
                         't' : initmoduleswitches:=initmoduleswitches+[cs_static_keyword];
                         't' : initmoduleswitches:=initmoduleswitches+[cs_static_keyword];
                         'v' : Message1(option_obsolete_switch,'-Sv');
                         'v' : Message1(option_obsolete_switch,'-Sv');
@@ -1490,7 +1490,12 @@ end;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.10  2000-09-24 21:33:47  peter
+  Revision 1.11  2000-09-26 10:50:41  jonas
+    * initmodeswitches is changed is you change the compiler mode from the
+      command line (the -S<x> switches didn't work anymore for changing the
+      compiler mode) (merged from fixes branch)
+
+  Revision 1.10  2000/09/24 21:33:47  peter
     * message updates merges
     * message updates merges
 
 
   Revision 1.9  2000/09/24 15:06:20  peter
   Revision 1.9  2000/09/24 15:06:20  peter

+ 7 - 2
compiler/scandir.inc

@@ -1002,7 +1002,7 @@ const
           begin
           begin
             current_scanner^.skipspace;
             current_scanner^.skipspace;
             current_scanner^.readstring;
             current_scanner^.readstring;
-            if not SetCompileMode(pattern) then
+            if not SetCompileMode(pattern,false) then
              Message1(scan_w_illegal_switch,pattern);
              Message1(scan_w_illegal_switch,pattern);
           end;
           end;
 
 
@@ -1436,7 +1436,12 @@ const
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.8  2000-09-24 21:33:47  peter
+  Revision 1.9  2000-09-26 10:50:41  jonas
+    * initmodeswitches is changed is you change the compiler mode from the
+      command line (the -S<x> switches didn't work anymore for changing the
+      compiler mode) (merged from fixes branch)
+
+  Revision 1.8  2000/09/24 21:33:47  peter
     * message updates merges
     * message updates merges
 
 
   Revision 1.7  2000/09/24 15:06:27  peter
   Revision 1.7  2000/09/24 15:06:27  peter