1*465ab238Srillig /* $NetBSD: msg_372.c,v 1.4 2024/08/31 06:57:31 rillig Exp $ */ 238c0bdf2Srillig # 3 "msg_372.c" 338c0bdf2Srillig 43d5fc263Srillig // Test for message: field width '%.*s' (%ju) in '%.*s' out of range 0..64 [372] 538c0bdf2Srillig 638c0bdf2Srillig /* 738c0bdf2Srillig * In new-style formats, the width of a bit-field must be between 0 (an empty 838c0bdf2Srillig * bit-field) and 64 (a bit-field spanning the whole value). 938c0bdf2Srillig */ 1038c0bdf2Srillig 1138c0bdf2Srillig /* lint1-extra-flags: -X 351 */ 1238c0bdf2Srillig 1338c0bdf2Srillig typedef typeof(sizeof(0)) size_t; 1438c0bdf2Srillig typedef unsigned long long uint64_t; 1538c0bdf2Srillig 1638c0bdf2Srillig int snprintb(char *, size_t, const char *, uint64_t); 1738c0bdf2Srillig 1838c0bdf2Srillig void 1938c0bdf2Srillig example(uint64_t u64) 2038c0bdf2Srillig { 2138c0bdf2Srillig char buf[64]; 2238c0bdf2Srillig 231ec17c71Srillig /* expect+12: warning: field width '\101' (65) in 'f\000\101all+1\0' out of range 0..64 [372] */ 241ec17c71Srillig /* expect+11: warning: bit field end 65 in 'f\000\101all+1\0' out of range 0..64 [373] */ 251ec17c71Srillig /* expect+10: warning: bit field end 65 in 'f\001\100oob64\0' out of range 0..64 [373] */ 261ec17c71Srillig /* expect+9: warning: 'f\001\100oob64\0' overlaps earlier 'f\000\100all\0' on bit 1 [376] */ 2738c0bdf2Srillig /* expect+8: warning: field width '\377' (255) in 'f\010\377oob64\0' out of range 0..64 [372] */ 2838c0bdf2Srillig /* expect+7: warning: bit field end 263 in 'f\010\377oob64\0' out of range 0..64 [373] */ 2938c0bdf2Srillig snprintb(buf, sizeof(buf), 3038c0bdf2Srillig "\177\020" 3138c0bdf2Srillig "f\000\100all\0" 3238c0bdf2Srillig "f\000\101all+1\0" 3338c0bdf2Srillig "f\001\100oob64\0" 3438c0bdf2Srillig "f\010\377oob64\0", 3538c0bdf2Srillig u64); 3638c0bdf2Srillig } 37