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]
Other format: [Raw text]

Patch installed to stop using libiberty's symcat.h


This patch eliminates uses of the macros from libiberty's symcat.h and
instead relies on the ISO CPP stringize and concatenation operators.

Bootstrapped on sparc-sun-solaris2.7 and installed as "obvious".


2003-06-16  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* builtin-attrs.def, builtin-attrs.def, builtins.c, cpplex.c,
	cpplib.c, gencheck.c, gengenrtl.c, machmode.def, protoize.c: Don't
	use macros from "symcat.h", instead rely on ISO C.
	
	* system.h: Don't include "symcat.h".
	* configure.in (AC_C_STRINGIZE): Delete.
	* config.in, configure: Regenerate.

diff -rup orig/egcc-CVS20030615/gcc/builtin-attrs.def egcc-CVS20030615/gcc/builtin-attrs.def
--- orig/egcc-CVS20030615/gcc/builtin-attrs.def	Sun Jun  1 21:39:16 2003
+++ egcc-CVS20030615/gcc/builtin-attrs.def	Mon Jun 16 14:50:47 2003
@@ -51,13 +51,11 @@ Software Foundation, 59 Temple Place - S
 
 DEF_ATTR_NULL_TREE (ATTR_NULL)
 
-/* Note that below we must avoid whitespace in arguments of CONCAT*.  */
-
 /* Construct a tree for a given integer and a list containing it.  */
 #define DEF_ATTR_FOR_INT(VALUE)					\
