From e09f204aca2393ba0f78867eb2e284ab00091205 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 13 Mar 2020 13:05:47 +0100 Subject: Strengthen warnings --- examples/pugl_embed_demo.c | 2 -- examples/pugl_gl3_demo.c | 2 -- examples/pugl_window_demo.c | 2 -- pugl/detail/implementation.c | 14 ++++++++------ pugl/detail/x11.c | 8 ++++---- wscript | 9 +++++---- 6 files changed, 17 insertions(+), 20 deletions(-) diff --git a/examples/pugl_embed_demo.c b/examples/pugl_embed_demo.c index 96df463..dc80b18 100644 --- a/examples/pugl_embed_demo.c +++ b/examples/pugl_embed_demo.c @@ -18,8 +18,6 @@ @file pugl_embed_demo.c An example of embedding a view in another. */ -#define GL_SILENCE_DEPRECATION 1 - #include "cube_view.h" #include "demo_utils.h" #include "test/test_utils.h" diff --git a/examples/pugl_gl3_demo.c b/examples/pugl_gl3_demo.c index a18c902..ec36d16 100644 --- a/examples/pugl_gl3_demo.c +++ b/examples/pugl_gl3_demo.c @@ -34,8 +34,6 @@ about 100000 rectangles. */ -#define GL_SILENCE_DEPRECATION 1 - #include "demo_utils.h" #include "shader_utils.h" #include "test/test_utils.h" diff --git a/examples/pugl_window_demo.c b/examples/pugl_window_demo.c index 49ceee0..18def43 100644 --- a/examples/pugl_window_demo.c +++ b/examples/pugl_window_demo.c @@ -18,8 +18,6 @@ @file pugl_windows_demo.c A demonstration of multiple Pugl windows. */ -#define GL_SILENCE_DEPRECATION 1 - #include "cube_view.h" #include "demo_utils.h" #include "test/test_utils.h" diff --git a/pugl/detail/implementation.c b/pugl/detail/implementation.c index 6433faa..7764bbd 100644 --- a/pugl/detail/implementation.c +++ b/pugl/detail/implementation.c @@ -290,22 +290,24 @@ puglDecodeUTF8(const uint8_t* buf) return 0xFFFD; } else if (buf[0] < 0xE0) { FAIL_IF((buf[1] & 0xC0u) != 0x80); - return (buf[0] << 6u) + buf[1] - 0x3080u; + return ((uint32_t)buf[0] << 6u) + buf[1] - 0x3080u; } else if (buf[0] < 0xF0) { FAIL_IF((buf[1] & 0xC0u) != 0x80); FAIL_IF(buf[0] == 0xE0 && buf[1] < 0xA0); FAIL_IF((buf[2] & 0xC0u) != 0x80); - return (buf[0] << 12u) + (buf[1] << 6u) + buf[2] - 0xE2080u; + return ((uint32_t)buf[0] << 12u) + // + ((uint32_t)buf[1] << 6u) + // + ((uint32_t)buf[2] - 0xE2080u); } else if (buf[0] < 0xF5) { FAIL_IF((buf[1] & 0xC0u) != 0x80); FAIL_IF(buf[0] == 0xF0 && buf[1] < 0x90); FAIL_IF(buf[0] == 0xF4 && buf[1] >= 0x90); FAIL_IF((buf[2] & 0xC0u) != 0x80u); FAIL_IF((buf[3] & 0xC0u) != 0x80u); - return ((buf[0] << 18u) + // - (buf[1] << 12u) + // - (buf[2] << 6u) + // - (buf[3] - 0x3C82080u)); + return (((uint32_t)buf[0] << 18u) + // + ((uint32_t)buf[1] << 12u) + // + ((uint32_t)buf[2] << 6u) + // + ((uint32_t)buf[3] - 0x3C82080u)); } return 0xFFFD; } diff --git a/pugl/detail/x11.c b/pugl/detail/x11.c index ae00f73..25693a2 100644 --- a/pugl/detail/x11.c +++ b/pugl/detail/x11.c @@ -432,8 +432,8 @@ translateEvent(PuglView* view, XEvent xevent) } } else if (xevent.xclient.message_type == atoms->PUGL_CLIENT_MSG) { event.type = PUGL_CLIENT; - event.client.data1 = xevent.xclient.data.l[0]; - event.client.data2 = xevent.xclient.data.l[1]; + event.client.data1 = (uintptr_t)xevent.xclient.data.l[0]; + event.client.data2 = (uintptr_t)xevent.xclient.data.l[1]; } break; case VisibilityNotify: @@ -626,8 +626,8 @@ puglEventToX(PuglView* view, const PuglEvent* event) xev.xclient.window = view->impl->win; xev.xclient.message_type = view->world->impl->atoms.PUGL_CLIENT_MSG; xev.xclient.format = 32; - xev.xclient.data.l[0] = event->client.data1; - xev.xclient.data.l[1] = event->client.data2; + xev.xclient.data.l[0] = (long)event->client.data1; + xev.xclient.data.l[1] = (long)event->client.data2; break; default: diff --git a/wscript b/wscript index 510b260..a80492d 100644 --- a/wscript +++ b/wscript @@ -62,6 +62,10 @@ def configure(conf): conf.env.append_value('CFLAGS', ['-Wunused-parameter', '-Wno-pedantic']) + if conf.env.TARGET_PLATFORM == 'darwin': + conf.env.append_unique('CFLAGS', ['-DGL_SILENCE_DEPRECATION']) + conf.env.append_unique('CXXFLAGS', ['-DGL_SILENCE_DEPRECATION']) + if Options.options.ultra_strict and 'clang' in conf.env.CC: for var in ['CFLAGS', 'CXXFLAGS']: flags = conf.env[var] @@ -69,16 +73,12 @@ def configure(conf): conf.env.append_value(var, [ '-Weverything', '-Wno-bad-function-cast', - '-Wno-documentation', # Cairo - '-Wno-documentation-unknown-command', # Cairo '-Wno-double-promotion', '-Wno-float-equal', '-Wno-format-nonliteral', '-Wno-padded', '-Wno-reserved-id-macro', - '-Wno-sign-conversion', '-Wno-switch-enum', - '-Wno-unused-macros', # GL_SILENCE_DEPRECATION ]) conf.env.append_value('CXXFLAGS', ['-Wno-c++98-compat', @@ -123,6 +123,7 @@ def configure(conf): autowaf.check_pkg(conf, 'cairo', uselib_store = 'CAIRO', atleast_version = '1.0.0', + system = True, mandatory = False) if Options.options.log: -- cgit v1.2.1