Re: [PATCH] gcc 3.0.1 warnings about multi-line literals

From: Benjamin LaHaise (bcrl@redhat.com)
Date: Mon Oct 22 2001 - 15:51:57 EST


On Mon, Oct 22, 2001 at 09:45:36PM +0100, Alan Cox wrote:
> > On Mon, Oct 22, 2001 at 01:05:10PM -0700, John Hawkes wrote:
> > > This patch eliminates gcc 3.0.1 warnings, "multi-line string literals are
> > > deprecated", in two include/asm-i386 files. Patches cleanly for at least
> > > 2.4.10 and 2.4.12, and tested in 2.4.10.
> >
> > Please reject this patch. The gcc folks are wrong in this case.
>
> Im curious - why do you make that specific claim. The multiline literals are
> rather ugly.

Which of the following is more readable:

/* try atomic lock inline, if that fails, spin out of line */
        "\tbtsl $1,%0\n"
        "\tbne 2f\n"
        "1:\n"
        "\t.section .text.lock\n\n"
        "\t2:\tcmpl $0,%0\n"
        "\tbne 2b\n"
        "\trep ; nop\n"
        "\tjmpl 1b\n\n"
        "\t.section .previous\n"

or:

/* try atomic lock inline, if that fails, spin out of line */
" btsl $1,%0
1:
        .section .text.lock

2: cmpl $0,%0
        bne 2b
        jmpl 1b

        .section .previous"

or:
        while (unlikely(test_and_set_bit(1, lock))) {
                while (lock.value)
                        arch_pause();
        }

Ooops, sorry, ignore 3 -- that's only possible in a world where there is
intrinsic support in the compiler to generate the assembly we're aiming
for. But of the two assembly versions, I think the second is much more
readable. The few gcc people I've spoken to locally about this agreed with
me when I showed them some of the inline assembly bits in the two forms as
above.

                -ben
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Oct 23 2001 - 21:00:32 EST