Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI for forward-porting GC3 patches to GC4 #147

Draft
wants to merge 10 commits into
base: gc4
Choose a base branch
from

Conversation

ddeclerck
Copy link
Contributor

Follow-up of #146.

@ddeclerck ddeclerck changed the title Dummy commit CI for forward-porting GC3 patches to GC4 May 29, 2024
@ddeclerck ddeclerck force-pushed the gc3_to_gc4 branch 3 times, most recently from 6900d8d to 1c95bd0 Compare May 30, 2024 21:21
@@ -96,12 +96,15 @@ autoreconf $AC_OPTS $MAINPATH > $msgs 2>&1; ret=$?
# Filter aminclude_static as those are only used _within_ another
# check so reporting as portability problem is only noise.
# This has the effect of redirecting some error messages to stdout.
# to be moved to the Makefile - currently only usable for bootstrap,
# but should be done on autogen, too
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A, that old TODO...

Copy link
Collaborator

@GitMensch GitMensch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to wrap the commits again. From what I've inspected we need one refactor for integrating 4.x logic (you've spotted that well) nicely.

libcob/fileio.c Outdated
snprintf (file_open_env, (size_t)COB_FILE_MAX, "%s%s", "IO_", s);
if ((file_open_io_env = cob_get_env (file_open_env, NULL)) == NULL) {
snprintf (file_open_env, (size_t)COB_FILE_MAX, "%s%s", "io_", s);
if (f != NULL) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When/why should f be null here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because some functions (open_cbl_file, cob_sys_delete_file, ...) were "improved" to perform file mapping in GC3 (rev 3944), by calling the cob_chk_file_mapping function, which does not take a cob_file argument in GC3 but does in GC4, and that function in turn calls cob_chk_file_env. Since these functions (open_cbl_file, cob_sys_delete_file, ...) do not use a cob_file object, I resorted to passing NULL and coping with that...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this okay for you @GitMensch ?

libcob/fileio.c Outdated Show resolved Hide resolved
@GitMensch
Copy link
Collaborator

oops, hope I haven't broken the gitignore in f36dcda - if not then we likely should apply that to the gcos3x branch as well.

@ddeclerck
Copy link
Contributor Author

ddeclerck commented May 31, 2024

I suggest to wrap the commits again. From what I've inspected we need one refactor for integrating 4.x logic (you've spotted that well) nicely.

Saw your message a bit late, added another commit in the meantime 😅

By wrapping up you mean, committing to SVN ? (after doing the requested modifications of course)

@GitMensch
Copy link
Collaborator

GitMensch commented Jun 1, 2024 via email

@ddeclerck
Copy link
Contributor Author

I tend to be overly "conservative". Indeed this piece of code is barely modified afterwards, so I'll do the refactoring.

@ddeclerck
Copy link
Contributor Author

Is this okay to merge (@GitMensch) ?

@GitMensch
Copy link
Collaborator

I'll try to review this (late) evening.

@GitMensch
Copy link
Collaborator

looks_absolute should use "src", not file_open_name directly (merge issue?)

"apply_file_paths" should get that via argument as well and have a function comment that it writes to the global buffer. Then add a Changelog "extracted from xyz and also used in abc" to finish that last commit.

We either have to remember for later that we need to add a testcase for the new use or (potentially easier) also include it in the last commit as well.

@ddeclerck
Copy link
Contributor Author

looks_absolute should use "src", not file_open_name directly (merge issue?)

This change is introduced in a later commit (3993).

"apply_file_paths" should get that via argument as well and have a function comment that it writes to the global buffer. Then add a Changelog "extracted from xyz and also used in abc" to finish that last commit.

Alright ; as for its output, should it write it through its argument or directly to file_open_name ?

We either have to remember for later that we need to add a testcase for the new use or (potentially easier) also include it in the last commit as well.

By "new use", de you mean the fact that we apply file paths to the complex case ?

@GitMensch
Copy link
Collaborator

By "new use", de you mean the fact that we apply file paths to the complex case ?

yes

This change is introduced in a later commit (3993).

good catch - then it is fine to leave as is; if you don't expect any big problem it would be nice to merge that in this bunch to commit that together, but a later bunch is fine as well

Alright ; as for its output, should it write it through its argument or directly to file_open_name ?

Depends on how other functions do it - it is best for now to mimic that (once the merge is completed we may revisit that part, but there are "some" commits left until we get there).

@ddeclerck
Copy link
Contributor Author

I made the necessary changes.

This change is introduced in a later commit (3993).

good catch - then it is fine to leave as is; if you don't expect any big problem it would be nice to merge that in this bunch to commit that together, but a later bunch is fine as well

I find it more convenient to merge consecutive commits. If that's okay for you I could add to the current batch the next eligible commits until 3993 (that would be 6 commits: 3973, 3979, 3988, 3989, 3992 and 3993).

