[RFC] Adding Python as a possible language and it's usage

Martin Liška mliska@suse.cz
Tue Jul 17 12:49:00 GMT 2018


Hi.

I've recently touched AWK option generate machinery and it's quite unpleasant
to make any adjustments. My question is simple: can we starting using a scripting
language like Python and replace usage of the AWK scripts? It's probably question
for Steering committee, but I would like to see feedback from community.

There are some bulletins why I would like to replace current AWK scripts:

1) gcc/optc-save-gen.awk is full of copy&pasted code, due to lack of flags type classes multiple
global variables are created (var_opt_char, var_opt_string, ...)

2) similar happens in gcc/opth-gen.awk

3) we do very many regex matches (mainly in gcc/opt-functions.awk), I believe
   we should come up with a structured option format that will make parsing and
   processing much simpler.

4) we can come up with new sanity checks of options:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81397

5) there are various targets that generate *.opt files, one example is ARM:
gcc/config/arm/parsecpu.awk

where transforms:
./gcc/config/arm/arm-cpus.in

I guess having a well-defined structured format for *.opt files will make
it easier to write generated opt files?

I'm attaching a prototype that can transform optionlist into options-save.c
that can be compiled and works.

I'm looking forward to a feedback.
Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc-options.py
Type: text/x-python
Size: 7622 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20180717/25bba3db/attachment.py>


More information about the Gcc mailing list