#1301 closed defect (fixed)

cpukit/sapi/src/debug.c: _Debug_Is_enabled boolean abuse

Reported by: Ralf Corsepius Owned by: Joel Sherrill
Priority: normal Milestone: 4.8
Component: score Version: 4.8
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

cpukit/sapi/src/debug.c contains this code:

boolean _Debug_Is_enabled(

rtems_debug_control level

)
{

return (_Debug_Level & level);

}

=> function uses "boolean" as "false == 0" and "true == '!= 0'" (as an integer)
and not as a strictly binary type ("false == 0" and "true == 1"; stdbool.h's "bool"'s definition).

=> IMO, this code should likely be changed into
...

  • return (_Debug_Level & level);

+ return (_Debug_Level & level) ? true : false;
...

Change History (1)

comment:1 Changed on Sep 2, 2008 at 8:24:06 AM by Ralf Corsepius

Resolution: fixed
Status: newclosed

Applied this patch to rtems-4-8-branch and CVS-HEAD:

@@ -61,5 +61,5 @@

rtems_debug_control level

)
{

  • return (_Debug_Level & level);

+ return (_Debug_Level & level) ? TRUE : FALSE;

}

... Closing.

Note: See TracTickets for help on using tickets.