Home | History | Annotate | Line # | Download | only in lint1
msg_034.c revision 1.3.2.1
      1  1.3.2.1    cjep /*	$NetBSD: msg_034.c,v 1.3.2.1 2021/05/31 22:15:24 cjep Exp $	*/
      2      1.1  rillig # 3 "msg_034.c"
      3      1.1  rillig 
      4  1.3.2.1    cjep // Test for message: nonportable bit-field type '%s' [34]
      5      1.1  rillig 
      6  1.3.2.1    cjep /* No -g since GCC allows all integer types as bit-fields. */
      7  1.3.2.1    cjep /* lint1-flags: -S -p -w */
      8      1.2  rillig 
      9  1.3.2.1    cjep /*
     10  1.3.2.1    cjep  * C90 3.5.2.1 allows 'int', 'signed int', 'unsigned int' as bit-field types.
     11  1.3.2.1    cjep  *
     12  1.3.2.1    cjep  * C99 6.7.2.1 significantly changed the wording of the allowable types for
     13  1.3.2.1    cjep  * bit-fields.  For example, 6.7.2.1p4 does not mention plain 'int' at all.
     14  1.3.2.1    cjep  * The rationale for C99 6.7.2.1 mentions plain int though, and it would have
     15  1.3.2.1    cjep  * broken a lot of existing code to disallow plain 'int' as a bit-field type.
     16  1.3.2.1    cjep  * Footnote 104 explicitly mentions plain 'int' as well and it even allows
     17  1.3.2.1    cjep  * typedef-types for bit-fields.
     18  1.3.2.1    cjep  */
     19      1.2  rillig struct example {
     20  1.3.2.1    cjep 	/* expect+1: 34 */
     21  1.3.2.1    cjep 	unsigned short ushort: 1;
     22  1.3.2.1    cjep 
     23  1.3.2.1    cjep 	/* expect+1: 344 */
     24  1.3.2.1    cjep 	int plain_int: 1;
     25  1.3.2.1    cjep 
     26  1.3.2.1    cjep 	signed int signed_int: 1;
     27      1.2  rillig 	unsigned int portable: 1;
     28      1.2  rillig };
     29