dynC_API: fix warnings given by gcc 4.8
authorJosh Stone <jistone@redhat.com>
Fri, 31 May 2013 00:18:18 +0000 (17:18 -0700)
committerJosh Stone <jistone@redhat.com>
Fri, 31 May 2013 00:18:18 +0000 (17:18 -0700)
commit6052cd370ae6923f7bb3d13884599fc874060970
treeb81e6324a848fa16fd61f2fe6f545c222ddcc213
parent8a035430164e89f3eeaa1e6dca96b13486f68dce
dynC_API: fix warnings given by gcc 4.8

For the "string constant" errors, convert the yywarn/yyerror functions
from char* to const char*, and remove a lot of unnecessary strdups.

The remaining few warnings are straightforward.

Compiling ../src/lex.dynC.C
../src/C.l: In function ‘int dynClex()’:
../src/C.l:64:19: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
 <<EOF>>        {yylval.context = "Syntax Error: Unterminated block comment"; return(ERROR);}
                   ^
../src/C.l:71:16: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
 "char"[ \t\v\f]*"*" {yylval.sval = "char *"; return TYPE; }
                ^
../src/C.l:133:36: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
                   yylval.context = "Unterminated string constant";
                                    ^
../src/C.l:144:40: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
                       yylval.context = "constant out of bounds";
                                        ^
../src/C.l:153:36: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
                   yylval.context = "bad escape sequence";
                                    ^
../src/C.l:222:238: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
 ^([^\n;{}])+\n {if(strstr(yytext, "//") != NULL){++line_num;}else{if(strncmp(yytext,"/*", 2) == 0){BEGIN(comment);++line_num;}else{if(lexVerbose)printf("No Semi!\n"); fatalError = true; dynClloc.first_column = yycolumn; yylval.context = "syntax error: missing ';'!"; yyless(yyleng - 1); return(ERROR);}}}
                                                                                                                                                                                                                                              ^
../src/C.l: In function ‘void set_lex_input(char*)’:
../src/C.l:236:20: warning: variable ‘bp’ set but not used [-Wunused-but-set-variable]

                    ^
Compiling ../src/dynC.tab.C
../src/C.y:41:25: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
 char *dynCSnippetName = "";
                         ^
../src/C.y: In function ‘int dynCparse()’:
../src/C.y:328:83: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
           yyerrorNoTok("Invalid number of arguments given in array initialization");
                                                                                   ^
../src/C.y:364:34: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
          yyerror("Syntax error");
                                  ^
../src/C.y:421:43: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
           yywarn("Statement does nothing!");
                                           ^
../src/C.y:612:88: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
           yyerrorNoTok("Local variables not allowed when snippet point is unspecified.");
                                                                                        ^
../src/C.y:642:88: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
           yyerrorNoTok("Local variables not allowed when snippet point is unspecified.");
                                                                                        ^
../src/C.y:646:59: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
           yyerror("Numbered indexes for parameters only");
                                                           ^
../src/C.y:771:83: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
              yyerrorNoTokNonUni("Return values only valid at function exit points");
                                                                                   ^
../src/C.y:796:59: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
        yyerror("Syntax error: unrecognized dyninst call");
                                                           ^
dynC.tab.c:2875:32: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
dynC.tab.c:3024:32: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
dynC_API/h/dynC.tab.h
dynC_API/src/C.l
dynC_API/src/C.y
dynC_API/src/dynC.tab.C
dynC_API/src/lex.dynC.C