public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH INSTALLED]: Make treelang dir -Wcast-qual clean
@ 2007-07-27  9:19 Kaveh R. GHAZI
  0 siblings, 0 replies; only message in thread
From: Kaveh R. GHAZI @ 2007-07-27  9:19 UTC (permalink / raw)
  To: gcc-patches

This patch addresses -Wcast-qual in the treelang dir.  There was
really only one warning from lex.l, but fixing that required
constifying a few extra places.

Tested on sparc-sun-solaris2.10, no regressions.  Installed.

		--Kaveh


2007-07-26  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* lex.l (update_yylval): Constify.
	* treelang.h (struct token_part, struct parameter_part):
	Likewise.
	* treetree.c (tree_code_create_function_prototype,
	tree_code_create_variable, tree_code_get_integer_value):
	Likewise.
	* treetree.h (tree_code_get_integer_value,
	tree_code_create_function_prototype, tree_code_create_variable):
	Likewise.

diff -rup orig/egcc-SVN20070725/gcc/treelang/lex.l egcc-SVN20070725/gcc/treelang/lex.l
--- orig/egcc-SVN20070725/gcc/treelang/lex.l	2007-07-18 12:20:26.000000000 -0400
+++ egcc-SVN20070725/gcc/treelang/lex.l	2007-07-26 12:57:35.104258866 -0400
@@ -269,7 +269,7 @@ update_yylval (int a)
   tok->tp.tok.length = yyleng;
   /* Have to copy yytext as it is just a ptr into the buffer at the
      moment.  */
-  tok->tp.tok.chars = (unsigned char*) get_string (yytext, yyleng);
+  tok->tp.tok.chars = (const unsigned char *) get_string (yytext, yyleng);
 }

 /* Trace the value LEXRET and the position and token details being
diff -rup orig/egcc-SVN20070725/gcc/treelang/treelang.h egcc-SVN20070725/gcc/treelang/treelang.h
--- orig/egcc-SVN20070725/gcc/treelang/treelang.h	2007-07-18 12:20:26.000000000 -0400
+++ egcc-SVN20070725/gcc/treelang/treelang.h	2007-07-26 12:57:14.698080927 -0400
@@ -53,7 +53,7 @@ struct token_part GTY(())
   location_t location;
   unsigned int charno;
   unsigned int length; /* The value.  */
-  unsigned char* chars;
+  const unsigned char *chars;
 };

 /* Definitions for fields in production.  */
@@ -119,7 +119,7 @@ struct production_part GTY(())
 struct parameter_part GTY(())
 {
   struct prod_token_parm_item *next; /* Next entry.  */
-  unsigned char* variable_name; /* Name. */
+  const unsigned char *variable_name; /* Name. */
   tree * GTY ((skip)) where_to_put_var_tree; /* Where to save decl.  */
 };

diff -rup orig/egcc-SVN20070725/gcc/treelang/treetree.c egcc-SVN20070725/gcc/treelang/treetree.c
--- orig/egcc-SVN20070725/gcc/treelang/treetree.c	2007-07-25 13:11:07.000000000 -0400
+++ egcc-SVN20070725/gcc/treelang/treetree.c	2007-07-26 12:55:21.284950445 -0400
@@ -299,7 +299,7 @@ tree_code_if_end (location_t loc ATTRIBU
    is PARMS, returns decl for this function.  */

 tree
-tree_code_create_function_prototype (unsigned char* chars,
+tree_code_create_function_prototype (const unsigned char *chars,
 				     unsigned int storage_class,
 				     unsigned int ret_type,
 				     struct prod_token_parm_item* parms,
@@ -489,7 +489,7 @@ tree_code_create_function_wrapup (locati

 tree
 tree_code_create_variable (unsigned int storage_class,
-			   unsigned char* chars,
+			   const unsigned char *chars,
 			   unsigned int length,
 			   unsigned int expression_type,
 			   tree init,
@@ -604,7 +604,7 @@ tree_code_output_expression_statement (t
    size checking is done.  */

 tree
-tree_code_get_integer_value (unsigned char* chars, unsigned int length)
+tree_code_get_integer_value (const unsigned char *chars, unsigned int length)
 {
   long long int val = 0;
   unsigned int ix;
diff -rup orig/egcc-SVN20070725/gcc/treelang/treetree.h egcc-SVN20070725/gcc/treelang/treetree.h
--- orig/egcc-SVN20070725/gcc/treelang/treetree.h	2007-07-18 12:20:26.000000000 -0400
+++ egcc-SVN20070725/gcc/treelang/treetree.h	2007-07-26 12:53:09.914397810 -0400
@@ -29,7 +29,7 @@

 tree tree_code_init_parameters (void);
 tree tree_code_add_parameter (tree list, tree proto_exp, tree exp);
-tree tree_code_get_integer_value (unsigned char *chars, unsigned int length);
+tree tree_code_get_integer_value (const unsigned char *chars, unsigned int length);
 void tree_code_generate_return (tree type, tree exp);
 void tree_ggc_storage_always_used  (void *m);
 tree tree_code_get_expression (unsigned int exp_type, tree type, tree op1,
@@ -38,13 +38,13 @@ tree tree_code_get_numeric_type (unsigne
 void tree_code_create_function_initial (tree prev_saved,
 					location_t loc);
 void tree_code_create_function_wrapup (location_t loc);
-tree tree_code_create_function_prototype (unsigned char* chars,
+tree tree_code_create_function_prototype (const unsigned char *chars,
 					  unsigned int storage_class,
 					  unsigned int ret_type,
 					  struct prod_token_parm_item* parms,
                                           location_t loc);
 tree tree_code_create_variable (unsigned int storage_class,
-				unsigned char* chars,
+				const unsigned char *chars,
 				unsigned int length,
 				unsigned int expression_type,
 				tree init,

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-07-27  8:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-27  9:19 [PATCH INSTALLED]: Make treelang dir -Wcast-qual clean Kaveh R. GHAZI

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).