CVS commit: src/sys/sys

"Taylor R Campbell" <[email protected]>
Newsgroups gmane.os.netbsd.devel.cvs
Message-ID <[email protected]>
Module Name:	src
Committed By:	riastradh
Date:		Sun May 17 01:36:21 UTC 2026

Modified Files:
	src/sys/sys: atomic.h

Log Message:
sys/atomic.h: Nix const qualifiers on temporaries added in previous.

The temporaries aren't modified, so in principle const is correct,
but on some ports (notably, sparc) we pass pointers to them through
__UNVOLATILE which objects to the const qualifier:

> In file included from /home/source/ab/HEAD/src/lib/librump/../../sys/rump/librump/rumpkern/sleepq.c:28:
> /home/source/ab/HEAD/src/lib/librump/../../sys/rump/librump/rumpkern/sleepq.c: In function 'lwp_unlock_to':
> /home/source/ab/HEAD/src/lib/librump/../../sys/rump/../sys/cdefs.h:202:49: error: cast discards 'const' qualifier from pointer target type [-Werror=cast-qual]
>   202 | #define __UNVOLATILE(a) ((void *)(unsigned long)(volatile void *)(a))
>       |                                                 ^
> /home/source/ab/HEAD/src/lib/librump/../../sys/rump/../sys/atomic.h:448:30: note: in expansion of macro '__UNVOLATILE'
>   448 |         __do_atomic_store(p, __UNVOLATILE(&v), sizeof(v))
>       |                              ^~~~~~~~~~~~
> /home/source/ab/HEAD/src/lib/librump/../../sys/rump/../sys/atomic.h:495:9: note: in expansion of macro '__DO_ATOMIC_STORE'
>   495 |         __DO_ATOMIC_STORE(__as_ptr, __as_val);                                \
>       |         ^~~~~~~~~~~~~~~~~
> /home/source/ab/HEAD/src/lib/librump/../../sys/rump/librump/rumpkern/sleepq.c:187:9: note: in expansion of macro 'atomic_store_release'
>   187 |         atomic_store_release(&l->l_mutex, new);
>       |         ^~~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors

PR kern/60272: sys/atomic.h: unnecessary stack spillage


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/sys/atomic.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.