From: Ian Campbell Subject: Re: [PATCH V2 3/9] libxl_json: Introduce libxl__json_object_to_yajl_gen. Date: Tue, 25 Sep 2012 15:32:01 +0100 Message-ID: <1348583521.11229.24.camel@zakaz.uk.xensource.com> References: <1347906148-9606-1-git-send-email-anthony.perard@citrix.com> <1347906148-9606-4-git-send-email-anthony.perard@citrix.com> <1348562684.3452.116.camel@zakaz.uk.xensource.com> <5061BDAE.5030700@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <5061BDAE.5030700@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Anthony PERARD Cc: Ian Jackson , Xen Devel List-Id: xen-devel@lists.xenproject.org On Tue, 2012-09-25 at 15:20 +0100, Anthony PERARD wrote: > >> + case JSON_ANY: > > > > Is JSON_ANY sort of like a JSON "void *"? Is it ever valid to be passed > > one here, IOW does this represent a coding error (==abort()) or a run > > time one (== log something)? > > This value is only used as parameter of one function, > libxl__json_map_get, that return an object from the json_object tree > with the expected type. But sometime we don't expect any type so > JSON_ANY is used and allow "map_get" to return any type of object. > > So JSON_ANY is not valid here and would probably be a coding error. Lets abort() then. > > >> + default: > > > > If you skip this default case then some compilers will warn (a runtime > > error) if we forget to add a new JSON_FOO here. > > I tried to remove the default, but then gcc believe that the function > would not return in some cases. Gah! > But I did not add a return because it > felt weird to add a useless/never_executed return/abort. > > But it seams better to remove the default case, so I will. >