Skip to content
Merged
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 cobj/warning-help.def
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@

/* CB_WARNDEF (var, name, wall, doc) */

CB_WARNDEF (cb_warn_obsolete, "obsolete", 1,
N_("Warn if obsolete features are used"))

CB_WARNDEF (cb_warn_archaic, "archaic", 1,
N_("Warn if archaic features are used"))

CB_WARNDEF (cb_warn_redefinition, "redefinition", 1,
N_("Warn incompatible redefinition of data items"))

Expand Down
1 change: 1 addition & 0 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ command_line_options_DEPENDENCIES = \
command-line-options.src/B.at \
command-line-options.src/list-reserved.at \
command-line-options.src/assign_external.at \
command-line-options.src/Wobsolete-Warchaic.at \
command-line-options.src/Wredefinition.at \
command-line-options.src/Wconstant.at \
command-line-options.src/Wparentheses.at \
Expand Down
1 change: 1 addition & 0 deletions tests/command-line-options.at
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ m4_include([B.at])
m4_include([list-reserved.at])
m4_include([assign_external.at])
m4_include([java-package.at])
m4_include([Wobsolete-Warchaic.at])
m4_include([Wredefinition.at])
m4_include([Wconstant.at])
m4_include([Wparentheses.at])
Expand Down
23 changes: 23 additions & 0 deletions tests/command-line-options.src/Wobsolete-Warchaic.at
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
AT_SETUP([-Wobsolete and -Warchaic])

AT_DATA([prog.cbl],
[ IDENTIFICATION DIVISION.
PROGRAM-ID. prog.
DATA DIVISION.
WORKING-STORAGE SECTION.
PROCEDURE DIVISION.
DISPLAY "HELLO".
STOP "hello".
])

AT_CHECK([${COBJ} -Wobsolete -conf=../../command-line-options.src/stop-literal-statement-obsolete.conf prog.cbl], [0], [],
[prog.cbl:7: Warning: STOP literal is obsolete in OpenCOBOL
])

AT_CHECK([${COBJ} -Warchaic -conf=../../command-line-options.src/stop-literal-statement-archaic.conf prog.cbl], [0], [],
[prog.cbl:7: Warning: STOP literal is archaic in OpenCOBOL
])

AT_CHECK([${COBJ} --help | grep '\-Warchaic' > /dev/null], [0])
AT_CHECK([${COBJ} --help | grep '\-Wobsolete' > /dev/null], [0])
AT_CLEANUP
153 changes: 153 additions & 0 deletions tests/command-line-options.src/stop-literal-statement-archaic.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
# COBOL compiler configuration -*- sh -*-

# Value: any string
name: "OpenCOBOL"

# Value: int
tab-width: 8
text-column: 72

# Value: 'record-sequential', 'line-sequential'
# This sets the default organization for sequential files,
# where the organization is not explicitly defined.
default-organization: record-sequential

# Value: 'cobol2002', 'mf', 'ibm', 'jph1'
assign-clause: mf

# If yes, file names are resolved at run time using environment variables.
# For example, given ASSIGN TO "DATAFILE", the actual file name will be
# 1. the value of environment variable 'DD_DATAFILE' or
# 2. the value of environment variable 'dd_DATAFILE' or
# 3. the value of environment variable 'DATAFILE' or
# 4. the literal "DATAFILE"
# If no, the value of the assign clause is the file name.
#
# Value: 'yes', 'no'
filename-mapping: yes

# Value: 'yes', 'no'
pretty-display: yes

# Value: 'yes', 'no'
auto-initialize: yes

# Value: 'yes', 'no'
complex-odo: no

# Value: 'yes', 'no'
indirect-redefines: no

