diff mbox

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

Message ID 54CC07AA.4090006@sunrus.com.cn
State New
Headers show

Commit Message

Chen Gang Jan. 30, 2015, 10:37 p.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 breaces
	instead of macro's empty body to avoid xgcc warnings.
---
 libgcc/gthr-single.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jakub Jelinek Jan. 30, 2015, 10:57 p.m. UTC | #1
On Sat, Jan 31, 2015 at 06:37:30AM +0800, 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);
>                                                        ^

Then you should use do {} while (0) instead of {} .  Also, braces not breaces.

> 2015-01-31  Chen Gang  <gang.chen.5i5j@gmail.com>
> 
> 	* gthr-single.h (__GTHREAD_MUTEX_INIT_FUNCTION): Use breaces
> 	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..586fec5 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) {}
>  #define __GTHREAD_RECURSIVE_MUTEX_INIT 0
>  
>  #define UNUSED __attribute__((unused))
> -- 
> 1.9.3

	Jakub
Chen Gang Jan. 31, 2015, 5:49 a.m. UTC | #2
On 1/31/15 06:57, Jakub Jelinek wrote:
> On Sat, Jan 31, 2015 at 06:37:30AM +0800, 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);
>>                                                        ^
> 
> Then you should use do {} while (0) instead of {} .  Also, braces not breaces.
>

OK, thanks, I shall send patch v2 within today (but maybe at night).

 
>> 2015-01-31  Chen Gang  <gang.chen.5i5j@gmail.com>
>>
>> 	* gthr-single.h (__GTHREAD_MUTEX_INIT_FUNCTION): Use breaces
>> 	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..586fec5 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) {}
>>  #define __GTHREAD_RECURSIVE_MUTEX_INIT 0
>>  
>>  #define UNUSED __attribute__((unused))
>> -- 
>> 1.9.3
> 
> 	Jakub
>
diff mbox

Patch

diff --git a/libgcc/gthr-single.h b/libgcc/gthr-single.h
index f084fe2..586fec5 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) {}
 #define __GTHREAD_RECURSIVE_MUTEX_INIT 0
 
 #define UNUSED __attribute__((unused))