~ubuntu-branches/ubuntu/feisty/fpc/feisty

« back to all changes in this revision

Viewing changes to compiler/switches.pas

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2007-01-27 20:08:50 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070127200850-9mrptaqqjsx9nwa7
Tags: 2.0.4-5
* Fixed Build-Depends.
* Add myself to Uploaders in debian/control.
* Make sure that the sources are really patched before building them.
* Build unit 'libc' on powerpc too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
{
2
 
    $Id: switches.pas,v 1.18 2005/02/14 17:13:07 peter Exp $
3
2
    Copyright (c) 1998-2002 by Peter Vreman
4
3
 
5
4
    This unit implements the parsing of the switches like $I-
40
39
****************************************************************************}
41
40
 
42
41
type
43
 
  TSwitchType=(ignoredsw,localsw,modulesw,globalsw,illegalsw,unsupportedsw);
 
42
  TSwitchType=(ignoredsw,localsw,modulesw,globalsw,illegalsw,unsupportedsw,alignsw);
44
43
  SwitchRec=record
45
44
    typesw : TSwitchType;
46
45
    setsw  : byte;
49
48
 
50
49
const
51
50
  turboSwitchTable: SwitchRecTable =(
52
 
   {A} (typesw:unsupportedsw; setsw:ord(cs_localnone)),
 
51
   {A} (typesw:alignsw; setsw:ord(cs_localnone)),
53
52
   {B} (typesw:localsw; setsw:ord(cs_full_boolean_eval)),
54
53
   {C} (typesw:localsw; setsw:ord(cs_do_assertion)),
55
54
   {D} (typesw:modulesw; setsw:ord(cs_debuginfo)),
60
59
   {I} (typesw:localsw; setsw:ord(cs_check_io)),
61
60
   {J} (typesw:localsw; setsw:ord(cs_typed_const_writable)),
62
61
   {K} (typesw:unsupportedsw; setsw:ord(cs_localnone)),
63
 
{$ifdef supportbrowser}
64
62
   {L} (typesw:modulesw; setsw:ord(cs_local_browser)),
65
 
{$else supportbrowser}
66
 
   {L} (typesw:modulesw; setsw:ord(cs_localnone)),
67
 
{$endif supportbrowser}
68
63
   {M} (typesw:localsw; setsw:ord(cs_generate_rtti)),
69
64
   {N} (typesw:unsupportedsw; setsw:ord(cs_localnone)),
70
65
   {O} (typesw:unsupportedsw; setsw:ord(cs_localnone)),
75
70
   {T} (typesw:localsw; setsw:ord(cs_typed_addresses)),
76
71
   {U} (typesw:illegalsw; setsw:ord(cs_localnone)),
77
72
   {V} (typesw:localsw; setsw:ord(cs_strict_var_strings)),
78
 
   {W} (typesw:unsupportedsw; setsw:ord(cs_localnone)),
 
73
   {W} (typesw:localsw; setsw:ord(cs_generate_stackframes)),
79
74
   {X} (typesw:modulesw; setsw:ord(cs_extsyntax)),
80
 
{$ifdef supportbrowser}
81
75
   {Y} (typesw:modulesw; setsw:ord(cs_browser)),
82
 
{$else supportbrowser}
83
 
   {Y} (typesw:modulesw; setsw:ord(cs_localnone)),
84
 
{$endif supportbrowser}
85
76
   {Z} (typesw:illegalsw; setsw:ord(cs_localnone))
86
77
    );
87
78
 
98
89
   {I} (typesw:localsw; setsw:ord(cs_check_io)),
99
90
   {J} (typesw:localsw; setsw:ord(cs_external_var)),
100
91
   {K} (typesw:unsupportedsw; setsw:ord(cs_localnone)),
101
 
{$ifdef supportbrowser}
102
92
   {L} (typesw:modulesw; setsw:ord(cs_local_browser)),
103
 
{$else supportbrowser}
104
 
   {L} (typesw:modulesw; setsw:ord(cs_localnone)),
105
 
{$endif supportbrowser}
106
93
   {M} (typesw:localsw; setsw:ord(cs_generate_rtti)),
107
94
   {N} (typesw:unsupportedsw; setsw:ord(cs_localnone)),
108
95
   {O} (typesw:unsupportedsw; setsw:ord(cs_localnone)),
113
100
   {T} (typesw:localsw; setsw:ord(cs_typed_addresses)),
114
101
   {U} (typesw:illegalsw; setsw:ord(cs_localnone)),
115
102
   {V} (typesw:localsw; setsw:ord(cs_strict_var_strings)),
116
 
   {W} (typesw:unsupportedsw; setsw:ord(cs_localnone)),
 
103
   {W} (typesw:localsw; setsw:ord(cs_generate_stackframes)),
117
104
   {X} (typesw:modulesw; setsw:ord(cs_extsyntax)),
118
 
