bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: __attribute__((__unused__)) problem


From: Akim Demaille
Subject: Re: __attribute__((__unused__)) problem
Date: Wed, 10 Apr 2013 16:31:58 +0200

Le 8 avr. 2013 à 21:14, victor khomenko <address@hidden> a écrit :

> Dear Akim,

Hi Victor,

Thanks for the report.

> c:\punf\picallib\parse_pi.cpp(1202) : warning C4365: 'return' : conversion 
> from 'int' to 'size_t', signed/unsigned mismatch

This is the second return.

> static YYSIZE_T
> yytnamerr (char *yyres, const char *yystr)
> {
>   […]
>   if (! yyres)
>     return yystrlen (yystr);
> 
>   return yystpcpy (yyres, yystr) - yyres;
> }


> c:\punf\picallib\parse_pi.cpp(1657) : warning C4242: '=' : conversion from 
> 'int' to 'yytype_int16', possible loss of data

This is the assignment:

 yysetstate:
  *yyssp = yystate;

because

    yytype_int16 *yyssp;
    int yystate;

it would make sense to be more consistent here.

> c:\punf\picallib\parse_pi.cpp(1662) : warning C4365: 'initializing' : 
> conversion from 'int' to 'size_t', signed/unsigned mismatch

      YYSIZE_T yysize = yyssp - yyss + 1;

> c:\punf\picallib\parse_pi.cpp(1704) : warning C4127: conditional expression 
> is constant

This is because of the do {…} while (false) trick in the
macros:

# define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
    do                                                                  \
      {                                                                 \
        YYSIZE_T yynewbytes;                                            \
        YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
        Stack = &yyptr->Stack_alloc;                                    \
        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
        yyptr += yynewbytes / sizeof (*yyptr);                          \
      }                                                                 \
    while (YYID (0))


> c:\punf\picallib\parse_pi.cpp(1705) : warning C4127: conditional expression 
> is constant
> 
> c:\punf\picallib\parse_pi.cpp(1706) : warning C4127: conditional expression 
> is constant
> 
> c:\punf\picallib\parse_pi.cpp(1773) : warning C4127: conditional expression 
> is constant
> 
> c:\punf\picallib\parse_pi.cpp(1826) : warning C4127: conditional expression 
> is constant
> 
> c:\punf\picallib\parse_pi.cpp(2292) : warning C4127: conditional expression 
> is constant
> 
> c:\punf\picallib\parse_pi.cpp(2344) : warning C4127: conditional expression 
> is constant

They are all alike.

> 
> c:\punf\picallib\parse_pi.cpp(854) : warning C4505: 'yy_location_print_' : 
> unreferenced local function has been removed
> 
> c:\punf\picallib\parse_pi.cpp(2295) : warning C4702: unreachable code
> <parse_pi.y><parse_pi.cpp>

yyerrorlab:

  /* Pacify compilers like GCC when the user code never invokes
     YYERROR and the label yyerrorlab therefore never appears in user
     code.  */
  if (/*CONSTCOND*/ 0)
     goto yyerrorlab;

  yyerror_range[1] = yylsp[1-yylen];  <======== this line

Well, it's going to be painful to address these warning.
I don't think I will do that in 2.7.1, which I'd like to
release soon.  They can be covered in 3.x.  I'd like to
avoid #pragma if I can, so if you have ideas, please contribute!




reply via email to

[Prev in Thread] Current Thread [Next in Thread]