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 1, 2020
1 parent 466ed63 commit 01e6820
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 9 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 Octachron, vicuna)

### Internal/compiler-libs changes:

- #463: a new Misc.Magic_number module for user-friendly parsing
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 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
2 changes: 1 addition & 1 deletion ocamltest/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,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-68 -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 @@ -29,7 +29,7 @@ OC_CFLAGS += $(SHAREDLIB_CFLAGS) $(EXTRACFLAGS)
OC_CPPFLAGS += -I$(ROOTDIR)/runtime

# 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-68 -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 @@ -31,7 +31,7 @@ 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 \
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"
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 tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ 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 \
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
6 changes: 5 additions & 1 deletion 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 @@ -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 01e6820

Please sign in to comment.