On Tue, Apr 25, 2017 at 7:25 PM, Gedare Bloom <ged...@rtems.org> wrote:
> On Tue, Apr 25, 2017 at 7:14 PM, Joel Sherrill <j...@rtems.org> wrote: > > Module: rtems > > Branch: master > > Commit: 6601684f74f0ea1ec44fb52ec75d52215af11f5f > > Changeset: http://git.rtems.org/rtems/commit/?id= > 6601684f74f0ea1ec44fb52ec75d52215af11f5f > > > > Author: Joel Sherrill <j...@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 you see how to do it, please go ahead. I have looked into this multiple times over the years and not found the magic. > > > if ( attr ) the_attr = attr; > > else the_attr = &_POSIX_Mutex_Default_attributes; > > > > > > _______________________________________________ > > vc mailing list > > v...@rtems.org > > http://lists.rtems.org/mailman/listinfo/vc > _______________________________________________ > devel mailing list > devel@rtems.org > http://lists.rtems.org/mailman/listinfo/devel >
_______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel