Skip to content

Commit

Permalink
added warning for missing mli interface file
Browse files Browse the repository at this point in the history
  • Loading branch information
Anukriti12 committed Apr 4, 2020
1 parent 466ed63 commit 91e31ce
Show file tree
Hide file tree
Showing 33 changed files with 45 additions and 34 deletions.
3 changes: 3 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ Working version
(Nicolás Ojeda Bär, review by Alain Frisch, Gabriel Scherer and Damien
Doligez)

- #9407: added warning for missing mli interface file
(Anukriti Kumar, review by Florian Angeletti)

### Internal/compiler-libs changes:

- #463: a new Misc.Magic_number module for user-friendly parsing
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ INCLUDES=-I utils -I parsing -I typing -I bytecomp -I file_formats \
-I asmcomp -I asmcomp/debug \
-I driver -I toplevel

COMPFLAGS=-strict-sequence -principal -absname -w +a-4-9-40-41-42-44-45-48-66 \
-warn-error A \
COMPFLAGS=-strict-sequence -principal -absname \
-w +a-4-9-40-41-42-44-45-48-66-68 -warn-error A \
-bin-annot -safe-string -strict-formats $(INCLUDES)
ifeq "$(FUNCTION_SECTIONS)" "true"
OPTCOMPFLAGS= -function-sections
Expand Down
2 changes: 1 addition & 1 deletion debugger/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ CAMLRUN ?= $(ROOTDIR)/boot/ocamlrun
CAMLYACC ?= $(ROOTDIR)/yacc/ocamlyacc$(EXE)

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-68 -warn-error A \
-safe-string -strict-sequence -strict-formats
LINKFLAGS=-linkall -I $(UNIXDIR) -I $(DYNLINKDIR)
YACCFLAGS=
Expand Down
2 changes: 1 addition & 1 deletion lex/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ CAMLYACC ?= $(ROOTDIR)/yacc/ocamlyacc
CAMLC = $(BOOT_OCAMLC) -strict-sequence -nostdlib \
-I $(ROOTDIR)/boot -use-prims $(ROOTDIR)/runtime/primitives
CAMLOPT = $(CAMLRUN) $(ROOTDIR)/ocamlopt -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-68 -warn-error A \
-safe-string -strict-sequence -strict-formats -bin-annot
LINKFLAGS =
YACCFLAGS = -v
Expand Down
2 changes: 1 addition & 1 deletion man/ocamlc.m
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@ compilation in any way (even if it is fatal). If a warning is enabled,

.IP
The default setting is
.BR \-w\ +a\-4\-6\-7\-9\-27\-29\-30\-32..42\-44\-45\-48\-50\-60\-66 .
.BR \-w\ +a\-4\-6\-7\-9\-27\-29\-30\-32..42\-44\-45\-48\-50\-60\-66\-68 .
Note that warnings
.BR 5 \ and \ 10
are not always triggered, depending on the internals of the type checker.
Expand Down
2 changes: 1 addition & 1 deletion ocamldoc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,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-68 -warn-error A \
-safe-string -strict-sequence -strict-formats -bin-annot -principal

LINKFLAGS=$(INCLUDES) -nostdlib
Expand Down
4 changes: 2 additions & 2 deletions otherlibs/dynlink/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ OCAMLC=$(BEST_OCAMLC) -g -nostdlib -I $(ROOTDIR)/stdlib
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 \
COMPFLAGS=-strict-sequence -principal -absname \
-w +a-4-9-40-41-42-44-45-48-66-68 -warn-error A \
-bin-annot -safe-string -strict-formats
ifeq "$(FLAMBDA)" "true"
OPTCOMPFLAGS=-O3
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
CAMLC=$(CAMLRUN) $(COMPILER)
COMPFLAGS=-strict-sequence -absname -w +a-4-9-41-42-44-45-48 \
COMPFLAGS=-strict-sequence -absname -w +a-4-9-41-42-44-45-48-68 \
-g -warn-error A -bin-annot -nostdlib \
-safe-string -strict-formats
ifeq "$(FLAMBDA)" "true"
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-68 -warn-error A"
modules = "stubs.c"
* libwin32unix
** bytecode
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/typing-fstclassmod/fstclassmod.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(* TEST
flags = "-w A -warn-error A"
flags = "-w A-68 -warn-error A"
*)

