Re: [sqlite] Two problems in latest version of lempar.c
Hi Richard thanks for the quick response! On 04.10.2016 14:21, Richard Hipp wrote: > On 10/4/16, Benjamin Franksenwrote: >> I am using the lemon parser generator in a project >> (http://www-csr.bessy.de/control/SoftDist/sequencer/). I updated the >> lemon parser template tools/lempar.c to the latest available version and >> found two problems, reported by gcc: >> >> ./snl.c: In function ‘yy_destructor’: >> ./snl.c:116:36: warning: unused variable ‘presult’ [-Wunused-variable] >> #define snlParserARG_FETCH Node **presult = yypParser->presult > > This can be resolved by using the "presult" variable in one of your > destructors. I have no destructors. The parser I am generating is part of a compiler that never frees any resources (until it exits). Anyway, ParseARG_STORE is used once in lempar.c to actually store the extra argument and four times to suppress unused variable warnings (according to the source comments), so I guess a fifth time won't do much harm ;-) >> ./snl.c: In function ‘snlParser’: >> ./snl.c:2446:33: warning: comparison of distinct pointer types lacks a >> cast [enabled by default] >> while( yypParser->yytos >= >yystack > > I think the latest trunk check-in may fix this. > https://www.sqlite.org/src/info/3a9d802fda105856 > > But that fix is untested, as the error handling logic where this code > is found is #ifdef-ed out in SQLite. Please give the latest a try and > let me know if that fails to fix the problem. The fix works fine, thanks. I don't know why I didn't see it when I looked at the repo today (I did intend to grab the latest version from the trunk), probably made a mistake navigating the web interface. Cheers Ben -- "Make it so they have to reboot after every typo." ― Scott Adams signature.asc Description: OpenPGP digital signature ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Two problems in latest version of lempar.c
On 10/4/16, Benjamin Franksenwrote: > Hello > > I am using the lemon parser generator in a project > (http://www-csr.bessy.de/control/SoftDist/sequencer/). I updated the > lemon parser template tools/lempar.c to the latest available version and > found two problems, reported by gcc: > > ./snl.c: In function ‘yy_destructor’: > ./snl.c:116:36: warning: unused variable ‘presult’ [-Wunused-variable] > #define snlParserARG_FETCH Node **presult = yypParser->presult This can be resolved by using the "presult" variable in one of your destructors. > ./snl.c: In function ‘snlParser’: > ./snl.c:2446:33: warning: comparison of distinct pointer types lacks a > cast [enabled by default] > while( yypParser->yytos >= >yystack I think the latest trunk check-in may fix this. https://www.sqlite.org/src/info/3a9d802fda105856 But that fix is untested, as the error handling logic where this code is found is #ifdef-ed out in SQLite. Please give the latest a try and let me know if that fails to fix the problem. -- D. Richard Hipp d...@sqlite.org ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Two problems in latest version of lempar.c
Hello I am using the lemon parser generator in a project (http://www-csr.bessy.de/control/SoftDist/sequencer/). I updated the lemon parser template tools/lempar.c to the latest available version and found two problems, reported by gcc: ./snl.c: In function ‘yy_destructor’: ./snl.c:116:36: warning: unused variable ‘presult’ [-Wunused-variable] #define snlParserARG_FETCH Node **presult = yypParser->presult ^ ./snl.c:1031:3: note: in expansion of macro ‘snlParserARG_FETCH’ snlParserARG_FETCH; ^ ./snl.c: In function ‘snlParser’: ./snl.c:2446:33: warning: comparison of distinct pointer types lacks a cast [enabled by default] while( yypParser->yytos >= >yystack The first is a harmless warning which can be suppressed by using the snlParserARG_STORE macro in yy_destructor right after snlParserARG_FETCH, as is done similarly in a number of other functions in lempar.c. The second one is *NOT* harmless. The '&' before yypParser->yystack is indeed wrong and could in corner cases lead to a crash or worse a security vulnerability. Cheers Ben PS: I am not subscribed, so please add my address to any replies. -- "Make it so they have to reboot after every typo." ― Scott Adams signature.asc Description: OpenPGP digital signature ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users