1OCAMLC(1)                   General Commands Manual                  OCAMLC(1)
2
3
4

NAME

6       ocamlc - The OCaml bytecode compiler
7
8

SYNOPSIS

10       ocamlc [ options ] filename ...
11
12       ocamlc.opt [ options ] filename ...
13
14

DESCRIPTION

16       The  OCaml  bytecode  compiler ocamlc(1) compiles OCaml source files to
17       bytecode object files and links these object files  to  produce  stand‐
18       alone  bytecode  executable files.  These executable files are then run
19       by the bytecode interpreter ocamlrun(1).
20
21       The ocamlc(1) command has a command-line interface similar to  the  one
22       of  most  C  compilers.  It accepts several types of arguments and pro‐
23       cesses them sequentially, after all options have been processed:
24
25       Arguments ending in .mli are taken to be source files  for  compilation
26       unit  interfaces.  Interfaces specify the names exported by compilation
27       units: they declare value names with their types,  define  public  data
28       types, declare abstract data types, and so on. From the file x.mli, the
29       ocamlc(1) compiler produces a compiled interface in the file x.cmi.
30
31       Arguments ending in .ml are taken to be source  files  for  compilation
32       unit implementations. Implementations provide definitions for the names
33       exported by the unit, and also contain expressions to be evaluated  for
34       their  side-effects.   From  the file x.ml, the ocamlc(1) compiler pro‐
35       duces compiled object bytecode in the file x.cmo.
36
37       If the interface file x.mli exists, the implementation x.ml is  checked
38       against the corresponding compiled interface x.cmi, which is assumed to
39       exist. If no interface x.mli is provided, the compilation of x.ml  pro‐
40       duces  a  compiled interface file x.cmi in addition to the compiled ob‐
41       ject code file x.cmo.  The file x.cmi produced corresponds to an inter‐
42       face  that  exports  everything  that  is defined in the implementation
43       x.ml.
44
45       Arguments ending in .cmo are taken  to  be  compiled  object  bytecode.
46       These  files  are linked together, along with the object files obtained
47       by compiling .ml arguments (if any), and the OCaml standard library, to
48       produce a standalone executable program. The order in which .cmo and.ml
49       arguments are presented on the command line  is  relevant:  compilation
50       units  are initialized in that order at run-time, and it is a link-time
51       error to use a component of a unit before having initialized it. Hence,
52       a  given  x.cmo  file must come before all .cmo files that refer to the
53       unit x.
54
55       Arguments ending in .cma are taken to be libraries of object  bytecode.
56       A  library  of  object  bytecode packs in a single file a set of object
57       bytecode files (.cmo files). Libraries are built  with  ocamlc -a  (see
58       the  description of the -a option below). The object files contained in
59       the library are linked as regular .cmo files (see above), in the  order
60       specified  when the .cma file was built. The only difference is that if
61       an object file contained in a library is not referenced anywhere in the
62       program, then it is not linked in.
63
64       Arguments  ending in .c are passed to the C compiler, which generates a
65       .o object file. This object file is linked  with  the  program  if  the
66       -custom flag is set (see the description of -custom below).
67
68       Arguments  ending  in .o or .a are assumed to be C object files and li‐
69       braries. They are passed to the C linker when linking in  -custom  mode
70       (see the description of -custom below).
71
72       Arguments  ending  in  .so are assumed to be C shared libraries (DLLs).
73       During linking, they are searched for external C  functions  referenced
74       from the OCaml code, and their names are written in the generated byte‐
75       code executable.  The run-time system ocamlrun(1) then loads  them  dy‐
76       namically at program start-up time.
77
78       The  output of the linking phase is a file containing compiled bytecode
79       that can be executed by the OCaml  bytecode  interpreter:  the  command
80       ocamlrun(1).  If caml.out is the name of the file produced by the link‐
81       ing phase, the command ocamlrun caml.out  arg1  arg2 ... argn  executes
82       the  compiled  code  contained in caml.out, passing it as arguments the
83       character strings arg1 to argn.  (See ocamlrun(1) for more details.)
84
85       On most systems, the file produced by the linking phase can be run  di‐
86       rectly,  as  in: ./caml.out arg1  arg2 ... argn.  The produced file has
87       the executable bit set, and it manages to launch  the  bytecode  inter‐
88       preter by itself.
89
90       ocamlc.opt  is  the  same compiler as ocamlc, but compiled with the na‐
91       tive-code compiler ocamlopt(1).  Thus, it behaves exactly like  ocamlc,
92       but  compiles faster.  ocamlc.opt may not be available in all installa‐
93       tions of OCaml.
94
95

