This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
supression of 'matching constraint does not allow a register' warning
- From: Peter Barada <peter at the-baradas dot com>
- To: gcc at gcc dot gnu dot org
- Date: Fri, 30 Apr 2004 12:10:27 -0400 (EDT)
- Subject: supression of 'matching constraint does not allow a register' warning
In the Linux-2.4.x kernel for m68k, the atomic operations use the
addql/subql instructions for incrementing/decrementing atomic
variables, and force the variables to memory to make the operation
truly atomic. The definition from linux-2.4.x/include/asm-m68k/atomic.h:
static __inline__ void atomic_inc(volatile atomic_t *v)
{
__asm__ __volatile__("addql #1,%0" : "=m" (*v): "0" (*v));
}
static __inline__ void atomic_dec(volatile atomic_t *v)
{
__asm__ __volatile__("subql #1,%0" : "=m" (*v): "0" (*v));
}
Unfortunately when used they generate the following warning from
parse_input_contstraint in gcc/stmt.c:
if (saw_match && !*allows_reg)
warning ("matching constraint does not allow a register");
Since atomic_inc/atomic_dec are defined that way to enforce an
atomic operation to memory, when building the kernel, *lots* of
warnings are generated making it hard to wade through the log looking
for other warnings/errors.
I'd like to add a flag to suppress this warning, and was wondering if
a patch for this would be accepted, and what best to call the flag.
Any comments are appreciated.
--
Peter Barada
peter@the-baradas.com