#4035 new enhancement

Reserved identifier "time" re-used in rtems_clock_get_tod_timeval()

Reported by: Jens Schweikhardt Owned by:
Priority: normal Milestone:
Component: rtems Version: 5
Severity: minor Keywords:
Cc: Blocked By:


The ISO C identifier "time" from time.h is re-used in the prototype and definition of the rtems_clock_get_tod_timeval() function (and maybe elsewhere too).
In certain cases this could lead to undefined behavior.
It certainly upsets our lint (Gimpel FlexeLint?).
It's good software hygiene to avoid shadowing ISO C identifiers.
Desired change: in cpukit/rtems/src/clockgettodtimeval.c
use an unreserved identifier.

Attachments (1)

x.diff (1.5 KB) - added by Jens Schweikhardt on Aug 1, 2020 at 8:38:16 AM.

Download all attachments as: .zip

Change History (4)

comment:1 Changed on Jul 31, 2020 at 1:58:47 PM by Jens Schweikhardt

The header should also be fixed, cpukit/include/rtems/rtems/clock.h

comment:2 Changed on Jul 31, 2020 at 2:31:47 PM by Joel Sherrill

Could you please provide a patch for this? It seems like a reasonable and mostly benign change but will ripple to Doxygen and documentation. If you fix the code to make your Flexelint happy, then we can be sure it is really fixed.

Changed on Aug 1, 2020 at 8:38:16 AM by Jens Schweikhardt

Attachment: x.diff added


comment:3 Changed on Aug 1, 2020 at 8:45:40 AM by Jens Schweikhardt

I've attached a patch renaming time to the_time, also in doxygen comments.
I'm new to git and followed the instructions for patch creation but ran into a wall with git format-patch (no output anywhere I could find). So I used git diff. The commit message could be

Rename the reserved identifier "time" to "the_time" to not invade ISO C name space.

Note: See TracTickets for help on using tickets.