Thread: [Ctool-users] Parsing error
Brought to you by:
flisakow
From: Emil O. <em...@ee...> - 2002-05-02 16:47:46
|
Hi, I'm having trouble parsing a few files in sudo-1.6.5p2 (though I'm having similar problems in other packages). The ctool parser doesn't seem to like files produced by bison/flex (who would? ;). In sudo, the offending files are lex.yy.c and sudo.tab.c. Then there's the file set_perms.c which has a really strange error. I extracted the problematic preprocessed code: static void runas_setup() { if ((sudo_user._runas_pw) ->pw_name != ((void *)0) ) { # 314 "set_perms.c" { if (setgid((sudo_user._runas_pw) ->pw_gid)) perror("cannot set gid to runas gid"); if (! (sudo_defs_table[( 34 )].sd_un.flag) && initgroups(* (sudo_user.runas) , (sudo_user._runas_pw) ->pw_gid) < 0) perror("cannot set group vector"); } } } set_perms.c:312: Error (parse error) before '#line' # 313 "set_perms.c" ^ set_perms.c:327: Error (parse error) before 'String Constant' } The first error is really strange to me considering that the line mentioned is not in the file! Any ideas on where this is coming from? Thanks, Emil |
From: Kwanghoon C. <cho...@ya...> - 2006-10-04 01:02:48
|
Hi there,=0A=0AWhen I tried to apply CTool to a C source code including=0A= =0A> extern int fun_name (=0A> float f ( int a )=0A> );=0A=0AI go= t an error message as=0A=0A> test.c:4: Function type not allowed:=0A> = );=0A> ^=0A=0Awhere the caret points to the closed paranthesis.=0A=0A= =0AThe error message comes from the rule param_decl_bis in=0Agram.y, which = is a parser specification of CTool, as follows:=0A=0A> param_decl_bis: dec= l_specs_reentrance_bis declarator=0A> {=0A> assert (gProj= ect->Parse_TOS->err_top_level ||=0A> $1 =3D=3D gProject-= >Parse_TOS->parseCtxt->curCtxt->decl_specs);=0A> gProject->Parse= _TOS->possibleType =3D true;=0A> $$ =3D $2;=0A> Type = * decl =3D gProject->Parse_TOS->parseCtxt->UseDeclCtxt();=0A> Ty= pe * extended =3D $$->extend(decl); =0A> if ($$->for= m &&=0A> $$->form->isFunction())=0A> {=0A> = if(yyerr ("Function type not allowed"))=0A> YYER= ROR;=0A> }=0A> else if (extended && =0A=0A=0AI am cu= rious about the reason on the ban imposed by CTool.=0AI thought the ban com= es from the definition of ANSI C standard,=0Aso I looked at the K&R C book = to find the reason of the ban =0Abut in vain. =0A=0A=0AWould anybody give m= e any explanation for my curiosity?=0A=0AThanks in advance.=0A=0A=0A=0ABest= regards,=0A=0A=0AKwanghoon Choi=0A=0A=0A=09=09=0A_________________________= _______________________________ =0A180=B5=B5 =B4=DE=B6=F3=C1=F8 =BE=DF=C8= =C4! =B8=DE=C0=CF - =C4=C4=C7=BB=C5=CD=BF=CD =C8=DE=B4=EB=C6=F9=C0=B8=B7=CE= =BE=F0=C1=A6 =BE=EE=B5=F0=BC=AD=B3=AA =BB=F5=B7=CE=BF=EE =BE=DF=C8=C4! =B8= =DE=C0=CF=C0=BB =C8=AE=C0=CE=C7=D8=BA=B8=BC=BC=BF=E4.=0Ahttp://kr.content.m= ail.yahoo.com/cgland |
From: flisakow <fli...@so...> - 2002-05-07 20:55:46
|
Hi, I received this message from the email list, and I'm CC'ing it back to the user's list also, so you should receive two copies. I was on vacation for the last week, and didn't reply to any email. One possible problem is that CTool uses gcc as its preprocessor by default (that's controlled by a compile-time option). Perhaps the #line directives inserted by that 2nd pass are actually causing the problem. There's a remove(cpp_file) call in project.cpp that could be commented out so you could see the actual input to CTool (its stored in filename.pp). I'll that a look at this myself in the next few days, but I wanted to reply sooner so you'd know the list is not dead. Shaun > Hi, > > I'm having trouble parsing a few files in sudo-1.6.5p2 (though I'm > having similar problems in other packages). The ctool parser doesn't > seem to like files produced by bison/flex (who would? ;). In sudo, the > offending files are lex.yy.c and sudo.tab.c. Then there's the file > set_perms.c which has a really strange error. I extracted the > problematic preprocessed code: > > static void > runas_setup() > { > if ((sudo_user._runas_pw) ->pw_name != ((void *)0) ) { > # 314 "set_perms.c" > { > if (setgid((sudo_user._runas_pw) ->pw_gid)) > perror("cannot set gid to runas gid"); > > > > > if (! (sudo_defs_table[( 34 )].sd_un.flag) && > initgroups(* (sudo_user.runas) , (sudo_user._runas_pw) ->pw_gid) < 0) > perror("cannot set group vector"); > > } > } > } > > set_perms.c:312: Error (parse error) before '#line' > # 313 "set_perms.c" > ^ > set_perms.c:327: Error (parse error) before 'String Constant' > } > > The first error is really strange to me considering that the line > mentioned is not in the file! Any ideas on where this is coming from? > > Thanks, > Emil > > > _______________________________________________________________ > > Have big pipes? SourceForge.net is looking for download mirrors. We supply > the hardware. You get the recognition. Email Us: ban...@so... > _______________________________________________ > Ctool-users mailing list > Cto...@li... > https://lists.sourceforge.net/lists/listinfo/ctool-users > -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Shaun Flisakowski fli...@sp... "In your heart, you know it's flat." - The Flat Earth Society http://www.spf-15.com/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
From: Emil O. <em...@ee...> - 2002-05-13 04:37:39
|
Hi, I think that I've discovered at least part of the problem: it looks like in the current grammar, #line statements are illegal at the beginning of a compound statement, so if I change the code to this: static void runas_setup() { if ((sudo_user._runas_pw) ->pw_name != ((void *)0) ) { { if (setgid((sudo_user._runas_pw) ->pw_gid)) perror("cannot set gid to runas gid"); # 318 "set_perms.c" if (! (sudo_defs_table[( 34 )].sd_un.flag) && initgroups(* (sudo_user.runas) , (sudo_user._runas_pw) ->pw_gid) < 0) perror("cannot set group vector"); } } } everything parses. I also tried putting the #line between the "if" line and the "perror" line, but that will not parse. Also, it looks like #line must appear after a statement (i.e. not after an opt_declaration_list). Am I right about this? If so, how can I fix it? Thanks, Emil flisakow wrote: > Hi, > > I received this message from the email list, and I'm CC'ing it back > to the user's list also, so you should receive two copies. I was > on vacation for the last week, and didn't reply to any email. > > One possible problem is that CTool uses gcc as its preprocessor by > default (that's controlled by a compile-time option). Perhaps the > #line directives inserted by that 2nd pass are actually causing > the problem. There's a remove(cpp_file) call in project.cpp that > could be commented out so you could see the actual input to CTool > (its stored in filename.pp). > > I'll that a look at this myself in the next few days, but I wanted > to reply sooner so you'd know the list is not dead. > > Shaun > > >>Hi, >> >>I'm having trouble parsing a few files in sudo-1.6.5p2 (though I'm >>having similar problems in other packages). The ctool parser doesn't >>seem to like files produced by bison/flex (who would? ;). In sudo, the >>offending files are lex.yy.c and sudo.tab.c. Then there's the file >>set_perms.c which has a really strange error. I extracted the >>problematic preprocessed code: >> >>static void >>runas_setup() >>{ >> if ((sudo_user._runas_pw) ->pw_name != ((void *)0) ) { >># 314 "set_perms.c" >> { >> if (setgid((sudo_user._runas_pw) ->pw_gid)) >> perror("cannot set gid to runas gid"); >> >> >> >> >> if (! (sudo_defs_table[( 34 )].sd_un.flag) && >> initgroups(* (sudo_user.runas) , (sudo_user._runas_pw) ->pw_gid) < 0) >> perror("cannot set group vector"); >> >> } >> } >>} >> >>set_perms.c:312: Error (parse error) before '#line' >># 313 "set_perms.c" >> ^ >>set_perms.c:327: Error (parse error) before 'String Constant' >>} >> >>The first error is really strange to me considering that the line >>mentioned is not in the file! Any ideas on where this is coming from? >> >>Thanks, >>Emil >> >> >>_______________________________________________________________ >> >>Have big pipes? SourceForge.net is looking for download mirrors. We supply >>the hardware. You get the recognition. Email Us: ban...@so... >>_______________________________________________ >>Ctool-users mailing list >>Cto...@li... >>https://lists.sourceforge.net/lists/listinfo/ctool-users >> > > > |