[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2] libxl: introduce LIBXL_DOMAIN_TYPE_INVALID



Dario Faggioli wrote:
To avoid recent gcc complaining about:
libxl.c: In function âlibxl_primary_console_execâ:
libxl.c:1233:9: error: case value â4294967295â not in enumerated type 
âlibxl_domain_typeâ [-Werror=switch]

Adjust code pieces where -Wswitch makes it claim that
LIBXL_DOMAIN_TYPE_INVALID is not handled.

Thanks for the patch I've tried it and works ok, so the below comment is just a suggestion about error handling.

Signed-off-by: Dario Faggioli<dario.faggioli@xxxxxxxxxx>
Signed-off-by: Christoph Egger<Christoph.Egger@xxxxxxx>
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -257,6 +257,8 @@ static char ** libxl__build_device_model
          for (i = 0; b_info->extra_hvm&&  b_info->extra_hvm[i] != NULL; i++)
              flexarray_append(dm_args, b_info->extra_hvm[i]);
          break;
+    case LIBXL_DOMAIN_TYPE_INVALID:
+        break;
      }
      flexarray_append(dm_args, NULL);
      return (char **) flexarray_contents(dm_args);
@@ -505,6 +507,8 @@ static char ** libxl__build_device_model
          for (i = 0; b_info->extra_hvm&&  b_info->extra_hvm[i] != NULL; i++)
              flexarray_append(dm_args, b_info->extra_hvm[i]);
          break;
+    case LIBXL_DOMAIN_TYPE_INVALID:
+        break;
      }

I think we should use "default" here (and on the previous one), print an error message, and probably return NULL. I guess we are going to get an error at some point later, so I think it's better to catch it here.

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.