Add an UNUSED annotation, and use it in libsys.
This commit is contained in:
parent
da25ecf758
commit
23e97af1b4
6 changed files with 46 additions and 15 deletions
|
@ -5,6 +5,33 @@
|
||||||
#error CHIP is not defined
|
#error CHIP is not defined
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* The UNUSED annotation tells the compiler or lint not to complain
|
||||||
|
* about an unused variable or function parameter.
|
||||||
|
*
|
||||||
|
* A number of different annotations are used, depending on the
|
||||||
|
* compiler or checker that is looking at the code.
|
||||||
|
*
|
||||||
|
* Note that some variants rename the parameter, so if you use
|
||||||
|
* the parameter after all, you'll get a complaint about a missing
|
||||||
|
* variable.
|
||||||
|
*
|
||||||
|
* You use it like this:
|
||||||
|
*
|
||||||
|
* void foo(int UNUSED(x)){}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef UNUSED
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
# define UNUSED(v) UNUSED_ ## v __attribute((unused))
|
||||||
|
#elif defined _lint
|
||||||
|
# define UNUSED(v) /*lint -e(715)*/ v
|
||||||
|
#elif defined __LCLINT__
|
||||||
|
# define UNUSED(v) /*@unused@*/ v
|
||||||
|
#else
|
||||||
|
# define UNUSED(v) _UNUSED_ ## v
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#define EXTERN extern /* used in *.h files */
|
#define EXTERN extern /* used in *.h files */
|
||||||
#define PRIVATE static /* PRIVATE x limits the scope of x */
|
#define PRIVATE static /* PRIVATE x limits the scope of x */
|
||||||
#define PUBLIC /* PUBLIC is the opposite of PRIVATE */
|
#define PUBLIC /* PUBLIC is the opposite of PRIVATE */
|
||||||
|
@ -15,7 +42,7 @@
|
||||||
|
|
||||||
#define DEFAULT_HZ 60 /* clock freq (software settable on IBM-PC) */
|
#define DEFAULT_HZ 60 /* clock freq (software settable on IBM-PC) */
|
||||||
|
|
||||||
#define SUPER_USER (uid_t) 0 /* uid_t of superuser */
|
#define SUPER_USER ((uid_t) 0) /* uid_t of superuser */
|
||||||
|
|
||||||
#define NULL ((void *)0) /* null pointer */
|
#define NULL ((void *)0) /* null pointer */
|
||||||
#define SCPVEC_NR 64 /* max # of entries in a SYS_VSAFECOPY* request */
|
#define SCPVEC_NR 64 /* max # of entries in a SYS_VSAFECOPY* request */
|
||||||
|
|
|
@ -167,7 +167,7 @@ PUBLIC void procentry (char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PUBLIC void procexit (char *name)
|
PUBLIC void procexit (char *UNUSED(name))
|
||||||
{
|
{
|
||||||
u64_t stop, spent;
|
u64_t stop, spent;
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,8 @@ PUBLIC void sef_setcb_init_restart(sef_cb_init_restart_t cb)
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* sef_cb_init_fresh_null *
|
* sef_cb_init_fresh_null *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC int sef_cb_init_fresh_null(int type, sef_init_info_t *info)
|
PUBLIC int sef_cb_init_fresh_null(int UNUSED(type),
|
||||||
|
sef_init_info_t *UNUSED(info))
|
||||||
{
|
{
|
||||||
return(OK);
|
return(OK);
|
||||||
}
|
}
|
||||||
|
@ -114,7 +115,7 @@ PUBLIC int sef_cb_init_fresh_null(int type, sef_init_info_t *info)
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* sef_cb_init_lu_null *
|
* sef_cb_init_lu_null *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC int sef_cb_init_lu_null(int type, sef_init_info_t *info)
|
PUBLIC int sef_cb_init_lu_null(int UNUSED(type), sef_init_info_t *UNUSED(info))
|
||||||
{
|
{
|
||||||
return(OK);
|
return(OK);
|
||||||
}
|
}
|
||||||
|
@ -122,7 +123,8 @@ PUBLIC int sef_cb_init_lu_null(int type, sef_init_info_t *info)
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* sef_cb_init_restart_null *
|
* sef_cb_init_restart_null *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC int sef_cb_init_restart_null(int type, sef_init_info_t *info)
|
PUBLIC int sef_cb_init_restart_null(int UNUSED(type),
|
||||||
|
sef_init_info_t *UNUSED(info))
|
||||||
{
|
{
|
||||||
return(OK);
|
return(OK);
|
||||||
}
|
}
|
||||||
|
@ -130,7 +132,8 @@ PUBLIC int sef_cb_init_restart_null(int type, sef_init_info_t *info)
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* sef_cb_init_restart_fail *
|
* sef_cb_init_restart_fail *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC int sef_cb_init_restart_fail(int type, sef_init_info_t *info)
|
PUBLIC int sef_cb_init_restart_fail(int UNUSED(type),
|
||||||
|
sef_init_info_t *UNUSED(info))
|
||||||
{
|
{
|
||||||
return(ENOSYS);
|
return(ENOSYS);
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,14 +192,14 @@ PUBLIC void sef_setcb_lu_ready_pre(sef_cb_lu_ready_pre_t cb)
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* sef_cb_lu_prepare_null *
|
* sef_cb_lu_prepare_null *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC void sef_cb_lu_prepare_null(int state)
|
PUBLIC void sef_cb_lu_prepare_null(int UNUSED(state))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* sef_cb_lu_state_isvalid_null *
|
* sef_cb_lu_state_isvalid_null *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC int sef_cb_lu_state_isvalid_null(int state)
|
PUBLIC int sef_cb_lu_state_isvalid_null(int UNUSED(state))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -207,14 +207,15 @@ PUBLIC int sef_cb_lu_state_isvalid_null(int state)
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* sef_cb_lu_state_changed_null *
|
* sef_cb_lu_state_changed_null *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC void sef_cb_lu_state_changed_null(int old_state, int state)
|
PUBLIC void sef_cb_lu_state_changed_null(int UNUSED(old_state),
|
||||||
|
int UNUSED(state))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* sef_cb_lu_state_dump_null *
|
* sef_cb_lu_state_dump_null *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC void sef_cb_lu_state_dump_null(int state)
|
PUBLIC void sef_cb_lu_state_dump_null(int UNUSED(state))
|
||||||
{
|
{
|
||||||
sef_lu_dprint("NULL\n");
|
sef_lu_dprint("NULL\n");
|
||||||
}
|
}
|
||||||
|
@ -222,7 +223,7 @@ PUBLIC void sef_cb_lu_state_dump_null(int state)
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* sef_cb_lu_ready_pre_null *
|
* sef_cb_lu_ready_pre_null *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC int sef_cb_lu_ready_pre_null(int result)
|
PUBLIC int sef_cb_lu_ready_pre_null(int UNUSED(result))
|
||||||
{
|
{
|
||||||
return(OK);
|
return(OK);
|
||||||
}
|
}
|
||||||
|
@ -230,7 +231,7 @@ PUBLIC int sef_cb_lu_ready_pre_null(int result)
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* sef_cb_lu_prepare_always_ready *
|
* sef_cb_lu_prepare_always_ready *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC void sef_cb_lu_prepare_always_ready(int state)
|
PUBLIC void sef_cb_lu_prepare_always_ready(int UNUSED(state))
|
||||||
{
|
{
|
||||||
sef_lu_ready(OK);
|
sef_lu_ready(OK);
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ PUBLIC void sef_setcb_ping_reply(sef_cb_ping_reply_t cb)
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* sef_cb_ping_reply_null *
|
* sef_cb_ping_reply_null *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC void sef_cb_ping_reply_null(message *m_ptr)
|
PUBLIC void sef_cb_ping_reply_null(message *UNUSED(m_ptr))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,8 @@ sys_hz(void)
|
||||||
/* Get HZ. */
|
/* Get HZ. */
|
||||||
if((r=sys_getinfo(GET_HZ, &Hz, sizeof(Hz), 0, 0)) != OK) {
|
if((r=sys_getinfo(GET_HZ, &Hz, sizeof(Hz), 0, 0)) != OK) {
|
||||||
Hz = DEFAULT_HZ;
|
Hz = DEFAULT_HZ;
|
||||||
printf("sys_hz: %d: reverting to HZ = %d\n", r, Hz);
|
printf("sys_hz: can not get HZ: error %d.\nUsing default HZ = %u\n",
|
||||||
|
r, (unsigned int) Hz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,4 +37,3 @@ micros_to_ticks(u32_t micros)
|
||||||
return ticks;
|
return ticks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue