# HG changeset patch # User john.levon@sun.com # Date 1181862105 25200 # Node ID b9d1affca0ff606998aee4cd46bd8f6c15fd4b23 # Parent 48ee88f21a3f6f4e92eafb2dec286df156f54cfe Make Xen headers lint-clean Make ring.h and xs_wire.h lint clean. Add an unused attribute to xsd_errors if using GCC, so we don''t get duplicate arrays in every object including the header. Signed-off-by: John Levon <john.levon@sun.com> Signed-off-by: Ryan Scott <ryan.scott@sun.com> diff --git a/xen/include/public/io/ring.h b/xen/include/public/io/ring.h --- a/xen/include/public/io/ring.h +++ b/xen/include/public/io/ring.h @@ -139,7 +139,7 @@ typedef struct __name##_back_ring __name #define SHARED_RING_INIT(_s) do { \ (_s)->req_prod = (_s)->rsp_prod = 0; \ (_s)->req_event = (_s)->rsp_event = 1; \ - memset((_s)->pad, 0, sizeof((_s)->pad)); \ + (void) memset((_s)->pad, 0, sizeof((_s)->pad)); \ } while(0) #define FRONT_RING_INIT(_r, _s, __size) do { \ diff --git a/xen/include/public/io/xs_wire.h b/xen/include/public/io/xs_wire.h --- a/xen/include/public/io/xs_wire.h +++ b/xen/include/public/io/xs_wire.h @@ -60,7 +60,12 @@ struct xsd_errors const char *errstring; }; #define XSD_ERROR(x) { x, #x } -static struct xsd_errors xsd_errors[] __attribute__((unused)) = { +/* LINTED: static unused */ +static struct xsd_errors xsd_errors[] +#if defined(__GNUC__) +__attribute__((unused)) +#endif + = { XSD_ERROR(EINVAL), XSD_ERROR(EACCES), XSD_ERROR(EEXIST), _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On 15/6/07 00:02, "john.levon@sun.com" <john.levon@sun.com> wrote:> Make ring.h and xs_wire.h lint clean. Add an unused attribute to xsd_errors if > using GCC, so we don''t get duplicate arrays in every object including the > header.Casting memset() to void is completely barking. Noone ever cares about the return value, or looks at it: is half the C code in the universe not lint clean therefore? And xsd_errors[] already has the unused attribute; this patch does not add it as the changeset comment suggests. Do you require to use that header file with a compiler other than gcc? -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On Fri, Jun 15, 2007 at 09:30:39AM +0100, Keir Fraser wrote:> > Make ring.h and xs_wire.h lint clean. Add an unused attribute to xsd_errors if > > using GCC, so we don''t get duplicate arrays in every object including the > > header. > > Casting memset() to void is completely barking. Noone ever cares about the > return value, or looks at it: is half the C code in the universe not lint > clean therefore?Correct. lint isn''t able to differentiate between sensible code and not. Which leaves us with either having one slightly silly piece of code here or maintaining a permanent patch against the file. I don''t think it''s too ugly to not apply.> And xsd_errors[] already has the unused attribute; this patch does not add > it as the changeset comment suggests.My apologies, I didn''t notice this from forward-porting the patch.> Do you require to use that header file with a compiler other than gcc?Yes, all the public headers need to be compiled with Sun CC as well. Unfortunately ''unused'' is one of the GCC attributes they haven''t implemented yet. regards john _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel