Randy Abernethy created THRIFT-2089: ---------------------------------------
Summary: Compiler ignores duplicate typenames Key: THRIFT-2089 URL: https://issues.apache.org/jira/browse/THRIFT-2089 Project: Thrift Issue Type: Improvement Components: Compiler (General) Affects Versions: 1.0 Environment: all Reporter: Randy Abernethy Assignee: Randy Abernethy Priority: Minor Fix For: 1.0 Attachments: 0001-added-compiler-duplicate-typename-checking.patch The current IDL compiler will compile the following IDL with no warnings or errors: {code:title=test.thrift|borderStyle=solid} struct A { 1: i16 a } struct A { 1: i16 a } {code} and this (w/ thrift -r): {code:title=test2.thrift|borderStyle=solid} include "test.thrift" struct A { 1: i16 a } {code} Both of these IDLs generate un-compilable output in most languages. The attached patch adds typename collision checking to the compiler. It generates errors when a typename is declared twice in the same file or when the same typename is declared in two files causing collisions in all namespace scopes. Explicit namespace declarations with collisions in some but not all scopes are reported as warning because the user could compile for a scope that would succeed. More details in the patch comments. Built and tested on Windows with VS2012 and Unbuntu w/ gcc 4.7.2 make check ran on Unbuntu clean (though I had to switch the config.h to thrift/thrift-config.h in TFileTransportTest.cpp) -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira