2010-10-27 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Added printf format check attribute.
	* src/Logger.h
	* src/StringFormat.h
pull/1/head
Tatsuhiro Tsujikawa 2010-10-27 14:57:46 +00:00
parent 9f6b9fc175
commit 9ff8e55d04
3 changed files with 28 additions and 11 deletions

View File

@ -1,3 +1,9 @@
2010-10-27 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added printf format check attribute.
* src/Logger.h
* src/StringFormat.h
2010-10-27 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Use std::numeric_limits<time_t> instead of checking of

View File

@ -92,25 +92,35 @@ public:
virtual ~Logger();
void debug(const char* msg, ...);
void debug(const char* msg, ...)
__attribute__ ((format (printf, 2, 3)));
void debug(const char* msg, const Exception& ex, ...);
void debug(const char* msg, const Exception& ex, ...)
__attribute__ ((format (printf, 2, 4)));
void info(const char* msg, ...);
void info(const char* msg, ...)
__attribute__ ((format (printf, 2, 3)));
void info(const char* msg, const Exception& ex, ...);
void info(const char* msg, const Exception& ex, ...)
__attribute__ ((format (printf, 2, 4)));
void notice(const char* msg, ...);
void notice(const char* msg, ...)
__attribute__ ((format (printf, 2, 3)));
void notice(const char* msg, const Exception& ex, ...);
void notice(const char* msg, const Exception& ex, ...)
__attribute__ ((format (printf, 2, 4)));
void warn(const char* msg, ...);
void warn(const char* msg, ...)
__attribute__ ((format (printf, 2, 3)));
void warn(const char* msg, const Exception& ex, ...);
void warn(const char* msg, const Exception& ex, ...)
__attribute__ ((format (printf, 2, 4)));
void error(const char* msg, ...);
void error(const char* msg, ...)
__attribute__ ((format (printf, 2, 3)));
void error(const char* msg, const Exception& ex, ...);
void error(const char* msg, const Exception& ex, ...)
__attribute__ ((format (printf, 2, 4)));
void openFile(const std::string& filename);

View File

@ -47,7 +47,8 @@ class StringFormat {
private:
std::string msg_;
public:
StringFormat(const char* fmt, ...);
StringFormat(const char* fmt, ...)
__attribute__ ((format (printf, 2, 3)));
const std::string& str() const;
};