Skip to content

Commit

Permalink
Remove duplicate ERR_PRINT macro.
Browse files Browse the repository at this point in the history
  • Loading branch information
madmiraal committed Feb 5, 2020
1 parent 2b1084f commit 5af3b4c
Show file tree
Hide file tree
Showing 76 changed files with 173 additions and 178 deletions.
2 changes: 1 addition & 1 deletion core/bind/core_bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3217,7 +3217,7 @@ Ref<JSONParseResult> _JSON::parse(const String &p_json) {
result->error = JSON::parse(p_json, result->result, result->error_string, result->error_line);

if (result->error != OK) {
ERR_PRINTS(vformat("Error parsing JSON at line %s: %s", result->error_line, result->error_string));
ERR_PRINT(vformat("Error parsing JSON at line %s: %s", result->error_line, result->error_string));
}
return result;
}
Expand Down
2 changes: 1 addition & 1 deletion core/class_db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ Object *ClassDB::instance(const StringName &p_class) {
}
#ifdef TOOLS_ENABLED
if (ti->api == API_EDITOR && !Engine::get_singleton()->is_editor_hint()) {
ERR_PRINTS("Class '" + String(p_class) + "' can only be instantiated by editor.");
ERR_PRINT("Class '" + String(p_class) + "' can only be instantiated by editor.");
return NULL;
}
#endif
Expand Down
5 changes: 0 additions & 5 deletions core/error_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -393,11 +393,6 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, DEBUG_STR(m_msg)); \
}

#define ERR_PRINTS(m_msg) \
{ \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, DEBUG_STR(m_msg)); \
}

// Only prints the error message once.

#define ERR_PRINT_ONCE(m_msg) \
Expand Down
2 changes: 1 addition & 1 deletion core/io/config_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ Error ConfigFile::_internal_load(const String &p_path, FileAccess *f) {
memdelete(f);
return OK;
} else if (err != OK) {
ERR_PRINTS("ConfgFile::load - " + p_path + ":" + itos(lines) + " error: " + error_text + ".");
ERR_PRINT("ConfgFile::load - " + p_path + ":" + itos(lines) + " error: " + error_text + ".");
memdelete(f);
return err;
}
Expand Down
4 changes: 2 additions & 2 deletions core/io/image_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Error ImageLoader::load_image(String p_file, Ref<Image> p_image, FileAccess *p_c
Error err;
f = FileAccess::open(p_file, FileAccess::READ, &err);
if (!f) {
ERR_PRINTS("Error opening file '" + p_file + "'.");
ERR_PRINT("Error opening file '" + p_file + "'.");
return err;
}
}
Expand All @@ -66,7 +66,7 @@ Error ImageLoader::load_image(String p_file, Ref<Image> p_image, FileAccess *p_c
continue;
Error err = loader[i]->load_image(p_image, f, p_force_linear, p_scale);
if (err != OK) {
ERR_PRINTS("Error loading image: " + p_file);
ERR_PRINT("Error loading image: " + p_file);
}

if (err != ERR_FILE_UNRECOGNIZED) {
Expand Down
2 changes: 1 addition & 1 deletion core/io/ip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ IP_Address IP::get_resolve_item_address(ResolverID p_id) const {
resolver->mutex->lock();

if (resolver->queue[p_id].status != IP::RESOLVER_STATUS_DONE) {
ERR_PRINTS("Resolve of '" + resolver->queue[p_id].hostname + "'' didn't complete yet.");
ERR_PRINT("Resolve of '" + resolver->queue[p_id].hostname + "'' didn't complete yet.");
resolver->mutex->unlock();
return IP_Address();
}
Expand Down
16 changes: 8 additions & 8 deletions core/io/multiplayer_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ Node *MultiplayerAPI::_process_get_node(int p_from, const uint8_t *p_packet, int
node = root_node->get_node(np);

if (!node)
ERR_PRINTS("Failed to get path from RPC: " + String(np) + ".");
ERR_PRINT("Failed to get path from RPC: " + String(np) + ".");
} else {
// Use cached path.
int id = target;
Expand All @@ -269,7 +269,7 @@ Node *MultiplayerAPI::_process_get_node(int p_from, const uint8_t *p_packet, int

node = root_node->get_node(ni->path);
if (!node)
ERR_PRINTS("Failed to get cached path from RPC: " + String(ni->path) + ".");
ERR_PRINT("Failed to get cached path from RPC: " + String(ni->path) + ".");
}
return node;
}
Expand Down Expand Up @@ -324,7 +324,7 @@ void MultiplayerAPI::_process_rpc(Node *p_node, const StringName &p_name, int p_
if (ce.error != Variant::CallError::CALL_OK) {
String error = Variant::get_call_error_text(p_node, p_name, (const Variant **)argp.ptr(), argc, ce);
error = "RPC - " + error;
ERR_PRINTS(error);
ERR_PRINT(error);
}
}

Expand Down Expand Up @@ -362,7 +362,7 @@ void MultiplayerAPI::_process_rset(Node *p_node, const StringName &p_name, int p
p_node->set(p_name, value, &valid);
if (!valid) {
String error = "Error setting remote property '" + String(p_name) + "', not found in object of type " + p_node->get_class() + ".";
ERR_PRINTS(error);
ERR_PRINT(error);
}
}

Expand Down Expand Up @@ -683,7 +683,7 @@ void MultiplayerAPI::rpcp(Node *p_node, int p_peer_id, bool p_unreliable, const
if (ce.error != Variant::CallError::CALL_OK) {
String error = Variant::get_call_error_text(p_node, p_method, p_arg, p_argcount, ce);
error = "rpc() aborted in local call: - " + error + ".";
ERR_PRINTS(error);
ERR_PRINT(error);
return;
}
}
Expand All @@ -698,7 +698,7 @@ void MultiplayerAPI::rpcp(Node *p_node, int p_peer_id, bool p_unreliable, const
if (ce.error != Variant::CallError::CALL_OK) {
String error = Variant::get_call_error_text(p_node, p_method, p_arg, p_argcount, ce);
error = "rpc() aborted in script local call: - " + error + ".";
ERR_PRINTS(error);
ERR_PRINT(error);
return;
}
}
Expand Down Expand Up @@ -735,7 +735,7 @@ void MultiplayerAPI::rsetp(Node *p_node, int p_peer_id, bool p_unreliable, const

if (!valid) {
String error = "rset() aborted in local set, property not found: - " + String(p_property) + ".";
ERR_PRINTS(error);
ERR_PRINT(error);
return;
}
} else if (p_node->get_script_instance()) {
Expand All @@ -753,7 +753,7 @@ void MultiplayerAPI::rsetp(Node *p_node, int p_peer_id, bool p_unreliable, const

if (!valid) {
String error = "rset() aborted in local script set, property not found: - " + String(p_property) + ".";
ERR_PRINTS(error);
ERR_PRINT(error);
return;
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/io/resource_format_binary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1635,7 +1635,7 @@ void ResourceFormatSaverBinaryInstance::_find_resources(const Variant &p_variant

if (!p_main && (!bundle_resources) && res->get_path().length() && res->get_path().find("::") == -1) {
if (res->get_path() == path) {
ERR_PRINTS("Circular reference to resource being saved found: '" + local_path + "' will be null next time it's loaded.");
ERR_PRINT("Circular reference to resource being saved found: '" + local_path + "' will be null next time it's loaded.");
return;
}
int idx = external_resources.size();
Expand Down
4 changes: 2 additions & 2 deletions core/io/resource_importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Error ResourceFormatImporter::_get_path_and_type(const String &p_path, PathAndTy
memdelete(f);
return OK;
} else if (err != OK) {
ERR_PRINTS("ResourceFormatImporter::load - " + p_path + ".import:" + itos(lines) + " error: " + error_text);
ERR_PRINT("ResourceFormatImporter::load - " + p_path + ".import:" + itos(lines) + " error: " + error_text);
memdelete(f);
return err;
}
Expand Down Expand Up @@ -279,7 +279,7 @@ void ResourceFormatImporter::get_internal_resource_path_list(const String &p_pat
memdelete(f);
return;
} else if (err != OK) {
ERR_PRINTS("ResourceFormatImporter::get_internal_resource_path_list - " + p_path + ".import:" + itos(lines) + " error: " + error_text);
ERR_PRINT("ResourceFormatImporter::get_internal_resource_path_list - " + p_path + ".import:" + itos(lines) + " error: " + error_text);
memdelete(f);
return;
}
Expand Down
4 changes: 2 additions & 2 deletions core/io/resource_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ String ResourceLoader::_path_remap(const String &p_path, bool *r_translation_rem
if (err == ERR_FILE_EOF) {
break;
} else if (err != OK) {
ERR_PRINTS("Parse error: " + p_path + ".remap:" + itos(lines) + " error: " + error_text + ".");
ERR_PRINT("Parse error: " + p_path + ".remap:" + itos(lines) + " error: " + error_text + ".");
break;
}

Expand Down Expand Up @@ -1013,7 +1013,7 @@ void ResourceLoader::finalize() {
#ifndef NO_THREADS
const LoadingMapKey *K = NULL;
while ((K = loading_map.next(K))) {
ERR_PRINTS("Exited while resource is being loaded: " + K->path);
ERR_PRINT("Exited while resource is being loaded: " + K->path);
}
loading_map.clear();
memdelete(loading_map_mutex);
Expand Down
2 changes: 1 addition & 1 deletion core/message_queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ void MessageQueue::_call_function(Object *p_target, const StringName &p_func, co
p_target->call(p_func, argptrs, p_argcount, ce);
if (p_show_error && ce.error != Variant::CallError::CALL_OK) {

ERR_PRINTS("Error calling deferred method: " + Variant::get_call_error_text(p_target, p_func, argptrs, p_argcount, ce) + ".");
ERR_PRINT("Error calling deferred method: " + Variant::get_call_error_text(p_target, p_func, argptrs, p_argcount, ce) + ".");
}
}

Expand Down
4 changes: 2 additions & 2 deletions core/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,7 @@ Error Object::emit_signal(const StringName &p_name, const Variant **p_args, int
if (ce.error == Variant::CallError::CALL_ERROR_INVALID_METHOD && !ClassDB::class_exists(target->get_class_name())) {
//most likely object is not initialized yet, do not throw error.
} else {
ERR_PRINTS("Error calling method from signal '" + String(p_name) + "': " + Variant::get_call_error_text(target, c.method, args, argc, ce) + ".");
ERR_PRINT("Error calling method from signal '" + String(p_name) + "': " + Variant::get_call_error_text(target, c.method, args, argc, ce) + ".");
err = ERR_METHOD_NOT_FOUND;
}
}
Expand Down Expand Up @@ -1945,7 +1945,7 @@ Object::~Object() {

if (_emitting) {
//@todo this may need to actually reach the debugger prioritarily somehow because it may crash before
ERR_PRINTS("Object " + to_string() + " was freed or unreferenced while a signal is being emitted from it. Try connecting to the signal using 'CONNECT_DEFERRED' flag, or use queue_free() to free the object (if this object is a Node) to avoid this error and potential crashes.");
ERR_PRINT("Object " + to_string() + " was freed or unreferenced while a signal is being emitted from it. Try connecting to the signal using 'CONNECT_DEFERRED' flag, or use queue_free() to free the object (if this object is a Node) to avoid this error and potential crashes.");
}

while ((S = signal_map.next(NULL))) {
Expand Down
4 changes: 2 additions & 2 deletions core/os/dir_access.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ Error DirAccess::copy(String p_from, String p_to, int p_chmod_flags) {
FileAccess *fsrc = FileAccess::open(p_from, FileAccess::READ, &err);

if (err) {
ERR_PRINTS("Failed to open " + p_from);
ERR_PRINT("Failed to open " + p_from);
return err;
}

Expand All @@ -294,7 +294,7 @@ Error DirAccess::copy(String p_from, String p_to, int p_chmod_flags) {

fsrc->close();
memdelete(fsrc);
ERR_PRINTS("Failed to open " + p_to);
ERR_PRINT("Failed to open " + p_to);
return err;
}

Expand Down
4 changes: 2 additions & 2 deletions core/project_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ Error ProjectSettings::_load_settings_text(const String &p_path) {
_convert_to_last_version(config_version);
return OK;
} else if (err != OK) {
ERR_PRINTS("Error parsing " + p_path + " at line " + itos(lines) + ": " + error_text + " File might be corrupted.");
ERR_PRINT("Error parsing " + p_path + " at line " + itos(lines) + ": " + error_text + " File might be corrupted.");
memdelete(f);
return err;
}
Expand Down Expand Up @@ -612,7 +612,7 @@ Error ProjectSettings::_load_settings_text_or_binary(const String &p_text_path,
return OK;
} else if (err_text != ERR_FILE_NOT_FOUND) {
// If the text-based file exists but can't be loaded, we want to know it
ERR_PRINTS("Couldn't load file '" + p_text_path + "', error code " + itos(err_text) + ".");
ERR_PRINT("Couldn't load file '" + p_text_path + "', error code " + itos(err_text) + ".");
return err_text;
}

Expand Down
2 changes: 1 addition & 1 deletion core/translation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ void TranslationServer::set_locale(const String &p_locale) {
print_verbose(vformat("Unsupported locale '%s', falling back to '%s'.", p_locale, trimmed_locale));

if (!is_locale_valid(trimmed_locale)) {
ERR_PRINTS(vformat("Unsupported locale '%s', falling back to 'en'.", trimmed_locale));
ERR_PRINT(vformat("Unsupported locale '%s', falling back to 'en'.", trimmed_locale));
locale = "en";
} else {
locale = trimmed_locale;
Expand Down
2 changes: 1 addition & 1 deletion core/type_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ struct GetTypeInfo<const T *, typename EnableIf<TypeInherits<Object, T>::value>:
template <typename T>
inline StringName __constant_get_enum_name(T param, const String &p_constant) {
if (GetTypeInfo<T>::VARIANT_TYPE == Variant::NIL)
ERR_PRINTS("Missing VARIANT_ENUM_CAST for constant's enum: " + p_constant);
ERR_PRINT("Missing VARIANT_ENUM_CAST for constant's enum: " + p_constant);
return GetTypeInfo<T>::get_class_info().class_name;
}

Expand Down
2 changes: 1 addition & 1 deletion core/undo_redo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ void UndoRedo::_process_operation_list(List<Operation>::Element *E) {
Variant::CallError ce;
obj->call(op.name, (const Variant **)argptrs.ptr(), argc, ce);
if (ce.error != Variant::CallError::CALL_OK) {
ERR_PRINTS("Error calling method from signal '" + String(op.name) + "': " + Variant::get_call_error_text(obj, op.name, (const Variant **)argptrs.ptr(), argc, ce));
ERR_PRINT("Error calling method from signal '" + String(op.name) + "': " + Variant::get_call_error_text(obj, op.name, (const Variant **)argptrs.ptr(), argc, ce));
}
#ifdef TOOLS_ENABLED
Resource *res = Object::cast_to<Resource>(obj);
Expand Down
2 changes: 1 addition & 1 deletion drivers/alsa/audio_driver_alsa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ void AudioDriverALSA::thread_func(void *p_udata) {
} else {
wrote = snd_pcm_recover(ad->pcm_handle, wrote, 0);
if (wrote < 0) {
ERR_PRINTS("ALSA: Failed and can't recover: " + String(snd_strerror(wrote)));
ERR_PRINT("ALSA: Failed and can't recover: " + String(snd_strerror(wrote)));
ad->active = false;
ad->exit_thread = true;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/alsamidi/midi_driver_alsamidi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void MIDIDriverALSAMidi::thread_func(void *p_udata) {
ret = snd_rawmidi_read(midi_in, &byte, 1);
if (ret < 0) {
if (ret != -EAGAIN) {
ERR_PRINTS("snd_rawmidi_read error: " + String(snd_strerror(ret)));
ERR_PRINT("snd_rawmidi_read error: " + String(snd_strerror(ret)));
}
} else {
if (byte & 0x80) {
Expand Down
10 changes: 5 additions & 5 deletions drivers/coreaudio/audio_driver_coreaudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ OSStatus AudioDriverCoreAudio::input_callback(void *inRefCon,
}
}
} else {
ERR_PRINTS("AudioUnitRender failed, code: " + itos(result));
ERR_PRINT("AudioUnitRender failed, code: " + itos(result));
}

ad->unlock();
Expand All @@ -253,7 +253,7 @@ void AudioDriverCoreAudio::start() {
if (!active) {
OSStatus result = AudioOutputUnitStart(audio_unit);
if (result != noErr) {
ERR_PRINTS("AudioOutputUnitStart failed, code: " + itos(result));
ERR_PRINT("AudioOutputUnitStart failed, code: " + itos(result));
} else {
active = true;
}
Expand All @@ -264,7 +264,7 @@ void AudioDriverCoreAudio::stop() {
if (active) {
OSStatus result = AudioOutputUnitStop(audio_unit);
if (result != noErr) {
ERR_PRINTS("AudioOutputUnitStop failed, code: " + itos(result));
ERR_PRINT("AudioOutputUnitStop failed, code: " + itos(result));
} else {
active = false;
}
Expand Down Expand Up @@ -491,7 +491,7 @@ Error AudioDriverCoreAudio::capture_start() {

OSStatus result = AudioOutputUnitStart(input_unit);
if (result != noErr) {
ERR_PRINTS("AudioOutputUnitStart failed, code: " + itos(result));
ERR_PRINT("AudioOutputUnitStart failed, code: " + itos(result));
}

return OK;
Expand All @@ -502,7 +502,7 @@ Error AudioDriverCoreAudio::capture_stop() {
if (input_unit) {
OSStatus result = AudioOutputUnitStop(input_unit);
if (result != noErr) {
ERR_PRINTS("AudioOutputUnitStop failed, code: " + itos(result));
ERR_PRINT("AudioOutputUnitStop failed, code: " + itos(result));
}
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/coremidi/midi_driver_coremidi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ Error MIDIDriverCoreMidi::open() {
OSStatus result = MIDIClientCreate(name, NULL, NULL, &client);
CFRelease(name);
if (result != noErr) {
ERR_PRINTS("MIDIClientCreate failed, code: " + itos(result));
ERR_PRINT("MIDIClientCreate failed, code: " + itos(result));
return ERR_CANT_OPEN;
}

result = MIDIInputPortCreate(client, CFSTR("Godot Input"), MIDIDriverCoreMidi::read, (void *)this, &port_in);
if (result != noErr) {
ERR_PRINTS("MIDIInputPortCreate failed, code: " + itos(result));
ERR_PRINT("MIDIInputPortCreate failed, code: " + itos(result));
return ERR_CANT_OPEN;
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/gles2/rasterizer_gles2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ static void GLAPIENTRY _gl_debug_print(GLenum source, GLenum type, GLuint id, GL

String output = String() + "GL ERROR: Source: " + debSource + "\tType: " + debType + "\tID: " + itos(id) + "\tSeverity: " + debSev + "\tMessage: " + message;

ERR_PRINTS(output);
ERR_PRINT(output);
}
#endif // CAN_DEBUG

Expand Down
4 changes: 2 additions & 2 deletions drivers/gles2/rasterizer_storage_gles2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ void RasterizerStorageGLES2::texture_allocate(RID p_texture, int p_width, int p_

if (p_flags & VS::TEXTURE_FLAG_USED_FOR_STREAMING) {
//not supported
ERR_PRINTS("Streaming texture for non power of 2 or has mipmaps on this hardware: " + texture->path + "'. Mipmaps and repeat disabled.");
ERR_PRINT("Streaming texture for non power of 2 or has mipmaps on this hardware: " + texture->path + "'. Mipmaps and repeat disabled.");
texture->flags &= ~(VS::TEXTURE_FLAG_REPEAT | VS::TEXTURE_FLAG_MIPMAPS);
} else {
texture->alloc_height = po2_height;
Expand Down Expand Up @@ -650,7 +650,7 @@ void RasterizerStorageGLES2::texture_set_data(RID p_texture, const Ref<Image> &p

if (texture->resize_to_po2) {
if (p_image->is_compressed()) {
ERR_PRINTS("Texture '" + texture->path + "' is required to be a power of 2 because it uses either mipmaps or repeat, so it was decompressed. This will hurt performance and memory usage.");
ERR_PRINT("Texture '" + texture->path + "' is required to be a power of 2 because it uses either mipmaps or repeat, so it was decompressed. This will hurt performance and memory usage.");
}

if (img == p_image) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/gles2/shader_gles2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ static void _display_error_with_code(const String &p_error, const Vector<const c
line++;
}

ERR_PRINTS(p_error);
ERR_PRINT(p_error);
}

static String _mkid(const String &p_id) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/gles3/rasterizer_gles3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ static void GLAPIENTRY _gl_debug_print(GLenum source, GLenum type, GLuint id, GL

String output = String() + "GL ERROR: Source: " + debSource + "\tType: " + debType + "\tID: " + itos(id) + "\tSeverity: " + debSev + "\tMessage: " + message;

ERR_PRINTS(output);
ERR_PRINT(output);
}
#endif // GLAD_ENABLED

Expand Down
Loading

0 comments on commit 5af3b4c

Please sign in to comment.