Tomas Hajny wrote 55 lines
On 15 Apr 07, at 21:14, Tom Verhoeff wrote:
> On Sat, Apr 14, 2007 at 06:56:12PM +0200, Jonas Maebe wrote:
> > On 13 Apr 2007, at 17:38, Tom Verhoeff wrote:
> >
> > >The order -Sa -Sg- fails to generate assertion checking code, whereas
> > >this is generated for the order -Sg- -Sa.
> > >
> > >A separate test confirms this (mis)behavior (see bug report: Steps To
> > >Reproduce).
> > >
> > >Or am I missing the obvious, and is this really a feature and not a
> > >bug?
> >
> > -S- disables all the -S options, regardless of where the second -
> > appears (like -O- disables all -O options). This can indeed be
> > confusing, since e.g. -Cor- turns on overflow checking, but disables
> > range checking. This is indeed not consistent. Both cases work as
> > designed, but the design is obviously not optimal.
>
> Thanks for the explanation. I think I understand what you are saying.
>
> In the (on-line) User's Guide, I can't find anything about the use of
> a trailing - for options. Where is this documented?
>
> How would one disable just the goto statement, without affecting other
> -S options?
>
> By the way, the User's Guide states that goto statements are disabled
> by default. However, the reason we added the -Sg- (attempting to disable
> just goto statements) was because after upgrading, suddenly programs
> with goto were accepted (and we don't want that in our educational use
> of Pascal). Hence, we added the option.
The default mode is -Mfpc nowadays. Modes FPC and
OBJFPC don't have goto enabled by default (i.e. -
Sg is required to enable it), so the docs are
correct (modes TP and Delphi both have -Sg
enabled for compatibility reasons).
> Could it be that the default configuration file also got changed by the
> update and now enables goto statements? (This would be confusing.)
This seems to be the case indeed (see
/fpcsrc/compiler/utils/samplecfg,
/fpcsrc/compiler/utils/fpc.cft,
/fpcsrc/compiler/utils/fpinc.cfg and
/fpcsrc/installer/install.dat). General question -
do we want to change this (taking into account
that having some default in the compiler and then
changing it into something different in the
default configuration file looks strange)?
If nothing else, you can obviously change this in
your own configuration files, of course.
So, it is now not possible to switch off goto statements in Delphi mode by just giving some command-line options. It requires an adapted configuration file, or knowing exactly what options are implicitly set for -Mdelphi, and copying those, except -Sg, on the command-line. Or do I overlook a simpler possbility?
My question about where -O-, -S-, and -Cx- are documented is still open... (I like to read manuals, but couldn't find anything.)
I have added a clarifying note to my original bug report (#0008686). The original bug report is thereby resolved, but there are still some related open ends:
* Documentation explaining -Sxxx-
* Defaults in standard config file(s) versus defaults for compiler (w/o config file)
* Simpler way to switch off single -S options
Thanks,
Tom
E-MAIL: T.Verhoeff @ TUE.NL | Dept. of Math. & Comp. Science
PHONE: +31 40 247 41 25 | Technische Universiteit Eindhoven
FAX: +31 40 247 54 04 | PO Box 513, NL-5600 MB Eindhoven
http://www.win.tue.nl/~wstomv/ | The Netherlands