@GitMensch
Copy link
Collaborator

That batch is good to go :-)

@ddeclerck
Copy link
Contributor Author

That batch is good to go :-)

Merged in SVN ;)

I see the next commits deal with translation files. Checking the history, it seems those files are usually just copied "as-is" from the GC3 branch to the trunk; is this correct ?

@GitMensch
Copy link
Collaborator

I see the next commits deal with translation files. Checking the history, it seems those files are usually just copied "as-is" from the GC3 branch to the trunk; is this correct ?

No, only new files are copied, the others left as-is; before a release I regenerate the files but the files are nearly completely maintained by the translation project.
So just record the merge, then copy over new files and svn add them, if there are any.

And of course

@ddeclerck
Copy link
Contributor Author

ddeclerck commented Jun 8, 2024

Alright.

And of course

Hope this unfinished sentence did not have any vital info 😅

@GitMensch
Copy link
Collaborator

I can't remember any important info missing there.

@codecov-commenter
Copy link

codecov-commenter commented Jun 8, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.

Please upload report for BASE (gc4@49792f4). Learn more about missing BASE report.

Files with missing lines Patch % Lines
cobc/codegen.c 88.88% 0 Missing and 1 partial ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@          Coverage Diff           @@
##             gc4     #147   +/-   ##
======================================
  Coverage       ?   65.39%           
======================================
  Files          ?       37           
  Lines          ?    67100           
  Branches       ?    18780           
======================================
  Hits           ?    43882           
  Misses         ?    16084           
  Partials       ?     7134           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ddeclerck
Copy link
Contributor Author

Quick question: I sometimes see alternative code for GC4 in #if 0 blocks; I guess I should implement those and drop the other branch, correct ?

I'm talking about those:

#if 0 /* TODO for 4.0: set the attributes from the field given outside on the stack */
		output ("cob_field *cob_fret, const int cob_pam");
#else
		output ("cob_field **cob_fret, const int cob_pam");
#endif

@GitMensch
Copy link
Collaborator

That's quite a bunch - any reason to not merge upstream?
Open issues you are aware of or special adjustments needed?

[we really need to get to commits that have someone else in the ChangeLogs...]

@ddeclerck
Copy link
Contributor Author

ddeclerck commented Jun 12, 2024

That's quite a bunch - any reason to not merge upstream? Open issues you are aware of or special adjustments needed?

No good reason. It may be many commits, but the first batch had way more lines (this one is only +1,162 −904).
Anyways, I'll merge upstream if that's okay with you.

[we really need to get to commits that have someone else in the ChangeLogs...]

I'm looking forward to reaching commit 4614 - our first contribution to GC3 ;)

@GitMensch
Copy link
Collaborator

Hm, seems 8:0:0 is the way to go (because 3.3 will be 7:0:3) if 3.2 was 6:0:2.
We could also arbitrarily increase the number to keep space for possible further additions to 3.x... In any case we don't need the age at other places so far, so no new extra define needed.

@GitMensch
Copy link
Collaborator

GitMensch commented Jan 8, 2025

And yes, merging the revision (early) that has the MacOS fix [= within this bunch] would be preferable in this bunch. Should likely have the revision number that broke it in its svn log message...

@ddeclerck
Copy link
Contributor Author

And yes, merging the revision (early) that has the MacOS fix [= within this bunch] would be preferable in this bunch. Should likely have the revision number that broke it in its svn log message...

Fixed by 5092.

Now this batch is ready for review.

@GitMensch
Copy link
Collaborator

I take it the commit will have correct svn-mergeinfo (without the merged, then reverted parts) and you'll merge the #210 commit from 3.x "clean" as soon as this is upstream, right?

@ddeclerck
Copy link
Contributor Author

I take it the commit will have correct svn-mergeinfo (without the merged, then reverted parts) and you'll merge the #210 commit from 3.x "clean" as soon as this is upstream, right?

Yeah, I updated the mergeinfo appropriately, and I'll indeed merge the 3.x commit for PR 210 as soon as it is upstreamed ;)

@GitMensch
Copy link
Collaborator

The MSVC checks have a bunch of new failures with this bunch - I guess you need to merge r5120 to fix that (but that creates conflicts later if 5105+5107+5119 are not merged before).
As an alternative you could manually do the necessary "update to current atlocal.in" as a minor adjustment (the changelog entry will get in with a later merge, then).

@ddeclerck
Copy link
Contributor Author

The MSVC checks have a bunch of new failures with this bunch - I guess you need to merge r5120 to fix that (but that creates conflicts later if 5105+5107+5119 are not merged before). As an alternative you could manually do the necessary "update to current atlocal.in" as a minor adjustment (the changelog entry will get in with a later merge, then).

Indeed. Well, just adding -fdiagnostics-plain-output seems sufficient for now.

