Skip to content

Commit

Permalink
Merge pull request #10207 from Octachron/deprecated_single_letter_war…
Browse files Browse the repository at this point in the history
…ning

Deprecate non-prefixed letters in warning specifications
  • Loading branch information
Octachron committed Mar 16, 2021
2 parents 3576548 + 619d068 commit 4db33fe
Show file tree
Hide file tree
Showing 318 changed files with 459 additions and 372 deletions.
2 changes: 2 additions & 0 deletions .depend
Original file line number Diff line number Diff line change
Expand Up @@ -5876,6 +5876,7 @@ driver/main_args.cmo : \
utils/warnings.cmi \
utils/profile.cmi \
utils/misc.cmi \
parsing/location.cmi \
utils/config.cmi \
driver/compenv.cmi \
utils/clflags.cmi \
Expand All @@ -5884,6 +5885,7 @@ driver/main_args.cmx : \
utils/warnings.cmx \
utils/profile.cmx \
utils/misc.cmx \
parsing/location.cmx \
utils/config.cmx \
driver/compenv.cmx \
utils/clflags.cmx \
Expand Down
6 changes: 6 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,12 @@ Working version
- #8877: Call the linker when ocamlopt is invoked with .o and .a files only.
(Greta Yorsh, review by Leo White)

- #10207: deprecate single uppercase or lowercase letter in warning
specifications.
The form `-w aBcD` was equivalent to `-w -a+b-c+d`.
It is now deprecated to improve the coexistence with warning mnemonics.
(Florian Angeletti, review by Damien Doligez and Gabriel Scherer)

### Internal/compiler-libs changes:

- #9243, simplify parser rules for array indexing operations
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ INCLUDES=-I utils -I parsing -I typing -I bytecomp -I file_formats \
-I driver -I toplevel

COMPFLAGS=-strict-sequence -principal -absname -w +a-4-9-40-41-42-44-45-48-66 \
-warn-error A \
-warn-error +a \
-bin-annot -safe-string -strict-formats $(INCLUDES)
LINKFLAGS=

Expand Down
2 changes: 1 addition & 1 deletion debugger/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ DYNLINKDIR=$(ROOTDIR)/otherlibs/dynlink
UNIXDIR=$(ROOTDIR)/otherlibs/$(UNIXLIB)

CAMLC=$(BEST_OCAMLC) -g -nostdlib -I $(ROOTDIR)/stdlib
COMPFLAGS=$(INCLUDES) -absname -w +a-4-9-41-42-44-45-48 -warn-error A \
COMPFLAGS=$(INCLUDES) -absname -w +a-4-9-41-42-44-45-48 -warn-error +A \
-safe-string -strict-sequence -strict-formats
LINKFLAGS=-linkall -I $(UNIXDIR) -I $(DYNLINKDIR)
OCAMLLEX ?= $(BEST_OCAMLLEX)
Expand Down
9 changes: 6 additions & 3 deletions driver/compenv.ml
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ let set_compiler_pass ppf ~name v flag ~filter =
because they are not understood by some versions of OCaml. *)
let can_discard = ref []

let parse_warnings error v =
Option.iter Location.(prerr_alert none) @@ Warnings.parse_options error v

let read_one_param ppf position name v =
let set name options s = setter ppf (fun b -> b) name options s in
let clear name options s = setter ppf (fun b -> not b) name options s in
Expand Down Expand Up @@ -277,11 +280,11 @@ let read_one_param ppf position name v =
| "dstartup" -> set "dstartup" [ Clflags.keep_startup_file ] v

(* warn-errors *)
| "we" | "warn-error" -> Warnings.parse_options true v
| "we" | "warn-error" -> parse_warnings true v
(* warnings *)
| "w" -> Warnings.parse_options false v
| "w" -> parse_warnings false v
(* warn-errors *)
| "wwe" -> Warnings.parse_options false v
| "wwe" -> parse_warnings false v
(* alerts *)
| "alert" -> Warnings.parse_alert_option v

Expand Down
6 changes: 4 additions & 2 deletions driver/main_args.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1700,7 +1700,8 @@ module Default = struct
let _strict_sequence = set strict_sequence
let _unboxed_types = set unboxed_types
let _unsafe_string = set unsafe_string
let _w s = Warnings.parse_options false s
let _w s =
Warnings.parse_options false s |> Option.iter Location.(prerr_alert none)

