[fpc-devel] "fpc -h" and "fpc -i"

Juha Manninen juha.manninen62 at gmail.com
Thu Nov 6 23:30:24 CET 2014

Lazarus has a GUI for all FPC options, parsed directly from "fpc -h"
and "fpc -i".
  Project Options -> Compiler Options -> Other -> All Options ...

It was temporarily broken with FPC trunk but works now.
I had to hard-code some things in the parser because "fpc -h" output
does not give enough data.

1. Selection lists say "see fpc -i for possible values" but there is
no mention in which section exactly the values are. I think I guessed
them right as nobody complained but the mapping is not always obvios.
Could it be
  "see fpc -i section 'ABI targets' for possible values"
  "see fpc -i section 'CPU instruction sets' for possible values"
It would make the parser robust for possible future changes.

2. Some list choices can have multiple selections, for example -Oo<x>,
and the GUI must use CheckBoxes.
Other list choices have one alternative selection, for example -Op<x>,
and the GUI uses a ComboBox.
This difference is not indicated in "fpc -h" output anyhow. A
consistent indication would make the parser more robust again.

Dmitry Boyarintsev had a plan to generate well formatted JSON with
"fpc -hj" or similar.
It would be parser friendly and would contain info about which option
should show in Lazarus GUI etc.
"fpc -h" output would be generated from the JSON data, thus it would
not require more maintenance.
Unfortunately this will not happen anytime soon, nobody is working on it.
Until then, small improvements in "fpc -h" output would be good.

One more issue are the options missing from "fpc -h".
Currently I only know that -gtt, -gttt, -gtttt etc. are not mentioned,
there is only -gt, yet the extra 't's are not duplicate options but
they change the meaning.
Long time ago there was a discussion about those missing options but
they may be added. Does anybody know?

I looked at FPC sources trying to find where the help strings are done.
I only found "msgtxt.inc" which apparently is generated, but where is
it generated?


More information about the fpc-devel mailing list