Re: [fpc-pascal] Compiler flag define or $IFOPT for optimizations

2022-06-03 Thread Benito van der Zander via fpc-pascal

Hi,
However, you can possibly solve it by always taking the options from 
an environment variable to the command line and then including 
contents of this command line to your sources. 


Unfortunately it is picking up all kinds of options from fpc.cfg and 
Lazarus.


Like in this case, I tried to disable range checking, and it is still 
enabled.



> You can introduce something like that yourself by always building all 
your sources from scratch, but then the solution outlined above should 
work for you.


I am setting up a build server that compiles the entire project from 
scratch on every commit.



Best,
Benito
On 28.05.22 14:34, Tomas Hajny via fpc-pascal wrote:

On 2022-05-28 13:44, Benito van der Zander via fpc-pascal wrote:


Hi,


I want to show how my program was compiled.

Now I have string like "FPC3.2.2 i386-Linux R+C+" from

  compiler := 'FPC' + {$INCLUDE %FPCVERSION%} + ' ' + {$INCLUDE
%FPCTargetCPU%}+'-'+{$INCLUDE %FPCTargetOS%}+ ' ' + {$IfOpt
R+}+'R+'{$endif} {$IfOpt S+}+'S+'{$endif} {$IfOpt O+}+'O+'{$endif}
{$IfOpt Q+}+'Q+'{$endif} {$IfOpt M+}+'M+'{$endif} {$IfOpt
C+}+'C+'{$endif};

But the optimization level (-O2 or -O1 ...) is missing.

Is there an IFOPT for that? Or a define with all the arguments


I don't think that there's such an option at the moment. However, you 
can possibly solve it by always taking the options from an environment 
variable to the command line and then including contents of this 
command line to your sources. I don't think that it makes much sense 
for the compiler to provide such an option, because unlike the 
compiler version, different options (including the optimization level) 
may be used for compilation of different units and there's no such a 
thing as a general optimization level valid for the complete compiled 
program from the compiler point of view. You can introduce something 
like that yourself by always building all your sources from scratch, 
but then the solution outlined above should work for you.


Tomas
___
fpc-pascal maillist  - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Compiler flag define or $IFOPT for optimizations

2022-06-03 Thread Tomas Hajny via fpc-pascal

On 2022-06-03 14:41, Benito van der Zander via fpc-pascal wrote:


Hi,


However, you can possibly solve it by always taking the options from
an environment variable to the command line and then including
contents of this command line to your sources.


Unfortunately it is picking up all kinds of options from fpc.cfg and
Lazarus.

Like in this case, I tried to disable range checking, and it is still
enabled.


You can disable using the configuration files using -n (that's what is 
being done during the FPC release process for release builds) and define 
all necessary / used options from the environment.




You can introduce something like that yourself by always building

all your sources from scratch, but then the solution outlined above
should work for you.

I am setting up a build server that compiles the entire project from
scratch on every commit.


As mentioned above, then the suggested approach should fit well, IMHO.

Tomas





On 28.05.22 14:34, Tomas Hajny via fpc-pascal wrote:


On 2022-05-28 13:44, Benito van der Zander via fpc-pascal wrote:

Hi,


I want to show how my program was compiled.

Now I have string like "FPC3.2.2 i386-Linux R+C+" from

compiler := 'FPC' + {$INCLUDE %FPCVERSION%} + ' ' + {$INCLUDE
%FPCTargetCPU%}+'-'+{$INCLUDE %FPCTargetOS%}+ ' ' + {$IfOpt
R+}+'R+'{$endif} {$IfOpt S+}+'S+'{$endif} {$IfOpt O+}+'O+'{$endif}

{$IfOpt Q+}+'Q+'{$endif} {$IfOpt M+}+'M+'{$endif} {$IfOpt
C+}+'C+'{$endif};

But the optimization level (-O2 or -O1 ...) is missing.

Is there an IFOPT for that? Or a define with all the arguments


I don't think that there's such an option at the moment. However,
you can possibly solve it by always taking the options from an
environment variable to the command line and then including contents
of this command line to your sources. I don't think that it makes
much sense for the compiler to provide such an option, because
unlike the compiler version, different options (including the
optimization level) may be used for compilation of different units
and there's no such a thing as a general optimization level valid
for the complete compiled program from the compiler point of view.
You can introduce something like that yourself by always building
all your sources from scratch, but then the solution outlined above
should work for you.

Tomas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal