diff mbox

[FFmpeg-devel] compat/atomics/gcc: use __typeof__ instead of typeof

Message ID 20170317184639.4788-1-jamrial@gmail.com
State Accepted
Commit 824d4062a172bd435fea7cbf8d6b55583c73e70e
Headers show

Commit Message

James Almer March 17, 2017, 6:46 p.m. UTC
Signed-off-by: James Almer <jamrial@gmail.com>
---
 compat/atomics/gcc/stdatomic.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Carl Eugen Hoyos March 17, 2017, 10:31 p.m. UTC | #1
2017-03-17 19:46 GMT+01:00 James Almer <jamrial@gmail.com>:
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  compat/atomics/gcc/stdatomic.h | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/compat/atomics/gcc/stdatomic.h b/compat/atomics/gcc/stdatomic.h
> index 41caddec5c..2b64687437 100644
> --- a/compat/atomics/gcc/stdatomic.h
> +++ b/compat/atomics/gcc/stdatomic.h
> @@ -100,8 +100,8 @@ do {                                    \
>
>  #define atomic_exchange(object, desired)                            \
>  ({                                                                  \
> -    typeof(object) _obj = (object);                                 \
> -    typeof(*object) _old;                                           \
> +    __typeof__(object) _obj = (object);                             \
> +    __typeof__(*object) _old;                                       \

Maybe mention why this is a good idea?

Carl Eugen
Muhammad Faiz March 18, 2017, 6:39 a.m. UTC | #2
On Sat, Mar 18, 2017 at 5:31 AM, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
> 2017-03-17 19:46 GMT+01:00 James Almer <jamrial@gmail.com>:
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>>  compat/atomics/gcc/stdatomic.h | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/compat/atomics/gcc/stdatomic.h b/compat/atomics/gcc/stdatomic.h
>> index 41caddec5c..2b64687437 100644
>> --- a/compat/atomics/gcc/stdatomic.h
>> +++ b/compat/atomics/gcc/stdatomic.h
>> @@ -100,8 +100,8 @@ do {                                    \
>>
>>  #define atomic_exchange(object, desired)                            \
>>  ({                                                                  \
>> -    typeof(object) _obj = (object);                                 \
>> -    typeof(*object) _old;                                           \
>> +    __typeof__(object) _obj = (object);                             \
>> +    __typeof__(*object) _old;                                       \
>
> Maybe mention why this is a good idea?

https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2017-March/208000.html

LGTM
Thank's
wm4 March 18, 2017, 6:54 a.m. UTC | #3
On Sat, 18 Mar 2017 13:39:34 +0700
Muhammad Faiz <mfcc64@gmail.com> wrote:

> On Sat, Mar 18, 2017 at 5:31 AM, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
> > 2017-03-17 19:46 GMT+01:00 James Almer <jamrial@gmail.com>:  
> >> Signed-off-by: James Almer <jamrial@gmail.com>
> >> ---
> >>  compat/atomics/gcc/stdatomic.h | 8 ++++----
> >>  1 file changed, 4 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/compat/atomics/gcc/stdatomic.h b/compat/atomics/gcc/stdatomic.h
> >> index 41caddec5c..2b64687437 100644
> >> --- a/compat/atomics/gcc/stdatomic.h
> >> +++ b/compat/atomics/gcc/stdatomic.h
> >> @@ -100,8 +100,8 @@ do {                                    \
> >>
> >>  #define atomic_exchange(object, desired)                            \
> >>  ({                                                                  \
> >> -    typeof(object) _obj = (object);                                 \
> >> -    typeof(*object) _old;                                           \
> >> +    __typeof__(object) _obj = (object);                             \
> >> +    __typeof__(*object) _old;                                       \  
> >
> > Maybe mention why this is a good idea?  
> 
> https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2017-March/208000.html
> 
> LGTM
> Thank's

I think he knows the reason, but wants the patch author to mention it in
the commit message.
James Almer March 18, 2017, 3:15 p.m. UTC | #4
On 3/18/2017 3:39 AM, Muhammad Faiz wrote:
> On Sat, Mar 18, 2017 at 5:31 AM, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
>> 2017-03-17 19:46 GMT+01:00 James Almer <jamrial@gmail.com>:
>>> Signed-off-by: James Almer <jamrial@gmail.com>
>>> ---
>>>  compat/atomics/gcc/stdatomic.h | 8 ++++----
>>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/compat/atomics/gcc/stdatomic.h b/compat/atomics/gcc/stdatomic.h
>>> index 41caddec5c..2b64687437 100644
>>> --- a/compat/atomics/gcc/stdatomic.h
>>> +++ b/compat/atomics/gcc/stdatomic.h
>>> @@ -100,8 +100,8 @@ do {                                    \
>>>
>>>  #define atomic_exchange(object, desired)                            \
>>>  ({                                                                  \
>>> -    typeof(object) _obj = (object);                                 \
>>> -    typeof(*object) _old;                                           \
>>> +    __typeof__(object) _obj = (object);                             \
>>> +    __typeof__(*object) _old;                                       \
>>
>> Maybe mention why this is a good idea?
> 
> https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2017-March/208000.html
> 
> LGTM
> Thank's

Added an explanation and pushed.
Carl Eugen Hoyos March 18, 2017, 3:47 p.m. UTC | #5
2017-03-18 7:54 GMT+01:00 wm4 <nfxjfg@googlemail.com>:
> On Sat, 18 Mar 2017 13:39:34 +0700
> Muhammad Faiz <mfcc64@gmail.com> wrote:
>
>> On Sat, Mar 18, 2017 at 5:31 AM, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
>> > 2017-03-17 19:46 GMT+01:00 James Almer <jamrial@gmail.com>:
>> >> Signed-off-by: James Almer <jamrial@gmail.com>
>> >> ---
>> >>  compat/atomics/gcc/stdatomic.h | 8 ++++----
>> >>  1 file changed, 4 insertions(+), 4 deletions(-)
>> >>
>> >> diff --git a/compat/atomics/gcc/stdatomic.h b/compat/atomics/gcc/stdatomic.h
>> >> index 41caddec5c..2b64687437 100644
>> >> --- a/compat/atomics/gcc/stdatomic.h
>> >> +++ b/compat/atomics/gcc/stdatomic.h
>> >> @@ -100,8 +100,8 @@ do {                                    \
>> >>
>> >>  #define atomic_exchange(object, desired)                            \
>> >>  ({                                                                  \
>> >> -    typeof(object) _obj = (object);                                 \
>> >> -    typeof(*object) _old;                                           \
>> >> +    __typeof__(object) _obj = (object);                             \
>> >> +    __typeof__(*object) _old;                                       \
>> >
>> > Maybe mention why this is a good idea?
>>
>> https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2017-March/208000.html
>>
>> LGTM
>> Thank's
>
> I think he knows the reason, but wants the patch author to mention it in
> the commit message.

I didn't (thank you btw, this isn't the comment I would have made) but
it's useful to have this in the commit message.

Carl Eugen
diff mbox

Patch

diff --git a/compat/atomics/gcc/stdatomic.h b/compat/atomics/gcc/stdatomic.h
index 41caddec5c..2b64687437 100644
--- a/compat/atomics/gcc/stdatomic.h
+++ b/compat/atomics/gcc/stdatomic.h
@@ -100,8 +100,8 @@  do {                                    \
 
 #define atomic_exchange(object, desired)                            \
 ({                                                                  \
-    typeof(object) _obj = (object);                                 \
-    typeof(*object) _old;                                           \
+    __typeof__(object) _obj = (object);                             \
+    __typeof__(*object) _old;                                       \
     do                                                              \
         _old = atomic_load(_obj);                                   \
     while (!__sync_bool_compare_and_swap(_obj, _old, (desired)));   \
@@ -113,8 +113,8 @@  do {                                    \
 
 #define atomic_compare_exchange_strong(object, expected, desired)   \
 ({                                                                  \
-    typeof(object) _exp = (expected);                               \
-    typeof(*object) _old = *_exp;                                   \
+    __typeof__(object) _exp = (expected);                           \
+    __typeof__(*object) _old = *_exp;                               \
     *_exp = __sync_val_compare_and_swap((object), _old, (desired)); \
     *_exp == _old;                                                  \
 })