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
3 changes: 3 additions & 0 deletions cobj/warning-help.def
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
CB_WARNDEF (cb_warn_redefinition, "redefinition", 1,
N_("Warn incompatible redefinition of data items"))

CB_WARNDEF (cb_warn_constant, "constant", 1,
N_("Warn inconsistent constant"))

CB_WARNDEF (cb_warn_parentheses, "parentheses", 1,
N_("Warn lack of parentheses around AND within OR"))

Expand Down
1 change: 1 addition & 0 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ command_line_options_DEPENDENCIES = \
command-line-options.src/list-reserved.at \
command-line-options.src/assign_external.at \
command-line-options.src/Wredefinition.at \
command-line-options.src/Wconstant.at \
command-line-options.src/Wparentheses.at \
command-line-options.src/Wcolumn-overflow.at \
command-line-options.src/Wterminator.at \
Expand Down
1 change: 1 addition & 0 deletions tests/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,7 @@ command_line_options_DEPENDENCIES = \
command-line-options.src/list-reserved.at \
command-line-options.src/assign_external.at \
command-line-options.src/Wredefinition.at \
command-line-options.src/Wconstant.at \
command-line-options.src/Wparentheses.at \
command-line-options.src/Wcolumn-overflow.at \
command-line-options.src/Wterminator.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 @@ -10,6 +10,7 @@ m4_include([list-reserved.at])
m4_include([assign_external.at])
m4_include([java-package.at])
m4_include([Wredefinition.at])
m4_include([Wconstant.at])
m4_include([Wparentheses.at])
m4_include([Wcolumn-overflow.at])
m4_include([Wterminator.at])
Expand Down
33 changes: 33 additions & 0 deletions tests/command-line-options.src/Wconstant.at
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
AT_SETUP([-Wcolumn-overflow])

AT_DATA([prog.cbl],
[ IDENTIFICATION DIVISION.
PROGRAM-ID. prog.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 NUM PIC 9(7) COMP-5.
PROCEDURE DIVISION.
MOVE 10000000000 TO NUM.
])

AT_CHECK([cobj -Wconstant prog.cbl], [0], [],
[prog.cbl:7: Warning: Numeric literal exceeds data size
])

AT_DATA([prog.cbl],
[ IDENTIFICATION DIVISION.
PROGRAM-ID. prog.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 NUM PIC 9.
PROCEDURE DIVISION.
MOVE -1 TO NUM.
])

AT_CHECK([cobj -Wconstant prog.cbl], [0], [],
[prog.cbl:7: Warning: Ignoring negative sign
])

AT_CHECK([${COBJ} --help | grep '\-Wconstant' > /dev/null], [0])

AT_CLEANUP