[PATCH] gbuild conversion: idlc module -- build warnings fixed

David Ostrovsky David.Ostrovsky at gmx.de
Fri Apr 13 04:51:27 PDT 2012


---
 idlc/source/parser.y        |   34 +++++++++++++++++++++++++++++-----
 idlc/source/preproc/eval.c  |   24 ++++++++++++------------
 idlc/source/wrap_parser.cxx |   32 --------------------------------
 3 files changed, 41 insertions(+), 49 deletions(-)
 delete mode 100644 idlc/source/wrap_parser.cxx

diff --git a/idlc/source/parser.y b/idlc/source/parser.y
index ec1dfc0..11f6eec 100644
--- a/idlc/source/parser.y
+++ b/idlc/source/parser.y
@@ -257,13 +257,34 @@ bool includes(AstDeclaration const * type1, AstDeclaration const * type2) {
 }
 
 // Suppress any warnings from generated code:
+// This suppression is not working after gbuild conversion
+// because parser.cxx is compiled drectly and not with wraper-stuff.
+//#if defined __GNUC__
+//#pragma GCC system_header
+//#elif defined __SUNPRO_CC
+//#pragma disable_warn
+//#elif defined _MSC_VER
+//#pragma warning(push, 1)
+//#pragma warning(disable: 4273 4701 4702 4706)
+//#endif
+
+// Suppress the warnings this way
+// borrowed from here:
+// rsc/source/parser/rscyacc.y
+#if defined _MSC_VER
+#pragma warning(push, 1)
+#pragma warning(disable:4129 4273 4701 4702)
+#endif
 #if defined __GNUC__
-#pragma GCC system_header
+#define GCC_VERSION (__GNUC__ * 10000 \
+                     + __GNUC_MINOR__ * 100 \
+                     + __GNUC_PATCHLEVEL__)
+/* Diagnostics pragma was introduced with gcc-4.2.1 */
+#if GCC_VERSION >= 40201
+#pragma GCC diagnostic ignored "-Wwrite-strings"
+#endif
 #elif defined __SUNPRO_CC
 #pragma disable_warn
-#elif defined _MSC_VER
-#pragma warning(push, 1)
-#pragma warning(disable: 4273 4701 4702 4706)
 #endif
 %}
 /*
@@ -601,7 +622,7 @@ forward_dcl :
 		{
 			pForward = new AstInterface(*$1, NULL, pScope);
 			
-			if ( pDecl = pScope->lookupByName(pForward->getScopedName()) ) 
+			if ( (pDecl = pScope->lookupByName(pForward->getScopedName())) ) 
 			{
 				if ( (pDecl != pForward) && 
 					 (pDecl->getNodeType() == NT_interface) )
@@ -3285,6 +3306,9 @@ identifier:
     ;
 
 %%
+#if defined _MSC_VER
+#pragma warning(pop)
+#endif
 
 /*
  * Report an error situation discovered in a production
diff --git a/idlc/source/preproc/eval.c b/idlc/source/preproc/eval.c
index 9a1a620..41cc2e3 100644
--- a/idlc/source/preproc/eval.c
+++ b/idlc/source/preproc/eval.c
@@ -262,7 +262,7 @@ long
 {
     Token *tp;
     Nlist *np;
-    int ntok, rand;
+    int ntok, local_rand;
 
     trp->tp++;
     if (kw == KIFDEF || kw == KIFNDEF)
@@ -283,7 +283,7 @@ long
     vp = vals;
     op = ops;
     *op++ = END;
-    for (rand = 0, tp = trp->bp + ntok; tp < trp->lp; tp++)
+    for (local_rand = 0, tp = trp->bp + ntok; tp < trp->lp; tp++)
     {
         switch (tp->type)
         {
@@ -298,17 +298,17 @@ long
             case NUMBER:
             case CCON:
             case STRING:
-                if (rand)
+                if (local_rand)
                     goto syntax;
                 *vp++ = tokval(tp);
-                rand = 1;
+                local_rand = 1;
                 continue;
 
                 /* unary */
             case DEFINED:
             case TILDE:
             case NOT:
-                if (rand)
+                if (local_rand)
                     goto syntax;
                 *op++ = tp->type;
                 continue;
@@ -318,7 +318,7 @@ long
             case MINUS:
             case STAR:
             case AND:
-                if (rand == 0)
+                if (local_rand == 0)
                 {
                     if (tp->type == MINUS)
                         *op++ = UMINUS;
@@ -349,22 +349,22 @@ long
             case QUEST:
             case COLON:
             case COMMA:
-                if (rand == 0)
+                if (local_rand == 0)
                     goto syntax;
                 if (evalop(priority[tp->type]) != 0)
                     return 0;
                 *op++ = tp->type;
-                rand = 0;
+                local_rand = 0;
                 continue;
 
             case LP:
-                if (rand)
+                if (local_rand)
                     goto syntax;
                 *op++ = LP;
                 continue;
 
             case RP:
-                if (!rand)
+                if (!local_rand)
                     goto syntax;
                 if (evalop(priority[RP]) != 0)
                     return 0;
@@ -382,7 +382,7 @@ long
                     if (np && (np->val == KMACHINE))
                     {
                         tp++;
-                        if (rand)
+                        if (local_rand)
                             goto syntax;
                         *op++ = ARCHITECTURE;
                         continue;
@@ -395,7 +395,7 @@ long
                 return 0;
         }
     }
-    if (rand == 0)
+    if (local_rand == 0)
         goto syntax;
     if (evalop(priority[END]) != 0)
         return 0;
diff --git a/idlc/source/wrap_parser.cxx b/idlc/source/wrap_parser.cxx
deleted file mode 100644
index 053713a..0000000
--- a/idlc/source/wrap_parser.cxx
+++ /dev/null
@@ -1,32 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-#include "parser.cxx"
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
-- 
1.7.5.4


--------------070709070502080101050009--


More information about the LibreOffice mailing list