WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH][TOOLS] libfsimage, pygrub, python: cleanup

To: John Levon <levon@xxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH][TOOLS] libfsimage, pygrub, python: cleanup
From: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Date: Fri, 18 Jul 2008 15:10:13 +0100
Cc: Christoph Egger <Christoph.Egger@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Fri, 18 Jul 2008 07:11:35 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20080715223624.GA1589@xxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Newsgroups: chiark.mail.xen.devel
References: <200807151543.16172.Christoph.Egger@xxxxxxx> <20080715223624.GA1589@xxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
John Levon writes ("Re: [Xen-devel] [PATCH][TOOLS] libfsimage, pygrub, python: 
cleanup"):
> On Tue, Jul 15, 2008 at 03:43:16PM +0200, [someone] wrote:
> >  fsi_plugin_ops_t *
> > +fsi_init_plugin(int version, fsi_plugin_t *fp, const char **name);
> > +
> > +fsi_plugin_ops_t *
> >  fsi_init_plugin(int version, fsi_plugin_t *fp, const char **name)
> 
> Huh? If some GCC option is insisting on this, it's a stupid option and
> shouldn't be enabled.

This is the result of (a) -Wmissing-prototypes, which is sensible
and (b) the submitter missing the point.

The purpose of -Wmissing-prototypes is to spot this situation:

  a.h:  double function(void);

  b.c:  #include "a.h"
        double some_caller(void) { return function(); }

  a.c:  int function(void) { return 1; }

The result of this is undefined behaviour, and neither the compiler
nor the linker will spot it.  If you pass -Wmissing-prototypes, then
the compiler will complain in a.c that there was no prototype for
function in scope.

This is supposed to clue you in to the missing #include.  You are
supposed to change a.c to this

  a.c:  #include "a.h"
        int function(void) { return 1; }

and now the compiler will tell you that your definition and
declaration of function do not match.

However if you don't understand this, you may do what the submitter of
this patch did, which is to change a.c to read like this:

  a.c:  int function(void);
        int function(void) { return 1; }

This completely defeats the point of -Wmissing-prototypes; I think
it's just wrong.

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel