$WARNING | $WARNINGS | $W - Define compiler warnings behavior

Language reference ›› Directives ››
Parent Previous Next

warning-directive = ( $WARNING | $WARNINGS | $W ) [ warning-reference ] directive-toggle { "," warning-reference directive-toggle } .
warning-reference = warning-number | warning-identifier .


Define compiler's warnings behavior.


NEW! (V2.1): Several warnings may be changed in the same directive, separated by commas. Nevertheless a global warning on / off cannot be mixed with individual warning on / off in the same directive.

       

<warning-number>:

Validate or invalidate only the specified compiler warning by its number after this point.


<warning-identifier>:

NEW! (V2.1): Validate or invalidate only the specified compiler warning by its identifier after this point. Not all warnings have an equivalent identifier, see below.


<directive-toggle>:

ON / OFF or "+" / "-": if <warning-reference> is omitted, validate or invalidate all the compiler warnings after this point of source code, overriding the default option defined in the Project's Options; else validate or invalidate only the <warning-reference> warning.




{$W 25-} // Do not report baud rate accuracy
{$WARNING BYTE_TRUNCATION OFF} // Do not report byte truncation
{$WARNING USER_WARNING OFF, BYTE_TRUNCATION_ON}


Warning numbers vs their identifiers vs their text:


1

USER_WARNING

User message

2

BOOLEAN_TRUNCATION

Boolean truncation

3

BYTE_TRUNCATION

Byte truncation

4

INTEGER_TRUNCATION

Integer truncation

5

WORD_TRUNCATION

Word truncation

6

LONGINT_TRUNCATION

Longint truncation

7


I'm afraid that I'm not able to generate an accurate delay with this processor frequency

8


Cannot achieve 1 µs delay with this processor frequency

9


Cannot achieve 10 µs delay with this processor frequency

10


delay is limited to %s µs at this processor frequency

11


Boolean occupies one bit so sizeof is not relevant

12


EUSART pins not supported; mapping and TRISx management have to be managed by user code.

13


Constant is not in the enumerated list

14


Converted to byte

15


Case items overlap

16


Implemented as array of byte

17


Ram top address change not allowed here; ignored

18


EEPROM top address change not allowed here; ignored

19


EEPROM variables cannot be local variables; ignored

20


EEPROM variables cannot be arrays; allocated in RAM

21


This bit or field is not from the same SFR than previous ones

22


Unit not accurate, should be recompiled (*)

23

STRING_TRUNCATION

String truncation

24


Internal routine call from ISR; possible re-entrance conflict

25

BAUDRATE_ACCURACY

Inaccurate baud rate

26

SMALL_STRING_BUFFER

Small string buffer allocated: %s bytes

27


The selected processor has a fixed frequency; ignored

28


Fixed frequency; the project's default frequency was different

29

DEPRECATED_DIRECTIVE

Deprecated or not applicable directive; ignored

30

SFR_READ_ONLY

This SFR is defined as read only

31

SFR_BIT_READ_ONLY

This SFR bit or field is defined as read only

32

SFR_BIT_WRITE_ONLY

This SFR bit or field is defined as write only

33

SFR_BIT_MISMATCH

This bit or field is undefined for this variable or SFR

34

SFR_BIT_UNDEFINED

This variable or SFR bit or field is undefined

35


Fixed frequency: should be defined in processor's configuration

36


Duplicated directive item

37

LOW_HEAP

Low heap size

38

SHORTINT_TRUNCATION

Shortint truncation

39

CIRCULAR_REFERENCE_CALL

Circular reference calls, program may have a stack overflow

40


delay is limited to %s ns at this processor frequency

41


delay is limited to %s cycles at this processor frequency

42


Possible HW stack overflow due to call nesting

43


Ignored for this processor

44


Offset is outside of host variable

45


The field / bit %s is defined in more than one SFR (%s); default is %s

46

EXPERIMENTAL

Experimental: %s

47

SFR_BIT_SET_ONLY

This SFR bit can only be set

48


No parameters; ignored

49

LONGWORD_TRUNCATION

Longword truncation

50

NO_ASSIGN

There was no ASSIGN

51


A SFR bit passed as VAR will be updated only at procedure / function return

52


Expression result is always zero

53

WIDENED

Combining signed and unsigned types - widened both operands.

54

REGISTER_MASKED

Masking of a standard processor register or bit

55


Reference to a bit of a processor constant, not a register