[previous] 2132 [next] Default argument promotion : unsigned bit-field promoted to unsigned int.
Arithmetic type - Integral promotion REFERENCE - ISO:C90-6.3.2.2 Function Calls, 6.5.4.3 Function Declarators, 7.8.1 Variable argument list access macros

A bit-field of unsigned type is being used as an argument in a function call and is being converted to type unsigned int according to the rules of default argument promotion.

This message will be generated if the function has not been declared or has been declared with an old style declaration. It will not be generated when default argument promotion results from a call to a function declared with a variable argument list.

A conversion of this nature will only occur if the bit-field is the same size as an int. If it is not, message 2130 will be generated.

For example:


/*PRQA S 1302,1303,3200,3209,3227,3408,3447,3602 ++*/

struct ST
{
    unsigned int uib1:20;
    unsigned int uib2:32;
    unsigned int uib3:12;
};

extern struct ST     stx;
extern void f1(int n, unsigned int p);          /*              - new style function declaration   */
extern void f3();                               /* Message 3001 - old style function declaration   */
extern void f4(int n, ...);                     /*              - new style with variable arg list */

extern void foo(void)
{
    f1(1, stx.uib2);                            /*                                      */
    f2(1, stx.uib2);                            /* Message 2132 + 3335 - no declaration */
    f3(1, stx.uib2);                            /* Message 2132                         */
    f4(1, stx.uib2);                            /*                                      */
}

See also:

QA·C Source Code Analyser 8.1.2
© 2013 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index Contents