Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/gnucobol-3.x' into gcos4gnucob…
Browse files Browse the repository at this point in the history
…ol-3.x
  • Loading branch information
ddeclerck committed May 16, 2024
2 parents 4907e0d + a497163 commit 21b5d51
Show file tree
Hide file tree
Showing 16 changed files with 302 additions and 259 deletions.
7 changes: 6 additions & 1 deletion build_windows/ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@

2024-05-15 Simon Sobisch <[email protected]>

* makedist.cmd: cater for new different library names
* version_cobc.rc, version_libcob.rc: updated date + rev

2024-05-14 David Declerck <[email protected]>

* general for libcob: add missing profiling.c
Expand Down Expand Up @@ -328,7 +333,7 @@
version_libcob.rc, version_cobcrun.rc provided by Simon)


Copyright 2014-2023 Free Software Foundation, Inc.
Copyright 2014-2024 Free Software Foundation, Inc.

Copying and distribution of this file, with or without modification, are
permitted provided the copyright notice and this notice are preserved.
13 changes: 6 additions & 7 deletions build_windows/makedist.cmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
:: Copyright (C) 2014-2023 Free Software Foundation, Inc.
:: Copyright (C) 2014-2024 Free Software Foundation, Inc.
:: Written by Simon Sobisch, Edward Hart
::
:: This file is part of GnuCOBOL.
Expand Down Expand Up @@ -347,13 +347,12 @@ if exist "%copy_from%\libvbisam.dll" (
echo No ISAM handler found.
)

:: Copy the intl libraries.
:: Copy the intl library.
call :copy_lib_if_exists "intl" %copy_to_bin% "libintl.dll"
call :copy_lib_if_exists "intl" %copy_to_bin% "libiconv.dll"

:: Copy the cJSON library.
call :copy_lib_if_exists "cJSON" %copy_to_bin% "cjson.dll"
call :copy_lib_if_exists "cJSON" %copy_to_bin% "json-c.dll"
call :copy_lib_if_exists "cJSON" %copy_to_bin% "*cjson.dll"
call :copy_lib_if_exists "JSON-c" %copy_to_bin% "*json-c.dll"

:: Copy the curses library.
call :copy_lib_if_exists "curses" %copy_to_bin% "pdcurses*.dll"
Expand All @@ -362,10 +361,10 @@ call :copy_lib_if_exists "curses" %copy_to_bin% "pdcurses*.dll"
call :copy_lib_if_exists "XML" %copy_to_bin% "libxml2.dll"
call :copy_lib_if_exists "zlib" %copy_to_bin% "zlib*.dll"
call :copy_lib_if_exists "charset" %copy_to_bin% "libcharset.dll"
call :copy_lib_if_exists "lzma" %copy_to_bin% "lzma*.dll"
call :copy_lib_if_exists "lzma" %copy_to_bin% "*lzma*.dll"

:: Copy the iconv library.
call :copy_lib_if_exists "libiconv.dll" %copy_to_bin% "iconv"
call :copy_lib_if_exists "iconv" %copy_to_bin% "libiconv.dll"

goto :eof

Expand Down
6 changes: 3 additions & 3 deletions build_windows/version_cobc.rc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "config.h"

#include "../libcob/version.h"
#define VCS_REF 5112
#define VCS_REF 5257

#define STRINGIZE_DETAIL_(v) #v
#define STRINGIZE(v) STRINGIZE_DETAIL_(v)
Expand Down Expand Up @@ -44,7 +44,7 @@ VS_VERSION_INFO VERSIONINFO
VALUE "FileDescription", PACKAGE_NAME " compiler, supporting most COBOL dialects with lots of extensions"
VALUE "FileVersion", STRINGIZE(__LIBCOB_VERSION)"."STRINGIZE(__LIBCOB_VERSION_MINOR)"."STRINGIZE(__LIBCOB_VERSION_PATCHLEVEL)"."STRINGIZE(VCS_REF)
VALUE "InternalName", "cobc"
VALUE "LegalCopyright", "Copyright (C) 2001-2023 Free Software Foundation, Inc."
VALUE "LegalCopyright", "Copyright (C) 2001-2024 Free Software Foundation, Inc."
VALUE "LegalTrademarks", "Compiler: GNU General Public License v3 - see COPYING,\x0ADocumentation: GNU Free Documentation License."
VALUE "OriginalFilename", "cobc.exe"
VALUE "ProductName", PACKAGE_NAME " compiler"
Expand All @@ -55,7 +55,7 @@ VS_VERSION_INFO VERSIONINFO
VALUE "SpecialBuild", ""

