The GNU Modula-2 front end to GCC

FAQ

Why do you need to specify @code{--enable-languages=c,c++,gm2}?

GNU Modula-2 uses the C++ compiler to compile the underlying main function which consists of a try catch clause. The try clause calls each module in order and the catch clause calls the default exception handler. It needs the C compiler during the initial bootstrap.

Why use the C++ exception mechanism in GCC, rather than a bespoke Modula-2 mechanism?

The C++ mechanism is tried and tested, it also provides GNU Modula-2 with the ability to link with C++ modules and via swig it can raise Python exceptions.

Why not copy the C++ exception handing code into the Modula-2 runtime thus saving the necessity to build the C++ compiler?

The C++ compiler is needed to compile the underlying \f[C]main()\f[P] function.

there appear to be differing versions of the exception handling code (we are using v3) and it would be expensive to maintain the gm2 version and keep it in sync with the particular version of gcc which is being used.

it would also mean a duplication of code and this would be frowned upon when GNU Modula-2 is grafted into the main GCC tree.

there is talk about the gcc libbackend.a being reimplemented in C++ and therefore in future releases it will be necessary to build -lstdc++ anyway.