diff mbox

[v2] libgcc: Use braces instead of macro's empty body to avoid xgcc warnings.

Message ID 54CC7085.1080805@sunrus.com.cn
State New
Headers show

Commit Message

Chen Gang Jan. 31, 2015, 6:04 a.m. UTC
The related warning (cross compile tile with --disable-threads):

  ../../../../gcc-tile-new/libgcc/libgcov-interface.c: In function '__gcov_fork':
  ../../../../gcc-tile-new/libgcc/libgcov-interface.c:182:53: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
       __GTHREAD_MUTEX_INIT_FUNCTION (&__gcov_flush_mx);
                                                       ^
2015-01-31  Chen Gang  <gang.chen.5i5j@gmail.com>

	* gthr-single.h (__GTHREAD_MUTEX_INIT_FUNCTION): Use braces
	instead of macro's empty body to avoid xgcc warnings.
---
 libgcc/gthr-single.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andreas Schwab Jan. 31, 2015, 8:53 a.m. UTC | #1
Chen Gang S <gang.chen@sunrus.com.cn> writes:

> 	* gthr-single.h (__GTHREAD_MUTEX_INIT_FUNCTION): Use braces
> 	instead of macro's empty body to avoid xgcc warnings.

It's actually an empty loop now.

Andreas.
Chen Gang Jan. 31, 2015, 10 a.m. UTC | #2
On 1/31/15 16:53, Andreas Schwab wrote:
> Chen Gang S <gang.chen@sunrus.com.cn> writes:
> 
>> 	* gthr-single.h (__GTHREAD_MUTEX_INIT_FUNCTION): Use braces
>> 	instead of macro's empty body to avoid xgcc warnings.
> 
> It's actually an empty loop now.
> 

Excuse me, I am not quite clear gcc version merging working flow. Now,
for gcc master branch (20150131), __GTHREAD_MUTEX_INIT_FUNCTION is still
as empty.

Could you provide more details about it?

Thanks.
Prathamesh Kulkarni Jan. 31, 2015, 11:43 a.m. UTC | #3
On 31 January 2015 at 15:30, Chen Gang S <gang.chen@sunrus.com.cn> wrote:
> On 1/31/15 16:53, Andreas Schwab wrote:
>> Chen Gang S <gang.chen@sunrus.com.cn> writes:
>>
>>>      * gthr-single.h (__GTHREAD_MUTEX_INIT_FUNCTION): Use braces
>>>      instead of macro's empty body to avoid xgcc warnings.
The ChangeLog entry should be fixed to reflect it's an empty loop now.
something like:
* gthr-single.h (__GTHREAD_MUTEX_INIT_FUNCTION): Use empty do-while
loop as macro body to avoid xgcc warnings.

Thanks,
Prathamesh
>>
>> It's actually an empty loop now.
>>
>
> Excuse me, I am not quite clear gcc version merging working flow. Now,
> for gcc master branch (20150131), __GTHREAD_MUTEX_INIT_FUNCTION is still
> as empty.
>
> Could you provide more details about it?
>
> Thanks.
> --
> Chen Gang
>
> Open, share, and attitude like air, water, and life which God blessed
Marek Polacek Jan. 31, 2015, 11:49 a.m. UTC | #4
On Sat, Jan 31, 2015 at 05:13:53PM +0530, Prathamesh Kulkarni wrote:
> On 31 January 2015 at 15:30, Chen Gang S <gang.chen@sunrus.com.cn> wrote:
> > On 1/31/15 16:53, Andreas Schwab wrote:
> >> Chen Gang S <gang.chen@sunrus.com.cn> writes:
> >>
> >>>      * gthr-single.h (__GTHREAD_MUTEX_INIT_FUNCTION): Use braces
> >>>      instead of macro's empty body to avoid xgcc warnings.
> The ChangeLog entry should be fixed to reflect it's an empty loop now.
> something like:
> * gthr-single.h (__GTHREAD_MUTEX_INIT_FUNCTION): Use empty do-while
> loop as macro body to avoid xgcc warnings.

And since CL entries should describe what, not why, the "to avoid..."
part is redundant.

	Marek
Chen Gang Jan. 31, 2015, 12:30 p.m. UTC | #5
On 1/31/15 19:49, Marek Polacek wrote:
> On Sat, Jan 31, 2015 at 05:13:53PM +0530, Prathamesh Kulkarni wrote:
>> On 31 January 2015 at 15:30, Chen Gang S <gang.chen@sunrus.com.cn> wrote:
>>> On 1/31/15 16:53, Andreas Schwab wrote:
>>>> Chen Gang S <gang.chen@sunrus.com.cn> writes:
>>>>
>>>>>      * gthr-single.h (__GTHREAD_MUTEX_INIT_FUNCTION): Use braces
>>>>>      instead of macro's empty body to avoid xgcc warnings.
>> The ChangeLog entry should be fixed to reflect it's an empty loop now.
>> something like:
>> * gthr-single.h (__GTHREAD_MUTEX_INIT_FUNCTION): Use empty do-while
>> loop as macro body to avoid xgcc warnings.
> 
> And since CL entries should describe what, not why, the "to avoid..."
> part is redundant.
> 

OK, thanks. I should send patch v3 within today.


Thanks.
Jeff Law April 14, 2015, 5:30 a.m. UTC | #6
On 01/30/2015 11:04 PM, Chen Gang S wrote:
> The related warning (cross compile tile with --disable-threads):
>
>    ../../../../gcc-tile-new/libgcc/libgcov-interface.c: In function '__gcov_fork':
>    ../../../../gcc-tile-new/libgcc/libgcov-interface.c:182:53: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
>         __GTHREAD_MUTEX_INIT_FUNCTION (&__gcov_flush_mx);
>                                                         ^
> 2015-01-31  Chen Gang  <gang.chen.5i5j@gmail.com>
>
> 	* gthr-single.h (__GTHREAD_MUTEX_INIT_FUNCTION): Use braces
> 	instead of macro's empty body to avoid xgcc warnings.
OK for the trunk.

jeff
diff mbox

Patch

diff --git a/libgcc/gthr-single.h b/libgcc/gthr-single.h
index f084fe2..01366f53 100644
--- a/libgcc/gthr-single.h
+++ b/libgcc/gthr-single.h
@@ -35,7 +35,7 @@  typedef int __gthread_recursive_mutex_t;
 
 #define __GTHREAD_ONCE_INIT 0
 #define __GTHREAD_MUTEX_INIT 0
-#define __GTHREAD_MUTEX_INIT_FUNCTION(mx)
+#define __GTHREAD_MUTEX_INIT_FUNCTION(mx) do {} while (0)
 #define __GTHREAD_RECURSIVE_MUTEX_INIT 0
 
 #define UNUSED __attribute__((unused))