# Binary byte size - defines the allocated bytes according to PIC
# Value: signed unsigned bytes
# ------ -------- -----
# '2-4-8' 1 - 4 2
# 5 - 9 4
# 10 - 18 8
#
# '1-2-4-8' 1 - 2 1
# 3 - 4 2
# 5 - 9 4
# 10 - 18 8
#
# '1--8' 1 - 2 1 - 2 1
# 3 - 4 3 - 4 2
# 5 - 6 5 - 7 3
# 7 - 9 8 - 9 4
# 10 - 11 10 - 12 5
# 12 - 14 13 - 14 6
# 15 - 16 15 - 16 7
# 17 - 18 17 - 18 8
binary-size: 1-2-4-8

# Value: 'yes', 'no'
binary-truncate: yes

# Value: 'native', 'big-endian'
binary-byteorder: big-endian

# Value: 'any', 'fatal', 'never'
abort-on-io-exception: any

# Value: 'yes', 'no'
larger-redefines-ok: no

# Value: 'yes', 'no'
relaxed-syntax-check: no

# Perform type OSVS - If yes, the exit point of any currently executing perform
# is recognized if reached.
# Value: 'yes', 'no'
perform-osvs: no

# If yes, linkage-section items remain allocated
# between invocations.
# Value: 'yes', 'no'
sticky-linkage: no

# If yes, set the file assign to the external file
# Value: 'yes', 'no'
assign_external: no

# If yes, allow non-matching level numbers
# Value: 'yes', 'no'
relax-level-hierarchy: no

# not-reserved:
# Value: Word to be taken out of the reserved words list
# (case independent)

# Dialect features
# Value: 'ok', 'archaic', 'obsolete', 'skip', 'ignore', 'unconformable'
author-paragraph: obsolete
memory-size-clause: obsolete
multiple-file-tape-clause: obsolete
label-records-clause: obsolete
value-of-clause: obsolete
data-records-clause: obsolete
top-level-occurs-clause: skip
synchronized-clause: ok
goto-statement-without-name: obsolete
stop-literal-statement: archaic
debugging-line: obsolete
padding-character-clause: obsolete
next-sentence-phrase: archaic
eject-statement: skip
entry-statement: obsolete
move-noninteger-to-alphanumeric: error
odo-without-to: ok

# Value: any single character
default-currency-symbol: $

# Value: int
max-alpha-character-data-size: 2147483647
max-sjis-character-data-size: 1073741823
max-utf8-character-data-size: 715827882

# If yes, length of PROGRAM-ID of after translation is bigger than
# 31 characters, give warning.
c89-identifier-length-check: no

# jp compatible
# Value: 'yes', 'no'
allow-end-program-with-wrong-name: no
allow-missing-also-clause-in-evaluate: no
allow-empty-imperative-statement: no
enable-program-status-register: no
enable-sort-status-register: no
enable-special-names-argument-clause: no
enable-special-names-environment-clause: no
enable-leng-intrinsic-function: no
enable-length-an-intrinsic-function: no
enable-national-intrinsic-function: no
use-invalidkey-handler-on-status34: no
cobol68-copy-in-data-description: no
switch-no-mnemonic: no
allow-is-in-sort-key-spec: no
allow-search-key-in-rhs: no
ignore-invalid-record-contains: no
enable-zero-division-error: no
enable-check-subscript-out-of-bounds: no
enable-expect-numeric-error: no
enable-expect-compute-string-error: no
153 changes: 153 additions & 0 deletions tests/command-line-options.src/stop-literal-statement-obsolete.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
# COBOL compiler configuration -*- sh -*-

# Value: any string
name: "OpenCOBOL"

# Value: int
tab-width: 8
text-column: 72

# Value: 'record-sequential', 'line-sequential'
# This sets the default organization for sequential files,
# where the organization is not explicitly defined.
default-organization: record-sequential

# Value: 'cobol2002', 'mf', 'ibm', 'jph1'
assign-clause: mf

