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

Small fixes from profiling PR #126

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cobc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@

2023-11-29 Fabrice Le Fessant <[email protected]>

* cobc.c (cobc_clean_up): when save-temps specifies a directory,
do not move object files and preprocess files when they were
specified as an explicit target on the command line (-E, -c)

2023-07-26 Simon Sobisch <[email protected]>

* typeck.c (search_set_keys): improving SEARCH ALL syntax checks
Expand Down
6 changes: 4 additions & 2 deletions cobc/cobc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2180,7 +2180,8 @@ clean_up_intermediates (struct filename *fn, const int status)
if (fn->need_preprocess
&& (status
|| cb_compile_level > CB_LEVEL_PREPROCESS
|| (cb_compile_level == CB_LEVEL_PREPROCESS && save_temps))) {
|| (cb_compile_level == CB_LEVEL_PREPROCESS
&& save_temps && !save_temps_dir))) {
cobc_check_action (fn->preprocess);
}
/* CHECKME: we had reports of unexpected intermediate
Expand Down Expand Up @@ -2287,7 +2288,8 @@ cobc_clean_up (const int status)
if (fn->need_assemble
&& (status
|| cb_compile_level > CB_LEVEL_ASSEMBLE
|| (cb_compile_level == CB_LEVEL_ASSEMBLE && save_temps))) {
|| (cb_compile_level == CB_LEVEL_ASSEMBLE
&& save_temps && !save_temps_dir))) {
cobc_check_action (fn->object);
}
clean_up_intermediates (fn, status);
Expand Down
5 changes: 5 additions & 0 deletions libcob/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@

2023-11-29 Fabrice Le Fessant <[email protected]>

* common.c (cob_get_strerror), coblocal.h: export as utility function
* common.c (cob_expand_env_string): fix potention buffer overflow

2023-07-28 Simon Sobisch <[email protected]>

* screenio.c, common.c: replace use of NCURSES_MOUSE_VERSION by
Expand Down
1 change: 1 addition & 0 deletions libcob/coblocal.h
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@ COB_HIDDEN int cob_check_env_true (char*);
COB_HIDDEN int cob_check_env_false (char*);
COB_HIDDEN const char *cob_get_last_exception_name (void);
COB_HIDDEN void cob_parameter_check (const char *, const int);
COB_HIDDEN char* cob_get_strerror (void);

enum cob_case_modifier {
CCM_NONE,
Expand Down
9 changes: 5 additions & 4 deletions libcob/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ cob_get_source_line ()
}

/* reentrant version of strerror */
static char *
char *
cob_get_strerror (void)
{
size_t size;
Expand Down Expand Up @@ -7785,9 +7785,10 @@ cob_expand_env_string (char *strval)
}
}
if (penv != NULL) {
if ((strlen (penv) + j) > (envlen - 128)) {
env = cob_realloc (env, envlen, strlen (penv) + 256);
envlen = strlen (penv) + 256;
size_t copy_len = strlen (penv);
if (copy_len + j + 128 > envlen) {
env = cob_realloc (env, envlen, j + copy_len + 256);
envlen = j + copy_len + 256;
}
j += sprintf (&env[j], "%s", penv);
penv = NULL;
Expand Down
62 changes: 62 additions & 0 deletions tests/testsuite.src/used_binaries.at
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,68 @@ AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [OK], [])
AT_CLEANUP


AT_SETUP([save-temps in sub-directory])
AT_KEYWORDS([runmisc])

AT_DATA([prog.cob], [
IDENTIFICATION DIVISION.
PROGRAM-ID. prog.
PROCEDURE DIVISION.
DISPLAY "OK" NO ADVANCING
END-DISPLAY.
EXIT PROGRAM.
])

AT_CHECK([mkdir debug])

AT_CHECK([$COMPILE -save-temps=debug -o prog.exe prog.cob])
AT_CHECK([$COBCRUN_DIRECT ./prog.exe], [0], [OK])
AT_CHECK([test -f debug/prog.$COB_OBJECT_EXT])
AT_CHECK([test -f debug/prog.c])
AT_CHECK([test -f debug/prog.s], [1])
AT_CHECK([test -f debug/prog.i])
AT_CHECK([test -f debug/prog.c.h])
AT_CHECK([test -f debug/prog.c.l.h])

# Check with -c

AT_CHECK([test -f prog.$COB_OBJECT_EXT], [1])
AT_CHECK([$COMPILE -save-temps=debug -c prog.cob])
AT_CHECK([test -f prog.$COB_OBJECT_EXT])
AT_CHECK([$COMPILE -save-temps=debug -c -o program.$COB_OBJECT_EXT prog.cob])
AT_CHECK([test -f program.$COB_OBJECT_EXT])

# Check with -S

AT_CHECK([test -f prog.s], [1])
AT_CHECK([$COMPILE -save-temps=debug -S prog.cob])
AT_CHECK([test -f prog.s])
AT_CHECK([$COMPILE -save-temps=debug -S -o program.s prog.cob])
AT_CHECK([test -f program.s])

# Check with -C

AT_CHECK([test -f prog.c], [1])
AT_CHECK([$COMPILE -save-temps=debug -C prog.cob])
AT_CHECK([test -f prog.c])
AT_CHECK([test -f prog.c.h])
AT_CHECK([test -f prog.c.l.h])
AT_CHECK([$COMPILE -save-temps=debug -C -o program.c prog.cob])
AT_CHECK([test -f program.c])
AT_CHECK([test -f program.c.h])
AT_CHECK([test -f program.c.l.h])

# Check with -E

AT_CHECK([test -f prog.i], [1])
AT_CHECK([$COMPILE -save-temps=debug -E -o prog.i prog.cob])
AT_CHECK([test -f prog.i])
AT_CHECK([$COMPILE -save-temps=debug -E -o program.i prog.cob])
AT_CHECK([test -f program.i])

AT_CLEANUP


AT_SETUP([C Compiler optimizations])
AT_KEYWORDS([runmisc cobc optimization])

Expand Down
Loading