Initial @file - #289
Conversation
GitMensch
left a comment
There was a problem hiding this comment.
we'll need a force-push from a new local branch to not includes screen changes, it may or may not cherry-pick the current commit on that)
We then need test cases which also shows what the implementation wants to provide and then can have a look if the proposed changes work that way (= work on getting it there).
032019f to
0598be5
Compare
GitMensch
left a comment
There was a problem hiding this comment.
As seen in CI that currently leads to a SEGFAULT:
1197. run_extensions.at:1761: testing CALL unusual PROGRAM-ID. ...
../../tests/run_extensions.at:1815: $COMPILE_MODULE A@B.cob
/tmp/_actions-runner-working-dir/gnucobol/gnucobol/_build/tests/testsuite.dir/at-groups/1197/test-source: line 154: 75721 Segmentation fault (core dumped) ( $at_check_trace; $COMPILE_MODULE A@B.cob ) >> "$at_stdout" 2>> "$at_stderr" 5>&-
--- /dev/null 2026-04-27 01:59:42.626967408 +0000
+++ /tmp/_actions-runner-working-dir/gnucobol/gnucobol/_build/tests/testsuite.dir/at-groups/1197/stderr 2026-05-18 21:19:44.588745273 +0000
@@ -0,0 +1,5 @@
+
+attempt to reference invalid memory address (signal SIGSEGV)
+
+cobc: aborting
+cobc: Please report this!
../../tests/run_extensions.at:1815: exit code was 139, expected 0
1197. run_extensions.at:1761: FAILED (run_extensions.at:1815)
so there is still some stuff to do :-)
Most important: please always add Changelog entries as those document the changes you did - also helps for review - and getting the habit of always documenting at least on git push is a good thing; similar applies for the testsuite (would go into used_binaries.at)
| /* Test whether ARGV[optind] points to a non-option argument. */ | ||
| #define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') | ||
|
|
||
|
|
There was a problem hiding this comment.
revert this non-change for cleaner diff
| STOP RUN. | ||
| ]) | ||
|
|
||
| AT_CHECK([echo "-x" > tempfile.txt |
There was a problem hiding this comment.
just use AT_DATA for that
| @@ -500,11 +498,11 @@ process_at_file(const char* argument_values,int* compile_mode,int* atfile_size){ | |||
| return NULL; | |||
| } | |||
There was a problem hiding this comment.
the old code here was better, you just need to add an additional scope {} around that; note that I'd suggest to do the define here and use all upper-case with a name that is unlikely conflict with any system header
53ea68e to
8036fd2
Compare
dd0e41a to
9dbd453
Compare
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## gitside-gnucobol-3.x #289 +/- ##
=======================================================
Coverage ? 67.44%
=======================================================
Files ? 34
Lines ? 61615
Branches ? 16051
=======================================================
Hits ? 41555
Misses ? 14107
Partials ? 5953 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| Modified for use in GnuCOBOL by Roger While | ||
| */ | ||
|
|
||
| #include "libcob/common.h" |
There was a problem hiding this comment.
that change is unrelated and should be done - if at all - in a different commit (possibly added by clangd vscode extension - you can configure automated changes there)
There was a problem hiding this comment.
file should be reverted -> no change
| This file is part of the libiberty library. | ||
| Libiberty is free software; you can redistribute it and/or | ||
| modify it under the terms of the GNU Library General Public | ||
| License as published by the Free Software Foundation; either | ||
| version 2 of the License, or (at your option) any later version. | ||
|
|
||
| Libiberty is distributed in the hope that it will be useful, | ||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| Library General Public License for more details. | ||
|
|
||
| You should have received a copy of the GNU Library General Public | ||
| License along with libiberty; see the file COPYING.LIB. If | ||
| not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, | ||
| Boston, MA 02110-1301, USA. */ |
There was a problem hiding this comment.
have a look at cobgetopt.c how to adjust the header
|
|
||
| 2026-05-29 Ramy George <ramygeorge19@gmail.com> | ||
|
|
||
| * argv.c: extracted the argv.c file from GCC |
There was a problem hiding this comment.
- argv.c: new file, extracted from libiberty [GCC version NNN], [youradjustments]
- cobgetopt.h (cob_expandargv): added the expandargv function in header
- Makefile.am (SOURCES): include argv.c
| /* Create and destroy argument vectors. An argument vector is simply an | ||
| array of string pointers, terminated by a NULL pointer. */ | ||
|
|
||
| #include "cobc/cobc.h" |
There was a problem hiding this comment.
there should be no cobc in libcob (only the other way around)
| arguments to the option '\0'. This behavior is specific to the GNU | ||
| `getopt'. */ | ||
|
|
||
| COB_EXPIMP void cob_expandargv (int *argcp, char ***argvp); |
There was a problem hiding this comment.
we use unnamed parameters in our headers
There was a problem hiding this comment.
GCC says:
../../libcob/argv.c:361:1: warning: 'cob_expandargv' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
361 | cob_expandargv (int *argcp, char ***argvp)
| ^~~~~~~~~~~~~~
../../libcob/argv.c:512:1: warning: 'expandargstr' defined but not used [-Wunused-function]
512 | expandargstr (const char *progname, const char *val)
| ^~~~~~~~~~~~
../../libcob/argv.c:486:1: warning: 'countargv' defined but not used [-Wunused-function]
486 | countargv (char * const *argv)
| ^~~~~~~~~
../../libcob/argv.c:300:1: warning: 'writeargv' defined but not used [-Wunused-function]
300 | writeargv (char * const *argv, FILE *f)
| ^~~~~~~~~
There was a problem hiding this comment.
following cobgetopt I'd also suggest to rename the file
| AT_DATA([echo "-x @tempfile.txt" > tempfile.txt]) | ||
| AT_DATA([echo "-g --free" > otherfile.txt]) |
There was a problem hiding this comment.
see above how AT_DATA is intended to be used (can still be single line)
| AT_SETUP(recursive @file with conflict) | ||
| AT_KEYWORDS([cobc getopt]) | ||
|
|
||
|
|
There was a problem hiding this comment.
2 before AT_SETUP one after AT_KEYWORDS
| cb_config_text_column = 72; | ||
|
|
||
| /* Process command line arguments */ | ||
| cob_expandargv(&argc, &argv); |
There was a problem hiding this comment.
is it useful to also add that to bin/cobcrun?
Summary
This pull request is intended to introduce the "@file" command line option to GnuCOBOL.
Motivation
Such option would no longer limit the amount of options to that of a given OS's Terminal size.
Changes
process_at_fileinprocess_command_lineMisc
I Have left a few notes on current changes and hope for feedback