Compiler options as string?

Basile Starynkevitch basile@starynkevitch.net
Sun Sep 26 14:05:00 GMT 2010


On Sat, 25 Sep 2010 14:31:31 +0200
Tobias Burnus <burnus@net-b.de> wrote:

>   I wonder what is the best way to obtain the compiler options as string 
> in a front end.
> 
> Thus, one needs to modify toplev to make them somehow available. Any 
> suggestions how this should be done?

I don't know if it is the best way of doing it, and I don't know if it
is portable enough to every system, but the naive way of doing that
probably could be to store the program arguments in yet another
globals, e.g.

  extern int toplevel_argc;
  extern char** toplevel_argv;
  int
  toplev_main (int argc, char **argv)
  {
    expandargv (&argc, &argv);
    toplevel_argc = argc;
    toplevel_argv = argv;
  ....

I do agree that this is perhaps not satisfactory. What I would dream of
is an object wrapping the entire GCC application process (e.g. like the
QApplication class of the QT toolkit). But that would require a big change.

Cheers.
-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***



More information about the Gcc-patches mailing list