public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][buildrobot] PR59496: Fix unused variable warning
@ 2014-01-14 16:59 Jan-Benedict Glaw
  2014-01-20  8:45 ` Jakub Jelinek
  0 siblings, 1 reply; 3+ messages in thread
From: Jan-Benedict Glaw @ 2014-01-14 16:59 UTC (permalink / raw)
  To: gcc-patches; +Cc: Mike Stump, Eric Christopher, Stan Shebs

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

Hi!

In the buildrobot's logs for building with config-list.mk, I noticed
this warning:

g++ -c  -DIN_GCC_FRONTEND -DIN_GCC_FRONTEND -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE  -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common  -DHAVE_CONFIG_H -I. -Ic-family -I../../../gcc/gcc -I../../../gcc/gcc/c-family -I../../../gcc/gcc/../include -I../../../gcc/gcc/../libcpp/include -I/opt/cfarm/mpc/include  -I../../../gcc/gcc/../libdecnumber -I../../../gcc/gcc/../libdecnumber/dpd -I../libdecnumber -I../../../gcc/gcc/../libbacktrace    -o c-family/c-common.o -MT c-family/c-common.o -MMD -MP -MF c-family/.deps/c-common.TPo ../../../gcc/gcc/c-family/c-common.c
../../../gcc/gcc/c-family/c-common.c: In function ‘tree_node* c_sizeof_or_alignof_type(location_t, tree, bool, bool, int)’:
../../../gcc/gcc/c-family/c-common.c:5007:9: error: unused variable ‘field’ [-Werror=unused-variable]
    tree field = build_decl (UNKNOWN_LOCATION, FIELD_DECL, NULL_TREE,
         ^
cc1plus: all warnings being treated as errors
make[2]: *** [c-family/c-common.o] Error 1

There were additional comments on the PR recently, I suggest this
patch to plug it:

2014-01-14  Jan-Benedict Glaw  <jbglaw@lug-owl.de>

	PR bootstrap/59496
	* config/rs6000/darwin.h (ADJUST_FIELD_ALIGN): Fix unused variable
	warning.

diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h
index 43a2ab5..fc1f862 100644
--- a/gcc/config/rs6000/darwin.h
+++ b/gcc/config/rs6000/darwin.h
@@ -328,9 +328,10 @@ extern int darwin_emit_branch_islands;
    behavior is dealt with by
    darwin_rs6000_special_round_type_align.  */
 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED)	\
-  (TARGET_ALIGN_NATURAL ? (COMPUTED)		\
-   : (COMPUTED) == 128 ? 128			\
-   : MIN ((COMPUTED), 32))
+  ((void) (FIELD),				\
+   (TARGET_ALIGN_NATURAL ? (COMPUTED)		\
+    : (COMPUTED) == 128 ? 128			\
+    : MIN ((COMPUTED), 32)))
 
 /* Darwin increases natural record alignment to doubleword if the first
    field is an FP double while the FP fields remain word aligned.  */




-- 
      Jan-Benedict Glaw      jbglaw@lug-owl.de              +49-172-7608481
Signature of:          GDB has a 'break' feature; why doesn't it have 'fix' too?
the second  :

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH][buildrobot] PR59496: Fix unused variable warning
  2014-01-14 16:59 [PATCH][buildrobot] PR59496: Fix unused variable warning Jan-Benedict Glaw
@ 2014-01-20  8:45 ` Jakub Jelinek
  2014-01-20 11:25   ` Iain Sandoe
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Jelinek @ 2014-01-20  8:45 UTC (permalink / raw)
  To: Jan-Benedict Glaw; +Cc: gcc-patches, Mike Stump, Eric Christopher, Stan Shebs

On Tue, Jan 14, 2014 at 05:59:11PM +0100, Jan-Benedict Glaw wrote:
> 2014-01-14  Jan-Benedict Glaw  <jbglaw@lug-owl.de>
> 
> 	PR bootstrap/59496
> 	* config/rs6000/darwin.h (ADJUST_FIELD_ALIGN): Fix unused variable
> 	warning.

Ok, thanks.

> diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h
> index 43a2ab5..fc1f862 100644
> --- a/gcc/config/rs6000/darwin.h
> +++ b/gcc/config/rs6000/darwin.h
> @@ -328,9 +328,10 @@ extern int darwin_emit_branch_islands;
>     behavior is dealt with by
>     darwin_rs6000_special_round_type_align.  */
>  #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED)	\
> -  (TARGET_ALIGN_NATURAL ? (COMPUTED)		\
> -   : (COMPUTED) == 128 ? 128			\
> -   : MIN ((COMPUTED), 32))
> +  ((void) (FIELD),				\
> +   (TARGET_ALIGN_NATURAL ? (COMPUTED)		\
> +    : (COMPUTED) == 128 ? 128			\
> +    : MIN ((COMPUTED), 32)))
>  
>  /* Darwin increases natural record alignment to doubleword if the first
>     field is an FP double while the FP fields remain word aligned.  */
> 

	Jakub

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

* Re: [PATCH][buildrobot] PR59496: Fix unused variable warning
  2014-01-20  8:45 ` Jakub Jelinek