# If yes, file names are resolved at run time using environment variables.
# For example, given ASSIGN TO "DATAFILE", the actual file name will be
# 1. the value of environment variable 'DD_DATAFILE' or
# 2. the value of environment variable 'dd_DATAFILE' or
# 3. the value of environment variable 'DATAFILE' or
# 4. the literal "DATAFILE"
# If no, the value of the assign clause is the file name.
#
# Value: 'yes', 'no'
filename-mapping: yes

# Value: 'yes', 'no'
pretty-display: yes

# Value: 'yes', 'no'
auto-initialize: yes

# Value: 'yes', 'no'
complex-odo: no

# Value: 'yes', 'no'
indirect-redefines: no

# Binary byte size - defines the allocated bytes according to PIC
# Value: signed unsigned bytes
# ------ -------- -----
# '2-4-8' 1 - 4 2
# 5 - 9 4
# 10 - 18 8
#
# '1-2-4-8' 1 - 2 1
# 3 - 4 2
# 5 - 9 4
# 10 - 18 8
#
# '1--8' 1 - 2 1 - 2 1
# 3 - 4 3 - 4 2
# 5 - 6 5 - 7 3
# 7 - 9 8 - 9 4
# 10 - 11 10 - 12 5
# 12 - 14 13 - 14 6
# 15 - 16 15 - 16 7
# 17 - 18 17 - 18 8
binary-size: 1-2-4-8

# Value: 'yes', 'no'
binary-truncate: yes

# Value: 'native', 'big-endian'
binary-byteorder: big-endian

# Value: 'any', 'fatal', 'never'
abort-on-io-exception: any

# Value: 'yes', 'no'
larger-redefines-ok: no

# Value: 'yes', 'no'
relaxed-syntax-check: no

# Perform type OSVS - If yes, the exit point of any currently executing perform
# is recognized if reached.
# Value: 'yes', 'no'
perform-osvs: no

# If yes, linkage-section items remain allocated
# between invocations.
# Value: 'yes', 'no'
sticky-linkage: no

# If yes, set the file assign to the external file
# Value: 'yes', 'no'
assign_external: no

# If yes, allow non-matching level numbers
# Value: 'yes', 'no'
relax-level-hierarchy: no

# not-reserved:
# Value: Word to be taken out of the reserved words list
# (case independent)

# Dialect features
# Value: 'ok', 'archaic', 'obsolete', 'skip', 'ignore', 'unconformable'
author-paragraph: obsolete
memory-size-clause: obsolete
multiple-file-tape-clause: obsolete
label-records-clause: obsolete
value-of-clause: obsolete
data-records-clause: obsolete
top-level-occurs-clause: skip
synchronized-clause: ok
goto-statement-without-name: obsolete
stop-literal-statement: obsolete
debugging-line: obsolete
padding-character-clause: obsolete
next-sentence-phrase: archaic
eject-statement: skip
entry-statement: obsolete
move-noninteger-to-alphanumeric: error
odo-without-to: ok

# Value: any single character
default-currency-symbol: $

# Value: int
max-alpha-character-data-size: 2147483647
max-sjis-character-data-size: 1073741823
max-utf8-character-data-size: 715827882

# If yes, length of PROGRAM-ID of after translation is bigger than
# 31 characters, give warning.
c89-identifier-length-check: no

# jp compatible
# Value: 'yes', 'no'
allow-end-program-with-wrong-name: no
allow-missing-also-clause-in-evaluate: no
allow-empty-imperative-statement: no
enable-program-status-register: no
enable-sort-status-register: no
enable-special-names-argument-clause: no
enable-special-names-environment-clause: no
enable-leng-intrinsic-function: no
enable-length-an-intrinsic-function: no
enable-national-intrinsic-function: no
use-invalidkey-handler-on-status34: no
cobol68-copy-in-data-description: no
switch-no-mnemonic: no
allow-is-in-sort-key-spec: no
allow-search-key-in-rhs: no
ignore-invalid-record-contains: no
enable-zero-division-error: no
enable-check-subscript-out-of-bounds: no
enable-expect-numeric-error: no
enable-expect-compute-string-error: no