warning C2705 - cw10.1

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

warning C2705 - cw10.1

Jump to solution
868 Views
roberto_m
Contributor III

Hi to all,

In my new «adventure» with  CW10.1 (porting a project, based on hcs08 qe64,  from CW 6.3), I meet a lot of «warnings».

Warnings (they weren't with CW 6.3) are generated by:

 

TPM1C2SC &= ~TPM1C2SC_CH2F_MASK;

 

I think because (from help)

 

CodeWarrior for Microcontrollers V10.x > HCS08/RS08 for Microcontrollers > RS08 Build Tools Reference Manual > Porting Tips and FAQs

 

Number Formats

Valid constant floating number suffixes are f and F for float and l or Lfor long double. Note that floating constants without suffixes are double constants in ANSI. For exponential numbers e or E has to be used. - and + can be used for signed representation of the floating number or the exponent.

The following suffixes are supported (Table A.2):


Table A.2 Supported number suffixes

ConstantSuffixType
floating
F
float
floating
L
long double
integral
U
unsigned in t
integral
uL
unsigned long

 

#define TPM1C2SC_CH2F_MASK              128U

 

U => implies unsigned int (16 bit). Registers of qe64 are 8 bit wide.

How can I avoid C2705 without disable it (with #PRAGMA)?

Labels (1)
Tags (1)
0 Kudos
1 Solution
536 Views
CrasyCat
Specialist III

Hello

 

     You can use an explicit cast to tell the compiler you want the value to be treated as 8-bit value.

 

CrasyCat

View solution in original post

0 Kudos
2 Replies
537 Views
CrasyCat
Specialist III

Hello

 

     You can use an explicit cast to tell the compiler you want the value to be treated as 8-bit value.

 

CrasyCat

0 Kudos
536 Views
roberto_m
Contributor III

Yes, this is a way.

 

But why use in mc9s08qe64.h « - 18.05.2010, V2.32  - MISRA compliance: U/UL suffixes added to all numbers (_MASK,_BITNUM and addresses) » that implies 16-bit vaule even if qe64 is an 8-bit mcu?