<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Mar 19, 2020 at 6:15 PM Colin Ian King <<a href="mailto:colin.king@canonical.com">colin.king@canonical.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 19/03/2020 23:33, Alex Hung wrote:<br>
> I found this breaks on 32bit (both PC & ARM) systems...<br>
<br>
Apologies for that. Let's just ignore (or revert) this one and I'll work<br>
on a V2 for the next release.<br></blockquote><div><br></div><div><div style="font-family:verdana,sans-serif" class="gmail_default">I also tried to build without this patch, but it won't compile. The following patch seems to depend on this one<br></div></div><div><br></div><div>1257875 New Makfile: add more warning flags to ensure we catch more issues<br></div><div><br></div><div><div style="font-family:verdana,sans-serif" class="gmail_default">error message as below:</div><br></div><div>opal/reserv_mem.c: In function ‘make_message’:<br>opal/reserv_mem.c:101:2: error: function ‘make_message’ might be a candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format]<br> vsnprintf(p, size, fmt, ap);<br> ^~~~~~~~~<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Colin<br>
<br>
> <br>
> On Wed, Mar 18, 2020 at 6:50 PM Alex Hung <<a href="mailto:alex.hung@canonical.com" target="_blank">alex.hung@canonical.com</a><br>
> <mailto:<a href="mailto:alex.hung@canonical.com" target="_blank">alex.hung@canonical.com</a>>> wrote:<br>
> <br>
> On 2020-03-18 5:59 p.m., Colin King wrote:<br>
> > From: Colin Ian King <<a href="mailto:colin.king@canonical.com" target="_blank">colin.king@canonical.com</a><br>
> <mailto:<a href="mailto:colin.king@canonical.com" target="_blank">colin.king@canonical.com</a>>><br>
> ><br>
> > Use the printf format attribute specifier to add a little more<br>
> > type checking. Wrap this with a FWTS_FORMAT macro so that we<br>
> > can no-op this for older compilers that don't support this<br>
> > feature.<br>
> ><br>
> > Signed-off-by: Colin Ian King <<a href="mailto:colin.king@canonical.com" target="_blank">colin.king@canonical.com</a><br>
> <mailto:<a href="mailto:colin.king@canonical.com" target="_blank">colin.king@canonical.com</a>>><br>
> > ---<br>
> > src/lib/include/fwts.h | 8 ++++++++<br>
> > src/opal/reserv_mem.c | 2 ++<br>
> > 2 files changed, 10 insertions(+)<br>
> ><br>
> > diff --git a/src/lib/include/fwts.h b/src/lib/include/fwts.h<br>
> > index 7a05befc..7effe818 100644<br>
> > --- a/src/lib/include/fwts.h<br>
> > +++ b/src/lib/include/fwts.h<br>
> > @@ -142,6 +142,14 @@<br>
> > #define OPTIMIZE0<br>
> > #endif<br>
> > <br>
> > +/* print format attribute */<br>
> > +#if ((defined(__GNUC__) && NEED_GNUC(3,2,0)) || \<br>
> > + (defined(__clang__) && NEED_CLANG(3, 7, 0)))<br>
> > +#define FWTS_FORMAT(func, a, b) __attribute__((format(func, a, b)))<br>
> > +#else<br>
> > +#define FWTS_FORMAT(func, a, b)<br>
> > +#endif<br>
> > +<br>
> > #define FWTS_UNUSED(var) (void)var<br>
> > <br>
> > #define FWTS_JSON_DATA_PATH DATAROOTDIR "/fwts"<br>
> > diff --git a/src/opal/reserv_mem.c b/src/opal/reserv_mem.c<br>
> > index f243fb2e..82293c91 100644<br>
> > --- a/src/opal/reserv_mem.c<br>
> > +++ b/src/opal/reserv_mem.c<br>
> > @@ -87,6 +87,8 @@ static int get_config(fwts_framework *fw,<br>
> > return FWTS_OK;<br>
> > }<br>
> > <br>
> > +static char *make_message(const char *fmt, ...)<br>
> FWTS_FORMAT(printf, 1, 2);<br>
> > +<br>
> > static char *make_message(const char *fmt, ...)<br>
> > {<br>
> > char *p;<br>
> ><br>
> <br>
> Acked-by: Alex Hung <<a href="mailto:alex.hung@canonical.com" target="_blank">alex.hung@canonical.com</a><br>
> <mailto:<a href="mailto:alex.hung@canonical.com" target="_blank">alex.hung@canonical.com</a>>><br>
> <br>
> <br>
> <br>
> -- <br>
> Cheers,<br>
> Alex Hung<br>
> <br>
<br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr">Cheers,<br>Alex Hung<br></div></div></div>