After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 623296 - Fortran: double question marks can cause error
Fortran: double question marks can cause error
Status: RESOLVED OBSOLETE
Product: doxygen
Classification: Other
Component: general
1.7.2
Other Linux
: Normal normal
: ---
Assigned To: Dimitri van Heesch
Dimitri van Heesch
[moved_to_github]
Depends on:
Blocks:
 
 
Reported: 2010-07-01 14:58 UTC by Andy May
Modified: 2018-07-30 10:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fortran which results in error (85 bytes, text/plain)
2010-12-21 07:56 UTC, Andy May
Details
Doxyfile (67.62 KB, text/plain)
2010-12-21 07:58 UTC, Andy May
Details

Description Andy May 2010-07-01 14:58:40 UTC
Consider the following Fortran file:

      program test
      implicit none
      write(6,*) '?? some text ??'
      end

When running doxygen on this file the following is seen:

Parsing file /home/andy/bug/test.f...
********************************************************************
Error in file /home/andy/bug/test.f line: 6, state: 20
********************************************************************

This is seen with doxygen 1.7.1 using binary version from the website:

doxygen-1.7.1.linux.bin.tar.gz
Comment 1 Andy May 2010-10-12 08:27:53 UTC
The problem remains in 1.7.2
Comment 2 Daniel Franke 2010-12-21 01:01:14 UTC
I can not reproduce the problem with above test case with current svn (r749), nor with 1.7.2.

Please attach a fully self contained test (.f, Doxyfile) that reproduces your problem.
Comment 3 Andy May 2010-12-21 07:56:22 UTC
Created attachment 176810 [details]
Fortran which results in error

The attached Fortran (identical to the source posted originally), results in the following:

~/test> doxygen --version
1.7.2
~/test> doxygen
...
Preprocessing /home/andy/test/test.f...
Prepassing fixed form of /home/andy/test/test.f
Parsing file /home/andy/test/test.f...
********************************************************************
Error in file /home/andy/test/test.f line: 7, state: 20
********************************************************************
...

This was using:

http://ftp.stack.nl/pub/users/dimitri/doxygen-1.7.2.linux.bin.tar.gz

I also see the same problem at SVN r749, built on openSUSE 11.3 (x86_64) with packages from default repositories and ./configure && make
Comment 4 Andy May 2010-12-21 07:58:38 UTC
Created attachment 176812 [details]
Doxyfile

The attached Doxyfile was generated simply with 'doxygen -g', no modifications were made.
Comment 5 Daniel Franke 2010-12-21 15:03:54 UTC
Hmm, strangely now I can reproduce it. And you found a trigraph, i.e. "??'" is internally converted to "^", hence the string is never closed.

See also:
    http://en.wikipedia.org/wiki/Digraphs_and_trigraphs#C
Comment 6 Daniel Franke 2010-12-21 15:18:03 UTC
(In reply to comment #5)
> Hmm, strangely now I can reproduce it.

And now I found the reason why: your Doxyfile has preprocessing enabled, mine didn't.

The preprocessor unconditionally replaces trigraphs with their corresponding values. For the case shown, one could use double quotes '"' as a work around, or disable preprocessing of the sources.
Comment 7 Andy May 2010-12-21 16:55:47 UTC
Thanks, this is interesting, I had no idea about these trigraphs.

This code is Fortran77, and it is not preprocessed during compilation. However, our source tree contains C, C++ and Fortran files, so we want Doxygen preprocessing turned on for the C and C++ files. I naively assumed this would cause no problems with the Fortran since there are no preprocessing directives contained within.

Perhaps one could instead of simply having an 'ENABLE_PREPROCESSING' variable, also have a 'PREPROCESSING_PATTERNS' variable which could be along the same lines as 'FILE_PATTERNS'?

Anyway, I will simply modify our source code to remove the trigraph, and implement a check to avoid ever allowing them to creep into our Fortran code again. Please feel free to close the bug if you decide not to implement any enhancement based on this bug report.
Comment 8 Dimitri van Heesch 2010-12-21 18:24:00 UTC
Every parser built into doxygen already has the ability to indicate whether or not C-preprocessing is required (see ParserInterface::needsPreprocessing()).

For Fortran this currently returns TRUE. I don't know if there are situations where Fortran code should be preprocessed. But if not then simply returning FALSE would already fix the problem (and still allow C/C++ files to be preprocessed).

Daniel: can you have a look?
Comment 9 Daniel Franke 2010-12-21 18:38:44 UTC
(In reply to comment #8)
> I don't know if there are situations where Fortran code should be preprocessed.
> But if not then simply returning FALSE would already fix the problem (and still 
> allow C/C++ files to be preprocessed).

Preprocessing of Fortran sources is not standardized, but common.

There is no such thing as a Fortran preprocessor. However, there are many cases where simply a C/C++ preprocessor is used. E.g. GNU fortran uses cpp or libcpp in traditional mode; preprocessing is triggered by the case of extension on platform that support it, i.e. .f90 is not preprocessed, but .F90 is. Same for .f[or] and .F[OR]. And so on.

Hence, I'd suggest to leave the preprocessing stuff as is, but introduce an option ENABLE_TRIGRAPHS = YES|NO, default YES to match behavior of earlier versions, to enable/disable trigraph processing. This may come in handy for other languages as well. Btw, cpp of GCC ignores trigraphs by default and only enables them with a flag, see:

  http://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html#index-trigraphs-946
Comment 10 Andy May 2010-12-21 18:59:31 UTC
Yes, we use the distinction, .F and .F90 to be preprocessed, and .f and .f90 to not be preprocessed. All the (recent editions of) compilers I know about automatically do this based on file suffix.
Comment 11 Dimitri van Heesch 2010-12-21 19:09:10 UTC
Ok, then the ENABLE_TRIGRAPHS option is a good idea indeed.
Comment 12 André Klapper 2018-07-30 10:49:52 UTC
As discussed in https://github.com/doxygen/doxygen/pull/734 , Doxygen has moved its issue tracking to 

   https://github.com/doxygen/doxygen/issues

All Doxygen tickets in GNOME Bugzilla have been migrated to Github. You can subscribe and participate in the new ticket in Github. You can find the corresponding Github ticket by searching for its Bugzilla ID (number) in Github.

Hence I am closing this GNOME Bugzilla ticket.
Please use the corresponding ticket in Github instead. Thanks a lot!