@GitMensch
Copy link
Collaborator

LGTM 4 upstream

@ddeclerck ddeclerck reopened this Jan 10, 2025
@ddeclerck
Copy link
Contributor Author

I think that's enough for this batch.
Mostly straightforward and automatically merged.

I just have a question regarding the pack_to_bin tables in numeric.c and move.c: there are two versions of that table, guarded by an #if .... 3.x used the second version, while trunk already had a similar table, but equivalent to the first version. Which one should actually be used in trunk ? (testsuite is fine with either versions)

@GitMensch
Copy link
Collaborator

GitMensch commented Jan 10, 2025

Take the first version to be enabled by default (as you have), because that is what trunk had so far; the issue for 3.x was that this was a behavior change, which we did not want.

... reading the Changelog diff

  • numeric.c (cob_decimal_set_packed): backport pack_to_bin change while adjusting its translation table for invalid BCD "digits" to yield the same result as before

:-)

Possibly add am comment on the #if 1 about that as well.
Note: there would be also the possibility to just ignore the upper nibble - in this case A=2, B=3, ...

As this is worked on: how do the invalid packed fields convert to numeric for GCOS?
I think on IBM it will always abend (if not "numeric fixup" is enabled), on MF not sure - but I could test both of those.

Also, it would be nice to fix this in gcos-strict.conf, when working on those commits:

init-justify: yes # TODO: verify

@ddeclerck
Copy link
Contributor Author

Take the first version to be enabled by default (as you have), because that is what trunk had so far; the issue for 3.x was that this was a behavior change, which we did not want.

Alright.

... reading the Changelog diff

  • numeric.c (cob_decimal_set_packed): backport pack_to_bin change while adjusting its translation table for invalid BCD "digits" to yield the same result as before

:-)

Yeah, that was a trunk patch ported back to 3.x with adjustments :p

As this is worked on: how do the invalid packed fields convert to numeric for GCOS? I think on IBM it will always abend (if not "numeric fixup" is enabled), on MF not sure - but I could test both of those.

I'll check, but I think I remember this causes an "illegal decimal data" exception on GCOS.

@GitMensch
Copy link
Collaborator

LGTM, so can be merged upstream - we'd like to want to know about the invalid data and the init-justify in any case...

@ddeclerck
Copy link
Contributor Author

ddeclerck commented Jan 10, 2025

LGTM, so can be merged upstream - we'd like to want to know about the invalid data and the init-justify in any case...

So, I can confirm the ILLDEC exception on GCOS when trying to read invalid packed decimal data.

I also checked whether initial data complies with JUSTIFIED RIGHT, and in fact, it does not. So, I'll fix gcos-strict.conf in 3.x and add that commit to this batch, if that's okay with you.

@GitMensch
Copy link
Collaborator

So, I can confirm the ILLDEC exception on GCOS when trying to read invalid packed decimal data.

Just to do the same - would you please post your test code here - then I'll recheck with the other compilers.

@GitMensch
Copy link
Collaborator

bunch is good to check in

@ddeclerck
Copy link
Contributor Author

So, I can confirm the ILLDEC exception on GCOS when trying to read invalid packed decimal data.

Just to do the same - would you please post your test code here - then I'll recheck with the other compilers.

Here is it, but note that:

  • I'm using the GCOS's COMP-3 type, which is basically PACKED-DECIMAL without sign (don't know if there's such variant on IBM ?)
  • I'm assuming EBCDIC encoding
       IDENTIFICATION DIVISION.
       PROGRAM-ID. prog.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 SRC-NUMPACK   PIC 9(6) COMP-3.
       01 SRC-NUMPACK-X REDEFINES SRC-NUMPACK PIC X(3).
       01 DST-NUMDISP   PIC 9(6).

       PROCEDURE DIVISION.
       MAIN.

      * akr = 0x819299 in EBCDIC => valid PACKED-DECIMAL
           MOVE "akr" TO SRC-NUMPACK-X.

           DISPLAY "SRC-NUMPACK-X    : '" SRC-NUMPACK-X "'".
           DISPLAY "SRC-NUMPACK      : '" SRC-NUMPACK "'".
           MOVE SRC-NUMPACK TO DST-NUMDISP.
           DISPLAY "DST-NUMDISP      : '" DST-NUMDISP "'".

      * aks = 0x8192A2 in EBCDIC => invalid PACKED-DECIMAL
           MOVE "aks" TO SRC-NUMPACK-X.

           DISPLAY "SRC-NUMPACK-X    : '" SRC-NUMPACK-X "'".
           DISPLAY "SRC-NUMPACK      : '" SRC-NUMPACK "'".
           MOVE SRC-NUMPACK TO DST-NUMDISP.
           DISPLAY "DST-NUMDISP      : '" DST-NUMDISP "'".

           STOP RUN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants