Merge pull request #26159 from marxin/fix-Wsuggest-attribute=format
Fix -Wsuggest-attribute=format warnings.
This commit is contained in:
commit
372152220b
8 changed files with 22 additions and 14 deletions
|
@ -49,11 +49,11 @@ public:
|
||||||
ERR_SHADER
|
ERR_SHADER
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void logv(const char *p_format, va_list p_list, bool p_err) = 0;
|
virtual void logv(const char *p_format, va_list p_list, bool p_err) _PRINTF_FORMAT_ATTRIBUTE_2_0 = 0;
|
||||||
virtual void log_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, ErrorType p_type = ERR_ERROR);
|
virtual void log_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, ErrorType p_type = ERR_ERROR);
|
||||||
|
|
||||||
void logf(const char *p_format, ...);
|
void logf(const char *p_format, ...) _PRINTF_FORMAT_ATTRIBUTE_2_3;
|
||||||
void logf_error(const char *p_format, ...);
|
void logf_error(const char *p_format, ...) _PRINTF_FORMAT_ATTRIBUTE_2_3;
|
||||||
|
|
||||||
virtual ~Logger();
|
virtual ~Logger();
|
||||||
};
|
};
|
||||||
|
@ -64,7 +64,7 @@ public:
|
||||||
class StdLogger : public Logger {
|
class StdLogger : public Logger {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void logv(const char *p_format, va_list p_list, bool p_err);
|
virtual void logv(const char *p_format, va_list p_list, bool p_err) _PRINTF_FORMAT_ATTRIBUTE_2_0;
|
||||||
virtual ~StdLogger();
|
virtual ~StdLogger();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ class RotatedFileLogger : public Logger {
|
||||||
public:
|
public:
|
||||||
RotatedFileLogger(const String &p_base_path, int p_max_files = 10);
|
RotatedFileLogger(const String &p_base_path, int p_max_files = 10);
|
||||||
|
|
||||||
virtual void logv(const char *p_format, va_list p_list, bool p_err);
|
virtual void logv(const char *p_format, va_list p_list, bool p_err) _PRINTF_FORMAT_ATTRIBUTE_2_0;
|
||||||
|
|
||||||
virtual ~RotatedFileLogger();
|
virtual ~RotatedFileLogger();
|
||||||
};
|
};
|
||||||
|
@ -99,7 +99,7 @@ class CompositeLogger : public Logger {
|
||||||
public:
|
public:
|
||||||
CompositeLogger(Vector<Logger *> p_loggers);
|
CompositeLogger(Vector<Logger *> p_loggers);
|
||||||
|
|
||||||
virtual void logv(const char *p_format, va_list p_list, bool p_err);
|
virtual void logv(const char *p_format, va_list p_list, bool p_err) _PRINTF_FORMAT_ATTRIBUTE_2_0;
|
||||||
virtual void log_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, ErrorType p_type = ERR_ERROR);
|
virtual void log_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, ErrorType p_type = ERR_ERROR);
|
||||||
|
|
||||||
void add_logger(Logger *p_logger);
|
void add_logger(Logger *p_logger);
|
||||||
|
|
|
@ -148,8 +148,8 @@ public:
|
||||||
static OS *get_singleton();
|
static OS *get_singleton();
|
||||||
|
|
||||||
void print_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, Logger::ErrorType p_type = Logger::ERR_ERROR);
|
void print_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, Logger::ErrorType p_type = Logger::ERR_ERROR);
|
||||||
void print(const char *p_format, ...);
|
void print(const char *p_format, ...) _PRINTF_FORMAT_ATTRIBUTE_2_3;
|
||||||
void printerr(const char *p_format, ...);
|
void printerr(const char *p_format, ...) _PRINTF_FORMAT_ATTRIBUTE_2_3;
|
||||||
|
|
||||||
virtual void alert(const String &p_alert, const String &p_title = "ALERT!") = 0;
|
virtual void alert(const String &p_alert, const String &p_title = "ALERT!") = 0;
|
||||||
virtual String get_stdin_string(bool p_block = true) = 0;
|
virtual String get_stdin_string(bool p_block = true) = 0;
|
||||||
|
|
|
@ -307,4 +307,12 @@ struct _GlobalLock {
|
||||||
#define unlikely(x) x
|
#define unlikely(x) x
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
#define _PRINTF_FORMAT_ATTRIBUTE_2_0 __attribute__((format(printf, 2, 0)))
|
||||||
|
#define _PRINTF_FORMAT_ATTRIBUTE_2_3 __attribute__((format(printf, 2, 3)))
|
||||||
|
#else
|
||||||
|
#define _PRINTF_FORMAT_ATTRIBUTE_2_0
|
||||||
|
#define _PRINTF_FORMAT_ATTRIBUTE_2_3
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // TYPEDEFS_H
|
#endif // TYPEDEFS_H
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
class SyslogLogger : public Logger {
|
class SyslogLogger : public Logger {
|
||||||
public:
|
public:
|
||||||
virtual void logv(const char *p_format, va_list p_list, bool p_err);
|
virtual void logv(const char *p_format, va_list p_list, bool p_err) _PRINTF_FORMAT_ATTRIBUTE_2_0;
|
||||||
virtual void print_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, ErrorType p_type);
|
virtual void print_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, ErrorType p_type);
|
||||||
|
|
||||||
virtual ~SyslogLogger();
|
virtual ~SyslogLogger();
|
||||||
|
|
|
@ -757,7 +757,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
||||||
editor = false;
|
editor = false;
|
||||||
#else
|
#else
|
||||||
String error_msg = "Error: Could not load game data at path '" + project_path + "'. Is the .pck file missing?\n";
|
String error_msg = "Error: Could not load game data at path '" + project_path + "'. Is the .pck file missing?\n";
|
||||||
OS::get_singleton()->print(error_msg.ascii().get_data());
|
OS::get_singleton()->print("%s", error_msg.ascii().get_data());
|
||||||
OS::get_singleton()->alert(error_msg);
|
OS::get_singleton()->alert(error_msg);
|
||||||
|
|
||||||
goto error;
|
goto error;
|
||||||
|
|
|
@ -457,7 +457,7 @@ bool test_27() {
|
||||||
state = s.begins_with(sb) == tc[i].expected;
|
state = s.begins_with(sb) == tc[i].expected;
|
||||||
}
|
}
|
||||||
if (!state) {
|
if (!state) {
|
||||||
OS::get_singleton()->print("\n\t Failure on:\n\t\tstring: ", tc[i].data, "\n\t\tbegin: ", tc[i].begin, "\n\t\texpected: ", tc[i].expected ? "true" : "false", "\n");
|
OS::get_singleton()->print("\n\t Failure on:\n\t\tstring: %s\n\t\tbegin: %s\n\t\texpected: %s\n", tc[i].data, tc[i].begin, tc[i].expected ? "true" : "false");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -703,7 +703,7 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
|
||||||
List<InternalCall> &custom_icalls = itype.api_type == ClassDB::API_EDITOR ? editor_custom_icalls : core_custom_icalls;
|
List<InternalCall> &custom_icalls = itype.api_type == ClassDB::API_EDITOR ? editor_custom_icalls : core_custom_icalls;
|
||||||
|
|
||||||
if (verbose_output)
|
if (verbose_output)
|
||||||
OS::get_singleton()->print(String("Generating " + itype.proxy_name + ".cs...\n").utf8());
|
OS::get_singleton()->print("Generating %s.cs...\n", itype.proxy_name.utf8().get_data());
|
||||||
|
|
||||||
String ctor_method(ICALL_PREFIX + itype.proxy_name + "_Ctor"); // Used only for derived types
|
String ctor_method(ICALL_PREFIX + itype.proxy_name + "_Ctor"); // Used only for derived types
|
||||||
|
|
||||||
|
@ -1280,7 +1280,7 @@ Error BindingsGenerator::generate_glue(const String &p_output_dir) {
|
||||||
|
|
||||||
List<InternalCall> &custom_icalls = itype.api_type == ClassDB::API_EDITOR ? editor_custom_icalls : core_custom_icalls;
|
List<InternalCall> &custom_icalls = itype.api_type == ClassDB::API_EDITOR ? editor_custom_icalls : core_custom_icalls;
|
||||||
|
|
||||||
OS::get_singleton()->print(String("Generating " + itype.name + "...\n").utf8());
|
OS::get_singleton()->print("Generating %s...\n", itype.name.utf8().get_data());
|
||||||
|
|
||||||
String ctor_method(ICALL_PREFIX + itype.proxy_name + "_Ctor"); // Used only for derived types
|
String ctor_method(ICALL_PREFIX + itype.proxy_name + "_Ctor"); // Used only for derived types
|
||||||
|
|
||||||
|
|
|
@ -567,7 +567,7 @@ Error ScriptClassParser::parse(const String &p_code) {
|
||||||
if (full_name.length())
|
if (full_name.length())
|
||||||
full_name += ".";
|
full_name += ".";
|
||||||
full_name += class_decl.name;
|
full_name += class_decl.name;
|
||||||
OS::get_singleton()->print(String("Ignoring generic class declaration: " + class_decl.name).utf8());
|
OS::get_singleton()->print("%s", String("Ignoring generic class declaration: " + class_decl.name).utf8().get_data());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (tk == TK_IDENTIFIER && String(value) == "struct") {
|
} else if (tk == TK_IDENTIFIER && String(value) == "struct") {
|
||||||
|
|
Loading…
Reference in a new issue