Merge pull request #22710 from akien-mga/fix-warnings

Fix some OSX and iOS Clang warnings
This commit is contained in:
Rémi Verschelde 2018-10-04 12:04:54 +02:00 committed by GitHub
commit f92a29adfe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 22 deletions

View file

@ -89,8 +89,13 @@ void *Memory::alloc_static(size_t p_bytes, bool p_pad_align) {
atomic_increment(&alloc_count);
if (prepad) {
// Clang 5 wrongly complains about 's' being unused,
// while it's used to modify 'mem'.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-variable"
uint64_t *s = (uint64_t *)mem;
*s = p_bytes;
#pragma clang diagnostic pop
uint8_t *s8 = (uint8_t *)mem;

View file

@ -74,6 +74,7 @@
#include <EGL/eglext.h>
#endif
#ifndef IPHONE_ENABLED
static void GLAPIENTRY _gl_debug_print(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const GLvoid *userParam) {
if (type == _EXT_DEBUG_TYPE_OTHER_ARB)
@ -120,6 +121,7 @@ static void GLAPIENTRY _gl_debug_print(GLenum source, GLenum type, GLuint id, GL
ERR_PRINTS(output);
}
#endif // IPHONE_ENABLED
typedef void (*DEBUGPROCARB)(GLenum source,
GLenum type,

View file

@ -103,8 +103,6 @@ void ThreadPosix::wait_to_finish_func_posix(Thread *p_thread) {
Error ThreadPosix::set_name_func_posix(const String &p_name) {
pthread_t running_thread = pthread_self();
#ifdef PTHREAD_NO_RENAME
return ERR_UNAVAILABLE;
@ -117,6 +115,7 @@ Error ThreadPosix::set_name_func_posix(const String &p_name) {
#else
pthread_t running_thread = pthread_self();
#ifdef PTHREAD_BSD_SET_NAME
pthread_set_name_np(running_thread, p_name.utf8().get_data());
int err = 0; // Open/FreeBSD ignore errors in this function

View file

@ -368,11 +368,14 @@ inline NativeScriptDesc *NativeScript::get_script_desc() const {
class NativeReloadNode : public Node {
GDCLASS(NativeReloadNode, Node)
bool unloaded = false;
bool unloaded;
public:
static void _bind_methods();
void _notification(int p_what);
NativeReloadNode() :
unloaded(false) {}
};
class ResourceFormatLoaderNativeScript : public ResourceFormatLoader {

View file

@ -53,7 +53,6 @@ static GLView *_instance = NULL;
static bool video_found_error = false;
static bool video_playing = false;
static float video_previous_volume = 0.0f;
static CMTime video_current_time;
void _show_keyboard(String);
@ -248,16 +247,6 @@ static int remove_touch(UITouch *p_touch) {
return remaining;
};
static int get_first_id(UITouch *p_touch) {
for (int i = 0; i < max_touches; i++) {
if (touches[i] != NULL)
return i;
};
return -1;
};
static void clear_touches() {
for (int i = 0; i < max_touches; i++) {
@ -751,7 +740,6 @@ static void clear_touches() {
[_instance.moviePlayerController stop];
[_instance.moviePlayerController.view removeFromSuperview];
//[[MPMusicPlayerController applicationMusicPlayer] setVolume: video_previous_volume];
video_playing = false;
}
*/

View file

@ -76,11 +76,6 @@
#define NSWindowStyleMaskBorderless NSBorderlessWindowMask
#endif
static NSRect convertRectToBacking(NSRect contentRect) {
return [OS_OSX::singleton->window_view convertRectToBacking:contentRect];
}
static void get_key_modifier_state(unsigned int p_osx_state, Ref<InputEventWithModifiers> state) {
state->set_shift((p_osx_state & NSEventModifierFlagShift));
@ -271,7 +266,7 @@ static Vector2 get_mouse_pos(NSEvent *event) {
float newDisplayScale = OS_OSX::singleton->is_hidpi_allowed() ? newBackingScaleFactor : 1.0;
const NSRect contentRect = [OS_OSX::singleton->window_view frame];
const NSRect fbRect = contentRect; //convertRectToBacking(contentRect);
const NSRect fbRect = contentRect;
OS_OSX::singleton->window_size.width = fbRect.size.width * newDisplayScale;
OS_OSX::singleton->window_size.height = fbRect.size.height * newDisplayScale;
@ -292,7 +287,7 @@ static Vector2 get_mouse_pos(NSEvent *event) {
[OS_OSX::singleton->context update];
const NSRect contentRect = [OS_OSX::singleton->window_view frame];
const NSRect fbRect = contentRect; //convertRectToBacking(contentRect);
const NSRect fbRect = contentRect;
float displayScale = OS_OSX::singleton->_display_scale();
OS_OSX::singleton->window_size.width = fbRect.size.width * displayScale;