Author Topic: about compiler plugin for Fortran  (Read 8030 times)

Offline darmar

  • Multiple posting newcomer
  • *
  • Posts: 68
about compiler plugin for Fortran
« on: October 21, 2009, 05:24:19 pm »
Hello

I would like to add GNU Fortran compiler support in to C::B. I have looked a little bit into source code of C::B compiler plugin. It seems to me, to develop a separate plugin is much longer way, than to add additional one compiler to existing C::B compiler plugin.

I would like to ask the team of C::B if would be possible to add GNU Fortran compiler to existing compiler plugin?
I could try to contribute required code.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: about compiler plugin for Fortran
« Reply #1 on: October 21, 2009, 06:28:14 pm »
I would like to ask the team of C::B if would be possible to add GNU Fortran compiler to existing compiler plugin?
I could try to contribute required code.
Sure. Contribution in that direction are welcome (I have to work with Fortran77, too from time to time).

But I am using the GNU MinGW fortran compiler just fine with the current framework. Even recent versions from TDragon Media or alike. Everything works nice. What exactly is what you have in mind.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline darmar

  • Multiple posting newcomer
  • *
  • Posts: 68
Re: about compiler plugin for Fortran
« Reply #2 on: October 21, 2009, 09:10:02 pm »
I just thinking about click/jump to the line with error in source code, and the compiler settings dialog.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: about compiler plugin for Fortran
« Reply #3 on: October 21, 2009, 09:16:01 pm »
I just thinking about click/jump to the line with error in source code, and the compiler settings dialog.
You should be able to achieve that, too by modifying the already present GCC plugin's RegExes. This can be done either within the sources or even manually through the advanced compiler options in C::B. Notice that some of the present RegExes already work fine as the compiler messages are "similar enough" quite often.
However - a fortran-only compiler based somehwo on the GCC compiler might still be useful not to mix different aspects (languages).
All three options would still be of interest to me... I don't want to discourage you, I am just stating alternatives.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline darmar

  • Multiple posting newcomer
  • *
  • Posts: 68
Re: about compiler plugin for Fortran
« Reply #4 on: November 17, 2009, 06:21:34 pm »
I am trying to add GNU Fortran compiler to compiler plugin. I have two problems:
1) Most errors/warnings the Fortran compiler writes on 4 lines, like in example:
test.f90:69.21:
        integer  :: i
                     1
Warning: Unused variable 'i' declared at (1)

What is the best way to catch such messages?
My solution (may be not the best): I catch 1st line and mark it as 'cltInfo', and then I catch 4th line and mark it as 'cltWarning'(cltError if error). The drawback is that user get two messages on 'Build messages' window for each error/warning: one just with line number (and with possibility to jump to code line by clicking on it) and second message just with error/warning message (but without possibility to jump to code line). Example:
test.f90      69     test.f90
                     Warning: Unused variable 'i' declared

2) The second problem: when Fortran modules are used in user code, the compiler generate not only *.o file, but *.mod files too. When user hit Build->Clean, then *.o files are deleted but *.mod files are not.
How to delete *.mod files?
I haven't found solution for it, but may be, it is not so important because all project files are forced to be recompiled anyway.

Offline darmar

  • Multiple posting newcomer
  • *
  • Posts: 68
Re: about compiler plugin for Fortran
« Reply #5 on: November 26, 2009, 02:10:26 pm »
Here is a code supporting GNU Fortran compiler (file attached to this message). The compiler support has the shortcomings mentioned in above message, but else works fine.

Should I do something more to enable the inclusion of this compiler support  to CB trunk?

[attachment deleted by admin]