mirror of https://github.com/swig/swig
Reword and simplify warnings 302 and 322
The declaration is not displayed in the warning if it is the same as the identifier.
This commit is contained in:
parent
454c3bc52d
commit
52ede59cdf
|
@ -2527,8 +2527,9 @@ for the above example you'll get:
|
|||
</p>
|
||||
|
||||
<div class="code"><pre>
|
||||
foo.i:5: Warning 302: Identifier 'Foo' redefined (ignored),
|
||||
foo.i:5: Warning 302: Redefinition of identifier 'Foo' as Foo(void) ignored,
|
||||
foo.i:1: Warning 302: previous definition of 'Foo'.
|
||||
|
||||
</pre></div>
|
||||
|
||||
<p>
|
||||
|
|
|
@ -392,7 +392,7 @@ example.i(4) : Syntax error in input(1).
|
|||
|
||||
<ul>
|
||||
<li>301. <tt>class</tt> keyword used, but not in C++ mode.
|
||||
<li>302. Identifier '<em>name</em>' redefined (ignored).
|
||||
<li>302. Redefinition of identifier '<em>name</em>' as <em>decl</em> ignored.
|
||||
<li>303. <tt>%extend</tt> defined for an undeclared class '<em>name</em>'.
|
||||
<li>305. Bad constant value (ignored).
|
||||
<li>306. '<em>identifier</em>' is private in this context.
|
||||
|
@ -409,7 +409,7 @@ example.i(4) : Syntax error in input(1).
|
|||
<li>319. No access specifier given for base class <em>name</em> (ignored).
|
||||
<li>320. Explicit template instantiation ignored.
|
||||
<li>321. <em>identifier</em> conflicts with a built-in name.
|
||||
<li>322. Redundant redeclaration of '<em>name</em>'.
|
||||
<li>322. Redundant redeclaration of identifier '<em>name</em>' as <em>decl</em> ignored.
|
||||
<li>323. Recursive scope inheritance of '<em>name</em>'.
|
||||
<li>324. Named nested template instantiations not supported. Processing as if no name was given to %template().
|
||||
<li>325. Nested <em>kind</em> not currently supported (<em>name</em> ignored).
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
c_redefine.i:4: Warning 302: Redefinition of identifier 'foo' (ignored) as foo,
|
||||
c_redefine.i:4: Warning 302: Redefinition of identifier 'foo' ignored,
|
||||
c_redefine.i:3: Warning 302: previous definition of 'foo' as foo(int,int).
|
||||
c_redefine.i:8: Warning 302: Redefinition of identifier 'bar' (ignored) as bar,
|
||||
c_redefine.i:8: Warning 302: Redefinition of identifier 'bar' ignored,
|
||||
c_redefine.i:6: Warning 302: previous definition of 'bar' as bar(int).
|
||||
c_redefine.i:14: Warning 322: Redundant redeclaration of identifier 'bar' as spam(int) (Renamed from 'spam'),
|
||||
c_redefine.i:14: Warning 322: Redundant redeclaration of identifier 'bar' (Renamed from 'spam') as spam(int) ignored,
|
||||
c_redefine.i:6: Warning 322: previous declaration of 'bar' as bar(int).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
c_redefine_typedef.i:10: Warning 302: Redefinition of identifier 'MyStruct' (ignored) as MyStruct,
|
||||
c_redefine_typedef.i:7: Warning 302: previous definition of 'MyStruct' as MyStruct.
|
||||
c_redefine_typedef.i:15: Warning 322: Redundant redeclaration of identifier 'Int' as Int,
|
||||
c_redefine_typedef.i:14: Warning 322: previous declaration of 'Int' as Int.
|
||||
c_redefine_typedef.i:10: Warning 302: Redefinition of identifier 'MyStruct' ignored,
|
||||
c_redefine_typedef.i:7: Warning 302: previous definition of 'MyStruct'.
|
||||
c_redefine_typedef.i:15: Warning 322: Redundant redeclaration of identifier 'Int' ignored,
|
||||
c_redefine_typedef.i:14: Warning 322: previous declaration of 'Int'.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
cpp_class_definition.i:11: Warning 302: Redefinition of identifier 'L' (ignored) as Space11::SubSpace11::L,
|
||||
cpp_class_definition.i:11: Warning 302: Redefinition of identifier 'L' as Space11::SubSpace11::L ignored,
|
||||
cpp_class_definition.i:10: Warning 302: previous definition of 'L' as Space11::SubSpace11::L.
|
||||
cpp_class_definition.i:22: Error: 'Space1::A' resolves to 'Space1::A' and was incorrectly instantiated in scope 'Space2' instead of within scope 'Space1'.
|
||||
cpp_class_definition.i:31: Error: Using the unary scope operator :: in class definition '::Space2::B' is invalid.
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
cpp_extend_destructors.i:8: Warning 302: Identifier '~AStruct' redefined by %extend (ignored),
|
||||
cpp_extend_destructors.i:5: Warning 302: %extend definition of '~AStruct'.
|
||||
cpp_extend_destructors.i:14: Warning 302: Redefinition of identifier '~BStruct' (ignored) as BStruct::~BStruct(),
|
||||
cpp_extend_destructors.i:14: Warning 302: Redefinition of identifier '~BStruct' as BStruct::~BStruct() ignored,
|
||||
cpp_extend_destructors.i:13: Warning 302: previous definition of '~BStruct' as BStruct::~BStruct().
|
||||
cpp_extend_destructors.i:87: Warning 302: Redefinition of identifier '~JStruct' (ignored) as JStruct::~JStruct(),
|
||||
cpp_extend_destructors.i:87: Warning 302: Redefinition of identifier '~JStruct' as JStruct::~JStruct() ignored,
|
||||
cpp_extend_destructors.i:85: Warning 302: previous definition of '~JStruct' as JStruct::~JStruct().
|
||||
cpp_extend_destructors.i:100: Warning 302: Redefinition of identifier '~LStruct' (ignored) as LStruct::~LStruct(),
|
||||
cpp_extend_destructors.i:100: Warning 302: Redefinition of identifier '~LStruct' as LStruct::~LStruct() ignored,
|
||||
cpp_extend_destructors.i:98: Warning 302: previous definition of '~LStruct' as LStruct::~LStruct().
|
||||
cpp_extend_destructors.i:24: Warning 521: Illegal destructor name CStruct::~NOT_CStruct(). Ignored.
|
||||
cpp_extend_destructors.i:30: Warning 521: Illegal destructor name DStruct::~NOT_DStruct(). Ignored.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
cpp_extend_redefine.i:9: Warning 302: Identifier 'bar' redefined by %extend (ignored),
|
||||
cpp_extend_redefine.i:5: Warning 302: %extend definition of 'bar'.
|
||||
cpp_extend_redefine.i:14: Warning 322: Redundant redeclaration of identifier 'spam' as foo::spam(),
|
||||
cpp_extend_redefine.i:14: Warning 322: Redundant redeclaration of identifier 'spam' as foo::spam() ignored,
|
||||
cpp_extend_redefine.i:10: Warning 322: previous declaration of 'spam' as foo::spam().
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
%module xxx
|
||||
|
||||
namespace Space {
|
||||
struct MyStruct {
|
||||
int b;
|
||||
};
|
||||
}
|
||||
|
||||
namespace Space {
|
||||
struct MyStruct {
|
||||
int b;
|
||||
};
|
||||
}
|
||||
|
||||
namespace Space {
|
||||
class MyClass {
|
||||
public:
|
||||
int a;
|
||||
};
|
||||
}
|
||||
|
||||
class Space::MyClass {
|
||||
public:
|
||||
int a;
|
||||
};
|
||||
|
||||
namespace Space {
|
||||
template<typename T>
|
||||
class MyTemplateClass {
|
||||
public:
|
||||
int a;
|
||||
};
|
||||
template<typename T>
|
||||
class MyTemplateClass {
|
||||
public:
|
||||
int a;
|
||||
};
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
cpp_redefine_class.i:10: Warning 302: Redefinition of identifier 'MyStruct' as Space::MyStruct ignored,
|
||||
cpp_redefine_class.i:4: Warning 302: previous definition of 'MyStruct' as Space::MyStruct.
|
||||
cpp_redefine_class.i:22: Warning 302: Redefinition of identifier 'MyClass' as Space::MyClass ignored,
|
||||
cpp_redefine_class.i:16: Warning 302: previous definition of 'MyClass' as Space::MyClass.
|
||||
cpp_redefine_class.i:34: Warning 302: Redefinition of identifier 'MyTemplateClass' as Space::MyTemplateClass ignored,
|
||||
cpp_redefine_class.i:29: Warning 302: previous definition of 'MyTemplateClass' as Space::MyTemplateClass.
|
||||
cpp_redefine_class.i:34: Warning 302: Redefinition of identifier 'MyTemplateClass' as Space::MyTemplateClass ignored,
|
||||
cpp_redefine_class.i:29: Warning 302: previous definition of 'MyTemplateClass' as Space::MyTemplateClass.
|
|
@ -1,14 +1,14 @@
|
|||
cpp_template_duplicate_names.i:14: Warning 302: Redefinition of identifier 'Duplicate1' (ignored) as Space::Duplicate1,
|
||||
cpp_template_duplicate_names.i:14: Warning 302: Redefinition of identifier 'Duplicate1' as Space::Duplicate1 ignored,
|
||||
cpp_template_duplicate_names.i:13: Warning 302: previous definition of 'Duplicate1' as Space::Duplicate1.
|
||||
cpp_template_duplicate_names.i:14: Warning 302: Redefinition of identifier 'Duplicate1' (ignored) as Space::Duplicate1,
|
||||
cpp_template_duplicate_names.i:14: Warning 302: Redefinition of identifier 'Duplicate1' as Space::Duplicate1 ignored,
|
||||
cpp_template_duplicate_names.i:13: Warning 302: previous definition of 'Duplicate1' as Space::Duplicate1.
|
||||
cpp_template_duplicate_names.i:25: Warning 404: Duplicate template instantiation of 'Duplicate2< 0 >' with name 'Duplicate2_0' ignored,
|
||||
cpp_template_duplicate_names.i:24: Warning 404: previous instantiation of 'Duplicate2< 0 >' with name 'Duplicate2_0'.
|
||||
cpp_template_duplicate_names.i:35: Warning 404: Duplicate template instantiation of 'Duplicate3< 0 >' with name 'Duplicate3' ignored,
|
||||
cpp_template_duplicate_names.i:34: Warning 404: previous instantiation of 'Duplicate3< 0 >' with name 'Duplicate3'.
|
||||
cpp_template_duplicate_names.i:47: Warning 302: Redefinition of identifier 'Duplicate4' (ignored) as Space::Duplicate4,
|
||||
cpp_template_duplicate_names.i:47: Warning 302: Redefinition of identifier 'Duplicate4' as Space::Duplicate4 ignored,
|
||||
cpp_template_duplicate_names.i:46: Warning 302: previous definition of 'Duplicate4' as Space::Duplicate4.
|
||||
cpp_template_duplicate_names.i:47: Warning 302: Redefinition of identifier 'Duplicate4' (ignored) as Space::Duplicate4,
|
||||
cpp_template_duplicate_names.i:47: Warning 302: Redefinition of identifier 'Duplicate4' as Space::Duplicate4 ignored,
|
||||
cpp_template_duplicate_names.i:46: Warning 302: previous definition of 'Duplicate4' as Space::Duplicate4.
|
||||
cpp_template_duplicate_names.i:50: Warning 404: Duplicate template instantiation of 'Duplicate4< 0 >' with name 'Duplicate4' ignored,
|
||||
cpp_template_duplicate_names.i:49: Warning 404: previous instantiation of 'Duplicate4< 0 >' with name 'Duplicate4'.
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
cpp_template_friend.i:4: Warning 302: Redefinition of identifier 'template_friend1' (ignored) as template_friend1,
|
||||
cpp_template_friend.i:3: Warning 302: previous definition of 'template_friend1' as template_friend1.
|
||||
cpp_template_friend.i:13: Warning 302: Redefinition of identifier 'template_friend2' (ignored) as template_friend2,
|
||||
cpp_template_friend.i:9: Warning 302: previous definition of 'template_friend2' as template_friend2.
|
||||
cpp_template_friend.i:17: Warning 322: Redundant redeclaration of identifier 'normal_friend1' as normal_friend1(int),
|
||||
cpp_template_friend.i:4: Warning 302: Redefinition of identifier 'template_friend1' ignored,
|
||||
cpp_template_friend.i:3: Warning 302: previous definition of 'template_friend1'.
|
||||
cpp_template_friend.i:13: Warning 302: Redefinition of identifier 'template_friend2' ignored,
|
||||
cpp_template_friend.i:9: Warning 302: previous definition of 'template_friend2'.
|
||||
cpp_template_friend.i:17: Warning 322: Redundant redeclaration of identifier 'normal_friend1' as normal_friend1(int) ignored,
|
||||
cpp_template_friend.i:16: Warning 322: previous declaration of 'normal_friend1' as normal_friend1(int).
|
||||
cpp_template_friend.i:26: Warning 322: Redundant redeclaration of identifier 'normal_friend2' as normal_friend2(int),
|
||||
cpp_template_friend.i:26: Warning 322: Redundant redeclaration of identifier 'normal_friend2' as normal_friend2(int) ignored,
|
||||
cpp_template_friend.i:22: Warning 322: previous declaration of 'normal_friend2' as normal_friend2(int).
|
||||
|
|
|
@ -4,27 +4,27 @@ cpp_template_redefine.i:50: Warning 344: Unable to deduce decltype for '*std::de
|
|||
cpp_template_redefine.i:56: Warning 344: Unable to deduce decltype for '&T::to_json'.
|
||||
cpp_template_redefine.i:59: Warning 344: Unable to deduce decltype for 'std::declval<M>().begin()->first'.
|
||||
cpp_template_redefine.i:63: Warning 344: Unable to deduce decltype for '*std::declval<V>().begin()'.
|
||||
cpp_template_redefine.i:101: Warning 322: Redundant redeclaration of identifier 'Json' as Json::Json(Converter const &),
|
||||
cpp_template_redefine.i:101: Warning 322: Redundant redeclaration of identifier 'Json' as Json::Json(Converter const &) ignored,
|
||||
cpp_template_redefine.i:101: Warning 322: previous declaration of 'Json' as Json::Json(Converter const &).
|
||||
cpp_template_redefine.i:101: Warning 322: Redundant redeclaration of identifier 'Json' as Json::Json(Converter const &),
|
||||
cpp_template_redefine.i:101: Warning 322: Redundant redeclaration of identifier 'Json' as Json::Json(Converter const &) ignored,
|
||||
cpp_template_redefine.i:101: Warning 322: previous declaration of 'Json' as Json::Json(Converter const &).
|
||||
cpp_template_redefine.i:102: Warning 322: Redundant redeclaration of identifier 'Json' as Json::Json(std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > const &),
|
||||
cpp_template_redefine.i:102: Warning 322: Redundant redeclaration of identifier 'Json' as Json::Json(std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > const &) ignored,
|
||||
cpp_template_redefine.i:102: Warning 322: previous declaration of 'Json' as Json::Json(std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > const &).
|
||||
cpp_template_redefine.i:102: Warning 322: Redundant redeclaration of identifier 'Json' as Json::Json(std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > const &),
|
||||
cpp_template_redefine.i:102: Warning 322: Redundant redeclaration of identifier 'Json' as Json::Json(std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > const &) ignored,
|
||||
cpp_template_redefine.i:102: Warning 322: previous declaration of 'Json' as Json::Json(std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > const &).
|
||||
cpp_template_redefine.i:103: Warning 322: Redundant redeclaration of identifier 'Json' as Json::Json(std::vector< std::string,std::allocator< std::string > > const &),
|
||||
cpp_template_redefine.i:103: Warning 322: Redundant redeclaration of identifier 'Json' as Json::Json(std::vector< std::string,std::allocator< std::string > > const &) ignored,
|
||||
cpp_template_redefine.i:103: Warning 322: previous declaration of 'Json' as Json::Json(std::vector< std::string,std::allocator< std::string > > const &).
|
||||
cpp_template_redefine.i:103: Warning 322: Redundant redeclaration of identifier 'Json' as Json::Json(std::vector< std::string,std::allocator< std::string > > const &),
|
||||
cpp_template_redefine.i:103: Warning 322: Redundant redeclaration of identifier 'Json' as Json::Json(std::vector< std::string,std::allocator< std::string > > const &) ignored,
|
||||
cpp_template_redefine.i:103: Warning 322: previous declaration of 'Json' as Json::Json(std::vector< std::string,std::allocator< std::string > > const &).
|
||||
cpp_template_redefine.i:105: Warning 322: Redundant redeclaration of identifier 'mmm' as Json::mmm< Converter,std::string >(Converter const &),
|
||||
cpp_template_redefine.i:105: Warning 322: Redundant redeclaration of identifier 'mmm' as Json::mmm< Converter,std::string >(Converter const &) ignored,
|
||||
cpp_template_redefine.i:105: Warning 322: previous declaration of 'mmm' as Json::mmm< Converter,std::string >(Converter const &).
|
||||
cpp_template_redefine.i:105: Warning 322: Redundant redeclaration of identifier 'mmm' as Json::mmm< Converter,std::string >(Converter const &),
|
||||
cpp_template_redefine.i:105: Warning 322: Redundant redeclaration of identifier 'mmm' as Json::mmm< Converter,std::string >(Converter const &) ignored,
|
||||
cpp_template_redefine.i:105: Warning 322: previous declaration of 'mmm' as Json::mmm< Converter,std::string >(Converter const &).
|
||||
cpp_template_redefine.i:106: Warning 322: Redundant redeclaration of identifier 'mmm' as Json::mmm< std::map< std::string,std::string >,0 >(std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > const &),
|
||||
cpp_template_redefine.i:106: Warning 322: Redundant redeclaration of identifier 'mmm' as Json::mmm< std::map< std::string,std::string >,0 >(std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > const &) ignored,
|
||||
cpp_template_redefine.i:106: Warning 322: previous declaration of 'mmm' as Json::mmm< std::map< std::string,std::string >,0 >(std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > const &).
|
||||
cpp_template_redefine.i:106: Warning 322: Redundant redeclaration of identifier 'mmm' as Json::mmm< std::map< std::string,std::string >,0 >(std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > const &),
|
||||
cpp_template_redefine.i:106: Warning 322: Redundant redeclaration of identifier 'mmm' as Json::mmm< std::map< std::string,std::string >,0 >(std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > const &) ignored,
|
||||
cpp_template_redefine.i:106: Warning 322: previous declaration of 'mmm' as Json::mmm< std::map< std::string,std::string >,0 >(std::map< std::string,std::string,std::less< std::string >,std::allocator< std::pair< std::string const,std::string > > > const &).
|
||||
cpp_template_redefine.i:107: Warning 322: Redundant redeclaration of identifier 'mmm' as Json::mmm< std::vector< std::string >,0 >(std::vector< std::string,std::allocator< std::string > > const &),
|
||||
cpp_template_redefine.i:107: Warning 322: Redundant redeclaration of identifier 'mmm' as Json::mmm< std::vector< std::string >,0 >(std::vector< std::string,std::allocator< std::string > > const &) ignored,
|
||||
cpp_template_redefine.i:107: Warning 322: previous declaration of 'mmm' as Json::mmm< std::vector< std::string >,0 >(std::vector< std::string,std::allocator< std::string > > const &).
|
||||
cpp_template_redefine.i:107: Warning 322: Redundant redeclaration of identifier 'mmm' as Json::mmm< std::vector< std::string >,0 >(std::vector< std::string,std::allocator< std::string > > const &),
|
||||
cpp_template_redefine.i:107: Warning 322: Redundant redeclaration of identifier 'mmm' as Json::mmm< std::vector< std::string >,0 >(std::vector< std::string,std::allocator< std::string > > const &) ignored,
|
||||
cpp_template_redefine.i:107: Warning 322: previous declaration of 'mmm' as Json::mmm< std::vector< std::string >,0 >(std::vector< std::string,std::allocator< std::string > > const &).
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
%module redefined_not
|
||||
|
||||
// These should not emit an Identifier redefined warning
|
||||
// These should not emit a 'Redefinition of identifier' warning
|
||||
%inline %{
|
||||
typedef unsigned int my_size_t;
|
||||
namespace Std {
|
||||
|
|
|
@ -687,19 +687,21 @@ static void add_symbols(Node *n) {
|
|||
String *n_name_decl = Swig_name_decl(n);
|
||||
String *c_name_decl = Swig_name_decl(c);
|
||||
if (redefined) {
|
||||
Printf(en, "Redefinition of identifier '%s' (ignored) as %s", symname_stripped, n_name_decl);
|
||||
Printf(ec, "previous definition of '%s' as %s", symname_stripped, c_name_decl);
|
||||
Printf(en, "Redefinition of identifier '%s'", symname_stripped);
|
||||
Printf(ec, "previous definition of '%s'", symname_stripped);
|
||||
} else {
|
||||
Printf(en, "Redundant redeclaration of identifier '%s' as %s", symname_stripped, n_name_decl);
|
||||
Printf(ec, "previous declaration of '%s' as %s", symname_stripped, c_name_decl);
|
||||
Printf(en, "Redundant redeclaration of identifier '%s'", symname_stripped);
|
||||
Printf(ec, "previous declaration of '%s'", symname_stripped);
|
||||
}
|
||||
if (!Equal(symname_stripped, n_name_stripped)) {
|
||||
if (!Equal(symname_stripped, n_name_stripped))
|
||||
Printf(en, " (Renamed from '%s')", SwigType_namestr(n_name_stripped));
|
||||
}
|
||||
Printf(en, ",");
|
||||
if (!Equal(symname_stripped, c_name_stripped)) {
|
||||
if (!Equal(symname_stripped, c_name_stripped))
|
||||
Printf(ec, " (Renamed from '%s')", SwigType_namestr(c_name_stripped));
|
||||
}
|
||||
if (!Equal(n_name_stripped, n_name_decl))
|
||||
Printf(en, " as %s", n_name_decl);
|
||||
if (!Equal(c_name_stripped, c_name_decl))
|
||||
Printf(ec, " as %s", c_name_decl);
|
||||
Printf(en, " ignored,");
|
||||
Printf(ec, ".");
|
||||
SWIG_WARN_NODE_BEGIN(n);
|
||||
if (redefined) {
|
||||
|
|
Loading…
Reference in New Issue