Warnings

Warnings give the programmer information about possible errors in Qore code.

Warnings can be enabled using the `-W` command-line option (see qore Executable Command-Line Processing for more information) or by using the %enable-all-warnings or %enable-warning parse directives.

Command Line Example

      prompt$ qore -wdeprecated -wduplicate-hash-key script.q

Qore Code Example
  %enable-warning deprecated
  %enable-warning duplicate-hash-key
  %disable-warning excess-args

List of All Warnings
  - broken-logic-precedence broken-logic-precedence
  - call-with-type-errors
  - deprecated
  - duplicate-block-vars
  - duplicate-global-vars
  - duplicate-hash-key
  - duplicate-local-vars
  - excess-args
  - invalid-operation
  - module-only
  - non-existent-method-call
  - return-value-ignored
  - undeclared-var
  - unknown-warning
  - unreachable-code
  - unreferenced-variable
  - warning-mask-unchanged

# broken-logic-precedence

Only available with %broken-logic-precedence parse define. Raised when the parser determins that meaning of an expression is affected by the %broken-logic-precedence parse define.

Since
  Qore 0.8.12.11

# call-with-type-errors

Raised when the parser determines that the argument types of a function or method call are such that the operation is guaranteed to produce a constant value

Since
  Qore 0.8.0

# deprecated

Raised when deprecated functionality is accessed.

See also
  "Deprecated" Functions

Since
  Qore 0.8.0

# duplicate-block-vars

Raised when a program declares a local variable more than once in the same block; note that this is not a warning but rather an error when %assume-local or %new-style parse options are set

Since
  Qore 0.8.2

# duplicate-global-vars

Raised when a program declares a global variable more than once

Since
  Qore 0.5.2

# duplicate-hash-key

Raised when an immediate hash is declared and at least one of the keys is repeated

Since
  Qore 0.8.0

# duplicate-local-vars

This warning is raised when a local variable with the same name is declared in a subblock (ie another local variable with the same name is reachable in the same lexical scope); note that this warning can raise false positives if the programmer is used to redeclaring the same variable names in subblocks

See also
  duplicate-block-vars

Since
  Qore 0.5.2

# excess-args

Raised when a function or method call is made with more arguments than are used by the function or method

Since
  Qore 0.8.0

# invalid-operation

Raised when the parser determins that the types of an operation are such that the operation is guaranteed to produce no value; this warning can only be raised when type information is available at parse time

Since
  Qore 0.8.0

# module-only

This warning is raised when a feature that is only valid in a user module is used in code that is not in a user module, for example, declaring a class or namespace The "public" Keyword

Since
  Qore 0.8.4

# non-existent-method-call

Warning is raised when the given method cannot be found in the class at parse time; this is a warning because the object could be a subclass that has the given method implemented, in which case the call will succeed at run time. Use the cast<>() operator to avoid this warning

Since
  Qore 0.8.0

# return-value-ignored

Raised when a function or method call is made with no side effects and the return value is ignored

Since
  Qore 0.8.0

# undeclared-var

This warning is raised when a program uses a variable that has not been declared with my or our

Since
  Qore 0.5.2

# unknown-warning

This warning is raised when a program tries to enable or disable an unknown warning

Since
  Qore 0.5.2

# unreachable-code

Raised when code is defined that can never be executed (for example, code following a return or thread_exit statement)

Since
  Qore 0.5.2

# unreferenced-variable

Raised when a variable is declared but never referenecd

Since
  Qore 0.8.2

# warning-mask-unchanged

This warning is raised when a program tries to change the warning mask with parse options, but the warnings are locked

Since
  Qore 0.5.2