Next: , Previous: , Up: Warning options   [Contents][Index]


9.10.3 Warnings about programming style


--warn-dead-predicates
--warn-dead-preds

Warn about predicates and functions that have no procedures which are ever called.


--warn-dead-procedures
--warn-dead-procs

Warn about procedures which are never called.


--no-warn-simple-code

Do not warn about constructs which are so simple that they are likely to be programming errors. (One example is if-then-elses whose condition always succeeds.)


--inform-ite-instead-of-switch

Generate informational messages for if-then-elses that could be replaced by switches.


--inform-incomplete-switch

Generate informational messages for switches that do not cover all the function symbols that the switched-on variable could be bound to.


--inform-incomplete-switch-threshold N

Have the ‘--inform-incomplete-switch’ option generate its messages only for switches that do cover at least ‘N’% of the function symbols that the switched-on variable could be bound to.


--warn-duplicate-calls

Warn about multiple calls to a predicate or function with the same input arguments.


--no-warn-redundant-coerce

Do not warn about redundant type coercions, which occur when the type of the result of the coerce expression is the same as the type of its argument.


--no-warn-state-var-shadowing

Do not warn about one state variable shadowing another.


--no-warn-unneeded-initial-statevars

Do not warn about state variables in clause heads that could be ordinary variables.


--no-warn-unneeded-initial-statevars-lambda

Do not warn about state variables in the heads of lambda expressions that could be ordinary variables.


--warn-implicit-stream-calls

Warn about calls to I/O predicates that could take explicit stream arguments, but do not do so.


--warn-unknown-format-calls

Warn about calls to string.format, io.format or stream.string_writer.format for which the compiler cannot tell whether there are any mismatches between the format string and the supplied values.


--warn-can-fail-function

Warn about functions that can fail. (Such functions should be replaced by semidet predicates.)


--no-warn-unneeded-mode-specific-clause

Do not warn about clauses that unnecessarily specify the modes of their arguments.


--warn-unsorted-import-blocks
--warn-unsorted-import-block

Generate a warning if two import_module and/or use_module declarations occur on the same line, or if a sequence of such declarations on consecutive lines are not sorted on module name.


--warn-inconsistent-pred-order-clauses
--warn-inconsistent-pred-order

Generate a warning if the order of the definitions does not match the order of the declarations for either the exported predicates and functions of the module, or for the nonexported predicates and functions of the module. Applies for definitions by Mercury clauses.


--warn-inconsistent-pred-order-foreign-procs

Generate a warning if the order of the definitions does not match the order of the declarations for either the exported predicates and functions of the module, or for the nonexported predicates and functions of the module. Applies for definitions by either Mercury clauses or foreign_proc pragmas.


--no-warn-non-contiguous-decls

Do not generate a warning if the mode declarations of a predicate or function do not all immediately follow its pred or func declaration.


--warn-non-contiguous-clauses

Generate a warning if the clauses of a predicate or function are not contiguous.


--warn-non-contiguous-foreign-procs

Generate a warning if the clauses and foreign_procs of a predicate or function are not contiguous.


--allow-non-contiguity-for name1,name2,...
–no-allow-non-contiguity-for

Allow the clauses (or, with ‘--warn-non-contiguous-foreign-procs’, the clauses and/or foreign_proc pragmas) of the named predicates and/or functions to be intermingled with each other, but not with those or any other predicates or functions. This option may be specified more than once, with each option value specifying a distinct set of predicates and/or function names that may be intermingled. Each name must uniquely specify a predicate or a function.


--warn-suspicious-foreign-code

Warn about possible errors in the bodies of foreign code pragmas.


Note that since the compiler’s ability to parse foreign language code is limited, some warnings reported by this option may be spurious, and some actual errors may not be detected at all.


--warn-suspicious-foreign-procs

Warn about possible errors in the bodies of foreign_proc pragmas. When enabled, the compiler attempts to determine whether the success indicator for a foreign procedure is correctly set, and whether the foreign procedure body contains operations that it should not contain, such as return statements in a C foreign procedure.


Note that since the compiler’s ability to parse foreign language code is limited, some warnings reported by this option may be spurious, and some actual errors may not be detected at all.


Next: , Previous: , Up: Warning options   [Contents][Index]