Commit d571dc72 authored by Nils Goroll's avatar Nils Goroll

rewrite 0U - VSL_SEGMENTS in way which should make Flexelint happy

We intentionally provoke an early wrap of our segment_n unsigned int.
The previous code is fine according to
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf
"A computation involving unsigned operands can never overflow...",
but nevertheless we don't want to trigger Flexelint warnings.

Thanks to Dag Haavi Finstad for digging the ISO standards url.
parent 6179e316
......@@ -461,7 +461,7 @@ VSM_Init(void)
vsl_end = vsl_head->log + vsl_segsize * VSL_SEGMENTS;
/* Make segment_n always overflow on first log wrap to make any
problems with regard to readers on that event visible */
vsl_segment_n = 0U - VSL_SEGMENTS;
vsl_segment_n = UINT_MAX - VSL_SEGMENTS + 1;
AZ(vsl_segment_n % VSL_SEGMENTS);
vsl_head->segment_n = vsl_segment_n;
vsl_ptr = vsl_head->log;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment