poke-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 1/2] Add const to buffer param of pkl_parse_buffer


From: Tim Rühsen
Subject: Re: [PATCH 1/2] Add const to buffer param of pkl_parse_buffer
Date: Fri, 3 Apr 2020 16:44:25 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0

On 4/3/20 4:24 PM, Jose E. Marchesi wrote:

     >      2020-04-02 Tim Rühsen  <address@hidden>
     >
     >              * src/pkl-parser.c (pkl_parse_buffer): Add const to buffer 
param.
     >              * src/pkl-parser.h (pkl_parse_buffer): Likewise.
     >
     > I just realized this change introduced a warning:
     >
     > ../../src/pkl-parser.c: In function 'pkl_parse_buffer':
     > ../../src/pkl-parser.c:141:10: warning: assignment discards 'const' 
qualifier from pointer target type [-Wdiscarded-qualifiers]
     >       *end = buffer + parser->nchars;

     Sorry, easy to miss when I use -Wall -Wextra (I'll propose a fix).
     Is there a recommend set of gcc flags to use to be in sync with you ?

By default poke uses -Wall, but not -Wextra.


Just FYI, you will miss warnings like

pk-repl.c: In function 'pk_repl':
pk-repl.c:383:40: warning: suggest braces around empty body in an 'if'
statement [-Wempty-body]
  383 |         /* Avoid gcc warning here.  */ ;

./pvm.jitter:3732:31: warning: comparison of unsigned expression < 0 is
always false [-Wtype-limits]
 3732 |     if (PVM_VAL_ULONG (index) < 0

pkl-trans.c: In function 'pkl_trans1_ps_array':
pkl-trans.c:902:48: warning: comparison of integer expressions of
different signedness: 'long int' and 'size_t' {aka 'long unsigned int'}
[-Wsign-compare]
  902 |           else if ((int64_t) initializer_index < index)

pkl-anal.c:710:41: warning: initialized field overwritten [-Woverride-init]
  710 |    PKL_PHASE_PS_HANDLER (PKL_AST_ARRAY, pkl_anal2_ps_array),
      |                                         ^~~~~~~~~~~~~~~~~~
pkl-pass.h:134:29: note: in definition of macro 'PKL_PHASE_PS_HANDLER'
  134 |   .code_ps_handlers[code] = handler
      |                             ^~~~~~~
pkl-anal.c:710:41: note: (near initialization for
'pkl_phase_anal2.code_ps_handlers[6]')
  710 |    PKL_PHASE_PS_HANDLER (PKL_AST_ARRAY, pkl_anal2_ps_array),
      |                                         ^~~~~~~~~~~~~~~~~~
pkl-pass.h:134:29: note: in definition of macro 'PKL_PHASE_PS_HANDLER'
  134 |   .code_ps_handlers[code] = handler

(...more...)



reply via email to

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