Jacek Caban : widl: Allow shadowing imported types with typedef.

Alexandre Julliard julliard at winehq.org
Tue Feb 26 13:48:15 CST 2013


Module: wine
Branch: master
Commit: ed50ce5efe04b65c0fe5648d2c8622b493b074fd
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ed50ce5efe04b65c0fe5648d2c8622b493b074fd

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Feb 26 14:52:54 2013 +0100

widl: Allow shadowing imported types with typedef.

---

 tools/widl/parser.y |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index d8435b9..b7fa2f6 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -1868,7 +1868,17 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at
       var_t *name;
 
       cur = find_type(decl->var->name, 0);
-      if (cur)
+
+      /*
+       * MIDL allows shadowing types that are declared in imported files.
+       * We don't throw an error in this case and instead add a new type
+       * (which is earlier on the list in hash table, so it will be used
+       * instead of shadowed type).
+       *
+       * FIXME: We may consider string separated type tables for each input
+       *        for cleaner solution.
+       */
+      if (cur && input_name == cur->loc_info.input_name)
           error_loc("%s: redefinition error; original definition was at %s:%d\n",
                     cur->name, cur->loc_info.input_name,
                     cur->loc_info.line_number);




More information about the wine-cvs mailing list