- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is there a compiler option to turn certain warnings into errors?
Guido
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In IVF 10.nn you have
/4{Y|N}d enable/disable default IMPLICIT NONE
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do you know if an option to turn certain warnings into error is considered for a future version of the compiler?
Regards,
Guido
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Guido,
As an interum measure you could write a script to scan the BuildLog for the warning messages and make it a post build process and/or Tool.
You could get fancy and make the application multiple projects, one being an empty main that calls the old main (program). Then make a verification project that scans the build log files and which builds a bogus subroutine.Structure it soverificatioin project will fail to build the bogus subroutine (deleting the old copy in the failure) and then the main will fail to link.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We have a lot of (legacy) source code in many files for several programs. We use make as a build system. I have written a small tool to scan the source files and list all the functions and subroutines that don't have "implicit none". I have added "implicit none" to all our source now and I hoped I could prevent people from forgetting to add "implicit none" to new functions.
In my opinion implicit typing might be a good thing for the lazy programmer but if you are not very careful it will lead to bugs.
I also plan on using the /gen-interfaces option in the future to prevent even more bugs :-)
Regards,
Guido
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Guido,
I too have been bitten by implicit many times over my 35 years of programming. Often it is due to a typographical error or ommission of inclusion of a header file or mod file.
I use TECO for making such global editing tasks.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you want to enforce IMPLICIT NONE for all compiles on your system, edit the file ifort.cfg, found in the compiler's BIN folder, and add:
/warn:declarations
If you just save the file in place, it will be used until you update the compiler. You can save a copy elsewhere and define the system environment variable IFORTCFG to have a value of the complete path to the configuration file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I already use /warn:declarations (from the makefile), the only thing is that it generates a warning and not an error (ivf 9.1).
Regards,
Guido
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Guido,
As a work around, add the compiler option /Qdiag-file:YourNameHere.diag
Then in your make file
grep explicit.type Debug*.diag>NoType.txt
This assumes you have GREP.
If NoType.txt is 0 bytes in size then no error. Using one ofthe script languages (AWK, PEARL, other, or roll your own) you can make a test of NoType.txt and if not 0 length your make file can delete the execuitable or perform other such action as you see fit (delete offending .obj file prior to link).
Jim
![](/skins/images/7B0AB6865064EAE32B30EC9A4E94B48A/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page