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]

Re: [PATCH] fix warnings in treelang/parse.y


On Saturday 17 September 2005 01:31, Gabriel Dos Reis wrote:
> See the documentation for pp_base_format() in $GCC/gcc/pretty-print.c
Thanks
> The changes are basically OK.  As a bonus, you might to take the
> opportunity to remove the trailing periods and decapitalize the first
> words.
attached :)

 bootstrapped and tested (make check-treelang) in i686

Rafael

2005-09-13  Rafael Ávila de Espíndola  <rafael.espindola@gmail.com>

                  * parse.y :  Fixed two compile warnings in "error" and 
"warning" invocations
                                       Removed trailing periods in messages
                                       Decapitalized the first word of each 
message
Index: gcc/treelang/parse.y
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/treelang/parse.y,v
retrieving revision 1.27
diff -c -3 -p -r1.27 parse.y
*** gcc/treelang/parse.y	25 Jun 2005 00:59:41 -0000	1.27
--- gcc/treelang/parse.y	17 Sep 2005 13:07:45 -0000
*************** storage typename NAME init_opt SEMICOLON
*** 201,207 ****
        gcc_assert (((struct prod_token_parm_item*)VAR_INIT (prod))->tp.pro.code);
        if (STORAGE_CLASS (prod) == EXTERNAL_REFERENCE_STORAGE)
  	{
! 	  error("%HExternal reference variable %q.*s has an initial value.",
  		&tok->tp.tok.location, tok->tp.tok.length, tok->tp.tok.chars);
  	  YYERROR;
  	  VAR_INIT (prod) = NULL;
--- 201,207 ----
        gcc_assert (((struct prod_token_parm_item*)VAR_INIT (prod))->tp.pro.code);
        if (STORAGE_CLASS (prod) == EXTERNAL_REFERENCE_STORAGE)
  	{
! 	  error("%Hexternal reference variable %q.*s has an initial value",
  		&tok->tp.tok.location, tok->tp.tok.length, tok->tp.tok.chars);
  	  YYERROR;
  	  VAR_INIT (prod) = NULL;
*************** storage typename NAME LEFT_PARENTHESIS p
*** 278,284 ****
        break;
        
      case AUTOMATIC_STORAGE:
!       error ("%HFunction %q.*s cannot be automatic.",
  	     &tok->tp.tok.location, tok->tp.tok.length, tok->tp.tok.chars);
        YYERROR;
        break;
--- 278,284 ----
        break;
        
      case AUTOMATIC_STORAGE:
!       error ("%Hfunction %q.*s cannot be automatic",
  	     &tok->tp.tok.location, tok->tp.tok.length, tok->tp.tok.chars);
        YYERROR;
        break;
*************** NAME LEFT_BRACE {
*** 351,357 ****
    current_function = proto = lookup_tree_name (&search_prod);
    if (!proto)
      {
!       error ("%HNo prototype found for %q.*s", &tok->tp.tok.location,
  	     tok->tp.tok.length, tok->tp.tok.chars);
        YYERROR;
      }
--- 351,357 ----
    current_function = proto = lookup_tree_name (&search_prod);
    if (!proto)
      {
!       error ("%Hno prototype found for %q.*s", &tok->tp.tok.location,
  	     tok->tp.tok.length, tok->tp.tok.chars);
        YYERROR;
      }
*************** tl_RETURN expression_opt {
*** 527,540 ****
        tree_code_generate_return (type_prod->tp.pro.code, NULL);
      else
        {
! 	warning (0, "%HRedundant expression in return.",
! 		 &ret_tok->tp.tok.location, ret_tok->tp.tok.length,
! 		 ret_tok->tp.tok.chars);
          tree_code_generate_return (type_prod->tp.pro.code, NULL);
         }
    else
      if (exp == NULL)
! 	error ("%HExpression missing in return.", &ret_tok->tp.tok.location);
      else
        {
          /* Check same type.  */
--- 527,539 ----
        tree_code_generate_return (type_prod->tp.pro.code, NULL);
      else
        {
! 	warning (0, "%Hredundant expression in return",
! 		 &ret_tok->tp.tok.location);
          tree_code_generate_return (type_prod->tp.pro.code, NULL);
         }
    else
      if (exp == NULL)
! 	error ("%Hexpression missing in return", &ret_tok->tp.tok.location);
      else
        {
          /* Check same type.  */
*************** NAME LEFT_PARENTHESIS expressions_with_c
*** 637,643 ****
    proto = lookup_tree_name (&search_prod);
    if (!proto)
      {
!       error ("%HFunction prototype not found for %q.*%s.",
  	     &tok->tp.tok.location, tok->tp.tok.length, tok->tp.tok.chars);
        YYERROR;
      }
--- 636,642 ----
    proto = lookup_tree_name (&search_prod);
    if (!proto)
      {
!       error ("%Hfunction prototype not found for %q.*s",
  	     &tok->tp.tok.location, tok->tp.tok.length, tok->tp.tok.chars);
        YYERROR;
      }
*************** NAME LEFT_PARENTHESIS expressions_with_c
*** 653,659 ****
  
    if (exp_count !=  exp_proto_count)
      {
!       error ("%HExpression count mismatch %q.*s with prototype.",
  	     &tok->tp.tok.location, tok->tp.tok.length, tok->tp.tok.chars);
        YYERROR;
      }
--- 652,658 ----
  
    if (exp_count !=  exp_proto_count)
      {
!       error ("%Hexpression count mismatch %q.*s with prototype",
  	     &tok->tp.tok.location, tok->tp.tok.length, tok->tp.tok.chars);
        YYERROR;
      }
*************** NAME {
*** 720,726 ****
    symbol_table_entry = lookup_tree_name (&search_prod);
    if (!symbol_table_entry)
      {
!       error ("%HVariable %q.*s not defined.",
  	     &tok->tp.tok.location, tok->tp.tok.length, tok->tp.tok.chars);
        YYERROR;
      }
--- 719,725 ----
    symbol_table_entry = lookup_tree_name (&search_prod);
    if (!symbol_table_entry)
      {
!       error ("%Hvariable %q.*s not defined",
  	     &tok->tp.tok.location, tok->tp.tok.length, tok->tp.tok.chars);
        YYERROR;
      }
*************** static void
*** 824,830 ****
  ensure_not_void (unsigned int type, struct prod_token_parm_item* name)
  {
    if (type == VOID_TYPE)
!     error ("%HType must not be void in this context.",
  	   &name->tp.tok.location);
  }
  
--- 823,829 ----
  ensure_not_void (unsigned int type, struct prod_token_parm_item* name)
  {
    if (type == VOID_TYPE)
!     error ("%Htype must not be void in this context",
  	   &name->tp.tok.location);
  }
  

Attachment: pgp00000.pgp
Description: PGP signature


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