@@ -758,7 +758,9 @@ Slice::CsVisitor::modulePrefixEnd(const ModulePtr& p)
758758 }
759759}
760760
761- Slice::Gen::Gen (const string& base, const vector<string>& includePaths, const string& dir) : _includePaths(includePaths)
761+ Slice::Gen::Gen (const string& base, const vector<string>& includePaths, const string& dir, bool enableAnalysis)
762+ : _includePaths(includePaths),
763+ _enableAnalysis(enableAnalysis)
762764{
763765 string fileBase = base;
764766 string::size_type pos = base.find_last_of (" /\\ " );
@@ -781,7 +783,11 @@ Slice::Gen::Gen(const string& base, const vector<string>& includePaths, const st
781783 }
782784 FileTracker::instance ()->addFile (file);
783785 printHeader ();
784- printGeneratedHeader (_out, fileBase + " .ice" );
786+
787+ if (!_enableAnalysis)
788+ {
789+ printGeneratedHeader (_out, fileBase + " .ice" );
790+ }
785791
786792 _out << sp;
787793 _out << nl << " #nullable enable" ;
@@ -790,20 +796,21 @@ Slice::Gen::Gen(const string& base, const vector<string>& includePaths, const st
790796
791797 _out << sp;
792798
793- /*
794- // Disable some warnings when auto-generated is removed from the header. See printGeneratedHeader above.
795- _out << nl << "#pragma warning disable SA1403 // File may only contain a single namespace";
796- _out << nl << "#pragma warning disable SA1611 // The documentation for parameter x is missing";
799+ if (_enableAnalysis)
800+ {
801+ // Disable some warnings when auto-generated is removed from the header. See printGeneratedHeader above.
802+ _out << nl << " #pragma warning disable SA1403 // File may only contain a single namespace" ;
803+ _out << nl << " #pragma warning disable SA1611 // The documentation for parameter x is missing" ;
797804
798- _out << nl << "#pragma warning disable CA1041 // Provide a message for the ObsoleteAttribute that marks ...";
799- _out << nl << "#pragma warning disable CA1068 // Cancellation token as last parameter";
800- _out << nl << "#pragma warning disable CA1725 // Change parameter name istr_ to istr in order to match ...";
805+ _out << nl << " #pragma warning disable CA1041 // Provide a message for the ObsoleteAttribute that marks ..." ;
806+ _out << nl << " #pragma warning disable CA1068 // Cancellation token as last parameter" ;
807+ _out << nl << " #pragma warning disable CA1725 // Change parameter name istr_ to istr in order to match ..." ;
801808
802- // Missing doc - only necessary for the tests.
803- _out << nl << "#pragma warning disable SA1602";
804- _out << nl << "#pragma warning disable SA1604";
805- _out << nl << "#pragma warning disable SA1605";
806- */
809+ // Missing doc - only necessary for the tests.
810+ _out << nl << " #pragma warning disable SA1602" ;
811+ _out << nl << " #pragma warning disable SA1604" ;
812+ _out << nl << " #pragma warning disable SA1605" ;
813+ }
807814
808815 _out << nl << " #pragma warning disable CS1591 // Missing XML Comment" ;
809816 _out << nl << " #pragma warning disable CS1573 // Parameter has no matching param tag in the XML comment" ;
@@ -1112,7 +1119,7 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p)
11121119 _out << nl << " public static " << name << " read(Ice.InputStream istr)" ;
11131120 _out << sb;
11141121 _out << nl << " int sz = istr.readSize();" ;
1115- _out << nl << name << " r = new " << name << " ();" ;
1122+ _out << nl << " var r = new " << name << " ();" ;
11161123 _out << nl << " for (int i = 0; i < sz; ++i)" ;
11171124 _out << sb;
11181125 _out << nl << keyS << " k;" ;
@@ -1581,7 +1588,7 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
15811588 BuiltinPtr builtin = dynamic_pointer_cast<Builtin>(p->type ());
15821589
15831590 // Don't explicitly initialize to default value.
1584- if (!builtin || builtin->kind () == Builtin::KindString || defaultValue != " 0" )
1591+ if (!builtin || builtin->kind () == Builtin::KindString || ( defaultValue != " 0" && defaultValue != " false " ) )
15851592 {
15861593 _out << " = " ;
15871594 writeConstantValue (p->type (), p->defaultValueType (), defaultValue);
0 commit comments