Re: [ROOT] g++ compiler directives

From: mathes@ik3.fzk.de
Date: Thu Jun 29 2000 - 08:46:26 MEST


Hi Alexey,

I had a similar problem recently ...

CINT cannot work with bit-fields.
Though I don't understand the directive __attribute__((packed)) I propose
to try the following, possibly you have also to use the __CINT__ constant
to exclude it from the parsing. rootcint has then to be called with -p
option, I think.

struct atic_header{
    union {
      unsigned int bitf;
#ifndef __CINT_
      struct {
        unsigned short msec:11;
        unsigned short crc:13;
        unsigned char subtype:5;
        unsigned char type:3;
     } bits;
#endif
    } packed;
    unsigned long time;
    unsigned short size;
} __attribute__ ((packed));
 
But you should check, that the packing is the same for both variants.

Happy rooting
   Hermann-Josef


> 
> I need to use packed structures in my code. So, in order to have g++
> create them correctly, I need to create struct types like:
> 
> struct atic_header{
>   unsigned msec:11;
>   unsigned crc:13;
>   unsigned subtype:5;
>   unsigned type:3;
>   unsigned long time;
>   unsigned short size;
> } __attribute__ ((packed));
> 
> typedef struct atic_header Atic_Header;
> 
> But this is a problem, since root's dictionary generator does not like
> this and gives errors like:
> 
> Error: ';' missing after class/struct/enum declaration FILE:filename
> LINE:line
> Warning: Unknown type (packed) in function argumant FILE:filename
> LINE:line
> 
> How do I fix this?
> 			Alexey
> 
> 


**************************************************************************
*                                                                        *
*   Dr. Hermann-Josef Mathes                                             *
*   KASCADE & AUGER Collaboration                                        *
*   Forschungszentrum Karlsruhe                Phone: +49 7247 822429    *
*   Institut fuer Kernphysik                   FAX:   +49 7247 824075    *
*   POB 3640                                                             *
*   D-76021 Karlsruhe/Germany                  Mail:  mathes@ik3.fzk.de  *
*                                                     hjmathes@web.de    *
*                                                                        *
**************************************************************************
*   Feel free to visit my homepage:                                      *
*          http://www-ik3.fzk.de/~mathes/Welcome.html                    *
*   My software project page for DAQ:                                    *
*          http://www-ik3.fzk.de/~mathes/software/software.html          *
*                                                                        *
*   Visit the institute and project homepages:                           *
*          http://www-ik3.fzk.de/                                        *
*          http://www-ik1.fzk.de/KASCADE_home.html                       *
**************************************************************************



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:29 MET