svn merge -r102224:107263 svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-3_4-branch
[official-gcc.git] / gcc / testsuite / g++.dg / ext / packed6.C
blobf89aafec16342047868d2ecbeb24514b0555da7d
1 // PR c++/15209
2 // { dg-options "-w" }
4 typedef unsigned int size_t;
5 typedef unsigned char uint8_t;
6 typedef unsigned short int uint16_t;
8 typedef unsigned int uint32_t;
9 __extension__ typedef unsigned long long int uint64_t;
11 typedef uint8_t u8;
12 typedef uint16_t u16;
13 typedef uint32_t u32;
14 typedef uint64_t u64;
16 struct MAGIC {u8 magic[8];} __attribute__ ((packed));
17 struct PACKETTYPE {u8 type[16];} __attribute__ ((packed));
20 typedef u16 leu16;
21 typedef u32 leu32;
22 typedef u64 leu64;
24 class MD5Hash
26 public:
28   MD5Hash(void) {};
30   void *print(void) const;
31   MD5Hash(const MD5Hash &other);
32   MD5Hash& operator=(const MD5Hash &other);
34 public:
35   u8 hash[16];
38 struct PACKET_HEADER
41   MAGIC magic;
42   leu64 length;
43   MD5Hash hash;
44   MD5Hash setid;
45   PACKETTYPE type;
46 } __attribute__ ((packed));
49 struct MAINPACKET
51   PACKET_HEADER header;
53   leu64 blocksize;
54   leu32 recoverablefilecount;
55   MD5Hash fileid[0];
58 } __attribute__ ((packed));
60 struct CriticalPacket
62   u8 *packetdata;
63   size_t packetlength;
66 class MainPacket : public CriticalPacket
68   const MD5Hash& SetId(void) const;
70   u64 blocksize;
71   u32 totalfilecount;
72   u32 recoverablefilecount;
75 inline const MD5Hash& MainPacket::SetId(void) const
77   return ((const MAINPACKET*)packetdata)->header.setid;