All of lore.kernel.org
 help / color / mirror / Atom feed
* [BUG] xenctrl.h : error with xc_error_code declaration
@ 2015-09-10 12:52 Sébastien Frémal
  2015-09-10 12:59 ` Razvan Cojocaru
  0 siblings, 1 reply; 2+ messages in thread
From: Sébastien Frémal @ 2015-09-10 12:52 UTC (permalink / raw)
  To: xen-devel@lists.xen.org


[-- Attachment #1.1: Type: text/plain, Size: 2054 bytes --]

Hello,

I just write to signal a bug and its solution. I installed the 14.04 LTS
ubuntu version and installed the xen version through synaptic. As I'm
developping modules for Xen I also installed the xen dev package. The
installed Xen version is 4.4.2.

I tried to compile one of my C files including xenctrl.h but I got the
following errors :
In file included from ../modules/gntring/libgntring4.c:12:0:
/usr/include/xenctrl.h:122:14: error: use of enum ‘xc_error_code’ without
previous declaration
 typedef enum xc_error_code xc_error_code;
              ^
/usr/include/xenctrl.h:122:41: error: invalid type in declaration before
‘;’ token
 typedef enum xc_error_code xc_error_code;
                                         ^
/usr/include/xenctrl.h:1759:6: error: using typedef-name ‘xc_error_code’
after ‘enum’
 enum xc_error_code {
      ^
/usr/include/xenctrl.h:122:28: note: ‘xc_error_code’ has a previous
declaration here
 typedef enum xc_error_code xc_error_code;
                            ^
/usr/include/xenctrl.h:1770:8: error: using typedef-name ‘xc_error_code’
after ‘enum’
   enum xc_error_code code;
        ^
/usr/include/xenctrl.h:122:28: note: ‘xc_error_code’ has a previous
declaration here
 typedef enum xc_error_code xc_error_code;




I looked at xenctrl.h and the typedef is put before the declaration of the
enum :

typedef enum xc_error_code xc_error_code;

...

enum xc_error_code {
  XC_ERROR_NONE = 0,
  XC_INTERNAL_ERROR = 1,
  XC_INVALID_KERNEL = 2,
  XC_INVALID_PARAM = 3,
  XC_OUT_OF_MEMORY = 4,
  /* new codes need to be added to xc_error_level_to_desc too */
};




I swapped the two declarations and that works just fine :

enum xc_error_code {
  XC_ERROR_NONE = 0,
  XC_INTERNAL_ERROR = 1,
  XC_INVALID_KERNEL = 2,
  XC_INVALID_PARAM = 3,
  XC_OUT_OF_MEMORY = 4,
  /* new codes need to be added to xc_error_level_to_desc too */
};

typedef enum xc_error_code xc_error_code;




Best regards,

Sebastien Fremal

[-- Attachment #1.2: Type: text/html, Size: 2424 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: [BUG] xenctrl.h : error with xc_error_code declaration
  2015-09-10 12:52 [BUG] xenctrl.h : error with xc_error_code declaration Sébastien Frémal
@ 2015-09-10 12:59 ` Razvan Cojocaru
  0 siblings, 0 replies; 2+ messages in thread
From: Razvan Cojocaru @ 2015-09-10 12:59 UTC (permalink / raw)
  To: Sébastien Frémal, xen-devel@lists.xen.org

On 09/10/2015 03:52 PM, Sébastien Frémal wrote:
> I just write to signal a bug and its solution. I installed the 14.04 LTS
> ubuntu version and installed the xen version through synaptic. As I'm
> developping modules for Xen I also installed the xen dev package. The
> installed Xen version is 4.4.2.
> 
> I tried to compile one of my C files including xenctrl.h but I got the
> following errors :
> In file included from ../modules/gntring/libgntring4.c:12:0:
> /usr/include/xenctrl.h:122:14: error: use of enum ‘xc_error_code’
> without previous declaration
>  typedef enum xc_error_code xc_error_code;
>               ^
> /usr/include/xenctrl.h:122:41: error: invalid type in declaration before
> ‘;’ token
>  typedef enum xc_error_code xc_error_code;
>                                          ^
> /usr/include/xenctrl.h:1759:6: error: using typedef-name ‘xc_error_code’
> after ‘enum’
>  enum xc_error_code {
>       ^
> /usr/include/xenctrl.h:122:28: note: ‘xc_error_code’ has a previous
> declaration here
>  typedef enum xc_error_code xc_error_code;
>                             ^
> /usr/include/xenctrl.h:1770:8: error: using typedef-name ‘xc_error_code’
> after ‘enum’
>    enum xc_error_code code;
>         ^
> /usr/include/xenctrl.h:122:28: note: ‘xc_error_code’ has a previous
> declaration here
>  typedef enum xc_error_code xc_error_code;
> 
> 
> 
> 
> I looked at xenctrl.h and the typedef is put before the declaration of
> the enum :
> 
> typedef enum xc_error_code xc_error_code;
> 
> ...
> 
> enum xc_error_code {
>   XC_ERROR_NONE = 0,
>   XC_INTERNAL_ERROR = 1,
>   XC_INVALID_KERNEL = 2,
>   XC_INVALID_PARAM = 3,
>   XC_OUT_OF_MEMORY = 4,
>   /* new codes need to be added to xc_error_level_to_desc too */
> };
> 
> 
> 
> 
> I swapped the two declarations and that works just fine :
> 
> enum xc_error_code {
>   XC_ERROR_NONE = 0,
>   XC_INTERNAL_ERROR = 1,
>   XC_INVALID_KERNEL = 2,
>   XC_INVALID_PARAM = 3,
>   XC_OUT_OF_MEMORY = 4,
>   /* new codes need to be added to xc_error_level_to_desc too */
> };
> 
> typedef enum xc_error_code xc_error_code;

That's already been fixed in 4.6:

http://lists.xen.org/archives/html/xen-devel/2014-07/msg00423.html


Cheers,
Razvan

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

end of thread, other threads:[~2015-09-10 12:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-10 12:52 [BUG] xenctrl.h : error with xc_error_code declaration Sébastien Frémal
2015-09-10 12:59 ` Razvan Cojocaru

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.