This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch to prefer STRINGX over STRINGIFY


This patch deletes the STRINGIFY macro in system.h and instead prefers
the STRINGX macro from libiberty's symcat.h.  I bootstrapped it on
solaris2.7 using CC set to "cc" and "cc -Xs".  (The -Xs flag on
Solaris is akin to -traditional.)  This verified the cases of a stage1
compiler that does and does not support the stringizing operator.

Zack this'll affect your gansidecl.h patch, you won't need to carry
the HAVE_STRINGIZE munging to ansidecl.h.

Ok to install?

		--Kaveh


2001-03-26  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* system.h: Include symcat.h.
	(STRINGIFY): Don't define.

	* configure.in: Adjust comment.

	* builtins.c: Use STRINGX, not STRINGIFY.
	* gencheck.c: Likewise.
	* gengenrtl.c: Likewise.
	* protoize.c: Likewise.

	* cpplex.c: Don't include symcat.h.
	* cpplib.c: Likewise.

	* gansidecl.h (HAVE_STRINGIZE): Don't define.
	
diff -rup orig/egcs-CVS20010325/gcc/builtins.c egcs-CVS20010325/gcc/builtins.c
--- orig/egcs-CVS20010325/gcc/builtins.c	Thu Mar 22 16:42:13 2001
+++ egcs-CVS20010325/gcc/builtins.c	Mon Mar 26 14:32:50 2001
@@ -57,7 +57,7 @@ Boston, MA 02111-1307, USA.  */
 const char *const built_in_class_names[4]
   = {"NOT_BUILT_IN", "BUILT_IN_FRONTEND", "BUILT_IN_MD", "BUILT_IN_NORMAL"};
 