(* Example of algorithm parametrized with modules *)
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/warnings/deprecated_module_assigment.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
flags = "-w A"
flags = "-w A-68"
* bytecode
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/warnings/deprecated_module_use.ml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module = "deprecated_module.mli"
*** ocamlc.byte
module = "deprecated_module.ml"
**** ocamlc.byte
flags = "-w A"
flags = "-w A-68"
module = "deprecated_module_use.ml"
***** check-ocamlc.byte-output
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/warnings/w01.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
flags = "-w A"
flags = "-w A-68"
* setup-ocamlc.byte-build-env
** ocamlc.byte
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/warnings/w03.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
flags = "-w A"
flags = "-w A-68"
* setup-ocamlc.byte-build-env
** ocamlc.byte
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/warnings/w04.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
flags = "-w A"
flags = "-w A-68"
* setup-ocamlc.byte-build-env
** ocamlc.byte
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/warnings/w04_failure.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
flags = "-w A"
flags = "-w A-68"
* setup-ocamlc.byte-build-env
** ocamlc.byte
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/warnings/w06.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
flags = "-w A"
flags = "-w A-68"
* setup-ocamlc.byte-build-env
** ocamlc.byte
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/warnings/w32b.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
flags = "-w A"
flags = "-w A-68"
* setup-ocamlc.byte-build-env
** ocamlc.byte
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/warnings/w33.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
flags = "-w A"
flags = "-w A-68"
* setup-ocamlc.byte-build-env
** ocamlc.byte
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/warnings/w45.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
flags = "-w A"
flags = "-w A-68"
* setup-ocamlc.byte-build-env
** ocamlc.byte
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/warnings/w47_inline.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
flags = "-w A"
flags = "-w A-68"
* setup-ocamlc.byte-build-env
** ocamlc.byte
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/warnings/w50.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
flags = "-w A"
flags = "-w A-68"
* setup-ocamlc.byte-build-env
** ocamlc.byte
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/warnings/w51.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
flags = "-w A"
flags = "-w A-68"
* setup-ocamlc.byte-build-env
** ocamlc.byte
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/warnings/w51_bis.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
flags = "-w A"
flags = "-w A-68"
* setup-ocamlc.byte-build-env
** ocamlc.byte
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/warnings/w53.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
flags = "-w A-60"
flags = "-w A-60-68"
* setup-ocamlc.byte-build-env
** ocamlc.byte
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/warnings/w54.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
flags = "-w A"
flags = "-w A-68"
* setup-ocamlc.byte-build-env
** ocamlc.byte
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/warnings/w55.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
flags = "-w A"
flags = "-w A-68"
compile_only = "true"
* setup-ocamlc.byte-build-env
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/warnings/w58.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
flags = "-w A"
flags = "-w A-68"
files = "module_without_cmx.mli"
* setup-ocamlc.byte-build-env
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/warnings/w59.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(* TEST
flags = "-w A"
flags = "-w A-68"
compile_only = "true"
* setup-ocamlc.byte-build-env
Expand Down
5 changes: 3 additions & 2 deletions tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ INCLUDES = $(addprefix -I $(ROOTDIR)/,utils parsing typing bytecomp \
middle_end middle_end/closure middle_end/flambda \
middle_end/flambda/base_types driver toplevel \
file_formats lambda)
COMPFLAGS = -absname -w +a-4-9-41-42-44-45-48 -strict-sequence -warn-error A \
-principal -safe-string -strict-formats -bin-annot $(INCLUDES)
COMPFLAGS = -absname -w +a-4-9-41-42-44-45-48-68 -strict-sequence \
-warn-error A -principal -safe-string -strict-formats \
-bin-annot $(INCLUDES)
LINKFLAGS = $(INCLUDES)
VPATH := $(filter-out -I,$(INCLUDES))

Expand Down
2 changes: 2 additions & 0 deletions typing/typemod.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2663,6 +2663,8 @@ let type_implementation sourcefile outputprefix modulename initial_env ast =
gen_annot outputprefix sourcefile annots;
(str, coercion)
end else begin
Location.prerr_warning (Location.in_file sourcefile)
Warnings.Interface_not_found;
let coercion =
Includemod.compunit initial_env ~mark:Includemod.Mark_positive
sourcefile sg "(inferred signature)" simple_sg
Expand Down
8 changes: 6 additions & 2 deletions utils/warnings.ml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ type t =
| Redefining_unit of string (* 65 *)
| Unused_open_bang of string (* 66 *)
| Unused_functor_parameter of string (* 67 *)
| Interface_not_found (* 68 *)
;;

(* If you remove a warning, leave a hole in the numbering. NEVER change
Expand Down Expand Up @@ -170,9 +171,10 @@ let number = function
| Redefining_unit _ -> 65
| Unused_open_bang _ -> 66
| Unused_functor_parameter _ -> 67
| Interface_not_found -> 68
;;

let last_warning_number = 67
let last_warning_number = 68
;;

(* Must be the max number returned by the [number] function. *)
Expand Down Expand Up @@ -393,7 +395,7 @@ let parse_options errflag s =
current := {(!current) with error; active}

(* If you change these, don't forget to change them in man/ocamlc.m *)
let defaults_w = "+a-4-6-7-9-27-29-30-32..42-44-45-48-50-60-66-67";;
let defaults_w = "+a-4-6-7-9-27-29-30-32..42-44-45-48-50-60-66-67-68";;
let defaults_warn_error = "-a+31";;

let () = parse_options false defaults_w;;
Expand Down Expand Up @@ -631,6 +633,8 @@ let message = function
which shadows the existing one.\n\
Hint: Did you mean 'type %s = unit'?" name
| Unused_functor_parameter s -> "unused functor parameter " ^ s ^ "."
| Interface_not_found ->
"Cannot find interface file."
;;

let nerrors = ref 0;;
Expand Down
1 change: 1 addition & 0 deletions utils/warnings.mli
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ type t =
| Redefining_unit of string (* 65 *)
| Unused_open_bang of string (* 66 *)
| Unused_functor_parameter of string (* 67 *)
| Interface_not_found (* 68 *)
;;

type alert = {kind:string; message:string; def:loc; use:loc}
Expand Down

0 comments on commit 91e31ce

Please sign in to comment.