[fpc-devel] FPC_HAS_FEATURE_SUPPORT

Michael Van Canneyt michael at freepascal.org
Wed Oct 22 09:05:27 CEST 2008



On Tue, 21 Oct 2008, Mattias Gaertner wrote:

> On Fri, 17 Oct 2008 19:03:43 +0200
> Mattias Gaertner <nc-gaertnma at netcologne.de> wrote:
> 
> > Can someone explain the new FPC system layout?
> > I find out so far:
> > 
> > In rtl/inc/systemh.inc there is
> > 
> > {$ifndef FPC_HAS_FEATURE_SUPPORT}
> > ...
> > {$define FPC_HAS_FEATURE_CLASSES}
> > ...
> > {$ENDIF}
> > 
> > Because FPC 2.3.1 defines FPC_HAS_FEATURE_SUPPORT the above is never
> > executed and therefore FPC_HAS_FEATURE_CLASSES is never defined. So
> > for example TObject is never defined.
> > 
> > What defines FPC_HAS_FEATURE_CLASSES and the other features?
> 
> Is this work in progress, vacation or was the question too complicated?

Florian is quite busy on his PhD. 

I had a look myself. 

As of version 2.3.1, the compiler by itself indicates all the various 
features it supports with FPC_HAS_FEATURE_XXX defines. Exactly which 
defines are defines depends on the compiler binary. For normal platforms, 
all features are enabled. 

To indicate the use of this system, it defines FPC_HAS_FEATURE_SUPPORT.

To be able to compile the RTL with version 2.2.0, The systemh.inc checks
for the presence of FPC_HAS_FEATURE_SUPPORT. If it is not defined then 
it assumes the version is below 2.3.0 and all the FPC_HAS_FEATURE_XXX 
confitionals are defined in the systemh.inc source.

To see the list of actual defines, you can do
ppc386 -vc test.pp
Macro defined: FPC_HAS_FEATURE_SUPPORT
Macro defined: CPU86
Macro defined: CPU87
Macro defined: CPU386
Macro defined: CPUI386
Macro defined: CPU32
Macro defined: FPC_HAS_TYPE_EXTENDED
Macro defined: FPC_HAS_TYPE_DOUBLE
Macro defined: FPC_HAS_TYPE_SINGLE
Macro defined: ENDIAN_LITTLE
Macro defined: FPC_LITTLE_ENDIAN
Macro defined: FPC_ABI_DEFAULT
Macro defined: CPUPENTIUM
Macro defined: FPUX87
Macro defined: FPC_LINK_STATIC
Macro FPC_VERSION set to 2
Macro FPC_RELEASE set to 3
Macro FPC_PATCH set to 1
Macro defined: FPC_HAS_FEATURE_HEAP
Macro defined: FPC_HAS_FEATURE_INITFINAL
Macro defined: FPC_HAS_FEATURE_RTTI
Macro defined: FPC_HAS_FEATURE_CLASSES
Macro defined: FPC_HAS_FEATURE_EXCEPTIONS
Macro defined: FPC_HAS_FEATURE_EXITCODE
Macro defined: FPC_HAS_FEATURE_ANSISTRINGS
Macro defined: FPC_HAS_FEATURE_WIDESTRINGS
Macro defined: FPC_HAS_FEATURE_TEXTIO
Macro defined: FPC_HAS_FEATURE_CONSOLEIO
Macro defined: FPC_HAS_FEATURE_FILEIO
Macro defined: FPC_HAS_FEATURE_RANDOM
Macro defined: FPC_HAS_FEATURE_VARIANTS
Macro defined: FPC_HAS_FEATURE_OBJECTS
Macro defined: FPC_HAS_FEATURE_DYNARRAYS
Macro defined: FPC_HAS_FEATURE_THREADING
Macro defined: FPC_HAS_FEATURE_COMMANDARGS
Macro defined: FPC_HAS_FEATURE_PROCESSES
Macro defined: FPC_HAS_FEATURE_STACKCHECK
Macro defined: FPC_HAS_FEATURE_DYNLIBS

For lazarus this means that it should either
- Not define FPC_HAS_FEATURE_SUPPORT
- Or define all FPC_HAS_FEATURE_XXX constants.
- Or maybe even check the compiler binary using the above method...

Michael.



More information about the fpc-devel mailing list