Add macro UNUSED to eliminate warnings about variables that are set to unused values

This commit is contained in:
Gregory Nutt 2014-03-30 07:58:58 -06:00
parent 392031ff7c
commit 060b84240b
4 changed files with 10 additions and 3 deletions

View File

@ -7076,4 +7076,6 @@
* configs/sama5d3x-ek: Change all configuration names to board-
specific names so that this are no name collisions with other
boards that have similar configuration variables (2013-3-30).
* configs/nuttx/compiler.h: Add macro UNUSED() that can be used
to eliminate warnings about variables that are set to values
that are not used (2014-3-30).

View File

@ -352,8 +352,8 @@ static inline int ramtron_readid(struct ramtron_dev_s *priv)
if (priv->part->name)
{
(void)manufacturer; /* Eliminate warnings when debug is off */
(void)memory; /* Eliminate warnings when debug is off */
UNUSED(manufacturer); /* Eliminate warnings when debug is off */
UNUSED(memory); /* Eliminate warnings when debug is off */
fvdbg("RAMTRON %s of size %d bytes (mf:%02x mem:%02x cap:%02x part:%02x)\n",
priv->part->name, priv->part->size, manufacturer, memory, capacity, part);

View File

@ -391,6 +391,7 @@ static void usbmsc_scsi_wait(FAR struct usbmsc_dev_s *priv)
{
ret = sem_wait(&priv->thwaitsem);
DEBUGASSERT(ret == OK || errno == EINTR);
UNUSED(ret); /* Eliminate warnings when debug is off */
}
while (priv->thwaiting);

View File

@ -58,6 +58,10 @@
# define CONFIG_HAVE_FUNCTIONNAME 1 /* Has __FUNCTION__ */
# define CONFIG_HAVE_FILENAME 1 /* Has __FILE__ */
/* Indicate that a local variable is not used */
# define UNUSED(a) ((void)(a))
/* Attributes
*
* GCC supports weak symbols which can be used to reduce code size because