Fix problems using -Wwrite-strings and -Wcast-qual with yacc generated
parsers. Closes PR #2792. Submitted by: Tim Vanderhoek
This commit is contained in:
parent
96522b887c
commit
7dce0a1e9f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=25234
@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: output.c,v 1.7 1997/02/22 19:58:00 peter Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -945,7 +945,8 @@ output_debug()
|
||||
++outline;
|
||||
fprintf(code_file, "#define YYFINAL %d\n", final_state);
|
||||
outline += 3;
|
||||
fprintf(code_file, "#ifndef YYDEBUG\n#define YYDEBUG %d\n#endif\n",
|
||||
fprintf(code_file, "#ifndef YYDEBUG\n#define YYDEBUG %d\n"
|
||||
"#elif YYDEBUG\n#include <stdio.h>\n#endif\n",
|
||||
tflag);
|
||||
if (rflag)
|
||||
fprintf(output_file, "#ifndef YYDEBUG\n#define YYDEBUG %d\n#endif\n",
|
||||
@ -970,7 +971,8 @@ output_debug()
|
||||
symnam[0] = "end-of-file";
|
||||
|
||||
if (!rflag) ++outline;
|
||||
fprintf(output_file, "#if YYDEBUG\nchar *%sname[] = {", symbol_prefix);
|
||||
fprintf(output_file, "#if YYDEBUG\n"
|
||||
"const char * const %sname[] = {", symbol_prefix);
|
||||
j = 80;
|
||||
for (i = 0; i <= max; ++i)
|
||||
{
|
||||
|
@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: skeleton.c,v 1.11 1997/02/22 19:58:02 peter Exp $
|
||||
* $Id: skeleton.c,v 1.12 1997/03/22 01:48:17 bde Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -68,19 +68,9 @@ char *banner[] =
|
||||
"#define yyclearin (yychar=(YYEMPTY))",
|
||||
"#define yyerrok (yyerrflag=0)",
|
||||
"#define YYRECOVERING (yyerrflag!=0)",
|
||||
"/* cfront 1.2 defines \"c_plusplus\" instead of \"__cplusplus\" */",
|
||||
"#ifdef c_plusplus",
|
||||
"#ifndef __cplusplus",
|
||||
"#define __cplusplus",
|
||||
"#endif",
|
||||
"#endif",
|
||||
"#ifdef __cplusplus",
|
||||
"extern \"C\" { char *getenv(const char *); }",
|
||||
"#else",
|
||||
"extern char *getenv();",
|
||||
"extern int yylex();",
|
||||
"extern int yyparse();",
|
||||
"#endif",
|
||||
"static int yygrowstack();",
|
||||
0
|
||||
};
|
||||
|
||||
@ -173,7 +163,7 @@ char *body[] =
|
||||
"{",
|
||||
" register int yym, yyn, yystate;",
|
||||
"#if YYDEBUG",
|
||||
" register char *yys;",
|
||||
" register const char *yys;",
|
||||
"",
|
||||
" if ((yys = getenv(\"YYDEBUG\")))",
|
||||
" {",
|
||||
|
Loading…
Reference in New Issue
Block a user