COMP: Disable some warnings in generated code. Disable compilation of unused goto block.

This commit is contained in:
Brad King 2007-10-05 10:02:34 -04:00
parent a2b2742543
commit 89dc3b0753
2 changed files with 68 additions and 46 deletions

View File

@ -170,13 +170,12 @@ Run bison like this:
bison --yacc --name-prefix=cmDependsFortran_yy bison --yacc --name-prefix=cmDependsFortran_yy
--defines=cmDependsFortranParserTokens.h --defines=cmDependsFortranParserTokens.h
-ocmDependsFortranParser.cxx cmDependsFortranParser.y -ocmDependsFortranParser.cxx
cmDependsFortranParser.y
Modify cmDependsFortranParser.cxx: Modify cmDependsFortranParser.cxx:
- remove TABs - remove TABs
- add __HP_aCC to the #if test for yyerrorlab warning suppression - Remove the yyerrorlab block in range ["goto yyerrlab1", "yyerrlab1:"]
- add __INTEL_COMPILER to the #if test for yyerrorlab warning suppression
*/ */
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
@ -201,7 +200,6 @@ static void cmDependsFortranError(yyscan_t yyscanner, const char* message)
cmDependsFortranParser_Error(parser, message); cmDependsFortranParser_Error(parser, message);
} }
static char charmap[] = { static char charmap[] = {
'\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007', '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
'\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017', '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
@ -267,6 +265,10 @@ static bool cmDependsFortranParserIsKeyword(const char* word,
#ifdef _MSC_VER #ifdef _MSC_VER
# pragma warning (disable: 4102) /* Unused goto label. */ # pragma warning (disable: 4102) /* Unused goto label. */
# pragma warning (disable: 4065) /* Switch contains default but no case. */ # pragma warning (disable: 4065) /* Switch contains default but no case. */
# pragma warning (disable: 4701) /* Local variable may not be initialized. */
# pragma warning (disable: 4702) /* Unreachable code. */
# pragma warning (disable: 4127) /* Conditional expression is constant. */
# pragma warning (disable: 4244) /* Conversion to smaller type, data loss. */
#endif #endif
@ -290,12 +292,12 @@ static bool cmDependsFortranParserIsKeyword(const char* word,
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE typedef union YYSTYPE
#line 88 "cmDependsFortranParser.y" #line 141 "cmDependsFortranParser.y"
{ {
char* string; char* string;
} }
/* Line 187 of yacc.c. */ /* Line 187 of yacc.c. */
#line 248 "cmDependsFortranParser.cxx" #line 301 "cmDependsFortranParser.cxx"
YYSTYPE; YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_DECLARED 1
@ -308,7 +310,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */ /* Line 216 of yacc.c. */
#line 261 "cmDependsFortranParser.cxx" #line 314 "cmDependsFortranParser.cxx"
#ifdef short #ifdef short
# undef short # undef short
@ -606,13 +608,13 @@ static const yytype_int8 yyrhs[] =
}; };
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] = static const yytype_uint16 yyrline[] =
{ {
0, 107, 107, 107, 109, 109, 111, 114, 123, 152, 0, 161, 161, 161, 163, 163, 165, 168, 178, 211,
162, 163, 169, 175, 181, 187, 192, 197, 202, 207, 222, 223, 229, 235, 241, 247, 252, 257, 262, 267,
208, 209, 210, 216, 216, 217, 217, 218, 218, 219, 268, 269, 270, 276, 276, 277, 277, 278, 278, 279,
219, 220, 220, 221, 221, 222, 222, 223, 223, 224, 279, 280, 280, 281, 281, 282, 282, 283, 283, 284,
224, 227, 228, 229, 230, 231 284, 287, 288, 289, 290, 291
}; };
#endif #endif
@ -1575,11 +1577,12 @@ yyreduce:
switch (yyn) switch (yyn)
{ {
case 7: case 7:
#line 115 "cmDependsFortranParser.y" #line 169 "cmDependsFortranParser.y"
{ {
if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (2)].string), "interface")) if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (2)].string), "interface"))
{ {
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_SetInInterface(parser, true); cmDependsFortranParser_SetInInterface(parser, true);
} }
free((yyvsp[(1) - (2)].string)); free((yyvsp[(1) - (2)].string));
@ -1587,30 +1590,34 @@ yyreduce:
break; break;
case 8: case 8:
#line 124 "cmDependsFortranParser.y" #line 179 "cmDependsFortranParser.y"
{ {
if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (4)].string), "use")) if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (4)].string), "use"))
{ {
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleUse(parser, (yyvsp[(2) - (4)].string)); cmDependsFortranParser_RuleUse(parser, (yyvsp[(2) - (4)].string));
free((yyvsp[(2) - (4)].string)); free((yyvsp[(2) - (4)].string));
} }
else if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (4)].string), "module")) else if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (4)].string), "module"))
{ {
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleModule(parser, (yyvsp[(2) - (4)].string)); cmDependsFortranParser_RuleModule(parser, (yyvsp[(2) - (4)].string));
free((yyvsp[(2) - (4)].string)); free((yyvsp[(2) - (4)].string));
} }
else if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (4)].string), "interface")) else if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (4)].string), "interface"))
{ {
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_SetInInterface(parser, true); cmDependsFortranParser_SetInInterface(parser, true);
free((yyvsp[(2) - (4)].string)); free((yyvsp[(2) - (4)].string));
} }
else if (cmDependsFortranParserIsKeyword((yyvsp[(2) - (4)].string), "interface") && else if (cmDependsFortranParserIsKeyword((yyvsp[(2) - (4)].string), "interface") &&
cmDependsFortranParserIsKeyword((yyvsp[(1) - (4)].string), "end")) cmDependsFortranParserIsKeyword((yyvsp[(1) - (4)].string), "end"))
{ {
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_SetInInterface(parser, false); cmDependsFortranParser_SetInInterface(parser, false);
free((yyvsp[(2) - (4)].string)); free((yyvsp[(2) - (4)].string));
} }
@ -1619,11 +1626,12 @@ yyreduce:
break; break;
case 9: case 9:
#line 153 "cmDependsFortranParser.y" #line 212 "cmDependsFortranParser.y"
{ {
if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (4)].string), "include")) if (cmDependsFortranParserIsKeyword((yyvsp[(1) - (4)].string), "include"))
{ {
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleInclude(parser, (yyvsp[(2) - (4)].string)); cmDependsFortranParser_RuleInclude(parser, (yyvsp[(2) - (4)].string));
} }
free((yyvsp[(1) - (4)].string)); free((yyvsp[(1) - (4)].string));
@ -1632,7 +1640,7 @@ yyreduce:
break; break;
case 11: case 11:
#line 164 "cmDependsFortranParser.y" #line 224 "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));
@ -1641,7 +1649,7 @@ yyreduce:
break; break;
case 12: case 12:
#line 170 "cmDependsFortranParser.y" #line 230 "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));
@ -1650,7 +1658,7 @@ yyreduce:
break; break;
case 13: case 13:
#line 176 "cmDependsFortranParser.y" #line 236 "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));
@ -1659,7 +1667,7 @@ yyreduce:
break; break;
case 14: case 14:
#line 182 "cmDependsFortranParser.y" #line 242 "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));
@ -1668,7 +1676,7 @@ yyreduce:
break; break;
case 15: case 15:
#line 188 "cmDependsFortranParser.y" #line 248 "cmDependsFortranParser.y"
{ {
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleIf(parser); cmDependsFortranParser_RuleIf(parser);
@ -1676,7 +1684,7 @@ yyreduce:
break; break;
case 16: case 16:
#line 193 "cmDependsFortranParser.y" #line 253 "cmDependsFortranParser.y"
{ {
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleElif(parser); cmDependsFortranParser_RuleElif(parser);
@ -1684,7 +1692,7 @@ yyreduce:
break; break;
case 17: case 17:
#line 198 "cmDependsFortranParser.y" #line 258 "cmDependsFortranParser.y"
{ {
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleElse(parser); cmDependsFortranParser_RuleElse(parser);
@ -1692,7 +1700,7 @@ yyreduce:
break; break;
case 18: case 18:
#line 203 "cmDependsFortranParser.y" #line 263 "cmDependsFortranParser.y"
{ {
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleEndif(parser); cmDependsFortranParser_RuleEndif(parser);
@ -1700,18 +1708,18 @@ yyreduce:
break; break;
case 41: case 41:
#line 227 "cmDependsFortranParser.y" #line 287 "cmDependsFortranParser.y"
{ free ((yyvsp[(1) - (1)].string)); } { free ((yyvsp[(1) - (1)].string)); }
break; break;
case 42: case 42:
#line 228 "cmDependsFortranParser.y" #line 288 "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 1664 "cmDependsFortranParser.cxx" #line 1723 "cmDependsFortranParser.cxx"
default: break; default: break;
} }
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@ -1804,6 +1812,7 @@ yyerrlab:
} }
} }
#if 0
/* Else will try to reuse look-ahead token after shifting the error /* Else will try to reuse look-ahead token after shifting the error
token. */ token. */
goto yyerrlab1; goto yyerrlab1;
@ -1833,6 +1842,7 @@ yyerrorlab:
| yyerrlab1 -- common code for both syntax error and YYERROR. | | yyerrlab1 -- common code for both syntax error and YYERROR. |
`-------------------------------------------------------------*/ `-------------------------------------------------------------*/
yyerrlab1: yyerrlab1:
#endif
yyerrstatus = 3; /* Each real token shifted decrements this. */ yyerrstatus = 3; /* Each real token shifted decrements this. */
for (;;) for (;;)
@ -1925,7 +1935,7 @@ yyreturn:
} }
#line 234 "cmDependsFortranParser.y" #line 294 "cmDependsFortranParser.y"
/* End of grammar */ /* End of grammar */