-#define DEF_BUILTIN(x) STRINGIFY(x),
+#define DEF_BUILTIN(x) STRINGX(x),
 const char *const built_in_names[(int) END_BUILTINS] =
 {
 #include "builtins.def"
diff -rup orig/egcs-CVS20010325/gcc/configure.in egcs-CVS20010325/gcc/configure.in
--- orig/egcs-CVS20010325/gcc/configure.in	Sat Mar 17 16:42:44 2001
+++ egcs-CVS20010325/gcc/configure.in	Mon Mar 26 14:32:50 2001
@@ -522,7 +522,7 @@ else
 fi
 
 # See if the stage1 system preprocessor understands the ANSI C
-# preprocessor stringification operator.
+# preprocessor stringification operator.  (Used by symcat.h.)
 AC_C_STRINGIZE
 
 # Use <inttypes.h> only if it exists,
diff -rup orig/egcs-CVS20010325/gcc/cpplex.c egcs-CVS20010325/gcc/cpplex.c
--- orig/egcs-CVS20010325/gcc/cpplex.c	Tue Mar  6 22:46:45 2001
+++ egcs-CVS20010325/gcc/cpplex.c	Mon Mar 26 14:32:50 2001
@@ -38,7 +38,6 @@ Foundation, 59 Temple Place - Suite 330,
 #include "system.h"
 #include "cpplib.h"
 #include "cpphash.h"
-#include "symcat.h"
 
 /* Tokens with SPELL_STRING store their spelling in the token list,
    and it's length in the token->val.name.len.  */
diff -rup orig/egcs-CVS20010325/gcc/cpplib.c egcs-CVS20010325/gcc/cpplib.c
--- orig/egcs-CVS20010325/gcc/cpplib.c	Thu Mar 15 07:43:13 2001
+++ egcs-CVS20010325/gcc/cpplib.c	Mon Mar 26 14:32:50 2001
@@ -26,7 +26,6 @@ Foundation, 59 Temple Place - Suite 330,
 #include "cpphash.h"
 #include "intl.h"
 #include "obstack.h"
-#include "symcat.h"
 
 /* Chained list of answers to an assertion.  */
 struct answer
diff -rup orig/egcs-CVS20010325/gcc/gansidecl.h egcs-CVS20010325/gcc/gansidecl.h
--- orig/egcs-CVS20010325/gcc/gansidecl.h	Mon Nov 20 16:09:25 2000
+++ egcs-CVS20010325/gcc/gansidecl.h	Mon Mar 26 15:43:08 2001
@@ -43,11 +43,6 @@ Boston, MA 02111-1307, USA.  */
 # ifndef HAVE_LONG_DOUBLE
 #  define HAVE_LONG_DOUBLE 1
 # endif
-/* Assume that (non-traditional) gcc used in stage2 or later has the
-   stringize feature.  */
-# if !defined (HAVE_STRINGIZE) && __STDC__
-#  define HAVE_STRINGIZE 1
-# endif /* ! HAVE_STRINGIZE && __STDC__ */
 #endif /* GCC >= 2.7 */
 
 #ifndef NULL_PTR
diff -rup orig/egcs-CVS20010325/gcc/gencheck.c egcs-CVS20010325/gcc/gencheck.c
--- orig/egcs-CVS20010325/gcc/gencheck.c	Fri Mar  9 23:05:20 2001
+++ egcs-CVS20010325/gcc/gencheck.c	Mon Mar 26 14:32:50 2001
@@ -21,7 +21,7 @@ Boston, MA 02111-1307, USA.  */
 #include "hconfig.h"
 #include "system.h"
 
-#define DEFTREECODE(SYM, NAME, TYPE, LEN)   STRINGIFY(SYM),
+#define DEFTREECODE(SYM, NAME, TYPE, LEN)   STRINGX(SYM),
 
 const char *tree_codes[] = {
 #include "tree.def"
diff -rup orig/egcs-CVS20010325/gcc/gengenrtl.c egcs-CVS20010325/gcc/gengenrtl.c
--- orig/egcs-CVS20010325/gcc/gengenrtl.c	Fri Mar  9 23:05:20 2001
+++ egcs-CVS20010325/gcc/gengenrtl.c	Mon Mar 26 14:32:50 2001
@@ -98,7 +98,7 @@ struct rtx_definition 
   const char *enumname, *name, *format;
 };
 
-#define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) { STRINGIFY(ENUM), NAME, FORMAT },
+#define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) { STRINGX(ENUM), NAME, FORMAT },
 
 struct rtx_definition defs[] = 
 {  
diff -rup orig/egcs-CVS20010325/gcc/protoize.c egcs-CVS20010325/gcc/protoize.c
--- orig/egcs-CVS20010325/gcc/protoize.c	Fri Mar 16 07:43:07 2001
+++ egcs-CVS20010325/gcc/protoize.c	Mon Mar 26 14:32:50 2001
@@ -278,7 +278,7 @@ static const char * const other_var_styl
 static const char * const other_var_style = "varargs";
 /* Note that this is a string containing the expansion of va_alist.
    But in `main' we discard all but the first token.  */
-static const char *varargs_style_indicator = STRINGIFY (va_alist);
+static const char *varargs_style_indicator = STRINGX (va_alist);
 #endif /* !defined (UNPROTOIZE) */
 
 /* The following two types are used to create hash tables.  In this program,
diff -rup orig/egcs-CVS20010325/gcc/system.h egcs-CVS20010325/gcc/system.h
--- orig/egcs-CVS20010325/gcc/system.h	Wed Mar 14 00:07:28 2001
+++ egcs-CVS20010325/gcc/system.h	Mon Mar 26 15:22:12 2001
@@ -355,21 +355,6 @@ extern void abort PARAMS ((void));
 #endif
 
 
-
-/* Define a STRINGIFY macro that's right for ANSI or traditional C.
-   Note: if the argument passed to STRINGIFY is itself a macro, eg
-   #define foo bar, STRINGIFY(foo) will produce "foo", not "bar".
-   Although the __STDC__ case could be made to expand this via a layer
-   of indirection, the traditional C case can not do so.  Therefore
-   this behavior is not supported. */
-#ifndef STRINGIFY
-# ifdef HAVE_STRINGIZE
-#  define STRINGIFY(STRING) #STRING
-# else
-#  define STRINGIFY(STRING) "STRING"
-# endif
-#endif /* ! STRINGIFY */
-
 #if HAVE_SYS_STAT_H
 # include <sys/stat.h>
 #endif
@@ -481,6 +466,7 @@ extern void abort PARAMS ((void));
 
 /* Get libiberty declarations. */
 #include "libiberty.h"
+#include "symcat.h"
 
 /* Provide a default for the HOST_BIT_BUCKET.
    This suffices for POSIX-like hosts.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]