@ 2014-01-20 11:25   ` Iain Sandoe
  0 siblings, 0 replies; 3+ messages in thread
From: Iain Sandoe @ 2014-01-20 11:25 UTC (permalink / raw)
  To: GCC Patches
  Cc: Jakub Jelinek, Jan-Benedict Glaw, Mike Stump, Eric Christopher,
	Stan Shebs


On 20 Jan 2014, at 08:45, Jakub Jelinek wrote:

> On Tue, Jan 14, 2014 at 05:59:11PM +0100, Jan-Benedict Glaw wrote:
>> 2014-01-14  Jan-Benedict Glaw  <jbglaw@lug-owl.de>
>> 
>> 	PR bootstrap/59496
>> 	* config/rs6000/darwin.h (ADJUST_FIELD_ALIGN): Fix unused variable
>> 	warning.
> 
> Ok, thanks.

As discussed on irc, I have applied a slightly modified version (differs in whitespace and amends the comment to explain the dummy use of FIELD).
Iain

r206802:

Index: gcc/ChangeLog
===================================================================
--- gcc/ChangeLog	(revision 206801)
+++ gcc/ChangeLog	(working copy)
@@ -1,3 +1,10 @@
+2014-01-20  Jan-Benedict Glaw  <jbglaw@lug-owl.de>
+	    Iain Sandoe  <iain@codesourcery.com>
+
+	PR bootstrap/59496
+	* config/rs6000/darwin.h (ADJUST_FIELD_ALIGN): Fix unused variable
+	warning.  Amend comment to reflect current functionality.
+
 2014-01-20  Richard Biener  <rguenther@suse.de>
 
 	PR middle-end/59860
Index: gcc/config/rs6000/darwin.h
===================================================================
--- gcc/config/rs6000/darwin.h	(revision 206801)
+++ gcc/config/rs6000/darwin.h	(working copy)
@@ -321,16 +321,19 @@
    ? GENERAL_REGS						\
    : (CLASS))
 
-/* Compute field alignment.  This is similar to the version of the
-   macro in the Apple version of GCC, except that version supports
-   'mac68k' alignment, and that version uses the computed alignment
-   always for the first field of a structure.  The first-field
-   behavior is dealt with by
-   darwin_rs6000_special_round_type_align.  */
-#define ADJUST_FIELD_ALIGN(FIELD, COMPUTED)	\
-  (TARGET_ALIGN_NATURAL ? (COMPUTED)		\
-   : (COMPUTED) == 128 ? 128			\
-   : MIN ((COMPUTED), 32))
+/* Compute field alignment.
+   This implements the 'power' alignment rule by pegging the alignment of
+   items (beyond the first aggregate field) to 32 bits.  The pegging is
+   suppressed for vector and long double items (both 128 in size).
+   There is a dummy use of the FIELD argument to avoid an unused variable
+   warning (see PR59496).  */
+#define ADJUST_FIELD_ALIGN(FIELD, COMPUTED)			\
+  ((void) (FIELD),						\
+    (TARGET_ALIGN_NATURAL					\
+     ? (COMPUTED)						\
+     : (COMPUTED) == 128					\
+	? 128							\
+	: MIN ((COMPUTED), 32)))
 
 /* Darwin increases natural record alignment to doubleword if the first
    field is an FP double while the FP fields remain word aligned.  */

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

end of thread, other threads:[~2014-01-20 11:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-14 16:59 [PATCH][buildrobot] PR59496: Fix unused variable warning Jan-Benedict Glaw
2014-01-20  8:45 ` Jakub Jelinek
2014-01-20 11:25   ` Iain Sandoe

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