Matthias Brantner has proposed merging lp:~matthias-brantner/zorba/bug-fixing 
into lp:zorba.

Requested reviews:
  Matthias Brantner (matthias-brantner)
  William Candillon (wcandillon)
Related bugs:
  Bug #867133 in Zorba: "SWIG PHP build failure on Mac OSX"
  https://bugs.launchpad.net/zorba/+bug/867133

For more details, see:
https://code.launchpad.net/~matthias-brantner/zorba/bug-fixing/+merge/83686

- Do not raise warnings for unknown annotations in unknown namespaces
- Improved error message for wrong annotations
-- 
https://code.launchpad.net/~matthias-brantner/zorba/bug-fixing/+merge/83686
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog	2011-11-23 22:25:05 +0000
+++ ChangeLog	2011-11-28 20:47:26 +0000
@@ -38,6 +38,7 @@
   * Fixed bug #3290122 (ZDST0003 needs collection name)
   * Fixed bug #3406272 (merging of adjacent text nodes must be done after all
     updates have been applied).
+  * Don't raise warnings for unknown annotations.
   * Fixed bug #3409344 (during detach, if the node being detached is the root of
     its tree, it should be detached from the tree as well; otherwise memory
     corruption will occur)

=== modified file 'doc/cxx/examples/errors.cpp'
--- doc/cxx/examples/errors.cpp	2011-08-11 05:11:12 +0000
+++ doc/cxx/examples/errors.cpp	2011-11-28 20:47:26 +0000
@@ -139,12 +139,12 @@
     // make sure that the warning zwarn::ZWST0002 is turned
     // into an error
     StaticContext_t lCtx = aZorba->createStaticContext();
-    lCtx->declareOption(lQName, "ZWST0002");
+    lCtx->declareOption(lQName, "ZWST0003");
 
     std::ostringstream s;
-    s << "declare namespace unknown = 'unknown-annotation';" << std::endl
-      << "declare %unknown:test variable $var := 3;" << std::endl
-      << "$var" << std::endl;
+    s << "declare namespace z = 'http://www.zorba-xquery.com/annotations';" << std::endl
+      << "declare %z:sequential function local:foo() { 1 };" << std::endl
+      << "local:foo()" << std::endl;
     XQuery_t lQuery = aZorba->compileQuery(s.str(), lCtx); 
 
     std::cout << lQuery << std::endl;

=== modified file 'src/compiler/translator/translator.cpp'
--- src/compiler/translator/translator.cpp	2011-11-24 10:18:51 +0000
+++ src/compiler/translator/translator.cpp	2011-11-28 20:47:26 +0000
@@ -3811,24 +3811,10 @@
     if (AnnotationInternal::lookup(lExpandedQName) == AnnotationInternal::zann_end)
     {
       RAISE_ERROR(err::XQST0045, loc,
-      ERROR_PARAMS( "%" + (lExpandedQName->getPrefix().empty() ?
-                           "\'" + lExpandedQName->getNamespace() + "\'"
-                           : lExpandedQName->getPrefix())
-                    + ":" + lExpandedQName->getLocalName()));
+      ERROR_PARAMS( "%" + ("\"" + lExpandedQName->getNamespace() + "\""
+                    + ":" + lExpandedQName->getLocalName())));
     }
   }
-  else
-  {
-    // annotation in unknown namespace -- generate a warning
-    theCCB->theXQueryDiagnostics->add_warning(
-      NEW_XQUERY_WARNING(
-        zwarn::ZWST0002_UNKNOWN_ANNOTATION,
-        WARN_PARAMS( "%" + (lExpandedQName->getPrefix().empty() ?
-                      "\'" + lExpandedQName->getNamespace() + "\'"
-                      : lExpandedQName->getPrefix())
-                      + ":" + lExpandedQName->getLocalName()),
-        WARN_LOC(loc)));
-  }
 
   std::vector<rchandle<const_expr> > lLiterals;
 

=== modified file 'test/rbkt/Queries/zorba/annotations/annot-unknown-02.spec'
--- test/rbkt/Queries/zorba/annotations/annot-unknown-02.spec	2011-07-12 23:32:16 +0000
+++ test/rbkt/Queries/zorba/annotations/annot-unknown-02.spec	2011-11-28 20:47:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.zorba-xquery.com/warnings:ZWST0002
+Error: http://www.zorba-xquery.com/warnings:ZWST0003

=== modified file 'test/rbkt/Queries/zorba/annotations/annot-unknown-02.xq'
--- test/rbkt/Queries/zorba/annotations/annot-unknown-02.xq	2011-07-12 23:32:16 +0000
+++ test/rbkt/Queries/zorba/annotations/annot-unknown-02.xq	2011-11-28 20:47:26 +0000
@@ -1,7 +1,11 @@
-declare namespace unknown = "unknown-annotation";
+declare namespace zann = "http://www.zorba-xquery.com/annotations";;
 declare namespace zwarn = "http://www.zorba-xquery.com/options/warnings";;
-declare option zwarn:error "ZWST0002";
-
-declare %unknown:test variable $var := 3;
-
-$var
+declare option zwarn:error "ZWST0003";
+
+declare %zann:sequential function local:foo()
+{
+  1
+};
+
+local:foo()
+

=== modified file 'test/rbkt/Queries/zorba/annotations/annot-unknown-04.spec'
--- test/rbkt/Queries/zorba/annotations/annot-unknown-04.spec	2011-07-12 23:32:16 +0000
+++ test/rbkt/Queries/zorba/annotations/annot-unknown-04.spec	2011-11-28 20:47:26 +0000
@@ -1,2 +1,2 @@
-Error: http://www.zorba-xquery.com/warnings:ZWST0002
+Error: http://www.zorba-xquery.com/warnings:ZWST0003
 

=== modified file 'test/rbkt/Queries/zorba/annotations/annot-unknown-04.xq'
--- test/rbkt/Queries/zorba/annotations/annot-unknown-04.xq	2011-07-12 23:32:16 +0000
+++ test/rbkt/Queries/zorba/annotations/annot-unknown-04.xq	2011-11-28 20:47:26 +0000
@@ -1,9 +1,12 @@
-declare namespace unknown = "unknown-annotation";
+declare namespace zann = "http://www.zorba-xquery.com/annotations";;
 declare namespace zwarn = "http://www.zorba-xquery.com/options/warnings";;
 declare option zwarn:enable "all";
-declare option zwarn:error "ZWST0002";
-
-declare %unknown:test variable $var := 3;
-
-$var
+declare option zwarn:error "ZWST0003";
+
+declare %zann:sequential function local:foo()
+{
+  1
+};
+
+local:foo()
 

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to