-  DEF_ATTR_INT (CONCAT2 (ATTR_,VALUE), VALUE)			\
-  DEF_ATTR_TREE_LIST (CONCAT2 (ATTR_LIST_,VALUE), ATTR_NULL,	\
-		      CONCAT2 (ATTR_,VALUE), ATTR_NULL)
+  DEF_ATTR_INT (ATTR_##VALUE, VALUE)			\
+  DEF_ATTR_TREE_LIST (ATTR_LIST_##VALUE, ATTR_NULL,	\
+		      ATTR_##VALUE, ATTR_NULL)
 DEF_ATTR_FOR_INT (0)
 DEF_ATTR_FOR_INT (1)
 DEF_ATTR_FOR_INT (2)
@@ -67,8 +65,8 @@ DEF_ATTR_FOR_INT (4)
 
 /* Construct a tree for a list of two integers.  */
 #define DEF_LIST_INT_INT(VALUE1, VALUE2)				 \
-  DEF_ATTR_TREE_LIST (CONCAT4 (ATTR_LIST_,VALUE1,_,VALUE2), ATTR_NULL,	 \
-		    CONCAT2 (ATTR_,VALUE1), CONCAT2 (ATTR_LIST_,VALUE2))
+  DEF_ATTR_TREE_LIST (ATTR_LIST_##VALUE1##_##VALUE2, ATTR_NULL,		 \
+		      ATTR_##VALUE1, ATTR_LIST_##VALUE2)
 DEF_LIST_INT_INT (1,0)
 DEF_LIST_INT_INT (1,2)
 DEF_LIST_INT_INT (2,0)
@@ -130,10 +128,10 @@ DEF_ATTR_TREE_LIST (ATTR_MALLOC_NOTHROW_
 
 /* Construct a tree for a format attribute.  */
 #define DEF_FORMAT_ATTRIBUTE(TYPE, FA, VALUES)				 \
-  DEF_ATTR_TREE_LIST (CONCAT4 (ATTR_,TYPE,_,VALUES), ATTR_NULL,		 \
-		      CONCAT2 (ATTR_,TYPE), CONCAT2 (ATTR_LIST_,VALUES)) \
-  DEF_ATTR_TREE_LIST (CONCAT4 (ATTR_FORMAT_,TYPE,_,VALUES), ATTR_FORMAT, \
-		      CONCAT4 (ATTR_,TYPE,_,VALUES), CONCAT2 (ATTR_NOTHROW_NONNULL_,FA))
+  DEF_ATTR_TREE_LIST (ATTR_##TYPE##_##VALUES, ATTR_NULL,		 \
+		      ATTR_##TYPE, ATTR_LIST_##VALUES)			 \
+  DEF_ATTR_TREE_LIST (ATTR_FORMAT_##TYPE##_##VALUES, ATTR_FORMAT,	 \
+		      ATTR_##TYPE##_##VALUES, ATTR_NOTHROW_NONNULL_##FA)
 DEF_FORMAT_ATTRIBUTE(PRINTF,1,1_0)
 DEF_FORMAT_ATTRIBUTE(PRINTF,1,1_2)
 DEF_FORMAT_ATTRIBUTE(PRINTF,2,2_0)
@@ -150,16 +148,16 @@ DEF_FORMAT_ATTRIBUTE(STRFMON,3,3_4)
 
 /* Construct a tree for a format_arg attribute.  */
 #define DEF_FORMAT_ARG_ATTRIBUTE(FA)					\
-  DEF_ATTR_TREE_LIST (CONCAT2 (ATTR_FORMAT_ARG_,FA), ATTR_FORMAT_ARG,	\
-		      CONCAT2 (ATTR_LIST_,FA), CONCAT2 (ATTR_NOTHROW_NONNULL_,FA))
+  DEF_ATTR_TREE_LIST (ATTR_FORMAT_ARG_##FA, ATTR_FORMAT_ARG,		\
+		      ATTR_LIST_##FA, ATTR_NOTHROW_NONNULL_##FA)
 DEF_FORMAT_ARG_ATTRIBUTE(1)
 DEF_FORMAT_ARG_ATTRIBUTE(2)
 #undef DEF_FORMAT_ARG_ATTRIBUTE
 
 /* Define an attribute for a function, along with the IDENTIFIER_NODE.  */
 #define DEF_FN_ATTR_IDENT(NAME, ATTRS, PREDICATE)	\
-  DEF_ATTR_IDENT (CONCAT2(ATTR_,NAME), STRINGX(NAME))	\
-  DEF_FN_ATTR (CONCAT2(ATTR_,NAME), ATTRS, PREDICATE)
+  DEF_ATTR_IDENT (ATTR_##NAME, #NAME)			\
+  DEF_FN_ATTR (ATTR_##NAME, ATTRS, PREDICATE)
 
 /* The ISO C functions are always checked (whether <stdio.h> is
    included or not), since it is common to call printf without
diff -rup orig/egcc-CVS20030615/gcc/builtins.c egcc-CVS20030615/gcc/builtins.c
--- orig/egcc-CVS20030615/gcc/builtins.c	Sun Jun 15 20:01:10 2003
+++ egcc-CVS20030615/gcc/builtins.c	Mon Jun 16 14:43:20 2003
@@ -64,7 +64,7 @@ Software Foundation, 59 Temple Place - S
 const char *const built_in_class_names[4]
   = {"NOT_BUILT_IN", "BUILT_IN_FRONTEND", "BUILT_IN_MD", "BUILT_IN_NORMAL"};
 
-#define DEF_BUILTIN(X, N, C, T, LT, B, F, NA, AT, IM) STRINGX(X),
+#define DEF_BUILTIN(X, N, C, T, LT, B, F, NA, AT, IM) #X,
 const char *const built_in_names[(int) END_BUILTINS] =
 {
 #include "builtins.def"
diff -rup orig/egcc-CVS20030615/gcc/cpplex.c egcc-CVS20030615/gcc/cpplex.c
--- orig/egcc-CVS20030615/gcc/cpplex.c	Thu Jun 12 20:01:29 2003
+++ egcc-CVS20030615/gcc/cpplex.c	Mon Jun 16 14:43:55 2003
@@ -44,7 +44,7 @@ static const unsigned char *const digrap
 { U"%:", U"%:%:", U"<:", U":>", U"<%", U"%>" };
 
 #define OP(e, s) { SPELL_OPERATOR, U s           },
-#define TK(e, s) { s,              U STRINGX (e) },
+#define TK(e, s) { s,              U #e },
 static const struct token_spelling token_spellings[N_TTYPES] = { TTYPE_TABLE };
 #undef OP
 #undef TK
diff -rup orig/egcc-CVS20030615/gcc/cpplib.c egcc-CVS20030615/gcc/cpplib.c
--- orig/egcc-CVS20030615/gcc/cpplib.c	Thu Jun 12 20:01:30 2003
+++ egcc-CVS20030615/gcc/cpplib.c	Mon Jun 16 14:45:09 2003
@@ -174,8 +174,7 @@ D(sccs,		T_SCCS,		EXTENSION, 0)		   /* 0
 /* Use the table to generate a series of prototypes, an enum for the
    directive names, and an array of directive handlers.  */
 
-/* Don't invoke CONCAT2 with any whitespace or K&R cc will fail.  */
-#define D(name, t, o, f) static void CONCAT2(do_,name) PARAMS ((cpp_reader *));
+#define D(name, t, o, f) static void do_##name PARAMS ((cpp_reader *));
 DIRECTIVE_TABLE
 #undef D
 
@@ -187,10 +186,9 @@ enum
 };
 #undef D
 
-/* Don't invoke CONCAT2 with any whitespace or K&R cc will fail.  */
 #define D(name, t, origin, flags) \
-{ CONCAT2(do_,name), (const uchar *) STRINGX(name), \
-  sizeof STRINGX(name) - 1, origin, flags },
+{ do_##name, (const uchar *) #name, \
+  sizeof #name - 1, origin, flags },
 static const directive dtable[] =
 {
 DIRECTIVE_TABLE
diff -rup orig/egcc-CVS20030615/gcc/gencheck.c egcc-CVS20030615/gcc/gencheck.c
--- orig/egcc-CVS20030615/gcc/gencheck.c	Sun Jun 15 20:01:12 2003
+++ egcc-CVS20030615/gcc/gencheck.c	Mon Jun 16 14:46:49 2003
@@ -24,7 +24,7 @@ Software Foundation, 59 Temple Place - S
 #include "coretypes.h"
 #include "tm.h"
 
-#define DEFTREECODE(SYM, NAME, TYPE, LEN)   STRINGX(SYM),
+#define DEFTREECODE(SYM, NAME, TYPE, LEN) #SYM,
 
 static const char *const tree_codes[] = {
 #include "tree.def"
diff -rup orig/egcc-CVS20030615/gcc/gengenrtl.c egcc-CVS20030615/gcc/gengenrtl.c
--- orig/egcc-CVS20030615/gcc/gengenrtl.c	Sun Jun  1 20:01:16 2003
+++ egcc-CVS20030615/gcc/gengenrtl.c	Mon Jun 16 14:47:00 2003
@@ -36,7 +36,7 @@ struct rtx_definition
   const char *const enumname, *const name, *const format;
 };
 
-#define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) { STRINGX(ENUM), NAME, FORMAT },
+#define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) { #ENUM, NAME, FORMAT },
 
 static const struct rtx_definition defs[] =
 {
diff -rup orig/egcc-CVS20030615/gcc/machmode.def egcc-CVS20030615/gcc/machmode.def
--- orig/egcc-CVS20030615/gcc/machmode.def	Mon Dec 16 13:19:43 2002
+++ egcc-CVS20030615/gcc/machmode.def	Mon Jun 16 14:51:31 2003
@@ -162,7 +162,7 @@ DEF_MACHMODE (CCmode, "CC", MODE_CC, BIT
 
 #ifdef EXTRA_MODES_FILE
 #define CC(N)  \
-  DEF_MACHMODE (CONCAT2 (N,mode), STRINGX (N), \
+  DEF_MACHMODE (N##mode, #N, \
                 MODE_CC, BITS_PER_UNIT*4, 4, 4, VOIDmode, VOIDmode)
 #include EXTRA_MODES_FILE
 #undef CC
diff -rup orig/egcc-CVS20030615/gcc/protoize.c egcc-CVS20030615/gcc/protoize.c
--- orig/egcc-CVS20030615/gcc/protoize.c	Sat May 17 18:18:41 2003
+++ egcc-CVS20030615/gcc/protoize.c	Mon Jun 16 14:47:18 2003
@@ -229,7 +229,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 = STRINGX (va_alist);
+static const char *varargs_style_indicator = #va_alist;
 #endif /* !defined (UNPROTOIZE) */
 
 /* The following two types are used to create hash tables.  In this program,
diff -rup orig/egcc-CVS20030615/gcc/system.h egcc-CVS20030615/gcc/system.h
--- orig/egcc-CVS20030615/gcc/system.h	Sat Jun  7 20:01:36 2003
+++ egcc-CVS20030615/gcc/system.h	Mon Jun 16 14:42:10 2003
@@ -499,7 +499,6 @@ 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.  */
diff -rup orig/egcc-CVS20030615/gcc/configure.in egcc-CVS20030615/gcc/configure.in
--- orig/egcc-CVS20030615/gcc/configure.in	Sat Jun 14 14:32:13 2003
+++ egcc-CVS20030615/gcc/configure.in	Mon Jun 16 14:53:49 2003
@@ -765,10 +765,6 @@ LDEXP_LIB="$LIBS"
 LIBS="$save_LIBS"
 AC_SUBST(LDEXP_LIB)
 
-# See if the stage1 system preprocessor understands the ANSI C
-# preprocessor stringification operator.  (Used by symcat.h.)
-AC_C_STRINGIZE
-
 # Use <inttypes.h> only if it exists,
 # doesn't clash with <sys/types.h>, and declares intmax_t.
 AC_MSG_CHECKING(for inttypes.h)


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