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]

[Ada] Fix const qualifier related warnings in misc.c


Tested on i586-suse-linux, applied on the mainline.


2009-04-24  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
            Thomas Quinot  <quinot@adacore.com>

	* fe.h (Set_Identifier_Casing): Add const to second parameter.
	* gcc-interface/misc.c (internal_error_function): Make copy of retur
	from pp_formatted_text before assigning BUFFER to it.
	(gnat_init): Likewise for main_input_filename and gnat_argv.
	(gnat_printable_name): Remove cast from call to Set_Identifier_Casing.


-- 
Eric Botcazou
Index: fe.h
===================================================================
--- fe.h	(revision 146634)
+++ fe.h	(working copy)
@@ -84,7 +84,7 @@ extern Node_Id Get_Attribute_Definition_
 
 extern void Error_Msg_N	          (Fat_Pointer, Node_Id);
 extern void Error_Msg_NE          (Fat_Pointer, Node_Id, Entity_Id);
-extern void Set_Identifier_Casing (Char *, Char *);
+extern void Set_Identifier_Casing (Char *, const Char *);
 
 /* err_vars: */
 
Index: gcc-interface/misc.c
===================================================================
--- gcc-interface/misc.c	(revision 146644)
+++ gcc-interface/misc.c	(working copy)
@@ -355,7 +355,7 @@ internal_error_function (const char *msg
   pp_format_verbatim (global_dc->printer, &tinfo);
 
   /* Extract a (writable) pointer to the formatted text.  */
-  buffer = (char*) pp_formatted_text (global_dc->printer);
+  buffer = xstrdup (pp_formatted_text (global_dc->printer));
 
   /* Go up to the first newline.  */
   for (p = buffer; *p; p++)
@@ -394,9 +394,12 @@ gnat_init (void)
   gnat_init_decl_processing ();
 
   /* Add the input filename as the last argument.  */
-  gnat_argv[gnat_argc] = (char *) main_input_filename;
-  gnat_argc++;
-  gnat_argv[gnat_argc] = 0;
+  if (main_input_filename)
+    {
+      gnat_argv[gnat_argc] = xstrdup (main_input_filename);
+      gnat_argc++;
+      gnat_argv[gnat_argc] = NULL;
+    }
 
   global_dc->internal_error = &internal_error_function;
 
@@ -547,7 +550,7 @@ gnat_printable_name (tree decl, int verb
 
   if (verbosity == 2 && !DECL_IS_BUILTIN (decl))
     {
-      Set_Identifier_Casing (ada_name, (char *) DECL_SOURCE_FILE (decl));
+      Set_Identifier_Casing (ada_name, DECL_SOURCE_FILE (decl));
       return ggc_strdup (Name_Buffer);
     }
 

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