let anonymous = Compenv.anonymous

Expand All @@ -1724,7 +1725,8 @@ module Default = struct
let _nopervasives = set nopervasives
let _ppx s = Compenv.first_ppx := (s :: (!Compenv.first_ppx))
let _unsafe = set unsafe
let _warn_error s = Warnings.parse_options true s
let _warn_error s =
Warnings.parse_options true s |> Option.iter Location.(prerr_alert none)
let _warn_help = Warnings.help_warnings
end

Expand Down
2 changes: 1 addition & 1 deletion lex/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ OCAMLYACCFLAGS = -v
CAMLC = $(BOOT_OCAMLC) -strict-sequence -nostdlib \
-I $(ROOTDIR)/boot -use-prims $(ROOTDIR)/runtime/primitives
CAMLOPT = $(CAMLRUN) $(ROOTDIR)/ocamlopt$(EXE) -nostdlib -I $(ROOTDIR)/stdlib
COMPFLAGS = -absname -w +a-4-9-41-42-44-45-48 -warn-error A \
COMPFLAGS = -absname -w +a-4-9-41-42-44-45-48 -warn-error +A \
-safe-string -strict-sequence -strict-formats -bin-annot
LINKFLAGS =
OCAMLLEX ?= $(BOOT_OCAMLLEX)
Expand Down
2 changes: 1 addition & 1 deletion ocamldoc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ INCLUDES_NODEP=\
DEPINCLUDES=$(INCLUDES_DEP)
INCLUDES=$(INCLUDES_DEP) $(INCLUDES_NODEP)

COMPFLAGS=$(INCLUDES) -absname -w +a-4-9-41-42-44-45-48 -warn-error A \
COMPFLAGS=$(INCLUDES) -absname -w +a-4-9-41-42-44-45-48 -warn-error +A \
-safe-string -strict-sequence -strict-formats -bin-annot -principal

LINKFLAGS=$(INCLUDES) -nostdlib
Expand Down
2 changes: 1 addition & 1 deletion ocamltest/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ include_directories := $(addprefix -I , $(directories))

flags := -g -nostdlib $(include_directories) \
-strict-sequence -safe-string -strict-formats \
-w +a-4-9-41-42-44-45-48 -warn-error A
-w +a-4-9-41-42-44-45-48 -warn-error +A

ocamlc = $(BEST_OCAMLC) $(flags)

Expand Down
2 changes: 1 addition & 1 deletion otherlibs/Makefile.otherlibs.common
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ OC_CFLAGS += $(SHAREDLIB_CFLAGS) $(EXTRACFLAGS)
OC_CPPFLAGS += -I$(ROOTDIR)/runtime $(EXTRACPPFLAGS)

# Compilation options
COMPFLAGS=-absname -w +a-4-9-41-42-44-45-48 -warn-error A -bin-annot -g \
COMPFLAGS=-absname -w +a-4-9-41-42-44-45-48 -warn-error +A -bin-annot -g \
-safe-string -strict-sequence -strict-formats $(EXTRACAMLFLAGS)
ifeq "$(FLAMBDA)" "true"
OPTCOMPFLAGS += -O3
Expand Down
2 changes: 1 addition & 1 deletion otherlibs/dynlink/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ OCAMLOPT=$(BEST_OCAMLOPT) -g -nostdlib -I $(ROOTDIR)/stdlib

# COMPFLAGS should be in sync with the toplevel Makefile's COMPFLAGS.
COMPFLAGS=-strict-sequence -principal -absname -w +a-4-9-40-41-42-44-45-48-66 \
-warn-error A \
-warn-error +A \
-bin-annot -safe-string -strict-formats
ifeq "$(FLAMBDA)" "true"
OPTCOMPFLAGS += -O3
Expand Down
2 changes: 1 addition & 1 deletion otherlibs/systhreads/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ CAMLC=$(BEST_OCAMLC) $(LIBS)
CAMLOPT=$(BEST_OCAMLOPT) $(LIBS)

