-
Notifications
You must be signed in to change notification settings - Fork 25
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
New option --copy COPYBOOK, to include a COPYBOOK #114
New option --copy COPYBOOK, to include a COPYBOOK #114
Conversation
Codecov Report
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. @@ Coverage Diff @@
## gcos4gnucobol-3.x #114 +/- ##
=====================================================
+ Coverage 65.74% 65.76% +0.02%
=====================================================
Files 32 32
Lines 59092 59133 +41
Branches 15575 15587 +12
=====================================================
+ Hits 38849 38890 +41
+ Misses 14262 14259 -3
- Partials 5981 5984 +3
... and 2 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I approve the idea and the general approach (that could be an issue if we don't discuss it up-front).
This needs some more checks and documentation, then would be fine.
Can you please also add --include
to actually include the specified header in every generated .c file after the default includes?
This would be the "command line" part of https://sourceforge.net/p/gnucobol/feature-requests/176/ and would work identical with all C compilers as backends - and is just so related to this PR...
e5f0129
to
49ec0d8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only minor changes in the argument handling needed, otherwise good for SVN.
cobc/cobc.c
Outdated
{ | ||
struct cb_text_list *l; | ||
for (l = cb_copy_list; l; l=l->next){ | ||
char *name = cobc_strdup(l->text); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to duplicate the l->text? Why not using it directly?
If needed, then please use a local char name[COB_MINI_BUFF]
here, this also removes the new failing under valgrind's memcheck when there is an error (because the err_exit leaves before we free the data).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason is that cb_copy_find_file()
expects a non-const first argument (it modifies /
into '\under Windows for example), while
cb_text_listcontains a
const char*` string.
I used the local array to remove the warning from valgrind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the explanation, adding a note that the buffer name point to is modified in its function doc is likely good (its enough to do before the commit to svn).
The change is good, was there also a reason (other than the late hour) to not use strcpy
?
As I've just recognized that: this could also serve for some people to gather compile options "the other way" using a file with directives, which are then included by this option. It would also provide a "similar" option to MicroFocus |
Hm, and another one - mostly a question @lefessan: how does this apply to |
It should probably be part of a document of recipes to migrate from MicroFocus to GnuCOBOL. Unfortunately, the localisation of errors would make it difficult to debug in case of problem, it would be better to call a directive entry point in the parser for each directives in a list, juste before including the copies. |
That would be interesting, especially if it handles the different directive variants. Something to keep in mind for later. |
Good point. I just checked: if the format is |
I agree, that's a reasonable approach, possibly also to suggest users to use format-independent COBOL in those |
9d017b1
to
52c386a
Compare
As these are new options: please add them to the NEWS. I suggest to do that here already to not forget it on the later commit. |
I just added the NEWS section. I am still not comfortable with using absolute paths with If we cannot make a relative path the default, I added a commit to add a |
14f72d6
to
993e3a4
Compare
Can you please explain where you see the problem with something like |
I didn't notice that For me, the behavior of For now, I only see scenarios where the option would only be used in development mode (so, with |
We do with |
What's the benefit of |
Yes, it does not leave intermediate files in the local dir. (FWIW, my latency is high since last week as I am in a two-week vacation with my kids... and I didn't have as much time as I expected to hack on my spare time :-) ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please adjust the Changelog to reference FR #176 (and close that as soon as the change is committed to svn).
Please drop COBC_BUILD_INPLACE
and replace as noted in the previous posts.
Afterwards this can go into svn (ideally after @ddeclerck's changes).
I am still not fond of using |
Isn't it enough to have In any case: #112 can be integrated upstream before. |
993e3a4
to
2f012f0
Compare
2f012f0
to
9987137
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ready to me. One more solved :-)
This option has two side-effect: * the C file is compiled in the project directory (so that the included file can be found locally) * no prototype is generated, so the new header file must contain a prototype for all statically called functions
1083820
to
82b9448
Compare
Merged. |
Thank you. I've just recognized that there's one missing part from FR # 176: Back in the discussions then the point was mot sources that call into C always need the same C header, and therefore a new directive was the goal. Can you or @engboris have a look at adding the |
reopen for the related missing part of the FR |
I'm currently working on it. What should happen if both the compiler option and the directive are defined? Should one be ignored? Both be considered?
EDIT : just noticed there are functions for that for the second paragraph of my answer |
You may also have multiple |
ping @engboris |
Hello @GitMensch Maybe there is a misunderstanding? I have a PR here #143 (which I believe is almost completed) and I was waiting for your feedback. Is there something you expected me to do that I didn't notice? |
Shall we close this one again, since it is now superseded by #143 ? |
Yes, it is fine to close that as only the directive is missing and this is what the related PR is about (not sure when I find the time to inspect the other current PRs though...). |
This option provides the same behavior as
--include FILE
forgcc
andclang
, i.e. including a file (or a group of files) before parsing the source.It can be used typically to include
REPLACE
statements.