Skip to content

Commit

Permalink
Change --include to require absolute paths
Browse files Browse the repository at this point in the history
  • Loading branch information
lefessan committed Oct 19, 2023
1 parent 52c386a commit 14f72d6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions cobc/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
* cobc.c, codegen.c: new option --include FILE, to #include
additional files in the C generated code. Such files can be
used to statically check the number of arguments in static
calls, for example. The files are put into quoted, unless
they start by '<'
calls, for example. The files are put into quotes, unless
they start by '<'. Since C files are compiled in a temp dir,
quoted files should be absolute paths.

2023-10-11 Fabrice Le Fessant <fabrice.le_fessant@ocamlpro.com>

Expand Down
1 change: 0 additions & 1 deletion cobc/cobc.c
Original file line number Diff line number Diff line change
Expand Up @@ -4459,7 +4459,6 @@ process_filename (const char *filename)
fn->translate = cobc_main_strdup (output_name);
} else
if (save_all_src || save_temps || save_c_src
|| cb_include_file_list
|| cb_compile_level == CB_LEVEL_TRANSLATE) {
fn->translate = cobc_main_stradd_dup (fbasename, ".c");
} else {
Expand Down
4 changes: 3 additions & 1 deletion doc/gnucobol.texi
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,9 @@ Include @file{copybook} at the beginning of the source code, as if
@item --include @var{file.h}
Add a @code{#include} @file{file.h} at the beginning of the generated
C source file. The file name is put into quotes, unless it starts by
@code{<}. The option also implies @option{-fno-gen-c-decl-static-call}.
@code{<}. Quoted files should be absolute paths, since C files are compiled
in temporary directories.
The option also implies @option{-fno-gen-c-decl-static-call}.
This option can be used to check function prototypes when
static calls are used. When this option is used, the source file is
compiled in the project directory (instead of the temp directory), and
Expand Down
4 changes: 2 additions & 2 deletions tests/testsuite.src/used_binaries.at
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ AT_DATA([prog.cob], [
AT_CHECK([$COBC -m -fstatic-call prog.cob], [0])

# We ignore the error output, as it depends on the C compiler in use
AT_CHECK([$COBC -m --include file.h -fstatic-call prog.cob], [1], [], [ignore])
AT_CHECK([$COBC -m --include "$PWD/file.h" -fstatic-call prog.cob], [1], [], [ignore])

AT_DATA([prog2.cob], [
IDENTIFICATION DIVISION.
Expand All @@ -1033,6 +1033,6 @@ AT_DATA([prog2.cob], [
CALL "f" USING "Hello" BY VALUE long RETURNING NOTHING.
])

AT_CHECK([$COBC -m --include file.h -fstatic-call prog2.cob], [0], [], [])
AT_CHECK([$COBC -m --include "$PWD/file.h" -fstatic-call prog2.cob], [0], [], [])

AT_CLEANUP

0 comments on commit 14f72d6

Please sign in to comment.