MKLIB=$(CAMLRUN) $(ROOTDIR)/tools/ocamlmklib$(EXE)
COMPFLAGS=-w +33..39 -warn-error A -g -bin-annot -safe-string
COMPFLAGS=-w +33..39 -warn-error +A -g -bin-annot -safe-string
ifeq "$(FLAMBDA)" "true"
OPTCOMPFLAGS += -O3
endif
Expand Down
4 changes: 3 additions & 1 deletion parsing/builtin_attributes.ml
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,9 @@ let warning_attribute ?(ppwarning = true) =
let process loc txt errflag payload =
match string_of_payload payload with
| Some s ->
begin try Warnings.parse_options errflag s
begin try
Option.iter (Location.prerr_alert loc)
(Warnings.parse_options errflag s)
with Arg.Bad msg -> warn_payload loc txt msg
end
| None ->
Expand Down
6 changes: 3 additions & 3 deletions stdlib/Compflags
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ case $1 in
# never instrument camlinternalOO or camlinternalLazy (PR#7725)
stdlib__Buffer.cmx) echo ' -inline 3';;
# make sure add_char is inlined (PR#5872)
stdlib__Buffer.cm[io]) echo ' -w A';;
camlinternalFormat.cm[io]) echo ' -w Ae';;
stdlib__Buffer.cm[io]) echo ' -w +A';;
camlinternalFormat.cm[io]) echo ' -w +A -w -fragile-match';;
stdlib__Printf.cm[io]|stdlib__Format.cm[io]|stdlib__Scanf.cm[io])
echo ' -w Ae';;
echo ' -w +A -w -fragile-match';;
stdlib__Scanf.cmx) echo ' -inline 9';;
*Labels.cmi) echo ' -pp "$AWK -f ./expand_module_aliases.awk"';;
*Labels.cm[ox]) echo ' -nolabels -no-alias-deps';;
Expand Down
2 changes: 1 addition & 1 deletion stdlib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ TARGET_BINDIR ?= $(BINDIR)
COMPILER=$(ROOTDIR)/ocamlc$(EXE)
CAMLC=$(CAMLRUN) $(COMPILER)
COMPFLAGS=-strict-sequence -absname -w +a-4-9-41-42-44-45-48 \
-g -warn-error A -bin-annot -nostdlib -principal \
-g -warn-error +A -bin-annot -nostdlib -principal \
-safe-string -strict-formats
ifeq "$(FLAMBDA)" "true"
OPTCOMPFLAGS += -O3
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/ast-invariants/test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ let invariants : type a. a kind -> a -> unit = function
| Interf -> Ast_invariants.signature

let check_file kind fn =
Warnings.parse_options false "-a";
ignore (Warnings.parse_options false "-a");
let ic = open_in fn in
Location.input_name := fn;
let lexbuf = Lexing.from_channel ic in
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/gc-roots/globroots.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(* TEST
flags += " -w a "
flags += " -w -a "
modules = "globrootsprim.c"
*)

Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/lib-digest/md5.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(* TEST
flags += " -w a "
flags += " -w -a "
*)