/* Non-Standard entries */
VALUE "Build", "July 2023"
VALUE "Build", "May 2024"
VALUE "Developer", "Keisuke Nishida, Roger While, Ron Norman, Simon Sobisch, Edward Hart and many others (see AUTHORS and THANKS)"
VALUE "Support", "https://www.gnu.org/software/gnucobol/"
VALUE "Users", "Unlimited."
Expand Down
6 changes: 3 additions & 3 deletions build_windows/version_libcob.rc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "config.h"

#include "../libcob/version.h"
#define VCS_REF 5059
#define VCS_REF 5257

#define STRINGIZE_DETAIL_(v) #v
#define STRINGIZE(v) STRINGIZE_DETAIL_(v)
Expand Down Expand Up @@ -44,7 +44,7 @@ VS_VERSION_INFO VERSIONINFO
VALUE "FileDescription", PACKAGE_NAME " runtime, supporting most COBOL dialects with lots of extensions"
VALUE "FileVersion", STRINGIZE(__LIBCOB_VERSION)"."STRINGIZE(__LIBCOB_VERSION_MINOR)"."STRINGIZE(__LIBCOB_VERSION_PATCHLEVEL)"."STRINGIZE(VCS_REF)
VALUE "InternalName", "libcob"
VALUE "LegalCopyright", "Copyright (C) 2001-2023 Free Software Foundation, Inc."
VALUE "LegalCopyright", "Copyright (C) 2001-2024 Free Software Foundation, Inc."
VALUE "LegalTrademarks", "Runtime: GNU Lesser General Public License v3 - see COPYING.LESSER,\x0ADocumentation: GNU Free Documentation License."
VALUE "OriginalFilename", "libcob.dll"
VALUE "ProductName", PACKAGE_NAME " runtime library"
Expand All @@ -55,7 +55,7 @@ VS_VERSION_INFO VERSIONINFO
VALUE "SpecialBuild", ""

/* Non-Standard entries */
VALUE "Build", "May 2023"
VALUE "Build", "May 2024"
VALUE "Developer", "Keisuke Nishida, Roger While, Ron Norman, Simon Sobisch, Edward Hart and many others (see AUTHORS and THANKS)"
VALUE "Support", "https://www.gnu.org/software/gnucobol/"
VALUE "Users", "Unlimited."
Expand Down
4 changes: 4 additions & 0 deletions cobc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

2024-05-15 Simon Sobisch <[email protected]>

* replace.c: fix compile warnings and formatting

2024-05-14 David Declerck <[email protected]>

