public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: system.h & warnings (patch for gansidecl.h included)
@ 1998-04-06 17:35 Kaveh R. Ghazi
  0 siblings, 0 replies; 3+ messages in thread
From: Kaveh R. Ghazi @ 1998-04-06 17:35 UTC (permalink / raw)
  To: law; +Cc: egcs

 > From: Jeffrey A Law <law@hurl.cygnus.com>
 > 
 >   In message < 199804031726.MAA22875@caip.rutgers.edu >you write:
 > 
 >   > 	It provides for centralized maintenance.  I don't know if any
 >   > attributes were added after gcc-2.7, but the current ubiquitous test
 >   > assumes that all attributes work as of version 2.7.  That may not hold
 >   > in the future and we should have a centralized way of handling these on
 >   > a per attribute basis.  This ensures if we have to distinguish between
 >   > them for the purposes of figuring out which ones work as of some gcc
 >   > version, they are already separated in the source code and we don't have
 >   > to change more than one file. 
 >   > 
 >   > 	Below is the patch I came up with.  Is it okay to install?
 > I'm not convinced we need this kind of centralized maintenance for
 > attributes, since I don't forsee that we'll use them all that often.
 > 
 > However, I also don't see a good reason not to install your patch :-)
 > 
 > So, go ahead and install it :-)
 > 
 > 
 >   > Fri Apr  3 09:50:55 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 >   >  
 >   >         * gansidecl.h: Check if compiler supports __attribute__.  Provide
 >   >         definitions for ATTRIBUTE_UNUSED and ATTRIBUTE_PRINTF using
 >   >         __attribute__ when its available.  Also provide definitions for
 >   >         ATTRIBUTE_PRINTF_1, ATTRIBUTE_PRINTF_2 and ATTRIBUTE_PRINTF_3 in
 >   >         terms of ATTRIBUTE_PRINTF.
 >   >  
 >   >         * genoutput.c (process_template): Use ATTRIBUTE_UNUSED in place
 >   > 	of __attribute__.
 > 
 > jeff

	Done.
--
Kaveh R. Ghazi			Project Manager / Custom Development
ghazi@caip.rutgers.edu		Icon CMT Corp.

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

* Re: system.h & warnings (patch for gansidecl.h included)
  1998-04-04 14:20 Kaveh R. Ghazi
@ 1998-04-04 16:52 ` Jeffrey A Law
  0 siblings, 0 replies; 3+ messages in thread
From: Jeffrey A Law @ 1998-04-04 16:52 UTC (permalink / raw)
  To: Kaveh R. Ghazi; +Cc: egcs, wilson

  In message < 199804031726.MAA22875@caip.rutgers.edu >you write:

  > 	It provides for centralized maintenance.  I don't know if any
  > attributes were added after gcc-2.7, but the current ubiquitous test
  > assumes that all attributes work as of version 2.7.  That may not hold
  > in the future and we should have a centralized way of handling these on
  > a per attribute basis.  This ensures if we have to distinguish between
  > them for the purposes of figuring out which ones work as of some gcc
  > version, they are already separated in the source code and we don't have
  > to change more than one file. 
  > 
  > 	Below is the patch I came up with.  Is it okay to install?
I'm not convinced we need this kind of centralized maintenance for
attributes, since I don't forsee that we'll use them all that often.

However, I also don't see a good reason not to install your patch :-)

So, go ahead and install it :-)


  > Fri Apr  3 09:50:55 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
  >  
  >         * gansidecl.h: Check if compiler supports __attribute__.  Provide
  >         definitions for ATTRIBUTE_UNUSED and ATTRIBUTE_PRINTF using
  >         __attribute__ when its available.  Also provide definitions for
  >         ATTRIBUTE_PRINTF_1, ATTRIBUTE_PRINTF_2 and ATTRIBUTE_PRINTF_3 in
  >         terms of ATTRIBUTE_PRINTF.
  >  
  >         * genoutput.c (process_template): Use ATTRIBUTE_UNUSED in place
  > 	of __attribute__.

jeff

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

* Re: system.h & warnings (patch for gansidecl.h included)
@ 1998-04-04 14:20 Kaveh R. Ghazi
  1998-04-04 16:52 ` Jeffrey A Law
  0 siblings, 1 reply; 3+ messages in thread