(* Test int32 arithmetic and optimizations using the MD5 algorithm *)
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/lib-unix/win-env/test_env.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
include unix
flags += "-strict-sequence -safe-string -w A -warn-error A"
flags += "-strict-sequence -safe-string -w +A -warn-error +A"
modules = "stubs.c"
* libwin32unix
** bytecode
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/output-complete-obj/github9344.ml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use_runtime = "false"
* setup-ocamlc.byte-build-env
** ocamlc.byte
flags = "-w a -output-complete-exe -ccopt -I${ocamlsrcdir}/runtime"
flags = "-w -a -output-complete-exe -ccopt -I${ocamlsrcdir}/runtime"
program = "github9344"
*** run
program = "sh ${test_source_directory}/github9344.sh"
Expand Down
4 changes: 2 additions & 2 deletions testsuite/tests/output-complete-obj/test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ files = "test.ml_stub.c"
* libunix
** setup-ocamlc.byte-build-env
*** ocamlc.byte
flags = "-w a -output-complete-obj"
flags = "-w -a -output-complete-obj"
program = "test.ml.bc.${objext}"
**** script
script = "${mkexe} -I${ocamlsrcdir}/runtime -o test.ml_bc_stub.exe \
Expand All @@ -17,7 +17,7 @@ stdout = "program-output"
stderr = "program-output"
** setup-ocamlopt.byte-build-env
*** ocamlopt.byte
flags = "-w a -output-complete-obj"
flags = "-w -a -output-complete-obj"
program = "test.ml.exe.${objext}"
**** script
script = "${mkexe} -I${ocamlsrcdir}/runtime -o test.ml_stub.exe \
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/output-complete-obj/test2.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use_runtime = "false"
include unix
** setup-ocamlc.byte-build-env
*** ocamlc.byte
flags = "-w a -output-complete-exe puts.c -ccopt -I${ocamlsrcdir}/runtime"
flags = "-w -a -output-complete-exe puts.c -ccopt -I${ocamlsrcdir}/runtime"
program = "test2"
**** run
program = "./test2"
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/runtime-errors/stackoverflow.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
flags = "-w a"
flags = "-w -a"
* setup-ocamlc.byte-build-env
** ocamlc.byte
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/runtime-errors/syserror.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
flags = "-w a"
flags = "-w -a"
* setup-ocamlc.byte-build-env
** ocamlc.byte
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/tool-ocaml/t000.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
include tool-ocaml-lib
flags = "-w a"
flags = "-w -a"
ocaml_script_as_argument = "true"
* setup-ocaml-build-env
** ocaml
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/tool-ocaml/t010-const0.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
include tool-ocaml-lib
flags = "-w a"
flags = "-w -a"
ocaml_script_as_argument = "true"
* setup-ocaml-build-env
** ocaml
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/tool-ocaml/t010-const1.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
include tool-ocaml-lib
flags = "-w a"
flags = "-w -a"
ocaml_script_as_argument = "true"
* setup-ocaml-build-env
** ocaml
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/tool-ocaml/t010-const2.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
include tool-ocaml-lib
flags = "-w a"
flags = "-w -a"
ocaml_script_as_argument = "true"
* setup-ocaml-build-env
** ocaml
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/tool-ocaml/t010-const3.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
include tool-ocaml-lib
flags = "-w a"
flags = "-w -a"
ocaml_script_as_argument = "true"
* setup-ocaml-build-env
** ocaml
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/tool-ocaml/t011-constint.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
include tool-ocaml-lib
flags = "-w a"
flags = "-w -a"
ocaml_script_as_argument = "true"
* setup-ocaml-build-env
** ocaml
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/tool-ocaml/t020.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
include tool-ocaml-lib
flags = "-w a"
flags = "-w -a"
ocaml_script_as_argument = "true"
* setup-ocaml-build-env
** ocaml
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/tool-ocaml/t021-pushconst1.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
include tool-ocaml-lib
flags = "-w a"
flags = "-w -a"
ocaml_script_as_argument = "true"
* setup-ocaml-build-env
** ocaml
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/tool-ocaml/t021-pushconst2.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
include tool-ocaml-lib
flags = "-w a"
flags = "-w -a"
ocaml_script_as_argument = "true"
* setup-ocaml-build-env
** ocaml
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/tool-ocaml/t021-pushconst3.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
include tool-ocaml-lib
flags = "-w a"
flags = "-w -a"
ocaml_script_as_argument = "true"
* setup-ocaml-build-env
** ocaml
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/tool-ocaml/t022-pushconstint.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
include tool-ocaml-lib
flags = "-w a"
flags = "-w -a"
ocaml_script_as_argument = "true"
* setup-ocaml-build-env
** ocaml
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/tool-ocaml/t040-makeblock1.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
include tool-ocaml-lib
flags = "-w a"
flags = "-w -a"
ocaml_script_as_argument = "true"
* setup-ocaml-build-env
** ocaml
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/tool-ocaml/t040-makeblock2.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
include tool-ocaml-lib
flags = "-w a"
flags = "-w -a"
ocaml_script_as_argument = "true"
* setup-ocaml-build-env
** ocaml
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/tool-ocaml/t040-makeblock3.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
include tool-ocaml-lib
flags = "-w a"
flags = "-w -a"
ocaml_script_as_argument = "true"
* setup-ocaml-build-env
** ocaml
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/tool-ocaml/t041-makeblock.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
include tool-ocaml-lib
flags = "-w a"
flags = "-w -a"
ocaml_script_as_argument = "true"
* setup-ocaml-build-env
** ocaml
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/tool-ocaml/t050-getglobal.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
include tool-ocaml-lib
flags = "-w a"
flags = "-w -a"
ocaml_script_as_argument = "true"
* setup-ocaml-build-env
** ocaml
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/tool-ocaml/t050-pushgetglobal.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
include tool-ocaml-lib
flags = "-w a"
flags = "-w -a"
ocaml_script_as_argument = "true"
* setup-ocaml-build-env
** ocaml
Expand Down

0 comments on commit 4db33fe

Please sign in to comment.