OCamlPro / gnucobol

A clone of the sourceforge GnuCOBOL compiler from COBOL to C.
https://get-superbol.com
GNU Lesser General Public License v3.0
16 stars 21 forks source link

fix code generation for INPUT/CLOSE with double arg #107

Closed lefessan closed 1 year ago

lefessan commented 1 year ago

The bug was that DECLARATIVES for both arguments were called when the operation failed for only one of them.

The reason was that the parser would generate OPEN or CLOSE statements that were one inside the other one, instead of a list of independant statements.

codecov-commenter commented 1 year ago

Codecov Report

Merging #107 (d1ea445) into gcos4gnucobol-3.x (2a101a4) will decrease coverage by 0.01%. The diff coverage is 86.95%.

:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@                  Coverage Diff                  @@
##           gcos4gnucobol-3.x     #107      +/-   ##
=====================================================
- Coverage              65.34%   65.34%   -0.01%     
=====================================================
  Files                     32       32              
  Lines                  58651    58665      +14     
  Branches               15447    15448       +1     
=====================================================
+ Hits                   38326    38335       +9     
- Misses                 14352    14357       +5     
  Partials                5973     5973              
Impacted Files Coverage Δ
cobc/cobc.c 72.40% <ø> (-0.01%) :arrow_down:
cobc/typeck.c 64.73% <ø> (ø)
cobc/parser.y 68.55% <86.95%> (+0.06%) :arrow_up:

... and 3 files with indirect coverage changes

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

lefessan commented 1 year ago

I have done the changes, except for enabling DECLARATIVES for DELETE FILE. I added the line (in typeck.c), and then commented it for later. The reason is that it breaks several tests in the testsuite (they expect DELETE FILE not to raise any error when the file is missing), and it's likely that it will break existing programs as well. One solution would be to add a config option for this specific feature, disabled by default.

GitMensch commented 1 year ago

Thank you.

Note that if DELETE FILE is not there, then there should be no error (instead a status 05 should be returned). It is reasonable to tackle that later.