This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Reindent nptl/pthread_rwlock_common.c
* Andreas Schwab:
> On Dez 11 2018, Florian Weimer <fweimer@redhat.com> wrote:
>
>> * Andreas Schwab:
>>
>>> @@ -338,8 +338,9 @@ __pthread_rwlock_rdlock_full (pthread_rwlock_t *rwlock,
>>> expected value for future operations. Acquire MO so we synchronize with
>>> prior writers as well as the last reader of the previous read phase (see
>>> below). */
>>> - r = atomic_fetch_add_acquire (&rwlock->__data.__readers,
>>> - (1 << PTHREAD_RWLOCK_READER_SHIFT)) + (1 << PTHREAD_RWLOCK_READER_SHIFT);
>>> + r = (atomic_fetch_add_acquire (&rwlock->__data.__readers,
>>> + (1 << PTHREAD_RWLOCK_READER_SHIFT))
>>> + + (1 << PTHREAD_RWLOCK_READER_SHIFT));
>>
>> Aren't some of these parentheses you are removing recommended for
>> getting correct indentation from Emacs?
>
> Which parens do I remove?
Further up, in the while condition:
while [-(((r-]{+((r+} & PTHREAD_RWLOCK_WRPHASE) == [-0)-]{+0+}
&& [-((r-]{+(r+} & PTHREAD_RWLOCK_WRLOCKED) != [-0)-]{+0+}
&& [-((r-]{+(r+} >> PTHREAD_RWLOCK_READER_SHIFT) > [-0))-]{+0)+}
But those aren't used for indentation anyway.
The parentheses you add are consistent with the Emacs-influenced style,
so I'd say this is okay.
There's a clear misindentation remaining, which you should fix as well:
- /* Try to enter a read phase: If the CAS below succeeds, we have
+ /* Try to enter a read phase: If the CAS below succeeds, we have
And Emacs 26 at least finds a few other inconsistencies (but which are
debatable).
Thanks,
Florian