1*c83f7defSrillig /* $NetBSD: msg_034.c,v 1.6 2022/06/17 18:54:53 rillig Exp $ */ 2a0a15c14Srillig # 3 "msg_034.c" 3a0a15c14Srillig 4dec93c30Srillig // Test for message: nonportable bit-field type '%s' [34] 5a0a15c14Srillig 62999d7a9Srillig /* No -g since GCC allows all integer types as bit-fields. */ 72999d7a9Srillig /* lint1-flags: -S -p -w */ 88a6c8bc4Srillig 92999d7a9Srillig /* 102999d7a9Srillig * C90 3.5.2.1 allows 'int', 'signed int', 'unsigned int' as bit-field types. 112999d7a9Srillig * 122999d7a9Srillig * C99 6.7.2.1 significantly changed the wording of the allowable types for 132999d7a9Srillig * bit-fields. For example, 6.7.2.1p4 does not mention plain 'int' at all. 142999d7a9Srillig * The rationale for C99 6.7.2.1 mentions plain int though, and it would have 152999d7a9Srillig * broken a lot of existing code to disallow plain 'int' as a bit-field type. 162999d7a9Srillig * Footnote 104 explicitly mentions plain 'int' as well and it even allows 172999d7a9Srillig * typedef-types for bit-fields. 182999d7a9Srillig */ 198a6c8bc4Srillig struct example { 20*c83f7defSrillig /* expect+1: warning: nonportable bit-field type 'unsigned short' [34] */ 212999d7a9Srillig unsigned short ushort: 1; 222999d7a9Srillig 23*c83f7defSrillig /* expect+1: warning: bit-field of type plain 'int' has implementation-defined signedness [344] */ 242999d7a9Srillig int plain_int: 1; 252999d7a9Srillig 262999d7a9Srillig signed int signed_int: 1; 278a6c8bc4Srillig unsigned int portable: 1; 288a6c8bc4Srillig }; 29