Hello,

this is a first, small chunk of the C++ conversion patch.
Committed as pre-approved.


libcpp/
2004-07-24  Bernardo Innocenti  <bernie@develer.com>

	* internal.h (xnew, xcnew, xnewvec, xcnewvec, xobnew): Remove.
	* directives.c: Use XNEW-family macros from libiberty.
	* lex.c: Likewise.
	* macro.c: Likewise.
	* cpplib.h (cpp_deps_style): Export enum with name.


Index: libcpp/directives.c
===================================================================
RCS file: /cvs/gcc/gcc/libcpp/directives.c,v
retrieving revision 1.3
diff -u -p -r1.3 directives.c
--- libcpp/directives.c	9 Jun 2004 20:10:13 -0000	1.3
+++ libcpp/directives.c	12 Jul 2004 00:18:58 -0000
@@ -1077,7 +1077,7 @@ char **
 _cpp_save_pragma_names (cpp_reader *pfile)
 {
   int ct = count_registered_pragmas (pfile->pragmas);
-  char **result = xnewvec (char *, ct);
+  char **result = XNEWVEC (char *, ct);
   (void) save_registered_pragmas (pfile->pragmas, result);
   return result;
 }
@@ -1318,11 +1318,11 @@ destringize_and_run (cpp_reader *pfile, 
     cpp_token *saved_cur_token = pfile->cur_token;
     tokenrun *saved_cur_run = pfile->cur_run;
 
-    pfile->context = xnew (cpp_context);
+    pfile->context = XNEW (cpp_context);
     pfile->context->macro = 0;
     pfile->context->prev = 0;
     run_directive (pfile, T_PRAGMA, result, dest - result);
-    free (pfile->context);
+    XDELETE (pfile->context);
     pfile->context = saved_context;
     pfile->cur_token = saved_cur_token;
     pfile->cur_run = saved_cur_run;
@@ -1532,7 +1532,7 @@ push_conditional (cpp_reader *pfile, int
   struct if_stack *ifs;
   cpp_buffer *buffer = pfile->buffer;
 
-  ifs = xobnew (&pfile->buffer_ob, struct if_stack);
+  ifs = XOBNEW (&pfile->buffer_ob, struct if_stack);
   ifs->line = pfile->directive_line;
   ifs->next = buffer->if_stack;
   ifs->skip_elses = pfile->state.skipping || !skip;
@@ -1922,7 +1922,7 @@ cpp_buffer *
 cpp_push_buffer (cpp_reader *pfile, const uchar *buffer, size_t len,
 		 int from_stage3)
 {
-  cpp_buffer *new = xobnew (&pfile->buffer_ob, cpp_buffer);
+  cpp_buffer *new = XOBNEW (&pfile->buffer_ob, cpp_buffer);
 
   /* Clears, amongst other things, if_stack and mi_cmacro.  */
   memset (new, 0, sizeof (cpp_buffer));
Index: libcpp/internal.h
===================================================================
RCS file: /cvs/gcc/gcc/libcpp/internal.h,v
retrieving revision 1.4
diff -u -p -r1.4 internal.h
--- libcpp/internal.h	30 Jun 2004 18:35:17 -0000	1.4
+++ libcpp/internal.h	12 Jul 2004 00:19:00 -0000
@@ -559,11 +559,6 @@ extern const char *_cpp_default_encoding
 
 /* Utility routines and macros.  */
 #define DSC(str) (const uchar *)str, sizeof str - 1
-#define xnew(T)		(T *) xmalloc (sizeof(T))
-#define xcnew(T)	(T *) xcalloc (1, sizeof(T))
-#define xnewvec(T, N)	(T *) xmalloc (sizeof(T) * (N))
-#define xcnewvec(T, N)	(T *) xcalloc (N, sizeof(T))
-#define xobnew(O, T)	(T *) obstack_alloc (O, sizeof(T))
 
 /* These are inline functions instead of macros so we can get type
    checking.  */
Index: libcpp/lex.c
===================================================================
RCS file: /cvs/gcc/gcc/libcpp/lex.c,v
retrieving revision 1.3
diff -u -p -r1.3 lex.c
--- libcpp/lex.c	9 Jun 2004 20:10:13 -0000	1.3
+++ libcpp/lex.c	12 Jul 2004 00:19:00 -0000
@@ -662,7 +662,7 @@ save_comment (cpp_reader *pfile, cpp_tok
 void
 _cpp_init_tokenrun (tokenrun *run, unsigned int count)
 {
-  run->base = xnewvec (cpp_token, count);
+  run->base = XNEWVEC (cpp_token, count);
   run->limit = run->base + count;
   run->next = NULL;
 }
@@ -673,7 +673,7 @@ next_tokenrun (tokenrun *run)
 {
   if (run->next == NULL)
     {
-      run->next = xnew (tokenrun);
+      run->next = XNEW (tokenrun);
       run->next->prev = run;
       _cpp_init_tokenrun (run->next, 250);
     }
Index: libcpp/macro.c
===================================================================
RCS file: /cvs/gcc/gcc/libcpp/macro.c,v
retrieving revision 1.3
diff -u -p -r1.3 macro.c
--- libcpp/macro.c	9 Jun 2004 20:10:13 -0000	1.3
+++ libcpp/macro.c	12 Jul 2004 00:19:01 -0000
@@ -919,7 +919,7 @@ next_context (cpp_reader *pfile)
 
   if (result == 0)
     {
-      result = xnew (cpp_context);
+      result = XNEW (cpp_context);
       result->prev = pfile->context;
       result->next = 0;
       pfile->context->next = result;
Index: libcpp/include/cpplib.h
===================================================================
RCS file: /cvs/gcc/gcc/libcpp/include/cpplib.h,v
retrieving revision 1.3
diff -u -p -r1.3 cpplib.h
--- libcpp/include/cpplib.h	9 Jun 2004 20:10:13 -0000	1.3
+++ libcpp/include/cpplib.h	12 Jul 2004 00:19:02 -0000
@@ -231,6 +231,9 @@ extern enum cpp_token_fld_kind cpp_token
 typedef unsigned CPPCHAR_SIGNED_T cppchar_t;
 typedef CPPCHAR_SIGNED_T cppchar_signed_t;
 
+/* Style of header dependencies to generate.  */
+enum cpp_deps_style { DEPS_NONE = 0, DEPS_USER, DEPS_SYSTEM };
+
 /* This structure is nested inside struct cpp_reader, and
    carries all the options visible to the command line.  */
 struct cpp_options
@@ -378,7 +381,7 @@ struct cpp_options
   struct
   {
     /* Style of header dependencies to generate.  */
-    enum {DEPS_NONE = 0, DEPS_USER, DEPS_SYSTEM } style;
+    enum cpp_deps_style style;
 
     /* Assume missing files are generated files.  */
     bool missing_files;
