From 5f9cf0c4b67d6e3b567a08a8d4a147788490f1b4 Mon Sep 17 00:00:00 2001 From: Fabrice Le Fessant Date: Fri, 15 Mar 2024 12:10:43 +0100 Subject: [PATCH] xxx --- cobc/cobc.c | 2 ++ cobc/error.c | 10 +++++----- cobc/pplex.l | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/cobc/cobc.c b/cobc/cobc.c index e7137c4e7..6fc48e7c6 100644 --- a/cobc/cobc.c +++ b/cobc/cobc.c @@ -9313,7 +9313,9 @@ process_file (struct filename *fn, int status) /* These lines should only be added with -MP */ if (cb_depend_add_phony){ for (l = cb_depend_list; l; l = l->next) { + char* filename = cobc_slashify (l->text); fprintf (file, "%s:\n", l->text); + cobc_free (filename); } } if (!cb_depend_file){ diff --git a/cobc/error.c b/cobc/error.c index f74b63dd3..447900f5a 100644 --- a/cobc/error.c +++ b/cobc/error.c @@ -63,11 +63,8 @@ size_t cb_msg_style; DECLNORET static void cobc_too_many_errors (void) COB_A_NORETURN; -/* Returns the argument with backslashes replaced by slashes -in filenames. Second argument explains whether the result should be -set in place or reallocated. - -Note that all Windows system calls accept slashes +/* Returns a copy of the argument with backslashes replaced by slashes +in filenames. Note that all Windows system calls accept slashes instead of backslashes. Only a few tools force the use of slashes, such as the cmd shell. */ char * @@ -92,6 +89,8 @@ print_error_prefix (const char *file, int line, const char *prefix) { if (file) { char *absfile = NULL ; + char *tmpfile = cobc_slashify (file); + file = tmpfile; if (cb_diagnostics_absolute_paths && strcmp (file, COB_DASH) != 0 && file[0] != '/' @@ -125,6 +124,7 @@ print_error_prefix (const char *file, int line, const char *prefix) fprintf (stderr, "%s:%d: ", file, line); } if (absfile) cobc_free (absfile); + cobc_free (tmpfile); } if (prefix) { fprintf (stderr, "%s", prefix); diff --git a/cobc/pplex.l b/cobc/pplex.l index 5e6b2fcf8..6daacfe45 100644 --- a/cobc/pplex.l +++ b/cobc/pplex.l @@ -1298,7 +1298,7 @@ ppopen_get_file (const char *name) ppin = fopen (name, "rb"); #endif if (!ppin) { - cb_error ("%s: %s", name, cb_get_strerror ()); + cb_error ("%s: %s", cobc_slashify (name), cb_get_strerror ()); /* Note: postpone error exit as we need the saved buffers later on */ return 0; }