* flag.def: fix macro usage for MSVC
Expand Down
92 changes: 49 additions & 43 deletions cobc/cobc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3006,18 +3006,15 @@ static int
process_command_line (const int argc, char **argv)
{
struct cb_define_struct *p;
size_t osize;
int c;
int idx;
int n;
int exit_option = 0;
int list_reserved = 0;
int list_registers = 0;
int list_intrinsics = 0;
int list_system_names = 0;
int list_exceptions = 0;
int list_system_routines = 0;
enum cob_exception_id i;
char ext[COB_MINI_BUFF];
char *conf_label; /* we want a dynamic address for error.c, not a static one */
char *conf_entry;
Expand Down Expand Up @@ -3197,7 +3194,7 @@ process_command_line (const int argc, char **argv)
/* output version information when running very verbose -vv */
/* pass verbose switch to invoked commands when running very very verbose -vvv */
if (cob_optarg) {
n = cobc_deciph_optarg (cob_optarg, 0);
const int n = cobc_deciph_optarg (cob_optarg, 0);
if (n == -1) {
cobc_err_exit (COBC_INV_PAR, "--verbose");
}
Expand Down Expand Up @@ -3289,12 +3286,12 @@ process_command_line (const int argc, char **argv)
cobc_wants_debug = 1;
break;

case CB_FLAG_GETOPT_DUMP: /* 8 */
case CB_FLAG_GETOPT_DUMP:
/* -fdump=<scope> : Add sections for dump code generation */
cobc_def_dump_opts (cob_optarg, 1);
break;

case CB_FLAG_GETOPT_NO_DUMP: /* 13 */
case CB_FLAG_GETOPT_NO_DUMP:
/* -fno-dump=<scope> : Suppress sections in dump code generation */
if (cob_optarg) {
cobc_def_dump_opts (cob_optarg, 0);
Expand Down Expand Up @@ -3329,6 +3326,7 @@ process_command_line (const int argc, char **argv)

/* debug: Turn on all exception conditions */
if (cobc_wants_debug) {
enum cob_exception_id i;
for (i = (enum cob_exception_id)1; i < COB_EC_MAX; ++i) {
CB_EXCEPTION_ENABLE (i) = 1;
}
Expand Down Expand Up @@ -3481,9 +3479,9 @@ process_command_line (const int argc, char **argv)
/* these options were processed in the first getopt-run */
break;

case 'o':
case 'o': {
/* -o : Output file */
osize = strlen (cob_optarg);
const size_t osize = strlen (cob_optarg);
if (osize > COB_SMALL_MAX) {
cobc_err_exit (_("invalid output file name"));
}
Expand All @@ -3495,6 +3493,7 @@ process_command_line (const int argc, char **argv)
/* Allocate buffer plus extension reserve */
output_name_buff = cobc_main_malloc (osize + 32U);
break;
}

case '0':
/* -O0 : disable optimizations (or at least minimize them) */
Expand Down Expand Up @@ -3778,27 +3777,29 @@ process_command_line (const int argc, char **argv)
CB_TEXT_LIST_ADD (cb_early_exit_list, cob_optarg);
break;

case CB_FLAG_GETOPT_STACK_SIZE: /* 1 */
case CB_FLAG_GETOPT_STACK_SIZE: {
/* -fstack-size=<xx> : Specify stack (perform) size */
n = cobc_deciph_optarg (cob_optarg, 0);
const int n = cobc_deciph_optarg (cob_optarg, 0);
if (n < 16 || n > 512) {
cobc_err_exit (COBC_INV_PAR, "-fstack-size");
}
cb_stack_size = n;
break;
}

#ifdef COBC_HAS_CUTOFF_FLAG /* CHECKME: to be removed in 4.0 */
case CB_FLAG_GETOPT_IF_CUTOFF: /* 2 */
case CB_FLAG_GETOPT_IF_CUTOFF: {
/* -fif-cutoff=<xx> : Specify IF cutoff level */
n = cobc_deciph_optarg (cob_optarg, 0);
const int n = cobc_deciph_optarg (cob_optarg, 0);
if (n < 1 || n > 512) {
cobc_err_exit (COBC_INV_PAR, "-fif-cutoff");
}
cb_if_cutoff = n;
break;
}
#endif

case CB_FLAG_GETOPT_SIGN: /* 3 */
case CB_FLAG_GETOPT_SIGN:
/* -fsign=<ASCII/EBCDIC> : Specify display sign */
if (!cb_strcasecmp (cob_optarg, "EBCDIC")) {
cb_ebcdic_sign = 1;
Expand All @@ -3809,25 +3810,25 @@ process_command_line (const int argc, char **argv)
}
break;

case CB_FLAG_GETOPT_EBCDIC_TABLE: /* 14 */
case CB_FLAG_GETOPT_EBCDIC_TABLE:
cb_ebcdic_table = cobc_main_strdup (cob_optarg);
break;

case CB_FLAG_GETOPT_DEFAULT_COLSEQ: /* 15 */
case CB_FLAG_GETOPT_DEFAULT_COLSEQ:
/* -fdefault-colseq=<ASCII/EBCDIC/NATIVE> */
if (cb_deciph_default_colseq_name (cob_optarg)) {
cobc_err_exit (COBC_INV_PAR, "-fdefault-colseq");
}
break;

case CB_FLAG_GETOPT_DEFAULT_FILE_COLSEQ: /* 16 */
case CB_FLAG_GETOPT_DEFAULT_FILE_COLSEQ:
/* -fdefault-file-colseq=<ASCII/EBCDIC/NATIVE> */
if (cb_deciph_default_file_colseq_name (cob_optarg)) {
cobc_err_exit (COBC_INV_PAR, "-fdefault-file-colseq");
}
break;

case CB_FLAG_GETOPT_FOLD_COPY: /* 4 */
case CB_FLAG_GETOPT_FOLD_COPY:
/* -ffold-copy=<UPPER/LOWER> : COPY fold case */
if (!cb_strcasecmp (cob_optarg, "UPPER")) {
cb_fold_copy = COB_FOLD_UPPER;
Expand All @@ -3838,7 +3839,7 @@ process_command_line (const int argc, char **argv)
}
break;

case CB_FLAG_GETOPT_FOLD_CALL: /* 5 */
case CB_FLAG_GETOPT_FOLD_CALL:
/* -ffold-call=<UPPER/LOWER> : CALL/PROG-ID fold case */
if (!cb_strcasecmp (cob_optarg, "UPPER")) {
cb_fold_call = COB_FOLD_UPPER;
Expand All @@ -3849,81 +3850,81 @@ process_command_line (const int argc, char **argv)
}
break;

case CB_FLAG_GETOPT_TTITLE: /* 6 */
case CB_FLAG_GETOPT_TTITLE: {
/* -fttitle=<title> : Title for listing */
{
const size_t len = strlen (cob_optarg);
size_t i;
if (cb_listing_with_title)
cobc_main_free (cb_listing_with_title);
cb_listing_with_title = cobc_main_strdup (cob_optarg);
for (i = 0; i < len; i++) {
if (cb_listing_with_title[i] == '_')
cb_listing_with_title[i] = ' ';
}
const size_t len = strlen (cob_optarg);
size_t i;
if (cb_listing_with_title)
cobc_main_free (cb_listing_with_title);
cb_listing_with_title = cobc_main_strdup (cob_optarg);
for (i = 0; i < len; i++) {
if (cb_listing_with_title[i] == '_')
cb_listing_with_title[i] = ' ';
}
break;
}

case CB_FLAG_GETOPT_MAX_ERRORS: /* 7 */
case CB_FLAG_GETOPT_MAX_ERRORS: {
/* -fmax-errors=<xx> : Maximum errors until abort */
n = cobc_deciph_optarg (cob_optarg, 0);
const int n = cobc_deciph_optarg (cob_optarg, 0);
if (n < 0) {
cobc_err_exit (COBC_INV_PAR, "-fmax-errors");
}
cb_max_errors = n;
break;
}

case CB_FLAG_GETOPT_DUMP: /* 8 */
case CB_FLAG_GETOPT_DUMP:
/* -fdump=<scope> : Add sections for dump code generation */
case CB_FLAG_GETOPT_NO_DUMP: /* 13 */
case CB_FLAG_GETOPT_NO_DUMP:
/* -fno-dump=<scope> : Suppress sections in dump code generation */
/* These options were all processed in the first getopt-run */
break;

case CB_FLAG_GETOPT_CALLFH: /* 9 */
case CB_FLAG_GETOPT_CALLFH:
/* -fcallfh=<func> : Function-name for EXTFH */
cb_call_extfh = cobc_main_strdup (cob_optarg);
break;

case CB_FLAG_GETOPT_INTRINSICS: /* 10 */
case CB_FLAG_GETOPT_INTRINSICS:
/* -fintrinsics=<xx> : Intrinsic name or ALL */
cobc_deciph_funcs (cob_optarg);
break;

case CB_FLAG_GETOPT_EC: /* 11 */
case CB_FLAG_GETOPT_EC:
/* -fec=<xx> : COBOL exception-name, e.g. EC-BOUND-OVERFLOW,
also allows to skip the prefix e.g. BOUND-OVERFLOW */
if (cobc_deciph_ec (cob_optarg, 1U)) {
cobc_err_exit (COBC_INV_PAR, "-fec");
}
break;

case CB_FLAG_GETOPT_NO_EC: /* 12 */
case CB_FLAG_GETOPT_NO_EC:
/* -fno-ec=<xx> : COBOL exception-name, e.g. EC-BOUND-OVERFLOW */
if (cobc_deciph_ec (cob_optarg, 0)) {
cobc_err_exit (COBC_INV_PAR, "-fno-ec");
}
break;

case CB_FLAG_GETOPT_MEMORY_CHECK: /* 17 */
/* -fmemory-check=<scope> : */
case CB_FLAG_GETOPT_MEMORY_CHECK:
/* -fmemory-check=<scope> : extra memcmp for memory-guard */
if (!cob_optarg) {
cb_flag_memory_check = CB_MEMCHK_ALL;
} else if (cobc_deciph_memory_check (cob_optarg)) {
cobc_err_exit (COBC_INV_PAR, "-fmemory-check");
}
break;

case CB_FLAG_GETOPT_COPY_FILE: /* 18 */
case CB_FLAG_GETOPT_COPY_FILE:
/* --copy=<file> : COPY file at beginning */
if (strlen (cob_optarg) > (COB_MINI_MAX)) {
cobc_err_exit (COBC_INV_PAR, "--copy");
}
CB_TEXT_LIST_ADD (cb_copy_list, cobc_strdup (cob_optarg));
break;

case CB_FLAG_GETOPT_INCLUDE_FILE: /* 19 */
/* -include=<file.h> : add #include "file.h" to
case CB_FLAG_GETOPT_INCLUDE_FILE:
/* -include=<file.h> : add #include "file.h" to
generated C file */
if (strlen (cob_optarg) > (COB_MINI_MAX)) {
cobc_err_exit (COBC_INV_PAR, "--include");
Expand Down Expand Up @@ -4048,7 +4049,8 @@ process_command_line (const int argc, char **argv)

/* LCOV_EXCL_START */
default:
cobc_err_msg ("missing evaluation of command line option '%c'", c); /* not translated as unlikely */
/* not translated as unlikely */
cobc_err_msg ("missing evaluation of command line option '%c'", c);
COBC_ABORT ();
/* LCOV_EXCL_STOP */

Expand Down Expand Up @@ -8193,6 +8195,9 @@ process_compile (struct filename *fn)
name = file_basename (fn->source, NULL);
#ifndef _MSC_VER
strcat (name, ".s");
#else
/* earlier versions of msbuild don't recognize .s */
strcat (name, ".asm");
#endif
}
size = strlen (name);
Expand All @@ -8207,6 +8212,7 @@ process_compile (struct filename *fn)
cobc_chk_buff_size (bufflen);

#ifdef _MSC_VER
/* TODO: we likely need to call ml.exe / ml64.exe */
sprintf (cobc_buffer, cb_source_debugging ?
"%s /c %s %s /Od /MDd /Zi /FR /c /Fa\"%s\" /Fo\"%s\" \"%s\"" :
"%s /c %s %s /MD /c /Fa\"%s\" /Fo\"%s\" \"%s\"",
Expand Down
Loading

0 comments on commit 21b5d51

Please sign in to comment.