Skip to content

Commit b21b8ce

Browse files
committed
ioq: Avoid _nounroll warning on older GCC versions
Some older GCC versions (11.4, 12.3, 13.2) give a false-positive warning when a loop pragma is attached to a loop that declares a variable: warning: ignoring loop annotation Work around it by hoisting the induction variable declarations. Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114691
1 parent 1ef2935 commit b21b8ce

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/ioq.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -280,11 +280,12 @@ static uintptr_t ioq_slot_wait(struct ioqq *ioqq, ioq_slot *slot, uintptr_t valu
280280
uintptr_t ret;
281281

282282
// Try spinning a few times before blocking
283+
int i, j;
283284
_nounroll
284-
for (int i = 0; i < 10; ++i) {
285+
for (i = 0; i < 10; ++i) {
285286
// Exponential backoff
286287
_nounroll
287-
for (int j = 0; j < (1 << i); ++j) {
288+
for (j = 0; j < (1 << i); ++j) {
288289
spin_loop();
289290
}
290291

0 commit comments

Comments
 (0)