msg_129.c revision 1.2 1 /* $NetBSD: msg_129.c,v 1.2 2021/01/30 22:38:54 rillig Exp $ */
2 # 3 "msg_129.c"
3
4 // Test for message: expression has null effect [129]
5
6 /* lint1-extra-flags: -h */
7
8 typedef unsigned char uint8_t;
9 typedef unsigned int uint32_t;
10
11 /*
12 * XXX: The message 129 looks wrong in this case. There are several comma
13 * operators, each of them has an assignment as operand, and an assignment
14 * has side effects.
15 *
16 * Nevertheless, when stepping through check_null_effect, the operator ','
17 * in line 17 says it has no side effect, which is strange.
18 */
19 void
20 uint8_buffer_write_uint32(uint8_t *c, uint32_t l)
21 {
22 (*(c++) = (uint8_t)(l & 0xff),
23 *(c++) = (uint8_t)((l >> 8L) & 0xff),
24 *(c++) = (uint8_t)((l >> 16L) & 0xff),
25 *(c++) = (uint8_t)((l >> 24L) & 0xff)); /* expect: 129 */
26 }
27