View Issue Details

IDProjectCategoryView StatusLast Update
0038132FPCDocumentationpublic2020-11-27 09:33
ReporterKai Burghardt Assigned ToMichael Van Canneyt  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Platformx86_64OSGNU/Linux 
Product Version3.2.0 
Fixed in Version3.3.1 
Summary0038132: Reference Guide: `class var` is accepted in other modes too, but Ref suggests otherwise
Description§ 5.3 “Class or Static fields” suggests that `class var` only works in Delphi modes, yet the objFPC mode does also accept the given example program.
Steps To Reproduce1. remove `{$static on}`
2. use `{$mode objFPC}`
Additional Information{$static on} is redundant since 2.6.0:
https://wiki.freepascal.org/User_Changes_2.6.0#The_Static_modifier_is_now_always_enabled
TagsNo tags attached.
Fixed in Revision1785.
FPCOldBugId
FPCTarget3.2.2
Attached Files

Activities

Kai Burghardt

2020-11-25 13:27

reporter  

ref.tex.patch (929 bytes)   
--- ref.tex~	2020-11-25 12:15:28.409713583 +0000
+++ ref.tex	2020-11-25 12:27:00.814178509 +0000
@@ -3816,7 +3816,7 @@
 An object can contain class or static fields: these fields are global to the object type,
 and act like global variables, but are known only in the scope of the object.
 The difference between static and class variables is purely the mode in which they work:
-The \var{static} keyword will always work, the \var{class} keyword will need \var{\{\$MODE DELPHI\}}.
+The \var{static} keyword will always work, the \var{class} keyword will need \var{\{\$MODE DELPHI\}} or \var{\{\$MODE OBJFPC\}}.
 
 They can be referenced from within the objects methods, but can also be referenced from
 outside the object by providing the fully qualified name.
@@ -3824,7 +3824,6 @@
 For instance, the output of the following program:
 \begin{verbatim}
 {$mode delphi}
-{$static on}
 type
   cl=object
     l : longint; static;
ref.tex.patch (929 bytes)   
prog.tex.patch (747 bytes)   
--- prog.tex~	2020-11-25 12:25:37.789164345 +0000
+++ prog.tex	2020-11-25 12:27:00.814178509 +0000
@@ -1697,16 +1697,6 @@
 debugging. 
 \end{remark}
 
-\subsection{\var{\protect\$STATIC} : Allow use of \var{Static} keyword.}
-
-If you specify the \var{\{\$STATIC ON\}} directive, then \var{Static}
-methods are allowed for objects. \var{Static} objects methods do not require
-a \var{Self} variable. They are equivalent to \var{Class} methods for
-classes. By default, \var{Static} methods are not allowed. Class methods
-are always allowed. Note that also static fields can be defined.
-
-This directive is equivalent to the \var{-St} command line option.
-
 \subsection{\var{\protect\$STOP} : Generate fatal error message}
 
 The following code
prog.tex.patch (747 bytes)   

Kai Burghardt

2020-11-25 13:36

reporter   ~0127175

And, surprisingly, FPC 3.2.0 does not complain about -St given on the command line, but only about the “illegal directive” {$static}. I don’t know, maybe it’s just “compatibility” (… agaaaiiiin, yeesh).
fpc.1.patch (321 bytes)   
--- fpc.1~	2020-11-25 12:35:15.572217696 +0000
+++ fpc.1	2020-11-25 12:35:15.572217696 +0000
@@ -675,6 +675,7 @@
 .TP
 .BI \-St
 Allow the "static" keyword in objects.
+Since 2.6.0 always enabled. This flag is recognized for compatibility reasons only.
 .TP
 .BI \-Un
 Do not check the unit name. Normally, the unit name
fpc.1.patch (321 bytes)   
user.tex.patch (621 bytes)   
--- user.tex~	2020-11-25 12:35:15.572217696 +0000
+++ user.tex	2020-11-25 12:35:15.572217696 +0000
@@ -1608,6 +1608,7 @@
 \item [-Ss] \olabel{Ss} The name of constructors must be \var{init}, and the
 name of destructors should be \var{done}.
 \item [-St] \olabel{St} Allow the \var{static} keyword in objects.
+Since 2.6.0 always enabled. The flag is recognized for compatibility reasons only.
 \item[-Sv] Support vector processing (uses CPU vector extensions if available)
 \item [-Sx] Enable exception keywords (default in Delphi/Objfpc mode). This
 will mark all exception related keywords as keywords, also in \tp or
user.tex.patch (621 bytes)   

Sven Barth

2020-11-25 23:19

manager   ~0127193

For me FPC 3.2.0 prints: "Warning: You are using the obsolete switch -St"

Kai Burghardt

2020-11-27 05:14

reporter   ~0127203

You’re right. I missed that. I think the period for fading out this option gracefully, just emitting a warning, is long past. -Mgpc, -Sp, or -gd aren’t accepted anymore either.

Michael Van Canneyt

2020-11-27 09:33

administrator   ~0127205

Fixed, thanks for reporting this and the patches...

Issue History

Date Modified Username Field Change
2020-11-25 13:27 Kai Burghardt New Issue
2020-11-25 13:27 Kai Burghardt Status new => assigned
2020-11-25 13:27 Kai Burghardt Assigned To => Michael Van Canneyt
2020-11-25 13:27 Kai Burghardt File Added: ref.tex.patch
2020-11-25 13:27 Kai Burghardt File Added: prog.tex.patch
2020-11-25 13:36 Kai Burghardt Note Added: 0127175
2020-11-25 13:36 Kai Burghardt File Added: fpc.1.patch
2020-11-25 13:36 Kai Burghardt File Added: user.tex.patch
2020-11-25 23:19 Sven Barth Note Added: 0127193
2020-11-27 05:14 Kai Burghardt Note Added: 0127203
2020-11-27 09:33 Michael Van Canneyt Status assigned => resolved
2020-11-27 09:33 Michael Van Canneyt Resolution open => fixed
2020-11-27 09:33 Michael Van Canneyt Fixed in Version => 3.3.1
2020-11-27 09:33 Michael Van Canneyt FPCTarget => 3.2.2
2020-11-27 09:33 Michael Van Canneyt Note Added: 0127205
2020-11-27 09:33 Michael Van Canneyt Steps to Reproduce Updated View Revisions
2020-11-27 09:33 Michael Van Canneyt Additional Information Updated View Revisions
2020-11-27 09:33 Michael Van Canneyt Fixed in Revision => 1785.