Permalink
Browse files

Compile with -Wextra gcc switch

... and fix all warnings reported by it.  Inspired by patch by Nedko Arnaudov.
  • Loading branch information...
1 parent 330e071 commit 055de11ccf7ebbfce663569b23b216684b135491 @pavouk committed Jan 10, 2012
Showing with 7 additions and 3 deletions.
  1. +1 −1 lgi/Makefile
  2. +3 −2 lgi/buffer.c
  3. +1 −0 lgi/callable.c
  4. +2 −0 lgi/marshal.c
View
2 lgi/Makefile
@@ -24,7 +24,7 @@ endif
OBJS = buffer.o callable.o core.o gi.o marshal.o object.o record.o
-COPTFLAGS = -Wall -O2 -g
+COPTFLAGS = -Wall -Wextra -O2 -g
CFLAGS = $(CCSHARED) $(COPTFLAGS) $(LUA_CFLAGS) $(shell pkg-config --cflags $(GINAME))
LIBS += $(shell pkg-config --libs $(GINAME))
LDFLAGS = $(LIBFLAG)
View
5 lgi/buffer.c
@@ -33,7 +33,7 @@ buffer_index (lua_State *L)
int index;
unsigned char *buffer = luaL_checkudata (L, 1, LGI_BYTES_BUFFER);
index = lua_tonumber (L, 2);
- if (index > 0 && index <= lua_objlen (L, 1))
+ if (index > 0 && (size_t) index <= lua_objlen (L, 1))
lua_pushnumber (L, buffer[index - 1]);
else
{
@@ -49,7 +49,8 @@ buffer_newindex (lua_State *L)
int index;
unsigned char *buffer = luaL_checkudata (L, 1, LGI_BYTES_BUFFER);
index = luaL_checkint (L, 2);
- luaL_argcheck (L, index > 0 && index <= lua_objlen (L, 1), 2, "bad index");
+ luaL_argcheck (L, index > 0 && (size_t) index <= lua_objlen (L, 1),
+ 2, "bad index");
buffer[index - 1] = luaL_checkint (L, 3) & 0xff;
return 0;
}
View
1 lgi/callable.c
@@ -728,6 +728,7 @@ closure_callback (ffi_cif *cif, void *ret, void **args, void *closure_arg)
gint res = 0, npos, i, stacktop;
gboolean call;
Param *param;
+ (void)cif;
/* Get access to proper Lua context. */
lua_State *L = callback_prepare_call (&block->callback, closure->target_ref,
View
2 lgi/marshal.c
@@ -38,6 +38,7 @@ static void
marshal_2c_int (lua_State *L, GITypeTag tag, GIArgument *val, int narg,
gboolean optional, gboolean use_pointer)
{
+ (void) optional;
switch (tag)
{
#define HANDLE_INT(nameup, namelow, ptrconv, pct, val_min, val_max) \
@@ -1429,6 +1430,7 @@ marshal_fundamental (lua_State *L)
static void
gclosure_destroy (gpointer user_data, GClosure *closure)
{
+ (void) closure;
lgi_closure_destroy (user_data);
}

0 comments on commit 055de11

Please sign in to comment.