aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pugl/cairo_gl.h3
-rw-r--r--pugl/pugl_internal.h5
-rw-r--r--pugl/pugl_internal_types.h11
-rw-r--r--pugl/pugl_osx.m44
-rw-r--r--pugl/pugl_win.c3
-rw-r--r--pugl/pugl_x11_cairo.c4
-rw-r--r--pugl/pugl_x11_gl.c10
-rw-r--r--test/pugl_cairo_test.c2
-rw-r--r--wscript4
9 files changed, 58 insertions, 28 deletions
diff --git a/pugl/cairo_gl.h b/pugl/cairo_gl.h
index 7024ae6..467a435 100644
--- a/pugl/cairo_gl.h
+++ b/pugl/cairo_gl.h
@@ -55,6 +55,9 @@ pugl_cairo_gl_free(PuglCairoGL* ctx)
static void
pugl_cairo_gl_configure(PuglCairoGL* ctx, int width, int height)
{
+ (void)ctx;
+ (void)width;
+ (void)height;
glDisable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_RECTANGLE_ARB);
diff --git a/pugl/pugl_internal.h b/pugl/pugl_internal.h
index 6042e6a..57b026f 100644
--- a/pugl/pugl_internal.h
+++ b/pugl/pugl_internal.h
@@ -46,11 +46,8 @@ puglDefaultHints(void)
}
PuglView*
-puglInit(int* pargc, char** argv)
+puglInit(int* PUGL_UNUSED(pargc), char** PUGL_UNUSED(argv))
{
- (void)pargc;
- (void)argv;
-
PuglView* view = (PuglView*)calloc(1, sizeof(PuglView));
if (!view) {
return NULL;
diff --git a/pugl/pugl_internal_types.h b/pugl/pugl_internal_types.h
index c065902..6a1ea80 100644
--- a/pugl/pugl_internal_types.h
+++ b/pugl/pugl_internal_types.h
@@ -21,10 +21,19 @@
#ifndef PUGL_INTERNAL_TYPES_H
#define PUGL_INTERNAL_TYPES_H
+#include "pugl/pugl.h"
+
#include <stdbool.h>
#include <stdint.h>
-#include "pugl/pugl.h"
+// Unused parameter macro to suppresses warnings and make it impossible to use
+#if defined(__cplusplus) || defined(_MSC_VER)
+# define PUGL_UNUSED(name)
+#elif defined(__GNUC__)
+# define PUGL_UNUSED(name) name##_unused __attribute__((__unused__))
+#else
+# define PUGL_UNUSED(name)
+#endif
/** Platform-specific internals. */
typedef struct PuglInternalsImpl PuglInternals;
diff --git a/pugl/pugl_osx.m b/pugl/pugl_osx.m
index 2164597..3112a23 100644
--- a/pugl/pugl_osx.m
+++ b/pugl/pugl_osx.m
@@ -72,6 +72,8 @@ struct PuglInternalsImpl {
backing:(NSBackingStoreType)bufferingType
defer:(BOOL)flag
{
+ (void)flag;
+
NSWindow* result = [super initWithContentRect:contentRect
styleMask:aStyle
backing:bufferingType
@@ -217,7 +219,7 @@ struct PuglInternalsImpl {
}
static uint32_t
-getModifiers(PuglView* view, NSEvent* ev)
+getModifiers(const NSEvent* const ev)
{
const NSEventModifierFlags modifierFlags = [ev modifierFlags];
@@ -228,7 +230,7 @@ getModifiers(PuglView* view, NSEvent* ev)
}
static PuglKey
-keySymToSpecial(PuglView* view, NSEvent* ev)
+keySymToSpecial(const NSEvent* const ev)
{
NSString* chars = [ev charactersIgnoringModifiers];
if ([chars length] == 1) {
@@ -303,7 +305,7 @@ handleCrossing(PuglOpenGLView* view, NSEvent* event, const PuglEventType type)
wloc.y,
rloc.x,
[[NSScreen mainScreen] frame].size.height - rloc.y,
- getModifiers(view->puglview, event),
+ getModifiers(event),
PUGL_CROSSING_NORMAL
};
puglDispatchEvent(view->puglview, (const PuglEvent*)&ev);
@@ -331,7 +333,7 @@ handleCrossing(PuglOpenGLView* view, NSEvent* event, const PuglEventType type)
wloc.y,
rloc.x,
[[NSScreen mainScreen] frame].size.height - rloc.y,
- getModifiers(puglview, event),
+ getModifiers(event),
0,
1
};
@@ -365,7 +367,7 @@ handleCrossing(PuglOpenGLView* view, NSEvent* event, const PuglEventType type)
wloc.y,
rloc.x,
[[NSScreen mainScreen] frame].size.height - rloc.y,
- getModifiers(puglview, event),
+ getModifiers(event),
(uint32_t)[event buttonNumber] + 1
};
puglDispatchEvent(puglview, (const PuglEvent*)&ev);
@@ -383,7 +385,7 @@ handleCrossing(PuglOpenGLView* view, NSEvent* event, const PuglEventType type)
wloc.y,
rloc.x,
[[NSScreen mainScreen] frame].size.height - rloc.y,
- getModifiers(puglview, event),
+ getModifiers(event),
(uint32_t)[event buttonNumber] + 1
};
puglDispatchEvent(puglview, (const PuglEvent*)&ev);
@@ -421,7 +423,7 @@ handleCrossing(PuglOpenGLView* view, NSEvent* event, const PuglEventType type)
wloc.y,
rloc.x,
[[NSScreen mainScreen] frame].size.height - rloc.y,
- getModifiers(puglview, event),
+ getModifiers(event),
[event deltaX],
[event deltaY]
};
@@ -436,7 +438,7 @@ handleCrossing(PuglOpenGLView* view, NSEvent* event, const PuglEventType type)
const NSPoint wloc = [self eventLocation:event];
const NSPoint rloc = [NSEvent mouseLocation];
- const PuglKey spec = keySymToSpecial(puglview, event);
+ const PuglKey spec = keySymToSpecial(event);
const NSString* chars = [event charactersIgnoringModifiers];
const char* str = [[chars lowercaseString] UTF8String];
const uint32_t code = (
@@ -450,7 +452,7 @@ handleCrossing(PuglOpenGLView* view, NSEvent* event, const PuglEventType type)
wloc.y,
rloc.x,
[[NSScreen mainScreen] frame].size.height - rloc.y,
- getModifiers(puglview, event),
+ getModifiers(event),
[event keyCode],
(code != 0xFFFD) ? code : 0
};
@@ -466,7 +468,7 @@ handleCrossing(PuglOpenGLView* view, NSEvent* event, const PuglEventType type)
{
const NSPoint wloc = [self eventLocation:event];
const NSPoint rloc = [NSEvent mouseLocation];
- const PuglKey spec = keySymToSpecial(puglview, event);
+ const PuglKey spec = keySymToSpecial(event);
const NSString* chars = [event charactersIgnoringModifiers];
const char* str = [[chars lowercaseString] UTF8String];
const uint32_t code =
@@ -480,7 +482,7 @@ handleCrossing(PuglOpenGLView* view, NSEvent* event, const PuglEventType type)
wloc.y,
rloc.x,
[[NSScreen mainScreen] frame].size.height - rloc.y,
- getModifiers(puglview, event),
+ getModifiers(event),
[event keyCode],
(code != 0xFFFD) ? code : 0
};
@@ -508,6 +510,8 @@ handleCrossing(PuglOpenGLView* view, NSEvent* event, const PuglEventType type)
selectedRange:(NSRange)selected
replacementRange:(NSRange)replacement
{
+ (void)selected;
+ (void)replacement;
[markedText release];
markedText = (
[string isKindOfClass:[NSAttributedString class]]
@@ -529,17 +533,23 @@ handleCrossing(PuglOpenGLView* view, NSEvent* event, const PuglEventType type)
attributedSubstringForProposedRange:(NSRange)range
actualRange:(NSRangePointer)actual
{
+ (void)range;
+ (void)actual;
return nil;
}
- (NSUInteger) characterIndexForPoint:(NSPoint)point
{
+ (void)point;
return 0;
}
- (NSRect) firstRectForCharacterRange:(NSRange)range
actualRange:(NSRangePointer)actual
{
+ (void)range;
+ (void)actual;
+
const NSRect frame = [(id)puglview bounds];
return NSMakeRect(frame.origin.x, frame.origin.y, 0.0, 0.0);
}
@@ -547,6 +557,8 @@ handleCrossing(PuglOpenGLView* view, NSEvent* event, const PuglEventType type)
- (void) insertText:(id)string
replacementRange:(NSRange)replacement
{
+ (void)replacement;
+
NSEvent* const event = [NSApp currentEvent];
NSString* const characters =
([string isKindOfClass:[NSAttributedString class]]
@@ -575,7 +587,7 @@ handleCrossing(PuglOpenGLView* view, NSEvent* event, const PuglEventType type)
wloc.y,
rloc.x,
[[NSScreen mainScreen] frame].size.height - rloc.y,
- getModifiers(puglview, event),
+ getModifiers(event),
[event keyCode],
code,
{ 0, 0, 0, 0, 0, 0, 0, 0 } };
@@ -587,7 +599,7 @@ handleCrossing(PuglOpenGLView* view, NSEvent* event, const PuglEventType type)
- (void) flagsChanged:(NSEvent*)event
{
- const uint32_t mods = getModifiers(puglview, event);
+ const uint32_t mods = getModifiers(event);
PuglEventType type = PUGL_NOTHING;
PuglKey special = 0;
@@ -685,6 +697,8 @@ handleCrossing(PuglOpenGLView* view, NSEvent* event, const PuglEventType type)
- (BOOL) windowShouldClose:(id)sender
{
+ (void)sender;
+
PuglEvent ev = { 0 };
ev.type = PUGL_CLOSE;
puglDispatchEvent(window->puglview, &ev);
@@ -693,6 +707,8 @@ handleCrossing(PuglOpenGLView* view, NSEvent* event, const PuglEventType type)
- (void) windowDidBecomeKey:(NSNotification*)notification
{
+ (void)notification;
+
PuglOpenGLView* glview = window->puglview->impl->glview;
if (window->puglview->impl->glview->urgentTimer) {
[glview->urgentTimer invalidate];
@@ -707,6 +723,8 @@ handleCrossing(PuglOpenGLView* view, NSEvent* event, const PuglEventType type)
- (void) windowDidResignKey:(NSNotification*)notification
{
+ (void)notification;
+
PuglEvent ev = { 0 };
ev.type = PUGL_FOCUS_OUT;
ev.focus.grab = false;
diff --git a/pugl/pugl_win.c b/pugl/pugl_win.c
index b691295..e47916c 100644
--- a/pugl/pugl_win.c
+++ b/pugl/pugl_win.c
@@ -856,9 +856,8 @@ puglRequestAttention(PuglView* view)
}
PuglStatus
-puglWaitForEvent(PuglView* view)
+puglWaitForEvent(PuglView* PUGL_UNUSED(view))
{
- (void)view;
WaitMessage();
return PUGL_SUCCESS;
}
diff --git a/pugl/pugl_x11_cairo.c b/pugl/pugl_x11_cairo.c
index c62621e..53304d8 100644
--- a/pugl/pugl_x11_cairo.c
+++ b/pugl/pugl_x11_cairo.c
@@ -89,13 +89,13 @@ puglX11CairoDestroy(PuglView* view)
}
static int
-puglX11CairoEnter(PuglView* view)
+puglX11CairoEnter(PuglView* PUGL_UNUSED(view))
{
return 0;
}
static int
-puglX11CairoLeave(PuglView* view, bool flush)
+puglX11CairoLeave(PuglView* PUGL_UNUSED(view), bool PUGL_UNUSED(flush))
{
return 0;
}
diff --git a/pugl/pugl_x11_gl.c b/pugl/pugl_x11_gl.c
index 0102f4c..06b4b2e 100644
--- a/pugl/pugl_x11_gl.c
+++ b/pugl/pugl_x11_gl.c
@@ -174,18 +174,16 @@ puglX11GlLeave(PuglView* view, bool flush)
}
static int
-puglX11GlResize(PuglView* view, int width, int height)
+puglX11GlResize(PuglView* PUGL_UNUSED(view),
+ int PUGL_UNUSED(width),
+ int PUGL_UNUSED(height))
{
- (void)view;
- (void)width;
- (void)height;
return 0;
}
static void*
-puglX11GlGetHandle(PuglView* view)
+puglX11GlGetHandle(PuglView* PUGL_UNUSED(view))
{
- (void)view;
return NULL;
}
diff --git a/test/pugl_cairo_test.c b/test/pugl_cairo_test.c
index ad68f3f..d749485 100644
--- a/test/pugl_cairo_test.c
+++ b/test/pugl_cairo_test.c
@@ -94,6 +94,7 @@ buttonDraw(cairo_t* cr, const Button* but)
static bool
buttonTouches(const Button* but, double x, double y)
{
+ (void)but;
return (x >= toggle_button.x && x <= toggle_button.x + toggle_button.w &&
y >= toggle_button.y && y <= toggle_button.y + toggle_button.h);
}
@@ -121,6 +122,7 @@ onDisplay(PuglView* view)
static void
onClose(PuglView* view)
{
+ (void)view;
quit = 1;
}
diff --git a/wscript b/wscript
index 99c2fad..d0697c2 100644
--- a/wscript
+++ b/wscript
@@ -45,6 +45,10 @@ def configure(conf):
elif conf.env.TARGET_PLATFORM == 'darwin':
conf.env.append_unique('CFLAGS', ['-Wno-deprecated-declarations'])
+ if Options.options.strict and not conf.env.MSVC_COMPILER:
+ conf.env.append_value('CFLAGS', ['-Wunused-parameter'])
+ conf.env.append_value('CXXFLAGS', ['-Wunused-parameter'])
+
autowaf.set_c_lang(conf, 'c99')
if not Options.options.no_gl: