[libcroco-list] Declaration after statment



Hello,

  Two files (cr-sel-eng.c.orig and cr-lay-eng.c.orig) fail to compile with
GCC 2.95.4 due to declarations after calls to g_return_val_if_fail and the
like.  These errors probably slipped through since GCC version 3.3 silently
accepts this non-standard syntax.  An upcoming version of GCC will feature
the -Wdeclaration-after-code flag to signal this sort of error (it's in CVS,
but I'm not sure whether it made it into the recent 3.3.1 release).  I have
included a patch below to correct these two files.

Michael Culbertson

----------------------------------------

--- src/seleng/cr-sel-eng.c.origSat Aug 16 18:27:22 2003
+++ src/seleng/cr-sel-eng.cSat Aug 16 18:29:15 2003
@@ -130,15 +130,15 @@
 id_add_sel_matches_node (CRAdditionalSel *a_add_sel,
                          xmlNode *a_node)
 {
+        gboolean result = FALSE ;
+        xmlChar *id = NULL ;
+
         g_return_val_if_fail (a_add_sel
                               && a_add_sel->type == ID_ADD_SELECTOR
                               && a_add_sel->content.id_name
                               && a_add_sel->content.id_name->str
                               && a_node, FALSE) ;

-        gboolean result = FALSE ;
-        xmlChar *id = NULL ;
-
         g_return_val_if_fail (a_add_sel
                               && a_add_sel->type == ID_ADD_SELECTOR
                               && a_node, FALSE) ;
@@ -786,10 +786,10 @@
         for (cur_decl = a_stmt->kind.ruleset->decl_list ;
              cur_decl ; cur_decl = cur_decl->next)
         {
+                CRDeclaration *decl = NULL ;
+
                 if (!cur_decl->property || !cur_decl->property->str)
                         continue ;
-
-                CRDeclaration *decl = NULL ;

                 /*
                  *First, test if the property is not
--- src/layeng/cr-lay-eng.c.origSat Aug 16 18:30:24 2003
+++ src/layeng/cr-lay-eng.cSat Aug 16 18:32:45 2003
@@ -1214,12 +1214,13 @@
                   CRBox *a_cur_box)
 {
         enum CRStatus status = CR_OK ;
+        CRBox *cont_box = NULL;

         g_return_val_if_fail (a_cur_box && a_cur_box->style,
                               CR_BAD_PARAM_ERROR) ;
-       
-        CRBox *cont_box = a_cur_box->parent ;
+        cont_box = a_cur_box->parent ;

+       
         /************************************
          *We are in a block formating context
          ************************************/



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