summaryrefslogtreecommitdiff
path: root/src/plot/32bpp-xrgb8888.c
diff options
context:
space:
mode:
authorRob Kendrick (humdrum) <rob.kendrick@codethink.co.uk>2013-04-25 15:13:36 +0100
committerRob Kendrick (humdrum) <rob.kendrick@codethink.co.uk>2013-04-25 15:13:36 +0100
commitfb5c3f3169d3a8d1e85626914b55825733b5376c (patch)
treefcbd30f7b9c369b0c1dbf1930d87eb8e6029843e /src/plot/32bpp-xrgb8888.c
parent9aeab2e5176285583f8d669ba79ce6ff45b81a00 (diff)
downloadlibnsfb-rjek/clang-warnings.tar.gz
libnsfb-rjek/clang-warnings.tar.bz2
Rationalise UNUSED macros. This changeset allows libnsfb to berjek/clang-warnings
built warning-free both with Clang 3.3 (from trunk) and GCC 4.7. Remove the use of GCC-specific __attribute__ ((unused)) as this only works on declarations, meaning there is no "fallback" to use on compilers that are not GCC or clang. The (void)foo; approach works with both clang and GCC, and hopefully other compilers people might be using. The alternative would to have been two UNUSED macros, one for use in definitions, and one for use in function bodies.
Diffstat (limited to 'src/plot/32bpp-xrgb8888.c')
-rw-r--r--src/plot/32bpp-xrgb8888.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/plot/32bpp-xrgb8888.c b/src/plot/32bpp-xrgb8888.c
index 548c970..fb69d91 100644
--- a/src/plot/32bpp-xrgb8888.c
+++ b/src/plot/32bpp-xrgb8888.c
@@ -18,36 +18,37 @@
#include "nsfb.h"
#include "plot.h"
-
-#define UNUSED __attribute__((unused))
-
static inline uint32_t *get_xy_loc(nsfb_t *nsfb, int x, int y)
{
return (void *)(nsfb->ptr + (y * nsfb->linelen) + (x << 2));
}
#if __BYTE_ORDER == __BIG_ENDIAN
-static inline nsfb_colour_t pixel_to_colour(UNUSED nsfb_t *nsfb, uint32_t pixel)
+static inline nsfb_colour_t pixel_to_colour(nsfb_t *nsfb, uint32_t pixel)
{
+ UNUSED(nsfb);
return (pixel >> 8) & ~0xFF000000U;
}
/* convert a colour value to a 32bpp pixel value ready for screen output */
-static inline uint32_t colour_to_pixel(UNUSED nsfb_t *nsfb, nsfb_colour_t c)
+static inline uint32_t colour_to_pixel(nsfb_t *nsfb, nsfb_colour_t c)
{
+ UNUSED(nsfb);
return (c << 8);
}
#else /* __BYTE_ORDER == __BIG_ENDIAN */
-static inline nsfb_colour_t pixel_to_colour(UNUSED nsfb_t *nsfb, uint32_t pixel)
+static inline nsfb_colour_t pixel_to_colour(nsfb_t *nsfb, uint32_t pixel)
{
+ UNUSED(nsfb);
return ((pixel & 0xFF) << 16) |
((pixel & 0xFF00)) |
((pixel & 0xFF0000) >> 16);
}
/* convert a colour value to a 32bpp pixel value ready for screen output */
-static inline uint32_t colour_to_pixel(UNUSED nsfb_t *nsfb, nsfb_colour_t c)
+static inline uint32_t colour_to_pixel(nsfb_t *nsfb, nsfb_colour_t c)
{
+ UNUSED(nsfb);
return ((c & 0xff0000) >> 16) | (c & 0xff00) | ((c & 0xff) << 16);
}
#endif