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

SEE ALSO

862       ocamlopt(1), ocamlrun(1), ocaml(1).
863       The OCaml user's manual, chapter "Batch compilation".
864
865
866
867                                                                     OCAMLC(1)
Impressum