gjs r105 - in trunk: . gi gjs



Author: otaylor
Date: Thu Nov 13 21:45:57 2008
New Revision: 105
URL: http://svn.gnome.org/viewvc/gjs?rev=105&view=rev

Log:
Bug 560670 â Turn on compilation warnings

configure.ac: Add -Wall and selected other warnings

gjs/importer.c: Pass the right value to finish_import()
gjs/jsapi-util.c: Reorder includes so that __GJS_UTIL_LOG_H__
 gets defined before jsapi-util.h is included.

gi/function.c: Initialize a variable to quiet GCC
gi/arg.c: Remove unused variables, fix missing case labels and
 return value in gjs_g_arg_release_in_arg()

Modified:
   trunk/configure.ac
   trunk/gi/arg.c
   trunk/gi/function.c
   trunk/gjs/importer.c
   trunk/gjs/jsapi-util.c

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Thu Nov 13 21:45:57 2008
@@ -24,6 +24,30 @@
 AC_PROG_LIBTOOL
 dnl DOLT
 
+# Add extra warning flags
+changequote(,)dnl
+ensureflag() {
+  flag="$1"; shift
+  result="$@"
+
+  case " ${result} " in
+  *[\ \	]${flag}[\ \	]*) ;;
+  *) result="${flag} ${result}" ;;
+  esac
+
+  echo ${result}
+}
+changequote([,])dnl
+
+if test "$GCC" = "yes"; then
+    for flag in -Wall -Wchar-subscripts -Wmissing-declarations \
+        -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wcast-align \
+        -Wsign-compare  -Wfloat-equal;
+    do
+        CFLAGS="`ensureflag $flag $CFLAGS`"
+    done
+fi
+
 # coverage
 AC_ARG_ENABLE([coverage],
               [AS_HELP_STRING([--enable-coverage],

Modified: trunk/gi/arg.c
==============================================================================
--- trunk/gi/arg.c	(original)
+++ trunk/gi/arg.c	Thu Nov 13 21:45:57 2008
@@ -212,8 +212,6 @@
                    GITypeInfo  *param_info,
                    void       **arr_p)
 {
-    guint32 i;
-    jsval elem;
     GITypeTag element_type;
 
     element_type = g_type_info_get_tag(param_info);
@@ -1126,7 +1124,7 @@
 
     /* we don't own the argument anymore */
     if (transfer == GI_TRANSFER_EVERYTHING)
-        return;
+        return JS_TRUE;
 
     type_tag = g_type_info_get_tag( (GITypeInfo*) type_info);
 
@@ -1143,8 +1141,10 @@
     case GI_TYPE_TAG_ARRAY:
         return gjs_g_arg_release_internal(context, GI_TRANSFER_EVERYTHING,
                                           type_info, type_tag, arg);
+    default:
+        return JS_TRUE;
     }
-
-    return JS_TRUE;
 }
 
+
+

Modified: trunk/gi/function.c
==============================================================================
--- trunk/gi/function.c	(original)
+++ trunk/gi/function.c	Thu Nov 13 21:45:57 2008
@@ -261,6 +261,7 @@
     if (return_tag != GI_TYPE_TAG_VOID)
         n_return_values += 1;
 
+    return_values = NULL; /* Quiet gcc warning about initialization */
     if (n_return_values > 0) {
         if (invoke_ok) {
             return_values = g_newa(jsval, n_return_values);

Modified: trunk/gjs/importer.c
==============================================================================
--- trunk/gjs/importer.c	(original)
+++ trunk/gjs/importer.c	Thu Nov 13 21:45:57 2008
@@ -315,7 +315,7 @@
 
     g_free(script);
 
-    if (!finish_import(context, obj))
+    if (!finish_import(context, name))
         goto out;
 
     retval = JS_TRUE;

Modified: trunk/gjs/jsapi-util.c
==============================================================================
--- trunk/gjs/jsapi-util.c	(original)
+++ trunk/gjs/jsapi-util.c	Thu Nov 13 21:45:57 2008
@@ -23,12 +23,12 @@
 
 #include <config.h>
 
-#include "jsapi-util.h"
-#include "context-jsapi.h"
-
 #include <util/log.h>
 #include <util/glib.h>
 
+#include "jsapi-util.h"
+#include "context-jsapi.h"
+
 #include <string.h>
 
 typedef struct {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]