2001-07-31 04:55:22

by paulr

[permalink] [raw]
Subject: 2.4.7 -- GCC-3.0 -- "multiline string literals deprecated" -- PATCH

Folks,

While building both kernels 2.4.6 and 2.4.7,
I encountered a series of compiler warnings,

warning: multiline string literals are deprecated.

The build environment was gcc3.0 and binutils-2.11.2.

In:
linux/arch/i386/kernel/semaphore.c,
linux/include/asm-i386/checksum.h, and
linux/include/asm-i386/floppy.h,

the placement of "" characters in the asm() directives
appeared to be the source of the messages.

The compiler messages seem harmless. Unfortunately,
warnings from these asm() constructs flooded the compile
log, making it difficult to locate "real" warnings....

I have attached patches against 2.4.7 for the files
above. " and \n" constructs were added for each asm()
stanza where the messages occurred. Please note that
this seems to be compiler-related. The 2.4.7 code worked
fine ;-)

NOTE:

I do *not* have an SMP system to verify the correctness
of the CONFIG_SMP asm() conditionals in

linux/arch/i386/kernel/semaphore.c

Please verify the SMP case.....

Please cc: me as needed; I am not subscribed to l-k.


Regards,

Paul


--
*********************************************
Paul Reich RF/Microwave Engineer

Support the "Freedom To Innovate"...
Just say "No".

*********************************************


Attachments:
checksum.h.patch (2.29 kB)
floppy.h.patch (960.00 B)
semaphore.c.patch (2.51 kB)
Download all attachments

2001-07-31 13:54:05

by Gareth Hughes

[permalink] [raw]
Subject: Re: 2.4.7 -- GCC-3.0 -- "multiline string literals deprecated" -- PATCH

paulr wrote:
>
> Folks,
>
> While building both kernels 2.4.6 and 2.4.7,
> I encountered a series of compiler warnings,
>
> warning: multiline string literals are deprecated.
>
> The build environment was gcc3.0 and binutils-2.11.2.

Yes, unfortunately GCC 3.0 deprecated multiline string literals -- I saw
someone arguing on the GCC mailing lists that writing large chunks of
inline asm shouldn't be "easy", as it interferes with the compiler's
optimization passes. There were other such braindead arguments
supporting the deprecation. The thread should be pretty easy to find in
the archives. Don't know if the deprecation will be removed in future
versions.

-- Gareth

2001-07-31 14:11:52

by Matti Aarnio

[permalink] [raw]
Subject: Re: 2.4.7 -- GCC-3.0 -- "multiline string literals deprecated" -- PATCH

On Tue, Jul 31, 2001 at 11:52:56PM +1000, Gareth Hughes wrote:
> paulr wrote:
> > Folks,
> >
> > While building both kernels 2.4.6 and 2.4.7,
> > I encountered a series of compiler warnings,
> >
> > warning: multiline string literals are deprecated.
> >
> > The build environment was gcc3.0 and binutils-2.11.2.
>
> Yes, unfortunately GCC 3.0 deprecated multiline string literals -- I saw
> someone arguing on the GCC mailing lists that writing large chunks of
> inline asm shouldn't be "easy",....

Those are different things.

The multiline string literal deprecation comes from people who
define what the new ANSI-C (C9X, or whatever) is, and inline asm
just uses literal strings as its input data.

The inline asm() does essentially want to look like a function call
with lots of strings as parameters. It has special __builtin_ meaning,
of course, but that is way after the lexical input scanner has done
its work.

> -- Gareth

/Matti Aarnio

2001-07-31 14:15:41

by Horst H. von Brand

[permalink] [raw]
Subject: Re: 2.4.7 -- GCC-3.0 -- "multiline string literals deprecated" -- PATCH

Gareth Hughes <[email protected]> said:

[...]

> Yes, unfortunately GCC 3.0 deprecated multiline string literals

AFAIU, they are non-standard, and can easily hide bugs (in opening a string
and forgetting to close you are in escence commenting out lines of code)

> -- I saw
> someone arguing on the GCC mailing lists that writing large chunks of
> inline asm shouldn't be "easy",

Right. If you use a compiler, you shouldn't need it much. Better make
other, more important, things easy/more foolproof, even at some cost for
the asm() writer. (Hint: Count the lines of asm in the kernel (an
_extremely_ heavy asm user!) vs the lines of plain C)

> as it interferes with the compiler's
> optimization passes. There were other such braindead arguments
> supporting the deprecation.

Yep, this is a braindead argument. There must have been others (sensible
ones)...

> The thread should be pretty easy to find in
> the archives. Don't know if the deprecation will be removed in future
> versions.

I hope they disallow multiline strings pretty soon.
--
Dr. Horst H. von Brand Usuario #22616 counter.li.org
Departamento de Informatica Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria +56 32 654239
Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513

2001-07-31 15:58:51

by Gareth Hughes

[permalink] [raw]
Subject: Re: 2.4.7 -- GCC-3.0 -- "multiline string literals deprecated" -- PATCH

Horst von Brand wrote:
>
> AFAIU, they are non-standard, and can easily hide bugs (in opening a string
> and forgetting to close you are in escence commenting out lines of code)

Zack Weinberg, who's post started the thread, gave three main criteria
for their removal in
http://gcc.gnu.org/ml/gcc-patches/2001-07/msg00327.html, including:

<quote>
There is only one argument in my mind for keeping them:

- It makes it easier to write lengthy chunks of inline assembly.

This is certainly true, however, writing a lengthy chunk of inline
assembly is almost always a mistake; it interferes with the compiler's
ability to do its job. Therefore I do not think there is any
compelling need to make that easy.
</quote>

If I ever write inline assembly, then it's for a very good reason. I'd
hesitate to call almost all uses of inline assembly a "mistake",
particlarly in places like the kernel, or math-intensive ones like 3D
graphics.

> Right. If you use a compiler, you shouldn't need it much. Better make
> other, more important, things easy/more foolproof, even at some cost for
> the asm() writer. (Hint: Count the lines of asm in the kernel (an
> _extremely_ heavy asm user!) vs the lines of plain C)

No argument re: lines of code. However, if I have to write a decent
chunk of inline assembly, multiline strings are much nicer IMHO.

> Yep, this is a braindead argument. There must have been others (sensible
> ones)...

See above ;-)

> I hope they disallow multiline strings pretty soon.

I don't have strong feelings either way. And I sure don't want to have
this argument again...

-- Gareth