OPTIONS

97       The following command-line options are recognized by ocamlc(1).
98
99       -a     Build a library (.cma file) with the object files  (.cmo  files)
100              given  on the command line, instead of linking them into an exe‐
101              cutable file. The name of the library must be set  with  the  -o
102              option.
103
104              If  -custom, -cclib or -ccopt  options are passed on the command
105              line, these options are stored in the  resulting  .cma  library.
106              Then,  linking  with  this  library  automatically adds back the
107              -custom, -cclib and -ccopt options as if they had been  provided
108              on the command line, unless the -noautolink option is given. Ad‐
109              ditionally, a substring $CAMLORIGIN  inside  a   -ccopt  options
110              will be replaced by the full path to the .cma library, excluding
111              the filename.  -absname Show absolute filenames  in  error  mes‐
112              sages.
113
114       -annot Deprecated since 4.11. Please use -bin-annot instead.
115
116       -bin-annot
117              Dump  detailed  information  about the compilation (types, bind‐
118              ings, tail-calls, etc) in binary  format.  The  information  for
119              file  src.ml is put into file src.cmt.  In case of a type error,
120              dump all the information inferred by the type-checker before the
121              error.  The annotation files produced by -bin-annot contain more
122              information and are much more compact than the files produced by
123              -annot.
124
125       -c     Compile  only.  Suppress  the  linking phase of the compilation.
126              Source code files are turned into compiled files,  but  no  exe‐
127              cutable  file is produced. This option is useful to compile mod‐
128              ules separately.
129
130       -cc ccomp
131              Use ccomp as the C linker when linking in "custom runtime"  mode
132              (see  the -custom option) and as the C compiler for compiling .c
133              source files.
134
135       -cclib -llibname
136              Pass the -llibname option to the C linker when linking in  "cus‐
137              tom  runtime"  mode  (see  the  -custom option). This causes the
138              given C library to be linked with the program.
139
140       -ccopt option
141              Pass the given option to the C compiler and linker, when linking
142              in "custom runtime" mode (see the -custom option). For instance,
143              -ccopt -Ldir causes the C linker to search for  C  libraries  in
144              directory dir.
145
146       -color mode
147              Enable  or disable colors in compiler messages (especially warn‐
148              ings and errors).  The following modes are supported:
149
150              auto use heuristics to enable colors only if the output supports
151              them (an ANSI-compatible tty terminal);
152
153              always enable colors unconditionally;
154
155              never disable color output.
156
157              The  environment  variable "OCAML_COLOR" is considered if -color
158              is not provided. Its values are auto/always/never as above.
159
160              If -color is not provided, "OCAML_COLOR" is not set and the  en‐
161              vironment  variable "NO_COLOR" is set, then color output is dis‐
162              abled. Otherwise, the default setting is auto, and  the  current
163              heuristic checks that the "TERM" environment variable exists and
164              is not empty or "dumb", and that isatty(stderr) holds.
165
166
167       -error-style mode
168              Control the way error messages and warnings  are  printed.   The
169              following modes are supported:
170
171              short only print the error and its location;
172
173              contextual  like "short", but also display the source code snip‐
174              pet corresponding to the location of the error.
175
176              The default setting is contextual.
177
178              The environment variable "OCAML_ERROR_STYLE"  is  considered  if
179              -error-style is not provided. Its values are short/contextual as
180              above.
181
182
183       -compat-32
184              Check that the generated bytecode executable can run  on  32-bit
185              platforms  and signal an error if it cannot. This is useful when
186              compiling bytecode on a 64-bit machine.
187
188       -config
189              Print the version number of ocamlc(1) and a detailed summary  of
190              its configuration, then exit.
191
192       -config-var
193              Print  the  value  of a specific configuration variable from the
194              -config output, then exit. If the variable does not  exist,  the
195              exit code is non-zero.
196
197       -custom
198              Link  in "custom runtime" mode. In the default linking mode, the
199              linker produces bytecode that is intended to  be  executed  with
200              the  shared  runtime system, ocamlrun(1).  In the custom runtime
201              mode, the linker produces an output file that contains both  the
202              runtime  system  and the bytecode for the program. The resulting
203              file is larger, but it can be executed  directly,  even  if  the
204              ocamlrun(1) command is not installed. Moreover, the "custom run‐
205              time" mode enables linking OCaml code with user-defined C  func‐
206              tions.
207
208              Never  use  the  strip(1)  command  on  executables  produced by
209              ocamlc -custom, this would remove the bytecode part of the  exe‐
210              cutable.
211
212              Security warning: never set the "setuid" or "setgid" bits on ex‐
213              ecutables produced by ocamlc -custom, this would make them  vul‐
214              nerable to attacks.
215
216       -depend ocamldep-args
217              Compute dependencies, as ocamldep would do.
218
219       -dllib -llibname
220              Arrange  for the C shared library dlllibname.so to be loaded dy‐
221              namically by the run-time system ocamlrun(1) at program start-up
222              time.
223
224       -dllpath dir
225              Adds  the directory dir to the run-time search path for shared C
226              libraries.  At link-time, shared libraries are searched  in  the
227              standard  search  path (the one corresponding to the -I option).
228              The -dllpath option simply stores dir in the produced executable
229              file, where ocamlrun(1) can find it and use it.
230
231       -for-pack module-path
232              Generate  an  object file (.cmo file) that can later be included
233              as a sub-module (with the given access path)  of  a  compilation
234              unit      constructed     with     -pack.      For     instance,
235              ocamlc -for-pack P -c A.ml will generate a.cmo that can later be
236              used with ocamlc -pack -o P.cmo a.cmo.  Note: you can still pack
237              a module that was compiled without -for-pack but  in  this  case
238              exceptions will be printed with the wrong names.
239
240       -g     Add  debugging information while compiling and linking. This op‐
241              tion is required in order to be able to debug the  program  with
242              ocamldebug(1)  and  to produce stack backtraces when the program
243              terminates on an uncaught exception.
244
245       -i     Cause the compiler to print all defined names  (with  their  in‐
246              ferred types or their definitions) when compiling an implementa‐
247              tion (.ml file). No compiled files (.cmo  and  .cmi  files)  are
248              produced.  This can be useful to check the types inferred by the
249              compiler. Also, since the output follows the  syntax  of  inter‐
250              faces,  it can help in writing an explicit interface (.mli file)
251              for a file: just redirect the standard output of the compiler to
252              a  .mli  file,  and edit that file to remove all declarations of
253              unexported names.
254
255       -I directory
256              Add the given directory to the list of directories searched  for
257              compiled  interface  files  (.cmi),  compiled  object code files
258              (.cmo),  libraries  (.cma),  and  C  libraries  specified   with
259              -cclib -lxxx  .   By  default, the current directory is searched
260              first, then the standard library  directory.  Directories  added
261              with  -I  are searched after the current directory, in the order
262              in which they were given on the command  line,  but  before  the
263              standard library directory. See also option -nostdlib.
264
265              If  the  given  directory starts with +, it is taken relative to
266              the standard library directory. For instance,  -I +compiler-libs
267              adds  the  subdirectory compiler-libs of the standard library to
268              the search path.
269
270       -impl filename
271              Compile the file filename as an implementation file, even if its
272              extension is not .ml.
273
274       -intf filename
275              Compile  the file filename as an interface file, even if its ex‐
276              tension is not .mli.
277
278       -intf-suffix string
279              Recognize file names ending with string as interface files  (in‐
280              stead of the default .mli).
281
282       -keep-docs
283              Keep documentation strings in generated .cmi files.
284
285       -keep-locs
286              Keep locations in generated .cmi files.
287
288       -labels
289              Labels  are not ignored in types, labels may be used in applica‐
290              tions, and labelled parameters can be given in any order.   This
291              is the default.
292
293       -linkall
294              Force  all  modules  contained  in libraries to be linked in. If
295              this flag is not given, unreferenced modules are not linked  in.
296              When building a library (option -a), setting the -linkall option
297              forces all subsequent links of programs involving  that  library
298              to  link all the modules contained in the library.  When compil‐
299              ing a module (option -c), setting the  -linkall  option  ensures
300              that this module will always be linked if it is put in a library
301              and this library is linked.
302
303       -make-runtime
304              Build a custom runtime system (in the file specified  by  option
305              -o)  incorporating the C object files and libraries given on the
306              command line.  This custom runtime system can be used  later  to
307              execute   bytecode   executables   produced   with   the  option
308              ocamlc -use-runtime runtime-name.
309
310       -match-context-rows
311              Set number of rows of context used during pattern matching  com‐
312              pilation.  Lower values cause faster compilation, but less opti‐
313              mized code. The default value is 32.
314
315       -no-alias-deps
316              Do not record dependencies for module aliases.
317
318       -no-app-funct
319              Deactivates the applicative behaviour of functors. With this op‐
320              tion, each functor application generates new types in its result
321              and applying the same functor twice to the same argument  yields
322              two incompatible structures.
323
324       -noassert
325              Do not compile assertion checks.  Note that the special form as‐
326              sert false is always compiled because  it  is  typed  specially.
327              This flag has no effect when linking already-compiled files.
328
329       -noautolink
330              When  linking  .cma libraries, ignore -custom, -cclib and -ccopt
331              options potentially contained in the libraries (if these options
332              were  given when building the libraries).  This can be useful if
333              a library contains incorrect specifications of C libraries or  C
334              options;  in this case, during linking, set -noautolink and pass
335              the correct C libraries and options on the command line.
336
337       -nolabels
338              Ignore non-optional labels in types. Labels cannot  be  used  in
339              applications, and parameter order becomes strict.
340
341       -nostdlib
342              Do  not  automatically add the standard library directory to the
343              list  of  directories  searched  for  compiled  interface  files
344              (.cmi), compiled object code files (.cmo), libraries (.cma), and
345              C libraries specified with -cclib -lxxx .  See also option -I.
346
347       -o exec-file
348              Specify the name of the output file produced by the linker.  The
349              default  output  name  is a.out, in keeping with the Unix tradi‐
350              tion. If the -a option is given, specify the name of the library
351              produced.  If the -pack option is given, specify the name of the
352              packed object file produced.  If the -output-obj or -output-com‐
353              plete-obj  option  is given, specify the name of the output file
354              produced.  This can also be used when compiling an interface  or
355              implementation  file, without linking, in which case it sets the
356              name of the cmi or cmo file, and also sets the  module  name  to
357              the file name up to the first dot.
358
359       -opaque
360              Interface  file  compiled  with  this  option are marked so that
361              other compilation units depending on it will not rely on any im‐
362              plementation  details of the compiled implementation. The native
363              compiler will not access the .cmx file of this unit -- nor  warn
364              if it is absent. This can improve speed of compilation, for both
365              initial and incremental builds, at the expense of performance of
366              the generated code.
367
368       -open module
369              Opens the given module before processing the interface or imple‐
370              mentation files. If several -open options are  given,  they  are
371              processed  in  order,  just as if the statements open! module1;;
372              ... open! moduleN;; were added at the top of each file.
373
374       -output-obj
375              Cause the linker to produce a C object file instead of  a  byte‐
376              code  executable  file. This is useful to wrap OCaml code as a C
377              library, callable from any C program. The name of the output ob‐
378              ject  file  must be set with the -o option. This option can also
379              be used to produce a C source file (.c extension) or a  compiled
380              shared/dynamic library (.so extension).
381
382       -output-complete-obj
383              Same as -output-obj except when creating an object file where it
384              includes the runtime and autolink libraries.
385
386       -pack  Build a bytecode object file (.cmo file) and its associated com‐
387              piled  interface  (.cmi) that combines the object files given on
388              the command line, making them appear as sub-modules of the  out‐
389              put  .cmo  file.  The name of the output .cmo file must be given
390              with       the       -o       option.        For       instance,
391              ocamlc -pack -o p.cmo a.cmo b.cmo c.cmo generates compiled files
392              p.cmo and p.cmi describing a compilation unit having three  sub-
393              modules  A, B and C, corresponding to the contents of the object
394              files a.cmo, b.cmo and c.cmo.  These contents can be  referenced
395              as P.A, P.B and P.C in the remainder of the program.
396
397       -pp command
398              Cause  the  compiler to call the given command as a preprocessor
399              for each source file. The output of command is redirected to  an
400              intermediate  file,  which is compiled. If there are no compila‐
401              tion errors, the intermediate file is  deleted  afterwards.  The
402              name  of this file is built from the basename of the source file
403              with the extension .ppi for an interface (.mli)  file  and  .ppo
404              for an implementation (.ml) file.
405
406       -ppx command
407              After  parsing,  pipe  the abstract syntax tree through the pre‐
408              processor command.  The module Ast_mapper(3) implements the  ex‐
409              ternal interface of a preprocessor.
410
411       -principal
412              Check  information  path during type-checking, to make sure that
413              all types are derived in a principal way.  When  using  labelled
414              arguments  and/or  polymorphic methods, this flag is required to
415              ensure future versions of the compiler will  be  able  to  infer
416              types  correctly,  even if internal algorithms change.  All pro‐
417              grams accepted in -principal mode are also accepted in  the  de‐
418              fault  mode  with  equivalent types, but different binary signa‐
419              tures, and this may slow down type checking; yet it  is  a  good
420              idea to use it once before publishing source code.
421
422       -rectypes
423              Allow  arbitrary  recursive  types during type-checking.  By de‐
424              fault, only recursive types where the recursion goes through  an
425              object  type  are  supported. Note that once you have created an
426              interface using this flag, you must use it again for all  depen‐
427              dencies.
428
429       -runtime-variant suffix
430              Add  suffix to the name of the runtime library that will be used
431              by the program.  If OCaml was configured with  option  -with-de‐
432              bug-runtime,  then  the  d suffix is supported and gives a debug
433              version of the runtime.
434
435       -stop-after pass
436              Stop compilation after the given compilation pass. The currently
437              supported passes are: parsing, typing.
438
439       -safe-string
440              Enforce  the  separation between types string and bytes, thereby
441              making strings read-only. This is the default.
442
443       -short-paths
444              When a type is  visible  under  several  module-paths,  use  the
445              shortest  one  when  printing the type's name in inferred inter‐
446              faces and error and warning messages.
447
448       -strict-sequence
449              Force the left-hand part of each sequence to have type unit.
450
451       -unboxed-types
452              When a type is unboxable (i.e. a record with a  single  argument
453              or  a  concrete  datatype with a single constructor of one argu‐
454              ment) it will be unboxed unless annotated with [@@ocaml.boxed].
455
456       -no-unboxed-types
457              When a type is unboxable  it will be boxed unless annotated with
458              [@@ocaml.unboxed].  This is the default.
459
460       -unsafe
461              Turn  bound  checking  off  for  array  and string accesses (the
462              v.(i)ands.[i] constructs). Programs compiled  with  -unsafe  are
463              therefore  slightly  faster,  but unsafe: anything can happen if
464              the program accesses an array or string outside of its bounds.
465
466       -unsafe-string
467              Identify the  types  string and bytes,  thereby  making  strings
468              writable.   This  is  intended for compatibility with old source
469              code and should not be used with new software.
470
471       -use-runtime runtime-name
472              Generate a bytecode executable file that can be executed on  the
473              custom   runtime   system   runtime-name,   built  earlier  with
474              ocamlc -make-runtime runtime-name.
475
476       -v     Print the version number of the compiler and the location of the
477              standard library directory, then exit.
478
479       -verbose
480              Print all external commands before they are executed, in partic‐
481              ular invocations of the C compiler and linker in  -custom  mode.
482              Useful to debug C library problems.
483
484       -vnum or -version
485              Print  the  version  number  of the compiler in short form (e.g.
486              "3.11.0"), then exit.
487
488       -w warning-list
489              Enable, disable, or mark as fatal the warnings specified by  the
490              argument warning-list.
491
492              Each warning can be enabled or disabled, and each warning can be
493              fatal or non-fatal.  If a warning is  disabled,  it  isn't  dis‐
494              played  and doesn't affect compilation in any way (even if it is
495              fatal).  If a warning is enabled, it is  displayed  normally  by
496              the compiler whenever the source code triggers it.  If it is en‐
497              abled and fatal, the compiler will also stop with an error after
498              displaying it.
499
500              The warning-list argument is either a mnemonic warning specifier
501              or a sequence of single character warning  specifiers,  with  no
502              separators  between them. A mnemonic warning specifier is one of
503              the following
504
505              +name   Enable warning name.
506
507              -name   Disable warning name.
508
509              @name   Enable and mark as fatal warning name.
510
511              A single character warning specifier is one of the following:
512
513              +num   Enable warning number num.
514
515              -num   Disable warning number num.
516
517              @num   Enable and mark as fatal warning number num.
518
519              +num1..num2   Enable all warnings between num1 and num2  (inclu‐
520              sive).
521
522              -num1..num2   Disable all warnings between num1 and num2 (inclu‐
523              sive).
524
525              @num1..num2   Enable and mark as fatal all warnings between num1
526              and num2 (inclusive).
527
528              +letter    Enable  the  set of warnings corresponding to letter.
529              The letter may be uppercase or lowercase.
530
531              -letter   Disable the set of warnings corresponding  to  letter.
532              The letter may be uppercase or lowercase.
533
534              @letter    Enable  and  mark as fatal the set of warnings corre‐
535              sponding to letter.  The letter may be uppercase or lowercase.
536
537              uppercase-letter   Enable the set of warnings  corresponding  to
538              uppercase-letter.
539
540              lowercase-letter    Disable the set of warnings corresponding to
541              lowercase-letter.
542
543              The warning numbers and mnemonic names are as follows.
544
545              1 [comment-start]
546              Suspicious-looking start-of-comment mark.
547
548              2 [comment-not-end]
549              Suspicious-looking end-of-comment mark.
550
551              3
552              Deprecated feature.
553
554              4 [fragile-match]
555              Fragile pattern matching: matching  that  will  remain  complete
556              even  if additional constructors are added to one of the variant
557              types matched.
558
559              5 [ignored-partial-application]
560              Partially applied function: expression whose result has function
561              type and is ignored.
562
563              6 [labels-omitted]
564              Label omitted in function application.
565
566              7 [method-override]
567              Method overridden without using the "method!" keyword.
568
569              8 [partial-match]
570              Partial match: missing cases in pattern-matching.
571
572              9 [missing-record-field-pattern]
573              Missing fields in a record pattern.
574
575              10 [non-unit-statement]
576              Expression on the left-hand side of a sequence that doesn't have
577              type unit (and that is not a function, see warning number 5).
578
579              11 [redundant-case]
580              Redundant case in a pattern matching (unused match case).
581
582              12 [redundant-subpat]
583              Redundant sub-pattern in a pattern-matching.
584
585              13 [instance-variable-override]
586              Override of an instance variable.
587
588              14 [illegal-backslash]
589              Illegal backslash escape in a string constant.
590
591              15 [implicit-public-methods]
592              Private method made public implicitly.
593
594              16 [unerasable-optional-argument]
595              Unerasable optional argument.
596
597              17 [undeclared-virtual-method]
598              Undeclared virtual method.
599
600              18 [not-principal]
601              Non-principal type.
602
603              19 [non-principal-labels]
604              Type without principality.
605
606              20 [ignored-extra-argument]
607              Unused function argument.
608
609              21 [nonreturning-statement]
610              Non-returning statement.
611
612              22 [preprocessor]
613              Preprocessor warning.
614
615              23 [useless-record-with]
616              Useless record with clause.
617
618              24 [bad-module-name]
619              Bad module name: the source file name is not a valid OCaml  mod‐
620              ule name.
621
622              25
623              Deprecated: now part of warning 8.
624
625              26 [unused-var]
626              Suspicious  unused  variable: unused variable that is bound with
627              let or as, and doesn't start with an underscore (_) character.
628
629              27 [unused-var-strict]
630              Innocuous unused variable: unused variable  that  is  not  bound
631              with  let nor as, and doesn't start with an underscore (_) char‐
632              acter.
633
634              28 [wildcard-arg-to-constant-constr]
635              A pattern contains a constant constructor applied to the  under‐
636              score (_) pattern.
637
638              29 [eol-in-string]
639              A  non-escaped end-of-line was found in a string constant.  This
640              may cause portability problems between Unix and Windows.
641
642              30 [duplicate-definitions]
643              Two labels or constructors of the same name are defined  in  two
644              mutually recursive types.
645
646              31 [module-linked-twice]
647              A module is linked twice in the same executable.
648
649              32 [unused-value-declaration]
650              Unused value declaration.
651
652              33 [unused-open]
653              Unused open statement.
654
655              34 [unused-type-declaration]
656              Unused type declaration.
657
658              35 [unused-for-index]
659              Unused for-loop index.
660
661              36 [unused-ancestor]
662              Unused ancestor variable.
663
664              37 [unused-constructor]
665              Unused constructor.
666
667              38 [unused-extension]
668              Unused extension constructor.
669
670              39 [unused-rec-flag]
671              Unused rec flag.
672
673              40 [name-out-of-scope]
674              Constructor or label name used out of scope.
675
676              41 [ambiguous-name]
677              Ambiguous constructor or label name.
678
679              42 [disambiguated-name]
680              Disambiguated constructor or label name.
681
682              43 [nonoptional-label]
683              Nonoptional label applied as optional.
684
685              44 [open-shadow-identifier]
686              Open statement shadows an already defined identifier.
687
688              45 [open-shadow-label-constructor]
689              Open statement shadows an already defined label or constructor.
690
691              46 [bad-env-variable]
692              Error in environment variable.
693
694              47 [attribute-payload]
695              Illegal attribute payload.
696
697              48 [eliminated-optional-arguments]
698              Implicit elimination of optional arguments.
699
700              49 [no-cmi-file]
701              Missing cmi file when looking up module alias.
702
703              50 [unexpected-docstring]
704              Unexpected documentation comment.
705
706              51 [wrong-tailcall-expectation]
707              Function call annotated with an incorrect @tailcall attribute
708
709              52 [fragile-literal-pattern]
710              Fragile constant pattern.
711
712              53 [misplaced-attribute]
713              Attribute cannot appear in this context.
714
715              54 [duplicated-attribute]
716              Attribute used more than once on an expression.
717
718              55 [inlining-impossible]
719              Inlining impossible.
720
721              56 [unreachable-case]
722              Unreachable  case  in a pattern-matching (based on type informa‐
723              tion).
724
725              57 [ambiguous-var-in-pattern-guard]
726              Ambiguous or-pattern variables under guard.
727
728              58 [no-cmx-file]
729              Missing cmx file.
730
731
732              59 [flambda-assignment-to-non-mutable-value]
733              Assignment on non-mutable value.
734
735              60 [unused-module]
736              Unused module declaration.
737
738              61 [unboxable-type-in-prim-decl]
739              Unannotated unboxable type in primitive declaration.
740
741              62 [constraint-on-gadt]
742              Type constraint on GADT type declaration.
743
744              63 [erroneous-printed-signature]
745              Erroneous printed signature.
746
747              64 [unsafe-array-syntax-without-parsing]
748              -unsafe used with a preprocessor returning a syntax tree.
749
750              65 [redefining-unit]
751              Type declaration defining a new '()' constructor.
752
753              66 [unused-open-bang]
754              Unused open! statement.
755
756              67 [unused-functor-parameter]
757              Unused functor parameter.
758
759              68 [match-on-mutable-state-prevent-uncurry]
760              Pattern-matching depending on mutable state prevents the remain‐
761              ing arguments from being uncurried.
762
763              69 [unused-field]
764              Unused record field.
765
766              70 [missing-mli]
767              Missing interface file.
768
769              71 [unused-tmc-attribute]
770              Unused @tail_mod_cons attribute
771
772              72 [tmc-breaks-tailcall]
773              A tail call is turned into a non-tail call by the @tail_mod_cons
774              transformation.
775
776
777              The letters stand for the following sets of warnings.  Any  let‐
778              ter not mentioned here corresponds to the empty set.
779
780              A  all warnings
781
782              C  1, 2
783
784              D  3
785
786              E  4
787
788              F  5
789
790              K  32, 33, 34, 35, 36, 37, 38, 39
791
792              L  6
793
794              M  7
795
796              P  8
797
798              R  9
799
800              S  10
801
802              U  11, 12
803
804              V  13
805
806              X  14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 30
807
808              Y  26
809
810              Z  27
811
812
813              The               default               setting               is
814              -w +a-4-7-9-27-29-30-32..42-44-45-48-50-60-66..70.   Note   that
815              warnings 5 and 10 are not always triggered, depending on the in‐
816              ternals of the type checker.
817
818       -warn-error warning-list
819              Mark as errors the warnings  specified  in  the  argument  warn‐
820              ing-list.   The  compiler  will  stop  with an error when one of
821              these warnings is emitted.  The warning-list has the same  mean‐
822              ing  as  for  the  -w  option: a + sign (or an uppercase letter)
823              marks the corresponding warnings as fatal, a - sign (or a lower‐
824              case  letter)  turns  them back into non-fatal warnings, and a @
825              sign both enables and marks as fatal the corresponding warnings.
826
827              Note: it is not recommended to use  the  -warn-error  option  in
828              production  code,  because it will almost certainly prevent com‐
829              piling your program with later versions of OCaml when  they  add
830              new warnings or modify existing warnings.
831
832              The default setting is -warn-error -a+31 (only warning 31 is fa‐
833              tal).
834
835       -warn-help
836              Show the description of all available warning numbers.
837
838       -where Print the location of the standard library, then exit.
839
840       -with-runtime
841              Include the runtime system in the generated program. This is the
842              default.
843
844       -without-runtime
845              The  compiler  does not include the runtime system (nor a refer‐
846              ence to it) in the generated program; it must be supplied  sepa‐
847              rately.
848
849       - file Process  file  as a file name, even if it starts with a dash (-)
850              character.
851
852       -help or --help
853              Display a short usage summary and exit.
854
855

SEE ALSO

857       ocamlopt(1), ocamlrun(1), ocaml(1).
858       The OCaml user's manual, chapter "Batch compilation".
859
860
861
862                                                                     OCAMLC(1)
Impressum