BUG: Fix parsing of fortran include directives during dependency scanning. Previously only #include worked but not just include.

This commit is contained in:
Brad King 2008-01-07 23:08:42 -05:00
parent 52eb0ccac7
commit e2e8993eb3
2 changed files with 30 additions and 18 deletions

View File

@ -612,10 +612,10 @@ static const yytype_int8 yyrhs[] =
static const yytype_uint16 yyrline[] = static const yytype_uint16 yyrline[] =
{ {
0, 161, 161, 161, 163, 163, 165, 171, 181, 211, 0, 161, 161, 161, 163, 163, 165, 171, 181, 211,
216, 223, 229, 235, 241, 247, 252, 257, 262, 267, 222, 229, 235, 241, 247, 253, 258, 263, 268, 273,
271, 272, 273, 278, 278, 278, 279, 279, 280, 280, 277, 278, 279, 284, 284, 284, 285, 285, 286, 286,
281, 281, 282, 282, 283, 283, 284, 284, 285, 285, 287, 287, 288, 288, 289, 289, 290, 290, 291, 291,
286, 286, 287, 287, 290, 291, 292, 293, 294 292, 292, 293, 293, 296, 297, 298, 299, 300
}; };
#endif #endif
@ -1636,13 +1636,19 @@ yyreduce:
case 9: case 9:
#line 212 "cmDependsFortranParser.y" #line 212 "cmDependsFortranParser.y"
{ {
if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (4)].string), "include"))
{
cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleInclude(parser, (yyvsp[(2) - (4)].string));
}
free((yyvsp[(1) - (4)].string)); free((yyvsp[(1) - (4)].string));
free((yyvsp[(2) - (4)].string)); free((yyvsp[(2) - (4)].string));
} }
break; break;
case 10: case 10:
#line 217 "cmDependsFortranParser.y" #line 223 "cmDependsFortranParser.y"
{ {
cmDependsFortranParser* parser = cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner); cmDependsFortran_yyget_extra(yyscanner);
@ -1652,7 +1658,7 @@ yyreduce:
break; break;
case 11: case 11:
#line 224 "cmDependsFortranParser.y" #line 230 "cmDependsFortranParser.y"
{ {
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleDefine(parser, (yyvsp[(2) - (4)].string)); cmDependsFortranParser_RuleDefine(parser, (yyvsp[(2) - (4)].string));
@ -1661,7 +1667,7 @@ yyreduce:
break; break;
case 12: case 12:
#line 230 "cmDependsFortranParser.y" #line 236 "cmDependsFortranParser.y"
{ {
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleUndef(parser, (yyvsp[(2) - (4)].string)); cmDependsFortranParser_RuleUndef(parser, (yyvsp[(2) - (4)].string));
@ -1670,7 +1676,7 @@ yyreduce:
break; break;
case 13: case 13:
#line 236 "cmDependsFortranParser.y" #line 242 "cmDependsFortranParser.y"
{ {
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleIfdef(parser, (yyvsp[(2) - (4)].string)); cmDependsFortranParser_RuleIfdef(parser, (yyvsp[(2) - (4)].string));
@ -1679,7 +1685,7 @@ yyreduce:
break; break;
case 14: case 14:
#line 242 "cmDependsFortranParser.y" #line 248 "cmDependsFortranParser.y"
{ {
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleIfndef(parser, (yyvsp[(2) - (4)].string)); cmDependsFortranParser_RuleIfndef(parser, (yyvsp[(2) - (4)].string));
@ -1688,7 +1694,7 @@ yyreduce:
break; break;
case 15: case 15:
#line 248 "cmDependsFortranParser.y" #line 254 "cmDependsFortranParser.y"
{ {
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleIf(parser); cmDependsFortranParser_RuleIf(parser);
@ -1696,7 +1702,7 @@ yyreduce:
break; break;
case 16: case 16:
#line 253 "cmDependsFortranParser.y" #line 259 "cmDependsFortranParser.y"
{ {
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleElif(parser); cmDependsFortranParser_RuleElif(parser);
@ -1704,7 +1710,7 @@ yyreduce:
break; break;
case 17: case 17:
#line 258 "cmDependsFortranParser.y" #line 264 "cmDependsFortranParser.y"
{ {
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleElse(parser); cmDependsFortranParser_RuleElse(parser);
@ -1712,7 +1718,7 @@ yyreduce:
break; break;
case 18: case 18:
#line 263 "cmDependsFortranParser.y" #line 269 "cmDependsFortranParser.y"
{ {
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleEndif(parser); cmDependsFortranParser_RuleEndif(parser);
@ -1720,25 +1726,25 @@ yyreduce:
break; break;
case 19: case 19:
#line 268 "cmDependsFortranParser.y" #line 274 "cmDependsFortranParser.y"
{ {
free((yyvsp[(1) - (4)].string)); free((yyvsp[(1) - (4)].string));
} }
break; break;
case 44: case 44:
#line 290 "cmDependsFortranParser.y" #line 296 "cmDependsFortranParser.y"
{ free ((yyvsp[(1) - (1)].string)); } { free ((yyvsp[(1) - (1)].string)); }
break; break;
case 45: case 45:
#line 291 "cmDependsFortranParser.y" #line 297 "cmDependsFortranParser.y"
{ free ((yyvsp[(1) - (1)].string)); } { free ((yyvsp[(1) - (1)].string)); }
break; break;
/* Line 1267 of yacc.c. */ /* Line 1267 of yacc.c. */
#line 1742 "cmDependsFortranParser.cxx" #line 1748 "cmDependsFortranParser.cxx"
default: break; default: break;
} }
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@ -1954,7 +1960,7 @@ yyreturn:
} }
#line 297 "cmDependsFortranParser.y" #line 303 "cmDependsFortranParser.y"
/* End of grammar */ /* End of grammar */

View File

@ -210,6 +210,12 @@ keyword_stmt:
} }
| WORD STRING other EOSTMT /* Ignore */ | WORD STRING other EOSTMT /* Ignore */
{ {
if (cmDependsFortranParserIsKeyword($1, "include"))
{
cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleInclude(parser, $2);
}
free($1); free($1);
free($2); free($2);
} }