public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH v2] libgcc: Use braces instead of macro's empty body to avoid xgcc warnings.
@ 2015-01-31 11:33 Chen Gang S
  2015-01-31 12:34 ` Andreas Schwab
  2015-04-14  5:30 ` Jeff Law
  0 siblings, 2 replies; 8+ messages in thread
From: Chen Gang S @ 2015-01-31 11:33 UTC (permalink / raw)
  To: ian, Jakub Jelinek; +Cc: walt, Jeff Law, gcc-patches List

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(-)

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))
-- 
1.9.3

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] libgcc: Use braces instead of macro's empty body to avoid xgcc warnings.
  2015-01-31 11:33 [PATCH v2] libgcc: Use braces instead of macro's empty body to avoid xgcc warnings Chen Gang S
@ 2015-01-31 12:34 ` Andreas Schwab
  2015-01-31 14:50   ` Chen Gang S
  2015-04-14  5:30 ` Jeff Law
  1 sibling, 1 reply; 8+ messages in thread
From: Andreas Schwab @ 2015-01-31 12:34 UTC (permalink / raw)
  To: Chen Gang S; +Cc: ian, Jakub Jelinek, walt, Jeff Law, gcc-patches List

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.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] libgcc: Use braces instead of macro's empty body to avoid xgcc warnings.
  2015-01-31 12:34 ` Andreas Schwab
@ 2015-01-31 14:50   ` Chen Gang S
  2015-01-31 15:45     ` Prathamesh Kulkarni
  0 siblings, 1 reply; 8+ messages in thread
From: Chen Gang S @ 2015-01-31 14:50 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: ian, Jakub Jelinek, walt, Jeff Law, gcc-patches List

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.
-- 
Chen Gang

Open, share, and attitude like air, water, and life which God blessed

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] libgcc: Use braces instead of macro's empty body to avoid xgcc warnings.
  2015-01-31 15:45     ` Prathamesh Kulkarni
@ 2015-01-31 15:45       ` Marek Polacek
  2015-01-31 19:51         ` Chen Gang S
  0 siblings, 1 reply; 8+ messages in thread
From: Marek Polacek @ 2015-01-31 15:45 UTC (permalink / raw)
  To: Prathamesh Kulkarni
  Cc: Chen Gang S, Andreas Schwab, Ian Lance Taylor, Jakub Jelinek,
	walt, Jeff Law, gcc-patches List

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] libgcc: Use braces instead of macro's empty body to avoid xgcc warnings.
  2015-01-31 14:50   ` Chen Gang S
@ 2015-01-31 15:45     ` Prathamesh Kulkarni
  2015-01-31 15:45       ` Marek Polacek
  0 siblings, 1 reply; 8+ messages in thread
From: Prathamesh Kulkarni @ 2015-01-31 15:45 UTC (permalink / raw)
  To: Chen Gang S
  Cc: Andreas Schwab, Ian Lance Taylor, Jakub Jelinek, walt, Jeff Law,
	gcc-patches List

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] libgcc: Use braces instead of macro's empty body to avoid xgcc warnings.
  2015-01-31 15:45       ` Marek Polacek
@ 2015-01-31 19:51         ` Chen Gang S
  0 siblings, 0 replies; 8+ messages in thread
From: Chen Gang S @ 2015-01-31 19:51 UTC (permalink / raw)
  To: Marek Polacek, Prathamesh Kulkarni
  Cc: Andreas Schwab, Ian Lance Taylor, Jakub Jelinek, walt, Jeff Law,
	gcc-patches List

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.
-- 
Chen Gang

Open, share, and attitude like air, water, and life which God blessed

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] libgcc: Use braces instead of macro's empty body to avoid xgcc warnings.
  2015-01-31 11:33 [PATCH v2] libgcc: Use braces instead of macro's empty body to avoid xgcc warnings Chen Gang S
  2015-01-31 12:34 ` Andreas Schwab
@ 2015-04-14  5:30 ` Jeff Law
  1 sibling, 0 replies; 8+ messages in thread
From: Jeff Law @ 2015-04-14  5:30 UTC (permalink / raw)
  To: Chen Gang S, ian, Jakub Jelinek; +Cc: walt, gcc-patches List

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] libgcc: Use braces instead of macro's empty body to avoid xgcc warnings.
@ 2015-04-15 15:29 Jeff Law
  0 siblings, 0 replies; 8+ messages in thread
From: Jeff Law @ 2015-04-15 15:29 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 339 bytes --]


This patch was originally from Chen Gang S.  However, his address at 
sunrus.com.cn bounces.  So presumably he didn't get the approved 
message.  I'm checking in the patch for him (with the fixed ChangeLog).

I've verified by hand that the warning goes away with a cross toolchain 
and that it doesn't affect x86_64-unknown-linux-gnu.




[-- Attachment #2: Re: [PATCH v2] libgcc: Use braces instead of macro's empty body to.eml --]
[-- Type: application/x-message-display, Size: 2546 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-04-15 15:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-31 11:33 [PATCH v2] libgcc: Use braces instead of macro's empty body to avoid xgcc warnings Chen Gang S
2015-01-31 12:34 ` Andreas Schwab
2015-01-31 14:50   ` Chen Gang S
2015-01-31 15:45     ` Prathamesh Kulkarni
2015-01-31 15:45       ` Marek Polacek
2015-01-31 19:51         ` Chen Gang S
2015-04-14  5:30 ` Jeff Law
2015-04-15 15:29 Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).