All of lore.kernel.org
 help / color / mirror / Atom feed
* Compiler problems with zero-length array in the middle of a struct
@ 2002-12-05 10:47 Carsten Langgaard
  2002-12-05 13:10 ` Ralf Baechle
  0 siblings, 1 reply; 4+ messages in thread
From: Carsten Langgaard @ 2002-12-05 10:47 UTC (permalink / raw)
  To: Ralf Baechle, linux-mips

[-- Attachment #1: Type: text/plain, Size: 534 bytes --]

Some compiler reject a zero-length array in the middle of a structure,
and report it as an error.
So could we please redo the change, that has recently been done to
include/linux/raid/md_p.h (see patch below).

/Carsten



--
_    _ ____  ___   Carsten Langgaard   Mailto:carstenl@mips.com
|\  /|||___)(___   MIPS Denmark        Direct: +45 4486 5527
| \/ |||    ____)  Lautrupvang 4B      Switch: +45 4486 5555
  TECHNOLOGIES     2750 Ballerup       Fax...: +45 4486 5556
                   Denmark             http://www.mips.com



[-- Attachment #2: md_p.patch --]
[-- Type: text/plain, Size: 509 bytes --]

Index: include/linux/raid/md_p.h
===================================================================
RCS file: /home/cvs/linux/include/linux/raid/md_p.h,v
retrieving revision 1.3
diff -u -r1.3 md_p.h
--- include/linux/raid/md_p.h	28 Nov 2000 03:59:04 -0000	1.3
+++ include/linux/raid/md_p.h	5 Dec 2002 10:40:55 -0000
@@ -151,10 +151,12 @@
 	 */
 	mdp_disk_t disks[MD_SB_DISKS];
 
+#if MD_SB_RESERVED_WORDS
 	/*
 	 * Reserved
 	 */
 	__u32 reserved[MD_SB_RESERVED_WORDS];
+#endif
 
 	/*
 	 * Active descriptor

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Compiler problems with zero-length array in the middle of a struct
  2002-12-05 10:47 Compiler problems with zero-length array in the middle of a struct Carsten Langgaard
@ 2002-12-05 13:10 ` Ralf Baechle
  2002-12-05 13:35   ` Carsten Langgaard
  0 siblings, 1 reply; 4+ messages in thread
From: Ralf Baechle @ 2002-12-05 13:10 UTC (permalink / raw)
  To: Carsten Langgaard; +Cc: linux-mips

On Thu, Dec 05, 2002 at 11:47:26AM +0100, Carsten Langgaard wrote:

> Some compiler reject a zero-length array in the middle of a structure,
> and report it as an error.
> So could we please redo the change, that has recently been done to
> include/linux/raid/md_p.h (see patch below).

Hmm...  What compiler version is that?  The gcc documentation explicitly
permits empty arrays.

  Ralf

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Compiler problems with zero-length array in the middle of a struct
  2002-12-05 13:10 ` Ralf Baechle
@ 2002-12-05 13:35   ` Carsten Langgaard
  2002-12-05 17:29     ` Alan Cox
  0 siblings, 1 reply; 4+ messages in thread
From: Carsten Langgaard @ 2002-12-05 13:35 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: linux-mips

It should be a problem in gcc-3.0, also the SDE compiler has a problem with
that, but it's going to be fixed.

/Carsten


Ralf Baechle wrote:

> On Thu, Dec 05, 2002 at 11:47:26AM +0100, Carsten Langgaard wrote:
>
> > Some compiler reject a zero-length array in the middle of a structure,
> > and report it as an error.
> > So could we please redo the change, that has recently been done to
> > include/linux/raid/md_p.h (see patch below).
>
> Hmm...  What compiler version is that?  The gcc documentation explicitly
> permits empty arrays.
>
>   Ralf

--
_    _ ____  ___   Carsten Langgaard   Mailto:carstenl@mips.com
|\  /|||___)(___   MIPS Denmark        Direct: +45 4486 5527
| \/ |||    ____)  Lautrupvang 4B      Switch: +45 4486 5555
  TECHNOLOGIES     2750 Ballerup       Fax...: +45 4486 5556
                   Denmark             http://www.mips.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Compiler problems with zero-length array in the middle of a struct
  2002-12-05 13:35   ` Carsten Langgaard
@ 2002-12-05 17:29     ` Alan Cox
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Cox @ 2002-12-05 17:29 UTC (permalink / raw)
  To: Carsten Langgaard; +Cc: Ralf Baechle, linux-mips

On Thu, 2002-12-05 at 13:35, Carsten Langgaard wrote:
> > Hmm...  What compiler version is that?  The gcc documentation explicitly
> > permits empty arrays.

There was some discussion about this and what to do with zero sized
objects. In the C++ universe it seems to be horribly complicated with
rules about two objects not having the same address.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-12-05 16:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-05 10:47 Compiler problems with zero-length array in the middle of a struct Carsten Langgaard
2002-12-05 13:10 ` Ralf Baechle
2002-12-05 13:35   ` Carsten Langgaard
2002-12-05 17:29     ` Alan Cox

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.