Skip to content

Commit

Permalink
Merge SVN 5251
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeclerck committed Feb 16, 2025
1 parent 7af6136 commit 710229b
Show file tree
Hide file tree
Showing 20 changed files with 59 additions and 56 deletions.
7 changes: 7 additions & 0 deletions cobc/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@

* flag.def: fix macro usage for MSVC

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

* tree.h: inclusion of cobc.h for types
* codeoptim.c, config.c, error.c, field.c, replace.c, reserved.c:
dropped unused header ctype
* codeoptim.c: dropped unused headers stdlib and string

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

* cobc.c (main): refactored to not need iterating via "iparams"
Expand Down
5 changes: 1 addition & 4 deletions cobc/codeoptim.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2006-2012, 2013, 2017-2023 Free Software Foundation, Inc.
Copyright (C) 2006-2012, 2013, 2017-2024 Free Software Foundation, Inc.
Written by Roger While, Ron Norman, Simon Sobisch, Edward Hart
This file is part of GnuCOBOL.
Expand All @@ -21,11 +21,8 @@
#include "config.h"

#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>

#include "cobc.h"
#include "tree.h"
Expand Down
20 changes: 10 additions & 10 deletions cobc/config.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2003-2012, 2014-2017, 2019-2023 Free Software Foundation, Inc.
Copyright (C) 2003-2012, 2014-2017, 2019-2024 Free Software Foundation, Inc.
Written by Keisuke Nishida, Roger While, Simon Sobisch
This file is part of GnuCOBOL.
Expand Down Expand Up @@ -553,13 +553,13 @@ cb_config_entry (char *buff, const char *fname, const int line)
/* Check for reserved word tag, if requested */
if (fname == words_file) {
if (strcmp (buff, "reserved")
&& strcmp (buff, "not-reserved")
&& strcmp (buff, "intrinsic-function")
&& strcmp (buff, "not-intrinsic-function")
&& strcmp (buff, "system-name")
&& strcmp (buff, "not-system-name")
&& strcmp (buff, "register")
&& strcmp (buff, "not-register")) {
&& strcmp (buff, "not-reserved")
&& strcmp (buff, "intrinsic-function")
&& strcmp (buff, "not-intrinsic-function")
&& strcmp (buff, "system-name")
&& strcmp (buff, "not-system-name")
&& strcmp (buff, "register")
&& strcmp (buff, "not-register")) {
configuration_error (fname, line, 1,
_("invalid configuration tag '%s' in word-list"), buff);
return -1;
Expand Down Expand Up @@ -591,7 +591,7 @@ cb_config_entry (char *buff, const char *fname, const int line)
val = read_string (val);

if (strcmp (name, "include") == 0
|| strcmp (name, "includeif") == 0) {
|| strcmp (name, "includeif") == 0) {
/* Include another conf file */
s = cob_expand_env_string ((char *)val);
cobc_main_free ((void *) val);
Expand Down Expand Up @@ -799,7 +799,7 @@ cb_config_entry (char *buff, const char *fname, const int line)
if (val[0] == '"' && val[1] != 0 && val[2] == '"' && val[3] == 0) {
cb_default_byte = val[1];
break;
} else
}
/* convert character to number (as quotes will commonly
be removed when given on shell) */
if (val[1] == 0 && (val[0] < '0' || val[0] > '9')) {
Expand Down
3 changes: 1 addition & 2 deletions cobc/error.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2001-2012, 2014-2023 Free Software Foundation, Inc.
Copyright (C) 2001-2012, 2014-2024 Free Software Foundation, Inc.
Written by Keisuke Nishida, Roger While, Simon Sobisch
This file is part of GnuCOBOL.
Expand All @@ -25,7 +25,6 @@
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <stdarg.h>
#ifdef HAVE_SYS_STAT_H
Expand Down
3 changes: 1 addition & 2 deletions cobc/field.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2001-2023 Free Software Foundation, Inc.
Copyright (C) 2001-2024 Free Software Foundation, Inc.
Written by Keisuke Nishida, Roger While, Simon Sobisch, Ron Norman,
Edward Hart
Expand Down Expand Up @@ -29,7 +29,6 @@
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#include <ctype.h>
#include <limits.h>

#include "cobc.h"
Expand Down
3 changes: 1 addition & 2 deletions cobc/replace.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2001-2023 Free Software Foundation, Inc.
Copyright (C) 2001-2024 Free Software Foundation, Inc.
Authors:
Keisuke Nishida, Roger While, Ron Norman, Simon Sobisch, Brian Tiffin,
Expand Down Expand Up @@ -32,7 +32,6 @@
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#include <ctype.h>
#include <time.h>
#include <limits.h>

Expand Down
3 changes: 1 addition & 2 deletions cobc/reserved.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2001-2012, 2014-2023 Free Software Foundation, Inc.
Copyright (C) 2001-2012, 2014-2024 Free Software Foundation, Inc.
Written by Keisuke Nishida, Roger While, Simon Sobisch, Edward Hart
This file is part of GnuCOBOL.
Expand All @@ -25,7 +25,6 @@
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <ctype.h>

#include "cobc.h"
#include "tree.h"
Expand Down
2 changes: 2 additions & 0 deletions cobc/tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

#include "../libcob/cobinternal.h"

#include "cobc.h" /* type definitions */

#define CB_BEFORE cb_int0
#define CB_AFTER cb_int1

Expand Down
10 changes: 10 additions & 0 deletions libcob/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@
* fisam.c (isam_read_next): use ISSTAT only for COB_WITH_STATUS_02,
fixing compile errors with VBISAM

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

* numeric.c (cob_numeric_display_cmp_zero): fixed overflow compare
* cobgetopt.c, intrinsic.c, move.c, numeric.c, reportio.c, strings.c,
termio.c: dropped headers ctype, errno and math where unused

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

* common.c (cob_accept_exception_status): fixed status 128

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

* common.h [__MINGW32__]: drop ancient redefinition of
Expand Down
3 changes: 1 addition & 2 deletions libcob/cobgetopt.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2010-2012, 2014-2016, 2018-2020, 2022 Free Software Foundation, Inc.
Copyright (C) 2010-2012, 2014-2016, 2018-2020, 2022, 2024 Free Software Foundation, Inc.
Modified for use in GnuCOBOL by Roger While, Simon Sobisch
*/

Expand Down Expand Up @@ -27,7 +27,6 @@
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <ctype.h>

#ifdef HAVE_UNISTD_H
#include <unistd.h>
Expand Down
8 changes: 4 additions & 4 deletions libcob/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#include <sys/stat.h>
#include <errno.h>

#include <math.h>
#include <math.h> /* for finite macros */
#ifdef HAVE_FINITE_IEEEFP_H
#include <ieeefp.h>
#endif
Expand Down Expand Up @@ -2947,7 +2947,7 @@ cob_accept_exception_status (cob_field *f)
exception = 1;
} else if (exception == cob_exception_tab_code[COB_EC_PROGRAM_NOT_FOUND]) {
exception = 2;
} else if (exception || cob_exception_tab_code[COB_EC_PROGRAM]) {
} else if (exception & cob_exception_tab_code[COB_EC_PROGRAM]) {
exception = 128;
}
}
Expand Down Expand Up @@ -8708,7 +8708,7 @@ cb_config_entry (char *buf, int line)

while (buf[i] != 0 && (isspace ((unsigned char)buf[i]) || buf[i] == ':' || buf[i] == '=')) i++;
if (buf[i] == '"'
|| buf[i] == '\'') {
|| buf[i] == '\'') {
qt = buf[i++];
for (j = 0; buf[i] != qt && buf[i] != 0; )
value[j++] = buf[i++];
Expand All @@ -8732,7 +8732,7 @@ cb_config_entry (char *buf, int line)
}
if (strcmp (value, "") == 0) {
if (strcasecmp (keyword, "include") != 0
&& strcasecmp (keyword, "includeif")) {
&& strcasecmp (keyword, "includeif")) {
conf_runtime_error(1, _("WARNING - '%s' without a value - ignored!"), keyword);
return 2;
} else {
Expand Down
7 changes: 4 additions & 3 deletions libcob/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -1458,9 +1458,10 @@ typedef struct __cob_module {
const char *gc_version; /* module version */

unsigned char xml_mode; /* Mode to handle XML PARSE (may be extended) */
#define COB_XML_XMLNSS 1 /* similar to XMLPARSE(XMLNSS) Micro Focus,
IBM may be different (_very_ likely for error codes);
but the main difference is to "COMPAT" */
/* similar to XMLPARSE(XMLNSS) Micro Focus,
IBM may be different (_very_ likely for error codes);
but the main difference is to "COMPAT" */
#define COB_XML_XMLNSS 1

cob_field function_return; /* Copy of RETURNING field */
unsigned int num_symbols; /* Number of symbols in table */
Expand Down
4 changes: 1 addition & 3 deletions libcob/intrinsic.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2005-2012, 2014-2023 Free Software Foundation, Inc.
Copyright (C) 2005-2012, 2014-2024 Free Software Foundation, Inc.
Written by Roger While, Simon Sobisch, Edward Hart, Brian Tiffin
This file is part of GnuCOBOL.
Expand Down Expand Up @@ -27,12 +27,10 @@
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <time.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#include <math.h>

/* include decimal definitions, allowing their use in common.h later */
#ifdef HAVE_GMP_H
Expand Down
4 changes: 1 addition & 3 deletions libcob/move.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2002-2012, 2014-2020, 2022-2023 Free Software Foundation, Inc.
Copyright (C) 2002-2012, 2014-2020, 2022-2024 Free Software Foundation, Inc.
Written by Keisuke Nishida, Roger While, Simon Sobisch, Ron Norman,
Edwart Hard
Expand Down Expand Up @@ -28,8 +28,6 @@
#include <stddef.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <math.h>

#ifdef HAVE_LOCALE_H
#include <locale.h>
Expand Down
6 changes: 2 additions & 4 deletions libcob/numeric.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2001-2012, 2014-2023 Free Software Foundation, Inc.
Copyright (C) 2001-2012, 2014-2024 Free Software Foundation, Inc.
Written by Keisuke Nishida, Roger While, Simon Sobisch, Ron Norman,
Chuck Haatveet
Expand Down Expand Up @@ -31,8 +31,6 @@
#include <stddef.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>

#include <math.h>
#ifdef HAVE_FINITE_IEEEFP_H
Expand Down Expand Up @@ -4300,7 +4298,7 @@ cob_numeric_display_cmp_zero (cob_field *f)
do {
const unsigned char p = COB_D2I (*ptr);
if (p != 0) {
const char p_sign = *(ptr_end - 1) & 0xF0;
const unsigned char p_sign = *(ptr_end - 1) & 0xF0;
int sign = p_sign == 0x70 || p_sign == 0xD0 || p_sign == 0xB0
? -1 : 1;
return sign;
Expand Down
2 changes: 1 addition & 1 deletion libcob/reportio.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2013-2023 Free Software Foundation, Inc.
Copyright (C) 2013-2024 Free Software Foundation, Inc.
Written by Ron Norman, Simon Sobisch
This file is part of GnuCOBOL.
Expand Down
3 changes: 1 addition & 2 deletions libcob/strings.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2002-2014, 2016-2020, 2022-2023 Free Software Foundation, Inc.
Copyright (C) 2002-2014, 2016-2020, 2022-2024 Free Software Foundation, Inc.
Written by Keisuke Nishida, Roger While, Edward Hart, Simon Sobisch
This file is part of GnuCOBOL.
Expand All @@ -26,7 +26,6 @@
#include <stddef.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>

/* include internal and external libcob definitions, forcing exports */
Expand Down
3 changes: 1 addition & 2 deletions libcob/termio.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2001-2012, 2014-2023 Free Software Foundation, Inc.
Copyright (C) 2001-2012, 2014-2024 Free Software Foundation, Inc.
Written by Keisuke Nishida, Roger While, Simon Sobisch, Edward Hart
This file is part of GnuCOBOL.
Expand Down Expand Up @@ -27,7 +27,6 @@
#include <string.h>
#include <stdarg.h>
#include <ctype.h>
#include <errno.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
Expand Down
8 changes: 4 additions & 4 deletions tests/testsuite.src/run_file.at
Original file line number Diff line number Diff line change
Expand Up @@ -23120,8 +23120,8 @@ AT_CHECK([diff reference prog.out], [0], [], [])
AT_CLEANUP


# This is only supported by the BDB backend
AT_SETUP([INDEXED file manipulation under ASCII/EBCDIC collation])
# This is, so far, only supported by the BDB backend
AT_SETUP([INDEXED files under ASCII/EBCDIC collation])
AT_KEYWORDS([runfile WRITE DELETE READ EBCDIC])

AT_SKIP_IF([test "$COB_HAS_ISAM" != "db"])
Expand Down Expand Up @@ -27845,7 +27845,7 @@ world
AT_CLEANUP


AT_SETUP([File SORT, LINE SEQUENTIAL variable records])
AT_SETUP([File SORT, LINE SEQUENTIAL])
AT_KEYWORDS([runfile SORT USING GIVING])

AT_DATA([file1],
Expand Down Expand Up @@ -27909,7 +27909,7 @@ Z9XXXXXXXXXX
AT_CLEANUP


AT_SETUP([EXTFH: File SORT, LINE SEQUENTIAL variable records])
AT_SETUP([EXTFH: File SORT, LINE SEQUENTIAL])
AT_KEYWORDS([runfile SORT USING GIVING EXTFH])

# same test as above, but this time using an external file handler
Expand Down
11 changes: 5 additions & 6 deletions tests/testsuite.src/run_fundamental.at
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Copyright (C) 2003-2012, 2014-2015, 2017-2023
## Copyright (C) 2003-2012, 2014-2015, 2017-2024
## Free Software Foundation, Inc.
## Written by Keisuke Nishida, Roger While, Simon Sobisch, Edward Hart,
## Ron Norman, Denis HUGONNARD-ROCHE, Chuck Haatvedt
Expand Down Expand Up @@ -6551,7 +6551,7 @@ AT_CHECK([$COMPILE prog.cob], [0], [],
[prog.cob:21: warning: unsigned 'W' may not be LESS THAN ZERO
])

AT_CHECK([./prog], [0], [V IS ZERO
AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [V IS ZERO
V IS ZERO AND W EQUAL 1
W EQUAL 1 AND V IS ZERO
W IS POSITIVE
Expand All @@ -6562,7 +6562,7 @@ V EQUAL 0 AND W IS POSITIVE
AT_CLEANUP


AT_SETUP([abbreviated conditions with multiple words operators])
AT_SETUP([abbreviated conditions])
AT_KEYWORDS([fundamental IF])

# for more details see bug #880
Expand Down Expand Up @@ -6592,15 +6592,14 @@ AT_DATA([prog.cob], [
])

AT_CHECK([$COMPILE prog.cob], [0], [], [])

AT_CHECK([./prog], [0], [TRUE 2
AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [TRUE 2
TRUE 3
], [])

AT_CLEANUP


AT_SETUP([abbreviated conditions with multiple words operators])
AT_SETUP([invalid use of condition-names])
AT_KEYWORDS([fundamental IF])

AT_DATA([prog.cob], [
Expand Down

0 comments on commit 710229b

Please sign in to comment.