{$ifdef supportbrowser}
119
105
   {Y} (typesw:modulesw; setsw:ord(cs_browser)),
120
 
{$else supportbrowser}
121
 
   {Y} (typesw:modulesw; setsw:ord(cs_localnone)),
122
 
{$endif supportbrowser}
123
106
   {Z} (typesw:localsw; setsw:ord(cs_externally_visible))
124
107
    );
125
108
 
147
130
   with switchTablePtr^[switch] do
148
131
   begin
149
132
     case typesw of
150
 
     ignoredsw : Message1(scan_n_ignored_switch,'$'+switch);
151
 
     illegalsw : Message1(scan_w_illegal_switch,'$'+switch);
152
 
 unsupportedsw : Message1(scan_w_unsupported_switch,'$'+switch);
153
 
       localsw : begin
154
 
                   if not localswitcheschanged then
155
 
                     nextaktlocalswitches:=aktlocalswitches;
156
 
                   if state='+' then
157
 
                    include(nextaktlocalswitches,tlocalswitch(setsw))
158
 
                   else
159
 
                    exclude(nextaktlocalswitches,tlocalswitch(setsw));
160
 
                   localswitcheschanged:=true;
161
 
                 end;
162
 
      modulesw : begin
163
 
                   if current_module.in_global then
164
 
                    begin
165
 
                      if state='+' then
166
 
                        include(aktmoduleswitches,tmoduleswitch(setsw))
167
 
                      else
168
 
                        begin
169
 
                          { Turning off debuginfo when lineinfo is requested
170
 
                            is not possible }
171
 
                          if not((cs_gdb_lineinfo in aktglobalswitches) and
172
 
                                 (tmoduleswitch(setsw)=cs_debuginfo)) then
173
 
                            exclude(aktmoduleswitches,tmoduleswitch(setsw));
174
 
                        end;
175
 
                    end
176
 
                   else
177
 
                    Message(scan_w_switch_is_global);
178
 
                 end;
179
 
      globalsw : begin
180
 
                   if current_module.in_global and (current_module=main_module) then
181
 
                    begin
182
 
                      if state='+' then
183
 
                       include(aktglobalswitches,tglobalswitch(setsw))
184
 
                      else
185
 
                       exclude(aktglobalswitches,tglobalswitch(setsw));
186
 
                    end
187
 
                   else
188
 
                    Message(scan_w_switch_is_global);
189
 
                 end;
 
133
       alignsw:
 
134
         if state='+' then
 
135
           aktpackrecords:=4
 
136
         else
 
137
           aktpackrecords:=1;
 
138
       ignoredsw :
 
139
         Message1(scan_n_ignored_switch,'$'+switch);
 
140
       illegalsw :
 
141
         Message1(scan_w_illegal_switch,'$'+switch);
 
142
       unsupportedsw :
 
143
         Message1(scan_w_unsupported_switch,'$'+switch);
 
144
       localsw :
 
145
         begin
 
146
           if not localswitcheschanged then
 
147
             nextaktlocalswitches:=aktlocalswitches;
 
148
           if state='+' then
 
149
            include(nextaktlocalswitches,tlocalswitch(setsw))
 
150
           else
 
151
            exclude(nextaktlocalswitches,tlocalswitch(setsw));
 
152
           localswitcheschanged:=true;
 
153
         end;
 
154
       modulesw :
 
155
         begin
 
156
           if current_module.in_global then
 
157
            begin
 
158
              if state='+' then
 
159
                include(aktmoduleswitches,tmoduleswitch(setsw))
 
160
              else
 
161
                begin
 
162
                  { Turning off debuginfo when lineinfo is requested
 
163
                    is not possible }
 
164
                  if not((cs_gdb_lineinfo in aktglobalswitches) and
 
165
                         (tmoduleswitch(setsw)=cs_debuginfo)) then
 
166
                    exclude(aktmoduleswitches,tmoduleswitch(setsw));
 
167
                end;
 
168
            end
 
169
           else
 
170
            Message(scan_w_switch_is_global);
 
171
         end;
 
172
       globalsw :
 
173
         begin
 
174
           if current_module.in_global and (current_module=main_module) then
 
175
            begin
 
176
              if state='+' then
 
177
               include(aktglobalswitches,tglobalswitch(setsw))
 
178
              else
 
179
               exclude(aktglobalswitches,tglobalswitch(setsw));
 
180
            end
 
181
           else
 
182
            Message(scan_w_switch_is_global);
 
183
         end;
190
184
      end;
191
185
   end;
192
186
end;
232
226
 
233
227
 
234
228
end.
235
 
{
236
 
  $Log: switches.pas,v $
237
 
  Revision 1.18  2005/02/14 17:13:07  peter
238
 
    * truncate log
239
 
 
240
 
  Revision 1.17  2005/01/04 18:39:06  olle
241
 
    * made macpas switches in sync with turbo switches
242
 
 
243
 
}