[rtems commit] posix/src/mutexinit.c: Fix used before initialized warning
Gedare Bloom
gedare at rtems.org
Wed Apr 26 00:25:03 UTC 2017
On Tue, Apr 25, 2017 at 7:14 PM, Joel Sherrill <joel at rtems.org> wrote:
> Module: rtems
> Branch: master
> Commit: 6601684f74f0ea1ec44fb52ec75d52215af11f5f
> Changeset: http://git.rtems.org/rtems/commit/?id=6601684f74f0ea1ec44fb52ec75d52215af11f5f
>
> Author: Joel Sherrill <joel at rtems.org>
> Date: Tue Apr 25 13:57:03 2017 -0500
>
> posix/src/mutexinit.c: Fix used before initialized warning
>
> ---
>
> cpukit/posix/src/mutexinit.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/cpukit/posix/src/mutexinit.c b/cpukit/posix/src/mutexinit.c
> index 39139a4..47e0bcb 100644
> --- a/cpukit/posix/src/mutexinit.c
> +++ b/cpukit/posix/src/mutexinit.c
> @@ -40,6 +40,9 @@ int pthread_mutex_init(
> const Scheduler_Control *scheduler;
> Priority_Control priority;
>
> + /* initialize to avoid warning for used uninitialized */
> + priority = 0;
> +
The warning is spurious. You could refactor the code so the compiler
doesn't get confused.
> if ( attr ) the_attr = attr;
> else the_attr = &_POSIX_Mutex_Default_attributes;
>
>
> _______________________________________________
> vc mailing list
> vc at rtems.org
> http://lists.rtems.org/mailman/listinfo/vc
More information about the devel
mailing list