From: Kaveh R. Ghazi @ 1998-04-04 14:20 UTC (permalink / raw)
  To: law; +Cc: egcs, ghazi, wilson

 > From: Jeffrey A Law <law@hurl.cygnus.com>
 > Status: RO
 > 
 > 
 >   In message < 199804021620.LAA18789@caip.rutgers.edu >you write:
 >   > 	One thing I'd like to bring up, the test you used in genoutput.c
 >   > to see if __attribute__ should be used only checks __GNUC__.  This can
 >   > fail for stage1 compilers which are gcc but are older versions.  E.g. 
 >   > these can be either gcc installed by the user or the default compiler
 >   > (like maybe nextstep? I'll bet it fails there.)
 > Good point.
 > 
 > 
 >   > 	I'd like to put something in gansidecl.h to do a rigorous test
 >   > once.  Then one can use __attribute__, or macros based on it, more freely. 
 > Yes, I think putting this into gansidecl.h would be fine.
 > 
 >   >  > #define ATTRIBUTE_UNUSED __attribute__ ((unused))
 >   >  > 
 > Why bother with the ATTRIBUTE_UNUSED macro?  It isn't significantly
 > simpler or easier to read than __attribute__ ((unused)).
 > jeff


	It provides for centralized maintenance.  I don't know if any
attributes were added after gcc-2.7, but the current ubiquitous test
assumes that all attributes work as of version 2.7.  That may not hold
in the future and we should have a centralized way of handling these on
a per attribute basis.  This ensures if we have to distinguish between
them for the purposes of figuring out which ones work as of some gcc
version, they are already separated in the source code and we don't have
to change more than one file. 

	Below is the patch I came up with.  Is it okay to install?

		Thanks,
		--Kaveh





Fri Apr  3 09:50:55 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * gansidecl.h: Check if compiler supports __attribute__.  Provide
        definitions for ATTRIBUTE_UNUSED and ATTRIBUTE_PRINTF using
        __attribute__ when its available.  Also provide definitions for
        ATTRIBUTE_PRINTF_1, ATTRIBUTE_PRINTF_2 and ATTRIBUTE_PRINTF_3 in
        terms of ATTRIBUTE_PRINTF.
 
        * genoutput.c (process_template): Use ATTRIBUTE_UNUSED in place
	of __attribute__.
 

--- egcs-980328/gcc/gansidecl.h~	Sat Feb  7 19:48:07 1998
+++ egcs-980328/gcc/gansidecl.h	Fri Apr  3 11:51:52 1998
@@ -46,6 +46,21 @@
 #endif
 #endif
 
+#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
+# define __attribute__(x)
+#endif
+
+#ifndef ATTRIBUTE_UNUSED
+#define ATTRIBUTE_UNUSED __attribute__ ((unused))
+#endif /* ATTRIBUTE_UNUSED */
+
+#ifndef ATTRIBUTE_PRINTF
+#define ATTRIBUTE_PRINTF(m, n) __attribute__ ((format (__printf__, m, n)))
+#define ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF(1, 2)
+#define ATTRIBUTE_PRINTF_2 ATTRIBUTE_PRINTF(2, 3)
+#define ATTRIBUTE_PRINTF_3 ATTRIBUTE_PRINTF(3, 4)
+#endif /* ATTRIBUTE_PRINTF */
+
 /* Define a generic NULL if one hasn't already been defined.  */
 
 #ifndef NULL
--- /cesl/u26/ghazi/gcc-testing/cvs-egcs/egcs/gcc/genoutput.c	Thu Apr  2 10:03:30 1998
+++ egcs-980328/gcc/genoutput.c	Fri Apr  3 11:49:02 1998
@@ -562,13 +563,8 @@ process_template (d, template)
 
   printf ("\nstatic char *\n");
   printf ("output_%d (operands, insn)\n", d->code_number);
-  printf ("#ifdef __GNUC__\n");
-  printf ("     rtx *operands __attribute__ ((unused));\n");
-  printf ("     rtx insn __attribute__ ((unused));\n");
-  printf ("#else\n");
-  printf ("     rtx *operands;\n");
-  printf ("     rtx insn;\n");
-  printf ("#endif\n");
+  printf ("     rtx *operands ATTRIBUTE_UNUSED;\n");
+  printf ("     rtx insn ATTRIBUTE_UNUSED;\n");
   printf ("{\n");
 
   /* If the assembler code template starts with a @ it is a newline-separated
--
Kaveh R. Ghazi			Project Manager / Custom Development
ghazi@caip.rutgers.edu		Icon CMT Corp.

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

end of thread, other threads:[~1998-04-06 17:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-04-06 17:35 system.h & warnings (patch for gansidecl.h included) Kaveh R. Ghazi
  -- strict thread matches above, loose matches on Subject: below --
1998-04-04 14:20 Kaveh R. Ghazi
1998-04-04 16:52 ` Jeffrey A 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).