gnucobol
gnucobol copied to clipboard
Variable is not referenced in report (SVN ticket : #863)
Hi Simon, I'm using my second account for this pull request.
Reference svn ticket : #863.
I replaced printf by cb_warning_x but I think I have some problems of understanding.
If I understand, I have to remove two checks and this condition in codegen.c :
if((f->report_flag & COB_REPORT_LINE)
&& f->children
&& (f->children->report_flag & COB_REPORT_LINE)) {
printf("Warning: Ignoring nested LINE %s %d\n",
(f->report_flag & COB_REPORT_LINE_PLUS)?"PLUS":"",
f->report_line);
f->report_line = 0;
f->report_flag &= ~COB_REPORT_LINE_PLUS;
f->report_flag &= ~COB_REPORT_LINE;
}
I added a new function and I called it finalize_report :
static void
check_report (struct cb_report *r, cb_tree ctl)
{
if (!ctl) {
return ;
}
cb_tree nx = CB_CHAIN(ctl);
if (nx) {
check_report(r, nx);
}
int bfound = 0;
cb_tree x = CB_VALUE (ctl);
struct cb_field *s = cb_code_field(x);
if((s->report_flag & COB_REPORT_LINE)
&& s->children
&& (s->children->report_flag & COB_REPORT_LINE)) {
cb_warning_x (COBC_WARN_FILLER,
CB_TREE(s), _("Warning: Ignoring nested LINE %s %d"),
(s->report_flag & COB_REPORT_LINE_PLUS)?"PLUS":"",
s->report_line);
s->report_line = 0;
s->report_flag &= ~COB_REPORT_LINE_PLUS;
s->report_flag &= ~COB_REPORT_LINE;
}
for(int i = r->num_lines-1; i >= 0; i--) {
if(r->line_ids[i]->report_control) {
struct cb_field *c = cb_code_field (r->line_ids[i]->report_control);
if(c == s) {
bfound = 1;
break;
}
}
}
if (!bfound) {
cb_warning_x (COBC_WARN_FILLER,
CB_TREE(ctl), _("Control field %s is not referenced in report"),
s->name);
ctl = NULL;
}
}
But I don't pass some unit test. Please tell me if I haven´t understood what I had to do ?
Codecov Report
Merging #94 (bb2edcf) into gcos4gnucobol-3.x (6b44051) will increase coverage by
0.01%. The diff coverage is88.23%.
: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 #94 +/- ##
=====================================================
+ Coverage 65.39% 65.40% +0.01%
=====================================================
Files 32 32
Lines 58797 58808 +11
Branches 15492 15496 +4
=====================================================
+ Hits 38449 38463 +14
+ Misses 14362 14361 -1
+ Partials 5986 5984 -2
| Impacted Files | Coverage Δ | |
|---|---|---|
| cobc/codegen.c | 75.39% <88.23%> (+0.06%) |
:arrow_up: |
... and 1 file with indirect coverage changes
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more