From: David Reiss Date: Tue, 10 Jun 2008 22:56:12 +0000 (+0000) Subject: Fix some warnings caused by treating string literals as non-const. X-Git-Tag: 0.2.0~776 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=0babe40d74f05e7a23ca72b44d74493f3b2fc1a4;p=common%2Fthrift.git Fix some warnings caused by treating string literals as non-const. git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666368 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/compiler/cpp/src/main.cc b/compiler/cpp/src/main.cc index efee9370..acb27a86 100644 --- a/compiler/cpp/src/main.cc +++ b/compiler/cpp/src/main.cc @@ -189,7 +189,7 @@ char *saferealpath(const char *path, char *resolved_path) { * * @param fmt C format string followed by additional arguments */ -void yyerror(char* fmt, ...) { +void yyerror(const char* fmt, ...) { va_list args; fprintf(stderr, "[ERROR:%s:%d] (last token was '%s')\n", @@ -209,7 +209,7 @@ void yyerror(char* fmt, ...) { * * @param fmt C format string followed by additional arguments */ -void pdebug(char* fmt, ...) { +void pdebug(const char* fmt, ...) { if (g_debug == 0) { return; } @@ -226,7 +226,7 @@ void pdebug(char* fmt, ...) { * * @param fmt C format string followed by additional arguments */ -void pverbose(char* fmt, ...) { +void pverbose(const char* fmt, ...) { if (g_verbose == 0) { return; } @@ -241,7 +241,7 @@ void pverbose(char* fmt, ...) { * * @param fmt C format string followed by additional arguments */ -void pwarning(int level, char* fmt, ...) { +void pwarning(int level, const char* fmt, ...) { if (g_warn < level) { return; } diff --git a/compiler/cpp/src/main.h b/compiler/cpp/src/main.h index 3ab27444..eb355f03 100644 --- a/compiler/cpp/src/main.h +++ b/compiler/cpp/src/main.h @@ -22,17 +22,17 @@ int yyparse(void); /** * Expected to be defined by Flex/Bison */ -void yyerror(char* fmt, ...); +void yyerror(const char* fmt, ...); /** * Parse debugging output, used to print helpful info */ -void pdebug(char* fmt, ...); +void pdebug(const char* fmt, ...); /** * Parser warning */ -void pwarning(int level, char* fmt, ...); +void pwarning(int level, const char* fmt, ...); /** * Failure!