1 .\"**************************************************************************
2 .\"* *
3 .\"* OCaml *
4 .\"* *
5 .\"* Xavier Leroy, projet Cristal, INRIA Rocquencourt *
6 .\"* *
7 .\"* Copyright 1996 Institut National de Recherche en Informatique et *
8 .\"* en Automatique. *
9 .\"* *
10 .\"* All rights reserved. This file is distributed under the terms of *
11 .\"* the GNU Lesser General Public License version 2.1, with the *
12 .\"* special exception on linking described in the file LICENSE. *
13 .\"* *
14 .\"**************************************************************************
15 .\"
16 .TH OCAMLC 1
17
18 .SH NAME
19 ocamlc \- The OCaml bytecode compiler
20
21 .SH SYNOPSIS
22 .B ocamlc
23 [
24 .I options
25 ]
26 .I filename ...
27
28 .B ocamlc.opt
29 [
30 .I options
31 ]
32 .I filename ...
33
34 .SH DESCRIPTION
35
36 The OCaml bytecode compiler
37 .BR ocamlc (1)
38 compiles OCaml source files to bytecode object files and links
39 these object files to produce standalone bytecode executable files.
40 These executable files are then run by the bytecode interpreter
41 .BR ocamlrun (1).
42
43 The
44 .BR ocamlc (1)
45 command has a command-line interface similar to the one of
46 most C compilers. It accepts several types of arguments and processes them
47 sequentially, after all options have been processed:
48
49 Arguments ending in .mli are taken to be source files for
50 compilation unit interfaces. Interfaces specify the names exported by
51 compilation units: they declare value names with their types, define
52 public data types, declare abstract data types, and so on. From the
53 file
54 .IR x \&.mli,
55 the
56 .BR ocamlc (1)
57 compiler produces a compiled interface
58 in the file
59 .IR x \&.cmi.
60
61 Arguments ending in .ml are taken to be source files for compilation
62 unit implementations. Implementations provide definitions for the
63 names exported by the unit, and also contain expressions to be
64 evaluated for their side-effects. From the file
65 .IR x \&.ml,
66 the
67 .BR ocamlc (1)
68 compiler produces compiled object bytecode in the file
69 .IR x \&.cmo.
70
71 If the interface file
72 .IR x \&.mli
73 exists, the implementation
74 .IR x \&.ml
75 is checked against the corresponding compiled interface
76 .IR x \&.cmi,
77 which is assumed to exist. If no interface
78 .IR x \&.mli
79 is provided, the compilation of
80 .IR x \&.ml
81 produces a compiled interface file
82 .IR x \&.cmi
83 in addition to the compiled object code file
84 .IR x \&.cmo.
85 The file
86 .IR x \&.cmi
87 produced
88 corresponds to an interface that exports everything that is defined in
89 the implementation
90 .IR x \&.ml.
91
92 Arguments ending in .cmo are taken to be compiled object bytecode. These
93 files are linked together, along with the object files obtained
94 by compiling .ml arguments (if any), and the OCaml standard
95 library, to produce a standalone executable program. The order in
96 which .cmo and.ml arguments are presented on the command line is
97 relevant: compilation units are initialized in that order at
98 run-time, and it is a link-time error to use a component of a unit
99 before having initialized it. Hence, a given
100 .IR x \&.cmo
101 file must come before all .cmo files that refer to the unit
102 .IR x .
103
104 Arguments ending in .cma are taken to be libraries of object bytecode.
105 A library of object bytecode packs in a single file a set of object
106 bytecode files (.cmo files). Libraries are built with
107 .B ocamlc\ \-a
108 (see the description of the
109 .B \-a
110 option below). The object files
111 contained in the library are linked as regular .cmo files (see above),
112 in the order specified when the .cma file was built. The only
113 difference is that if an object file
114 contained in a library is not referenced anywhere in the program, then
115 it is not linked in.
116
117 Arguments ending in .c are passed to the C compiler, which generates
118 a .o object file. This object file is linked with the program if the
119 .B \-custom
120 flag is set (see the description of
121 .B \-custom
122 below).
123
124 Arguments ending in .o or .a are assumed to be C object files and
125 libraries. They are passed to the C linker when linking in
126 .B \-custom
127 mode (see the description of
128 .B \-custom
129 below).
130
131 Arguments ending in .so
132 are assumed to be C shared libraries (DLLs). During linking, they are
133 searched for external C functions referenced from the OCaml code,
134 and their names are written in the generated bytecode executable.
135 The run-time system
136 .BR ocamlrun (1)
137 then loads them dynamically at program start-up time.
138
139 The output of the linking phase is a file containing compiled bytecode
140 that can be executed by the OCaml bytecode interpreter:
141 the command
142 .BR ocamlrun (1).
143 If
144 .B caml.out
145 is the name of the file produced by the linking phase, the command
146 .B ocamlrun caml.out
147 .IR arg1 \ \ arg2 \ ... \ argn
148 executes the compiled code contained in
149 .BR caml.out ,
150 passing it as arguments the character strings
151 .I arg1
152 to
153 .IR argn .
154 (See
155 .BR ocamlrun (1)
156 for more details.)
157
158 On most systems, the file produced by the linking
159 phase can be run directly, as in:
160 .B ./caml.out
161 .IR arg1 \ \ arg2 \ ... \ argn .
162 The produced file has the executable bit set, and it manages to launch
163 the bytecode interpreter by itself.
164
165 .B ocamlc.opt
166 is the same compiler as
167 .BR ocamlc ,
168 but compiled with the native-code compiler
169 .BR ocamlopt (1).
170 Thus, it behaves exactly like
171 .BR ocamlc ,
172 but compiles faster.
173 .B ocamlc.opt
174 may not be available in all installations of OCaml.
175
176 .SH OPTIONS
177
178 The following command-line options are recognized by
179 .BR ocamlc (1).
180 .TP
181 .B \-a
182 Build a library (.cma file) with the object files (.cmo files) given
183 on the command line, instead of linking them into an executable
184 file. The name of the library must be set with the
185 .B \-o
186 option.
187 .IP
188 If
189 .BR \-custom , \ \-cclib \ or \ \-ccopt
190 options are passed on the command
191 line, these options are stored in the resulting .cma library. Then,
192 linking with this library automatically adds back the
193 .BR \-custom , \ \-cclib \ and \ \-ccopt
194 options as if they had been provided on the
195 command line, unless the
196 .B \-noautolink
197 option is given. Additionally, a substring
198 .B $CAMLORIGIN
199 inside a
200 .BR \ \-ccopt
201 options will be replaced by the full path to the .cma library,
202 excluding the filename.
203 .B \-absname
204 Show absolute filenames in error messages.
205 .TP
206 .B \-annot
207 Dump detailed information about the compilation (types, bindings,
208 tail-calls, etc). The information for file
209 .IR src .ml
210 is put into file
211 .IR src .annot.
212 In case of a type error, dump all the information inferred by the
213 type-checker before the error. The
214 .IR src .annot
215 file can be used with the emacs commands given in
216 .B emacs/caml\-types.el
217 to display types and other annotations interactively.
218 .TP
219 .B \-bin\-annot
220 Dump detailed information about the compilation (types, bindings,
221 tail-calls, etc) in binary format. The information for file
222 .IR src .ml
223 is put into file
224 .IR src .cmt.
225 In case of a type error, dump
226 all the information inferred by the type-checker before the error.
227 The annotation files produced by
228 .B \-bin\-annot
229 contain more information
230 and are much more compact than the files produced by
231 .BR \-annot .
232 .TP
233 .B \-c
234 Compile only. Suppress the linking phase of the
235 compilation. Source code files are turned into compiled files, but no
236 executable file is produced. This option is useful to
237 compile modules separately.
238 .TP
239 .BI \-cc \ ccomp
240 Use
241 .I ccomp
242 as the C linker when linking in "custom runtime" mode (see the
243 .B \-custom
244 option) and as the C compiler for compiling .c source files.
245 .TP
246 .BI \-cclib\ -l libname
247 Pass the
248 .BI \-l libname
249 option to the C linker when linking in "custom runtime" mode (see the
250 .B \-custom
251 option). This causes the given C library to be linked with the program.
252 .TP
253 .BI \-ccopt \ option
254 Pass the given
255 .I option
256 to the C compiler and linker, when linking in
257 "custom runtime" mode (see the
258 .B \-custom
259 option). For instance,
260 .BI \-ccopt\ \-L dir
261 causes the C linker to search for C libraries in
262 directory
263 .IR dir .
264 .TP
265 .BI \-color \ mode
266 Enable or disable colors in compiler messages (especially warnings and errors).
267 The following modes are supported:
268
269 .B auto
270 use heuristics to enable colors only if the output supports them (an
271 ANSI-compatible tty terminal);
272
273 .B always
274 enable colors unconditionally;
275
276 .B never
277 disable color output.
278
279 The default setting is
280 .B auto,
281 and the current heuristic
282 checks that the "TERM" environment variable exists and is
283 not empty or "dumb", and that isatty(stderr) holds.
284
285 The environment variable "OCAML_COLOR" is considered if \-color is not
286 provided. Its values are auto/always/never as above.
287
288 .TP
289 .BI \-error\-style \ mode
290 Control the way error messages and warnings are printed.
291 The following modes are supported:
292
293 .B short
294 only print the error and its location;
295
296 .B contextual
297 like "short", but also display the source code snippet corresponding
298 to the location of the error.
299
300 The default setting is
301 .B contextual.
302
303 The environment variable "OCAML_ERROR_STYLE" is considered if
304 \-error\-style is not provided. Its values are short/contextual as
305 above.
306
307 .TP
308 .B \-compat\-32
309 Check that the generated bytecode executable can run on 32-bit
310 platforms and signal an error if it cannot. This is useful when
311 compiling bytecode on a 64-bit machine.
312 .TP
313 .B \-config
314 Print the version number of
315 .BR ocamlc (1)
316 and a detailed summary of its configuration, then exit.
317 .TP
318 .BI \-config-var
319 Print the value of a specific configuration variable
320 from the
321 .B \-config
322 output, then exit. If the variable does not exist,
323 the exit code is non-zero.
324 .TP
325 .B \-custom
326 Link in "custom runtime" mode. In the default linking mode, the
327 linker produces bytecode that is intended to be executed with the
328 shared runtime system,
329 .BR ocamlrun (1).
330 In the custom runtime mode, the
331 linker produces an output file that contains both the runtime system
332 and the bytecode for the program. The resulting file is larger, but it
333 can be executed directly, even if the
334 .BR ocamlrun (1)
335 command is not
336 installed. Moreover, the "custom runtime" mode enables linking OCaml
337 code with user-defined C functions.
338
339 Never use the
340 .BR strip (1)
341 command on executables produced by
342 .BR ocamlc\ \-custom ,
343 this would remove the bytecode part of the executable.
344
345 Security warning: never set the "setuid" or "setgid" bits on
346 executables produced by
347 .BR ocamlc\ \-custom ,
348 this would make them vulnerable to attacks.
349 .TP
350 .BI \-depend\ ocamldep-args
351 Compute dependencies, as ocamldep would do.
352 .TP
353 .BI \-dllib\ \-l libname
354 Arrange for the C shared library
355 .BI dll libname .so
356 to be loaded dynamically by the run-time system
357 .BR ocamlrun (1)
358 at program start-up time.
359 .TP
360 .BI \-dllpath \ dir
361 Adds the directory
362 .I dir
363 to the run-time search path for shared
364 C libraries. At link-time, shared libraries are searched in the
365 standard search path (the one corresponding to the
366 .B \-I
367 option).
368 The
369 .B \-dllpath
370 option simply stores
371 .I dir
372 in the produced
373 executable file, where
374 .BR ocamlrun (1)
375 can find it and use it.
376 .TP
377 .BI \-for\-pack \ module\-path
378 Generate an object file (.cmo file) that can later be included
379 as a sub-module (with the given access path) of a compilation unit
380 constructed with
381 .BR \-pack .
382 For instance,
383 .B ocamlc\ \-for\-pack\ P\ \-c\ A.ml
384 will generate a.cmo that can later be used with
385 .BR "ocamlc -pack -o P.cmo a.cmo" .
386 Note: you can still pack a module that was compiled without
387 .B \-for\-pack
388 but in this case exceptions will be printed with the wrong names.
389 .TP
390 .B \-g
391 Add debugging information while compiling and linking. This option is
392 required in order to be able to debug the program with
393 .BR ocamldebug (1)
394 and to produce stack backtraces when
395 the program terminates on an uncaught exception.
396 .TP
397 .B \-i
398 Cause the compiler to print all defined names (with their inferred
399 types or their definitions) when compiling an implementation (.ml
400 file). No compiled files (.cmo and .cmi files) are produced.
401 This can be useful to check the types inferred by the
402 compiler. Also, since the output follows the syntax of interfaces, it
403 can help in writing an explicit interface (.mli file) for a file: just
404 redirect the standard output of the compiler to a .mli file, and edit
405 that file to remove all declarations of unexported names.
406 .TP
407 .BI \-I \ directory
408 Add the given directory to the list of directories searched for
409 compiled interface files (.cmi), compiled object code files
410 (.cmo), libraries (.cma), and C libraries specified with
411 .BI \-cclib\ \-l xxx
412 .RB .
413 By default, the current directory is searched first, then the
414 standard library directory. Directories added with
415 .B \-I
416 are searched
417 after the current directory, in the order in which they were given on
418 the command line, but before the standard library directory. See also
419 option
420 .BR \-nostdlib .
421
422 If the given directory starts with
423 .BR + ,
424 it is taken relative to the
425 standard library directory. For instance,
426 .B \-I\ +compiler-libs
427 adds the subdirectory
428 .B compiler-libs
429 of the standard library to the search path.
430 .TP
431 .BI \-impl \ filename
432 Compile the file
433 .I filename
434 as an implementation file, even if its extension is not .ml.
435 .TP
436 .BI \-intf \ filename
437 Compile the file
438 .I filename
439 as an interface file, even if its extension is not .mli.
440 .TP
441 .BI \-intf\-suffix \ string
442 Recognize file names ending with
443 .I string
444 as interface files (instead of the default .mli).
445 .TP
446 .B \-keep-docs
447 Keep documentation strings in generated .cmi files.
448 .TP
449 .B \-keep-locs
450 Keep locations in generated .cmi files.
451 .TP
452 .B \-labels
453 Labels are not ignored in types, labels may be used in applications,
454 and labelled parameters can be given in any order. This is the default.
455 .TP
456 .B \-linkall
457 Force all modules contained in libraries to be linked in. If this
458 flag is not given, unreferenced modules are not linked in. When
459 building a library (option
460 .BR \-a ),
461 setting the
462 .B \-linkall
463 option forces all subsequent links of programs involving that library
464 to link all the modules contained in the library.
465 When compiling a module (option
466 .BR \-c ),
467 setting the
468 .B \-linkall
469 option ensures that this module will
470 always be linked if it is put in a library and this library is linked.
471 .TP
472 .B \-make\-runtime
473 Build a custom runtime system (in the file specified by option
474 .BR \-o )
475 incorporating the C object files and libraries given on the command
476 line. This custom runtime system can be used later to execute
477 bytecode executables produced with the option
478 .B ocamlc\ \-use\-runtime
479 .IR runtime-name .
480 .TP
481 .B \-match\-context\-rows
482 Set number of rows of context used during pattern matching
483 compilation. Lower values cause faster compilation, but
484 less optimized code. The default value is 32.
485 .TP
486 .B \-no-alias-deps
487 Do not record dependencies for module aliases.
488 .TP
489 .B \-no\-app\-funct
490 Deactivates the applicative behaviour of functors. With this option,
491 each functor application generates new types in its result and
492 applying the same functor twice to the same argument yields two
493 incompatible structures.
494 .TP
495 .B \-noassert
496 Do not compile assertion checks. Note that the special form
497 .B assert\ false
498 is always compiled because it is typed specially.
499 This flag has no effect when linking already-compiled files.
500 .TP
501 .B \-noautolink
502 When linking .cma libraries, ignore
503 .BR \-custom , \ \-cclib \ and \ \-ccopt
504 options potentially contained in the libraries (if these options were
505 given when building the libraries). This can be useful if a library
506 contains incorrect specifications of C libraries or C options; in this
507 case, during linking, set
508 .B \-noautolink
509 and pass the correct C libraries and options on the command line.
510 .TP
511 .B \-nolabels
512 Ignore non-optional labels in types. Labels cannot be used in
513 applications, and parameter order becomes strict.
514 .TP
515 .B \-nostdlib
516 Do not automatically add the standard library directory to the list of
517 directories searched for compiled interface files (.cmi), compiled
518 object code files (.cmo), libraries (.cma), and C libraries specified
519 with
520 .BI \-cclib\ \-l xxx
521 .RB .
522 See also option
523 .BR \-I .
524 .TP
525 .BI \-o \ exec\-file
526 Specify the name of the output file produced by the linker. The
527 default output name is
528 .BR a.out ,
529 in keeping with the Unix tradition. If the
530 .B \-a
531 option is given, specify the name of the library
532 produced. If the
533 .B \-pack
534 option is given, specify the name of the
535 packed object file produced. If the
536 .B \-output\-obj
537 option is given,
538 specify the name of the output file produced.
539 This can also be used when compiling an interface or implementation
540 file, without linking, in which case it sets the name of the cmi or
541 cmo file, and also sets the module name to the file name up to the
542 first dot.
543 .TP
544 .B \-opaque
545 Interface file compiled with this option are marked so that other
546 compilation units depending on it will not rely on any implementation
547 details of the compiled implementation. The native compiler will not
548 access the .cmx file of this unit -- nor warn if it is absent. This can
549 improve speed of compilation, for both initial and incremental builds,
550 at the expense of performance of the generated code.
551 .TP
552 .BI \-open \ module
553 Opens the given module before processing the interface or
554 implementation files. If several
555 .B \-open
556 options are given, they are processed in order, just as if
557 the statements open! module1;; ... open! moduleN;; were added
558 at the top of each file.
559 .TP
560 .B \-output\-obj
561 Cause the linker to produce a C object file instead of a bytecode
562 executable file. This is useful to wrap OCaml code as a C library,
563 callable from any C program. The name of the output object file
564 must be set with the
565 .B \-o
566 option. This
567 option can also be used to produce a C source file (.c extension) or
568 a compiled shared/dynamic library (.so extension).
569 .TP
570 .B \-pack
571 Build a bytecode object file (.cmo file) and its associated compiled
572 interface (.cmi) that combines the object
573 files given on the command line, making them appear as sub-modules of
574 the output .cmo file. The name of the output .cmo file must be
575 given with the
576 .B \-o
577 option. For instance,
578 .B ocamlc\ \-pack\ \-o\ p.cmo\ a.cmo\ b.cmo\ c.cmo
579 generates compiled files p.cmo and p.cmi describing a compilation
580 unit having three sub-modules A, B and C, corresponding to the
581 contents of the object files a.cmo, b.cmo and c.cmo. These
582 contents can be referenced as P.A, P.B and P.C in the remainder
583 of the program.
584 .TP
585 .BI \-pp \ command
586 Cause the compiler to call the given
587 .I command
588 as a preprocessor for each source file. The output of
589 .I command
590 is redirected to
591 an intermediate file, which is compiled. If there are no compilation
592 errors, the intermediate file is deleted afterwards. The name of this
593 file is built from the basename of the source file with the
594 extension .ppi for an interface (.mli) file and .ppo for an
595 implementation (.ml) file.
596 .TP
597 .BI \-ppx \ command
598 After parsing, pipe the abstract syntax tree through the preprocessor
599 .IR command .
600 The module
601 .BR Ast_mapper (3)
602 implements the external interface of a preprocessor.
603 .TP
604 .B \-principal
605 Check information path during type-checking, to make sure that all
606 types are derived in a principal way. When using labelled arguments
607 and/or polymorphic methods, this flag is required to ensure future
608 versions of the compiler will be able to infer types correctly, even
609 if internal algorithms change.
610 All programs accepted in
611 .B \-principal
612 mode are also accepted in the
613 default mode with equivalent types, but different binary signatures,
614 and this may slow down type checking; yet it is a good idea to
615 use it once before publishing source code.
616 .TP
617 .B \-rectypes
618 Allow arbitrary recursive types during type-checking. By default,
619 only recursive types where the recursion goes through an object type
620 are supported. Note that once you have created an interface using this
621 flag, you must use it again for all dependencies.
622 .TP
623 .BI \-runtime\-variant \ suffix
624 Add
625 .I suffix
626 to the name of the runtime library that will be used by the program.
627 If OCaml was configured with option
628 .BR \-with\-debug\-runtime ,
629 then the
630 .B d
631 suffix is supported and gives a debug version of the runtime.
632 .TP
633 .BI \-stop\-after \ pass
634 Stop compilation after the given compilation pass. The currently
635 supported passes are:
636 .BR parsing ,
637 .BR typing .
638 .TP
639 .B \-safe\-string
640 Enforce the separation between types
641 .BR string \ and\ bytes ,
642 thereby making strings read-only. This is the default.
643 .TP
644 .B \-short\-paths
645 When a type is visible under several module-paths, use the shortest
646 one when printing the type's name in inferred interfaces and error and
647 warning messages.
648 .TP
649 .B \-strict\-sequence
650 Force the left-hand part of each sequence to have type unit.
651 .TP
652 .B \-unboxed\-types
653 When a type is unboxable (i.e. a record with a single argument or a
654 concrete datatype with a single constructor of one argument) it will
655 be unboxed unless annotated with
656 .BR [@@ocaml.boxed] .
657 .TP
658 .B \-no-unboxed\-types
659 When a type is unboxable it will be boxed unless annotated with
660 .BR [@@ocaml.unboxed] .
661 This is the default.
662 .TP
663 .B \-unsafe
664 Turn bound checking off for array and string accesses (the
665 .BR v.(i) and s.[i]
666 constructs). Programs compiled with
667 .B \-unsafe
668 are therefore
669 slightly faster, but unsafe: anything can happen if the program
670 accesses an array or string outside of its bounds.
671 .TP
672 .B \-unsafe\-string
673 Identify the types
674 .BR string \ and\ bytes ,
675 thereby making strings writable.
676 This is intended for compatibility with old source code and should not
677 be used with new software.
678 .TP
679 .BI \-use\-runtime \ runtime\-name
680 Generate a bytecode executable file that can be executed on the custom
681 runtime system
682 .IR runtime\-name ,
683 built earlier with
684 .B ocamlc\ \-make\-runtime
685 .IR runtime\-name .
686 .TP
687 .B \-v
688 Print the version number of the compiler and the location of the
689 standard library directory, then exit.
690 .TP
691 .B \-verbose
692 Print all external commands before they are executed, in particular
693 invocations of the C compiler and linker in
694 .B \-custom
695 mode. Useful to debug C library problems.
696 .TP
697 .BR \-vnum \ or\ \-version
698 Print the version number of the compiler in short form (e.g. "3.11.0"),
699 then exit.
700 .TP
701 .BI \-w \ warning\-list
702 Enable, disable, or mark as fatal the warnings specified by the argument
703 .IR warning\-list .
704
705 Each warning can be
706 .IR enabled \ or\ disabled ,
707 and each warning can be
708 .IR fatal or
709 .IR non-fatal .
710 If a warning is disabled, it isn't displayed and doesn't affect
711 compilation in any way (even if it is fatal). If a warning is enabled,
712 it is displayed normally by the compiler whenever the source code
713 triggers it. If it is enabled and fatal, the compiler will also stop
714 with an error after displaying it.
715
716 The
717 .I warning\-list
718 argument is a sequence of warning specifiers, with no separators
719 between them. A warning specifier is one of the following:
720
721 .BI + num
722 \ \ Enable warning number
723 .IR num .
724
725 .BI \- num
726 \ \ Disable warning number
727 .IR num .
728
729 .BI @ num
730 \ \ Enable and mark as fatal warning number
731 .IR num .
732
733 .BI + num1 .. num2
734 \ \ Enable all warnings between
735 .I num1
736 and
737 .I num2
738 (inclusive).
739
740 .BI \- num1 .. num2
741 \ \ Disable all warnings between
742 .I num1
743 and
744 .I num2
745 (inclusive).
746
747 .BI @ num1 .. num2
748 \ \ Enable and mark as fatal all warnings between
749 .I num1
750 and
751 .I num2
752 (inclusive).
753
754 .BI + letter
755 \ \ Enable the set of warnings corresponding to
756 .IR letter .
757 The letter may be uppercase or lowercase.
758
759 .BI \- letter
760 \ \ Disable the set of warnings corresponding to
761 .IR letter .
762 The letter may be uppercase or lowercase.
763
764 .BI @ letter
765 \ \ Enable and mark as fatal the set of warnings corresponding to
766 .IR letter .
767 The letter may be uppercase or lowercase.
768
769 .I uppercase\-letter
770 \ \ Enable the set of warnings corresponding to
771 .IR uppercase\-letter .
772
773 .I lowercase\-letter
774 \ \ Disable the set of warnings corresponding to
775 .IR lowercase\-letter .
776
777 The warning numbers are as follows.
778
779 1
780 \ \ \ Suspicious-looking start-of-comment mark.
781
782 2
783 \ \ \ Suspicious-looking end-of-comment mark.
784
785 3
786 \ \ \ Deprecated feature.
787
788 4
789 \ \ \ Fragile pattern matching: matching that will remain
790 complete even if additional constructors are added to one of the
791 variant types matched.
792
793 5
794 \ \ \ Partially applied function: expression whose result has
795 function type and is ignored.
796
797 6
798 \ \ \ Label omitted in function application.
799
800 7
801 \ \ \ Method overridden without using the "method!" keyword
802
803 8
804 \ \ \ Partial match: missing cases in pattern-matching.
805
806 9
807 \ \ \ Missing fields in a record pattern.
808
809 10
810 \ \ Expression on the left-hand side of a sequence that doesn't
811 have type
812 .B unit
813 (and that is not a function, see warning number 5).
814
815 11
816 \ \ Redundant case in a pattern matching (unused match case).
817
818 12
819 \ \ Redundant sub-pattern in a pattern-matching.
820
821 13
822 \ \ Override of an instance variable.
823
824 14
825 \ \ Illegal backslash escape in a string constant.
826
827 15
828 \ \ Private method made public implicitly.
829
830 16
831 \ \ Unerasable optional argument.
832
833 17
834 \ \ Undeclared virtual method.
835
836 18
837 \ \ Non-principal type.
838
839 19
840 \ \ Type without principality.
841
842 20
843 \ \ Unused function argument.
844
845 21
846 \ \ Non-returning statement.
847
848 22
849 \ \ Preprocessor warning.
850
851 23
852 \ \ Useless record
853 .B with
854 clause.
855
856 24
857 \ \ Bad module name: the source file name is not a valid OCaml module name.
858
859 25
860 \ \ Deprecated: now part of warning 8.
861
862 26
863 \ \ Suspicious unused variable: unused variable that is bound with
864 .BR let \ or \ as ,
865 and doesn't start with an underscore (_) character.
866
867 27
868 \ \ Innocuous unused variable: unused variable that is not bound with
869 .BR let \ nor \ as ,
870 and doesn't start with an underscore (_) character.
871
872 28
873 \ \ A pattern contains a constant constructor applied to the underscore (_)
874 pattern.
875
876 29
877 \ \ A non-escaped end-of-line was found in a string constant. This may
878 cause portability problems between Unix and Windows.
879
880 30
881 \ \ Two labels or constructors of the same name are defined in two
882 mutually recursive types.
883
884 31
885 \ \ A module is linked twice in the same executable.
886
887 32
888 \ \ Unused value declaration.
889
890 33
891 \ \ Unused open statement.
892
893 34
894 \ \ Unused type declaration.
895
896 35
897 \ \ Unused for-loop index.
898
899 36
900 \ \ Unused ancestor variable.
901
902 37
903 \ \ Unused constructor.
904
905 38
906 \ \ Unused extension constructor.
907
908 39
909 \ \ Unused rec flag.
910
911 40
912 \ \ Constructor or label name used out of scope.
913
914 41
915 \ \ Ambiguous constructor or label name.
916
917 42
918 \ \ Disambiguated constructor or label name.
919
920 43
921 \ \ Nonoptional label applied as optional.
922
923 44
924 \ \ Open statement shadows an already defined identifier.
925
926 45
927 \ \ Open statement shadows an already defined label or constructor.
928
929 46
930 \ \ Error in environment variable.
931
932 47
933 \ \ Illegal attribute payload.
934
935 48
936 \ \ Implicit elimination of optional arguments.
937
938 49
939 \ \ Missing cmi file when looking up module alias.
940
941 50
942 \ \ Unexpected documentation comment.
943
944 59
945 \ \ Assignment on non-mutable value.
946
947 60
948 \ \ Unused module declaration.
949
950 61
951 \ \ Unannotated unboxable type in primitive declaration.
952
953 62
954 \ \ Type constraint on GADT type declaration
955
956 63
957 \ \ Erroneous printed signature
958
959 64
960 \ \ -unsafe used with a preprocessor returning a syntax tree
961
962 65
963 \ \ Type declaration defining a new '()' constructor
964
965 66
966 \ \ Unused open! statement.
967
968 The letters stand for the following sets of warnings. Any letter not
969 mentioned here corresponds to the empty set.
970
971 .B A
972 \ all warnings
973
974 .B C
975 \ 1, 2
976
977 .B D
978 \ 3
979
980 .B E
981 \ 4
982
983 .B F
984 \ 5
985
986 .B K
987 \ 32, 33, 34, 35, 36, 37, 38, 39
988
989 .B L
990 \ 6
991
992 .B M
993 \ 7
994
995 .B P
996 \ 8
997
998 .B R
999 \ 9
1000
1001 .B S
1002 \ 10
1003
1004 .B U
1005 \ 11, 12
1006
1007 .B V
1008 \ 13
1009
1010 .B X
1011 \ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 30
1012
1013 .B Y
1014 \ 26
1015
1016 .B Z
1017 \ 27
1018
1019 .IP
1020 The default setting is
1021 .BR \-w\ +a\-4\-6\-7\-9\-27\-29\-30\-32..42\-44\-45\-48\-50\-60\-66 .
1022 Note that warnings
1023 .BR 5 \ and \ 10
1024 are not always triggered, depending on the internals of the type checker.
1025 .TP
1026 .BI \-warn\-error \ warning\-list
1027 Mark as errors the warnings specified in the argument
1028 .IR warning\-list .
1029 The compiler will stop with an error when one of these
1030 warnings is emitted. The
1031 .I warning\-list
1032 has the same meaning as for
1033 the
1034 .B \-w
1035 option: a
1036 .B +
1037 sign (or an uppercase letter) marks the corresponding warnings as fatal, a
1038 .B \-
1039 sign (or a lowercase letter) turns them back into non-fatal warnings, and a
1040 .B @
1041 sign both enables and marks as fatal the corresponding warnings.
1042
1043 Note: it is not recommended to use the
1044 .B \-warn\-error
1045 option in production code, because it will almost certainly prevent
1046 compiling your program with later versions of OCaml when they add new
1047 warnings or modify existing warnings.
1048
1049 The default setting is
1050 .B \-warn\-error \-a+31
1051 (only warning 31 is fatal).
1052 .TP
1053 .B \-warn\-help
1054 Show the description of all available warning numbers.
1055 .TP
1056 .B \-where
1057 Print the location of the standard library, then exit.
1058 .TP
1059 .B \-with-runtime
1060 Include the runtime system in the generated program. This is the default.
1061 .TP
1062 .B \-without-runtime
1063 The compiler does not include the runtime system (nor a reference to it) in the
1064 generated program; it must be supplied separately.
1065 .TP
1066 .BI \- \ file
1067 Process
1068 .I file
1069 as a file name, even if it starts with a dash (-) character.
1070 .TP
1071 .BR \-help \ or \ \-\-help
1072 Display a short usage summary and exit.
1073
1074 .SH SEE ALSO
1075 .BR ocamlopt (1), \ ocamlrun (1), \ ocaml (1).
1076 .br
1077 .IR "The OCaml user's manual" ,
1078 chapter "Batch compilation".
1079