Commit Graph

13 Commits

Author SHA1 Message Date
Brad King 88fb1980c3 Fortran: Restore support for parsing "end interface X"
Since commit 219a9b1e14 (Fortran: Fix suprious dependencies with
submodules, 2022-07-30, v3.25.0-rc1~327^2) we accidentally fail to
recognize `end interface X`, causing all subsequent modules to be seen
as an interface.

Fixes: #24203
2022-11-30 06:38:36 -05:00
Vitaly Mogulian 219a9b1e14 Fortran: Fix suprious dependencies with submodules
In commit 695f0d0d3a (cmFortranParser: Parse keywords as lexical tokens,
2016-09-05, v3.7.0-rc1~150^2) we created keyword-specific variants of
the original `USE WORD other EOSTMT` production, such as
`MODULE WORD other EOSTMT` and `INTERFACE WORD other EOSTMT`.  The same
pattern was used by more keyword-specific productions in commit b5ac8b8aa7
(Fortran: Add support for submodule syntax in dependency scanning,
2016-09-05, v3.7.0-rc1~73^2~1).

The postfix part (`other`) of several keyword-specific productions is
not needed to match Fortran syntax.  See the Fortran 2018 standard,
para.4.1.4/1 on p.28, para.14.2.1/2 on pp.293-294.  The postfix is
needed only for a case of operator 'use':

    use <module-name> [, only : <list-of-vars>]

The unnecessary postfix matching from the keyword-specific productions
such as module, submodule, and interface declarations can cause spurious
module dependencies to be detected, so remove it.

Extend the test suite with examples covering the previously-broken
cases.

Fixes: #18427
2022-08-09 09:11:30 -04:00
Brad King 2646d5dfcf LexerParser: Suppress clang -Wunused-but-set-variable warnings 2022-04-06 16:02:03 -04:00
Isuru Fernando fe3f846e1b Makefiles: Add support for building Fortran intrinsics
Fixes: #21463
2021-06-24 08:39:47 -04:00
Brad King fda060f030 LexerParser: Do not leak Fortran parser tokens discarded due to errors 2021-06-08 09:13:50 -04:00
Brad King aac80ec1ee LexerParser: Suppress gcc -Wfree-nonheap-object warnings in generated code 2021-02-05 06:48:44 -05:00
Christoph Grüninger 6f64300a01 LexerParser: Clean up includes following include-what-you-use 2021-01-25 12:06:28 -05:00
Christoph Grüninger c95442b9b1 LexerParser: Manual removing code from Bison is no longer needed
This was needed to avoid warnings while compiling the sources generated
by older versions of GNU Bison, but is not with GNU Bison 3.7.4.
2021-01-25 12:05:36 -05:00
Christoph Grüninger 5a8a61a798 LexerParser: Do not use GNU Bison's yacc mode, we use Bison extensions
Silence Bison warnings regarding use of Bison extensions.
2021-01-25 12:05:20 -05:00
Tiziano Müller 154b8d1a27 Fortran: ignore CPP line directives in line-continued USE stmts
Issue: #18188
2019-11-13 11:30:19 -05:00
Brad King 34257b0dd4 LexerParser: Suppress GCC -Wconversion warnings
GCC 8 warns about some of the conversions in bison-generated code.
Suppress the warnings.
2018-07-31 09:34:55 -04:00
Brad King 402735314e Fortran: Add support for submodule dependencies
Since commit v3.7.0-rc1~73^2~1 (Fortran: Add support for submodule
syntax in dependency scanning, 2016-09-05) we support parsing Fortran
sources that use submodule syntax, but it left addition of `.smod`
dependencies to future work.  Add it now.

The syntax

    submodule (module_name) submodule_name

means the current source requires `module_name.mod` and provides
`module_name@submodule_name.smod`.  The syntax

    submodule (module_name:submodule_name) nested_submodule_name

means the current source requires `module_name@submodule_name.smod`
provides `module_name@nested_submodule_name.smod`.

Fixes: #17017
2018-04-20 10:57:31 -04:00
Daniel Pfeifer 9bad0dfcce LexerParser: move to custom directory 2017-04-28 23:10:39 +02:00