View File

@ -31,13 +31,14 @@ This file must be translated to C and modified to build everywhere.
Run bison like this: Run bison like this:
bison --yacc --name-prefix=cmDependsFortran_yy --defines=cmDependsFortranParserTokens.h -ocmDependsFortranParser.cxx cmDependsFortranParser.y bison --yacc --name-prefix=cmDependsFortran_yy
--defines=cmDependsFortranParserTokens.h
-ocmDependsFortranParser.cxx
cmDependsFortranParser.y
Modify cmDependsFortranParser.cxx: Modify cmDependsFortranParser.cxx:
- remove TABs - remove TABs
- add __HP_aCC to the #if test for yyerrorlab warning suppression - Remove the yyerrorlab block in range ["goto yyerrlab1", "yyerrlab1:"]
- add __INTEL_COMPILER to the #if test for yyerrorlab warning suppression
*/ */
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
@ -127,6 +128,10 @@ static bool cmDependsFortranParserIsKeyword(const char* word,
#ifdef _MSC_VER #ifdef _MSC_VER
# pragma warning (disable: 4102) /* Unused goto label. */ # pragma warning (disable: 4102) /* Unused goto label. */
# pragma warning (disable: 4065) /* Switch contains default but no case. */ # pragma warning (disable: 4065) /* Switch contains default but no case. */
# pragma warning (disable: 4701) /* Local variable may not be initialized. */
# pragma warning (disable: 4702) /* Unreachable code. */
# pragma warning (disable: 4127) /* Conditional expression is constant. */
# pragma warning (disable: 4244) /* Conversion to smaller type, data loss. */
#endif #endif
%} %}
@ -143,7 +148,8 @@ static bool cmDependsFortranParserIsKeyword(const char* word,
%token CPP_INCLUDE F90PPR_INCLUDE COCO_INCLUDE %token CPP_INCLUDE F90PPR_INCLUDE COCO_INCLUDE
%token F90PPR_DEFINE CPP_DEFINE F90PPR_UNDEF CPP_UNDEF %token F90PPR_DEFINE CPP_DEFINE F90PPR_UNDEF CPP_UNDEF
%token CPP_IFDEF CPP_IFNDEF CPP_IF CPP_ELSE CPP_ELIF CPP_ENDIF %token CPP_IFDEF CPP_IFNDEF CPP_IF CPP_ELSE CPP_ELIF CPP_ENDIF
%token F90PPR_IFDEF F90PPR_IFNDEF F90PPR_IF F90PPR_ELSE F90PPR_ELIF F90PPR_ENDIF %token F90PPR_IFDEF F90PPR_IFNDEF F90PPR_IF
%token F90PPR_ELSE F90PPR_ELIF F90PPR_ENDIF
%token <string> CPP_TOENDL %token <string> CPP_TOENDL
%token <number> UNTERMINATED_STRING %token <number> UNTERMINATED_STRING
%token <string> STRING WORD %token <string> STRING WORD
@ -163,7 +169,8 @@ keyword_stmt:
{ {
if (cmDependsFortranParserIsKeyword($1, "interface")) if (cmDependsFortranParserIsKeyword($1, "interface"))
{ {
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_SetInInterface(parser, true); cmDependsFortranParser_SetInInterface(parser, true);
} }
free($1); free($1);
@ -172,26 +179,30 @@ keyword_stmt:
{ {
if (cmDependsFortranParserIsKeyword($1, "use")) if (cmDependsFortranParserIsKeyword($1, "use"))
{ {
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleUse(parser, $2); cmDependsFortranParser_RuleUse(parser, $2);
free($2); free($2);
} }
else if (cmDependsFortranParserIsKeyword($1, "module")) else if (cmDependsFortranParserIsKeyword($1, "module"))
{ {
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleModule(parser, $2); cmDependsFortranParser_RuleModule(parser, $2);
free($2); free($2);
} }
else if (cmDependsFortranParserIsKeyword($1, "interface")) else if (cmDependsFortranParserIsKeyword($1, "interface"))
{ {
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_SetInInterface(parser, true); cmDependsFortranParser_SetInInterface(parser, true);
free($2); free($2);
} }
else if (cmDependsFortranParserIsKeyword($2, "interface") && else if (cmDependsFortranParserIsKeyword($2, "interface") &&
cmDependsFortranParserIsKeyword($1, "end")) cmDependsFortranParserIsKeyword($1, "end"))
{ {
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_SetInInterface(parser, false); cmDependsFortranParser_SetInInterface(parser, false);
free($2); free($2);
} }
@ -201,7 +212,8 @@ keyword_stmt:
{ {
if (cmDependsFortranParserIsKeyword($1, "include")) if (cmDependsFortranParserIsKeyword($1, "include"))
{ {
cmDependsFortranParser* parser = cmDependsFortran_yyget_extra(yyscanner); cmDependsFortranParser* parser =
cmDependsFortran_yyget_extra(yyscanner);
cmDependsFortranParser_RuleInclude(parser, $2); cmDependsFortranParser_RuleInclude(parser, $2);
} }
free($1); free($1);