Laszlo Ersek
2021-Nov-25 15:55 UTC
[Libguestfs] [PATCH nbdkit v2 follow-up 2/4] Add __attribute__((__unused__))
On 11/25/21 16:30, Richard W.M. Jones wrote:> ../../common/include/checked-overflow.h:164:18: error: typedef 'x_has_uint_type' locally defined but not used [-Werror=unused-local-typedefs] > typedef char x_has_uint_type[(typeof (x))-1 > 0 ? 1 : -1]; \ > ^ > --- > common/include/checked-overflow.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/common/include/checked-overflow.h b/common/include/checked-overflow.h > index d72f95a2..01943948 100644 > --- a/common/include/checked-overflow.h > +++ b/common/include/checked-overflow.h > @@ -161,7 +161,7 @@ > */ > #define STATIC_ASSERT_UNSIGNED_INT(x) \ > do { \ > - typedef char x_has_uint_type[(typeof (x))-1 > 0 ? 1 : -1]; \ > + typedef char x_has_uint_type[(typeof (x))-1 > 0 ? 1 : -1] __attribute__((__unused__)); \ > } while (0) > > /* Assign the sum "a + b" to "*r", using uintmax_t modular arithmetic. >This breaks the nice 80 chars width; can I move __attribute__((__unused__)) to the next line? If so, how many space chars should I use for indentation, relative to the "typedef"? Thanks! Laszlo
Richard W.M. Jones
2021-Nov-25 16:01 UTC
[Libguestfs] [PATCH nbdkit v2 follow-up 2/4] Add __attribute__((__unused__))
On Thu, Nov 25, 2021 at 04:55:25PM +0100, Laszlo Ersek wrote:> On 11/25/21 16:30, Richard W.M. Jones wrote: > > ../../common/include/checked-overflow.h:164:18: error: typedef 'x_has_uint_type' locally defined but not used [-Werror=unused-local-typedefs] > > typedef char x_has_uint_type[(typeof (x))-1 > 0 ? 1 : -1]; \ > > ^ > > --- > > common/include/checked-overflow.h | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/common/include/checked-overflow.h b/common/include/checked-overflow.h > > index d72f95a2..01943948 100644 > > --- a/common/include/checked-overflow.h > > +++ b/common/include/checked-overflow.h > > @@ -161,7 +161,7 @@ > > */ > > #define STATIC_ASSERT_UNSIGNED_INT(x) \ > > do { \ > > - typedef char x_has_uint_type[(typeof (x))-1 > 0 ? 1 : -1]; \ > > + typedef char x_has_uint_type[(typeof (x))-1 > 0 ? 1 : -1] __attribute__((__unused__)); \ > > } while (0) > > > > /* Assign the sum "a + b" to "*r", using uintmax_t modular arithmetic. > > > > This breaks the nice 80 chars width; can I move > __attribute__((__unused__)) to the next line? If so, how many space > chars should I use for indentation, relative to the "typedef"?Sure; no idea! Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/