diff options
author | Bernard Normier <bernard@zeroc.com> | 2017-02-04 16:48:50 -0500 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2017-02-04 16:48:50 -0500 |
commit | abb5616afdbe48c59b0f09f4b11aaa6fc5bb13be (patch) | |
tree | 900cd08e75cd11aceee75c7ab93085cbea824e60 | |
parent | Fixed (ICE-7556) - header-ext and makefile dependencies (diff) | |
download | ice-abb5616afdbe48c59b0f09f4b11aaa6fc5bb13be.tar.bz2 ice-abb5616afdbe48c59b0f09f4b11aaa6fc5bb13be.tar.xz ice-abb5616afdbe48c59b0f09f4b11aaa6fc5bb13be.zip |
Slice compilers now emit deprecated warning for classes with operations (ICE-7557)
Refactored suppress-warning implementation
29 files changed, 398 insertions, 527 deletions
diff --git a/cpp/src/Slice/JavaUtil.cpp b/cpp/src/Slice/JavaUtil.cpp index 461f9b7c09e..5387f7bab41 100644 --- a/cpp/src/Slice/JavaUtil.cpp +++ b/cpp/src/Slice/JavaUtil.cpp @@ -153,7 +153,6 @@ public: string file = *q; DefinitionContextPtr dc = p->findDefinitionContext(file); assert(dc); - bool emitWarnings = !dc->suppressWarning("invalid-metadata"); StringList globalMetaData = dc->getMetaData(); for(StringList::const_iterator r = globalMetaData.begin(); r != globalMetaData.end();) { @@ -172,10 +171,7 @@ public: } else { - if(emitWarnings) - { - emitWarning(file, "", "ignoring invalid global metadata `" + s + "'"); - } + dc->warning(InvalidMetaData, file, "", "ignoring invalid global metadata `" + s + "'"); globalMetaData.remove(s); continue; } @@ -238,7 +234,6 @@ public: UnitPtr unit = p->unit(); string file = p->file(); DefinitionContextPtr dc = unit->findDefinitionContext(p->file()); - bool emitWarnings = !dc->suppressWarning("invalid-metadata"); if(!returnType) { @@ -247,11 +242,8 @@ public: string s = *q++; if(s.find("java:type:", 0) == 0) { - if(emitWarnings) - { - emitWarning(p->file(), p->line(), "ignoring invalid metadata `" + s + - "' for operation with void return type"); - } + dc->warning(InvalidMetaData, p->file(), p->line(), "ignoring invalid metadata `" + s + + "' for operation with void return type"); metaData.remove(s); continue; } @@ -294,7 +286,6 @@ public: const string line = p->line(); const UnitPtr unit = p->unit(); const DefinitionContextPtr dc = unit->findDefinitionContext(file); - bool emitWarnings = !dc->suppressWarning("invalid-metadata"); for(StringList::const_iterator q = metaData.begin(); q != metaData.end(); ) { @@ -309,11 +300,8 @@ public: BuiltinPtr builtin = BuiltinPtr::dynamicCast(p->type()); if(!builtin || builtin->kind() != Builtin::KindByte) { - if(emitWarnings) - { - emitWarning(file, line, "ignoring invalid metadata `" + s + "': " + - "this metadata can only be used with a byte sequence"); - } + dc->warning(InvalidMetaData, file, line, "ignoring invalid metadata `" + s + "': " + + "this metadata can only be used with a byte sequence"); continue; } newMetaData.push_back(s); @@ -328,11 +316,8 @@ public: builtin->kind() != Builtin::KindInt && builtin->kind() != Builtin::KindLong && builtin->kind() != Builtin::KindFloat && builtin->kind() != Builtin::KindDouble)) { - if(emitWarnings) - { - emitWarning(file, line, "ignoring invalid metadata `" + s + "': " + - "this metadata can not be used with this type"); - } + dc->warning(InvalidMetaData, file, line, "ignoring invalid metadata `" + s + "': " + + "this metadata can not be used with this type"); continue; } newMetaData.push_back(s); @@ -382,7 +367,6 @@ private: string file = cont->file(); DefinitionContextPtr dc = unit->findDefinitionContext(file); assert(dc); - bool emitWarnings = !dc->suppressWarning("invalid-metadata"); for(StringList::const_iterator p = metaData.begin(); p != metaData.end(); ++p) { @@ -443,10 +427,7 @@ private: continue; } - if(emitWarnings) - { - emitWarning(cont->file(), cont->line(), "ignoring invalid metadata `" + s + "'"); - } + dc->warning(InvalidMetaData, cont->file(), cont->line(), "ignoring invalid metadata `" + s + "'"); } else { @@ -463,7 +444,6 @@ private: const UnitPtr unit = p->unit(); const DefinitionContextPtr dc = unit->findDefinitionContext(file); assert(dc); - bool emitWarnings = !dc->suppressWarning("invalid-metadata"); StringList newMetaData; for(StringList::const_iterator i = metaData.begin(); i != metaData.end(); ++i) { @@ -484,10 +464,7 @@ private: assert(b); str = b->typeId(); } - if(emitWarnings) - { - emitWarning(file, line, "invalid metadata for " + str); - } + dc->warning(InvalidMetaData, file, line, "invalid metadata for " + str); } else if(i->find("java:buffer") == 0) { @@ -506,20 +483,14 @@ private: } - if(emitWarnings) - { - emitWarning(file, line, "ignoring invalid metadata `" + *i + "'"); - } + dc->warning(InvalidMetaData, file, line, "ignoring invalid metadata `" + *i + "'"); } else if(i->find("java:protobuf:") == 0 || i->find("java:serializable:") == 0) { // // Only valid in sequence definition which is checked in visitSequence // - if(emitWarnings) - { - emitWarning(file, line, "ignoring invalid metadata `" + *i + "'"); - } + dc->warning(InvalidMetaData, file, line, "ignoring invalid metadata `" + *i + "'"); } else if(i->find("delegate") == 0) { @@ -528,9 +499,9 @@ private: { newMetaData.push_back(*i); } - else if(emitWarnings) + else { - emitWarning(file, line, "ignoring invalid metadata `" + *i + "'"); + dc->warning(InvalidMetaData, file, line, "ignoring invalid metadata `" + *i + "'"); } } else if(i->find("java:implements:") == 0) @@ -539,9 +510,9 @@ private: { newMetaData.push_back(*i); } - else if(emitWarnings) + else { - emitWarning(file, line, "ignoring invalid metadata `" + *i + "'"); + dc->warning(InvalidMetaData, file, line, "ignoring invalid metadata `" + *i + "'"); } } else @@ -557,7 +528,6 @@ private: const UnitPtr unit = p->unit(); const DefinitionContextPtr dc= unit->findDefinitionContext(file); assert(dc); - bool emitWarnings = !dc->suppressWarning("invalid-metadata"); StringList newMetaData; for(StringList::const_iterator i = metaData.begin(); i != metaData.end(); ++i) { @@ -580,10 +550,7 @@ private: assert(b); str = b->typeId(); } - if(emitWarnings) - { - emitWarning(file, line, "invalid metadata for " + str); - } + dc->warning(InvalidMetaData, file, line, "invalid metadata for " + str); continue; } newMetaData.push_back(*i); diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index 9b95062c035..656da795cf4 100644 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -129,6 +129,7 @@ Unit* unit; Slice::DefinitionContext::DefinitionContext(int includeLevel, const StringList& metaData) : _includeLevel(includeLevel), _metaData(metaData), _seenDefinition(false) { + initSuppressedWarnings(); } string @@ -171,6 +172,7 @@ void Slice::DefinitionContext::setMetaData(const StringList& metaData) { _metaData = metaData; + initSuppressedWarnings(); } string @@ -193,11 +195,72 @@ Slice::DefinitionContext::getMetaData() const return _metaData; } +void +Slice::DefinitionContext::warning(WarningCategory category, const string& file, int line, const string& msg) const +{ + if(!suppressWarning(category)) + { + emitWarning(file, line, msg); + } +} + +void +Slice::DefinitionContext::warning(WarningCategory category, const string& file, const string& line, const string& msg) const +{ + if(!suppressWarning(category)) + { + emitWarning(file, line, msg); + } +} + bool -Slice::DefinitionContext::suppressWarning(const string& name) const +Slice::DefinitionContext::suppressWarning(WarningCategory category) const { - string q = findMetaData("suppress-warning"); - return q == "suppress-warning" || q == "supress-warning:all" || q == ("suppress-warning:" + name); + return _suppressedWarnings.find(category) != _suppressedWarnings.end() || + _suppressedWarnings.find(All) != _suppressedWarnings.end(); +} + +void +Slice::DefinitionContext::initSuppressedWarnings() +{ + _suppressedWarnings.clear(); + const string prefix = "suppress-warning"; + string value = findMetaData(prefix); + if(value == prefix) + { + _suppressedWarnings.insert(All); + } + else if(!value.empty()) + { + assert(value.length() > prefix.length()); + if(value[prefix.length()] == ':') + { + value = value.substr(prefix.length() + 1); + vector<string> result; + IceUtilInternal::splitString(value, ",", result); + for(vector<string>::iterator p = result.begin(); p != result.end(); ++p) + { + string s = IceUtilInternal::trim(*p); + if(s == "all") + { + _suppressedWarnings.insert(All); + } + else if(s == "deprecated") + { + _suppressedWarnings.insert(Deprecated); + } + else if(s == "invalid-metadata") + { + _suppressedWarnings.insert(InvalidMetaData); + } + else + { + warning(InvalidMetaData, "", "", string("invalid category `") + s + + "' in global metadata suppress-warning"); + } + } + } + } } // ---------------------------------------------------------------------- @@ -1034,7 +1097,7 @@ Slice::Container::createDictionary(const string& name, const TypePtr& keyType, c } if(containsSequence) { - _unit->warning("use of sequences in dictionary keys has been deprecated"); + _unit->warning(Deprecated, "use of sequences in dictionary keys has been deprecated"); } } @@ -2125,7 +2188,7 @@ Slice::Container::mergeModules() metaData2.unique(); if(!checkGlobalMetaData(metaData1, metaData2)) { - unit()->warning("global metadata mismatch for module `" + mod1->name() + "' in files " + + unit()->warning(All, "global metadata mismatch for module `" + mod1->name() + "' in files " + dc1->filename() + " and " + dc2->filename()); } @@ -3322,6 +3385,12 @@ Slice::ClassDef::createOperation(const string& name, _unit->error(msg); } + if(!isInterface() && !isLocal() && !_hasOperations) + { + // Only warn for the first operation + _unit->warning(Deprecated, "classes with operations are deprecated"); + } + _hasOperations = true; OperationPtr op = new Operation(this, name, returnType, optional, tag, mode); _contents.push_back(op); @@ -5442,7 +5511,7 @@ Slice::Operation::attributes() const } if(i == 2) { - emitWarning(definitionContext()->filename(), line(), "invalid freeze metadata for operation"); + _unit->warning(InvalidMetaData, "invalid freeze metadata for operation"); } else { @@ -5463,7 +5532,7 @@ Slice::Operation::attributes() const { if(result != 0 && (i == int(Supports) || i == int(Never))) { - emitWarning(definitionContext()->filename(), line(), "invalid freeze metadata for operation"); + _unit->warning(InvalidMetaData, "invalid freeze metadata for operation"); } else { @@ -5477,7 +5546,7 @@ Slice::Operation::attributes() const if(i == 4) { - emitWarning(definitionContext()->filename(), line(), "invalid freeze metadata for operation"); + _unit->warning(InvalidMetaData, "invalid freeze metadata for operation"); // // Set default @@ -5960,13 +6029,6 @@ Slice::Unit::setSeenDefinition() } void -Slice::Unit::error(const char* s) -{ - emitError(currentFile(), _currentLine, s); - _errors++; -} - -void Slice::Unit::error(const string& s) { emitError(currentFile(), _currentLine, s); @@ -5974,15 +6036,16 @@ Slice::Unit::error(const string& s) } void -Slice::Unit::warning(const char* s) const -{ - emitWarning(currentFile(), _currentLine, s); -} - -void -Slice::Unit::warning(const string& s) const +Slice::Unit::warning(WarningCategory category, const string& msg) const { - emitWarning(currentFile(), _currentLine, s); + if(_definitionContextStack.empty()) + { + emitWarning(currentFile(), _currentLine, msg); + } + else + { + _definitionContextStack.top()->warning(category, currentFile(), _currentLine, msg); + } } ContainerPtr diff --git a/cpp/src/Slice/Parser.h b/cpp/src/Slice/Parser.h index 9363105a066..1c7fc8f2fea 100644 --- a/cpp/src/Slice/Parser.h +++ b/cpp/src/Slice/Parser.h @@ -66,6 +66,13 @@ enum FormatType SlicedFormat // Full format. }; +enum WarningCategory +{ + All, + Deprecated, + InvalidMetaData +}; + class GrammarBase; class SyntaxTreeBase; class Type; @@ -235,17 +242,21 @@ public: StringList getMetaData() const; // - // Check if we need to suppress the given warnings based - // on the [["supress-warning"]] global meta-data + // Emit warning unless filtered out by [["suppress-warning"]] // - bool suppressWarning(const std::string& = "") const; + void warning(WarningCategory, const std::string&, int, const std::string&) const; + void warning(WarningCategory, const std::string&, const std::string&, const std::string&) const; private: + bool suppressWarning(WarningCategory) const; + void initSuppressedWarnings(); + int _includeLevel; StringList _metaData; std::string _filename; bool _seenDefinition; + std::set<WarningCategory> _suppressedWarnings; }; typedef ::IceUtil::Handle<DefinitionContext> DefinitionContextPtr; @@ -1025,11 +1036,8 @@ public: void setSeenDefinition(); - void error(const char*); // Not const, because error count is increased. - void error(const std::string&); // Ditto. - - void warning(const char*) const; - void warning(const std::string&) const; + void error(const std::string&); // Not const because error count is increased + void warning(WarningCategory, const std::string&) const; ContainerPtr currentContainer() const; void pushContainer(const ContainerPtr&); diff --git a/cpp/src/Slice/PythonUtil.cpp b/cpp/src/Slice/PythonUtil.cpp index 9f09a765ed4..f4c59dd141b 100644 --- a/cpp/src/Slice/PythonUtil.cpp +++ b/cpp/src/Slice/PythonUtil.cpp @@ -432,7 +432,7 @@ Slice::Python::CodeVisitor::visitClassDecl(const ClassDeclPtr& p) { _out << nl << "_M_" << getAbsolute(p, "_t_") << " = IcePy.declareValue('" << scoped << "')"; } - + if(!p->isLocal() && (p->isInterface() || p->definition()->allOperations().size())) { _out << nl << "_M_" << getAbsolute(p, "_t_", "Disp") << " = IcePy.declareClass('" << scoped << "')"; @@ -468,7 +468,7 @@ Slice::Python::CodeVisitor::writeOperations(const ClassDefPtr& p) _out << ", " << fixIdent((*pli)->name()); } } - + if(!p->isLocal()) { const string currentParamName = getEscapedParamName(*oli, "current"); @@ -529,7 +529,7 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) string prxType = getAbsolute(p, "_t_", "Prx"); ClassList bases = p->bases(); ClassDefPtr base; - + if(!bases.empty() && !bases.front()->isInterface()) { base = bases.front(); @@ -622,7 +622,7 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) } } _out.dec(); - + if(!isLocal) { // @@ -646,7 +646,7 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) { writeOperations(p); } - + // // __str__ // @@ -657,7 +657,7 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) _out << sp << nl << "__repr__ = __str__"; _out.dec(); - + if(_classHistory.count(scoped) == 0 && p->canBeCyclic()) { // @@ -724,9 +724,9 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) } _out << "))"; _out << nl << valueName << "._ice_type = _M_" << type; - + registerName(valueName); - + _out.dec(); } else if(!isLocal && isInterface) @@ -744,7 +744,7 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) // Define the proxy class _out << nl << "_M_" << prxAbs << " = Ice.createTempClass()"; _out << nl << "class " << prxName << '('; - + { vector<string> baseClasses; for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q) @@ -755,7 +755,7 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) baseClasses.push_back(getSymbol(*q, "", "Prx")); } } - + if(baseClasses.empty()) { _out << "Ice.ObjectPrx"; @@ -766,7 +766,7 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) while(q != baseClasses.end()) { _out << *q; - + if(++q != baseClasses.end()) { _out << ", "; @@ -776,7 +776,7 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) } _out << "):"; _out.inc(); - + OperationList ops = p->operations(); for(OperationList::iterator oli = ops.begin(); oli != ops.end(); ++oli) { @@ -887,7 +887,7 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) _out.dec(); _out.dec(); // end prx class - + _out << nl << "_M_" << prxType << " = IcePy.defineProxy('" << scoped << "', " << prxName << ")"; registerName(prxName); @@ -905,7 +905,7 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) baseClasses.push_back(getSymbol(*q, "_", "Disp")); } } - + if(baseClasses.empty()) { _out << "Ice.Object"; @@ -916,7 +916,7 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) while(q != baseClasses.end()) { _out << *q; - + if(++q != baseClasses.end()) { _out << ", "; @@ -927,7 +927,7 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) _out << "):"; _out.inc(); - + // // ice_ids // @@ -970,9 +970,9 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) _out.inc(); _out << nl << "return '" << scoped << "'"; _out.dec(); - + writeOperations(p); - + // // __str__ // @@ -983,7 +983,7 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) _out << sp << nl << "__repr__ = __str__"; _out.dec(); - + _out << sp << nl << "_M_" << classType << " = IcePy.defineClass('" << scoped << "', " << className << ", "; writeMetaData(p->getMetaData()); @@ -1019,8 +1019,8 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) } _out << "))"; _out << nl << className << "._ice_type = _M_" << classType; - - + + // // Define each operation. The arguments to the IcePy.Operation constructor are: // @@ -2996,7 +2996,6 @@ Slice::Python::MetaDataVisitor::visitUnitStart(const UnitPtr& p) string file = *q; DefinitionContextPtr dc = p->findDefinitionContext(file); assert(dc); - bool emitWarnings = !dc->suppressWarning("invalid-metadata"); StringList globalMetaData = dc->getMetaData(); for(StringList::const_iterator r = globalMetaData.begin(); r != globalMetaData.end();) { @@ -3009,10 +3008,7 @@ Slice::Python::MetaDataVisitor::visitUnitStart(const UnitPtr& p) continue; } - if(emitWarnings) - { - emitWarning(file, "", "ignoring invalid global metadata `" + s + "'"); - } + dc->warning(InvalidMetaData, file, "", "ignoring invalid global metadata `" + s + "'"); globalMetaData.remove(s); } } @@ -3088,7 +3084,6 @@ Slice::Python::MetaDataVisitor::visitSequence(const SequencePtr& p) const UnitPtr unit = p->unit(); const DefinitionContextPtr dc = unit->findDefinitionContext(file); assert(dc); - bool emitWarnings = !dc->suppressWarning("invalid-metadata"); for(StringList::const_iterator q = metaData.begin(); q != metaData.end(); ) { @@ -3102,11 +3097,8 @@ Slice::Python::MetaDataVisitor::visitSequence(const SequencePtr& p) BuiltinPtr builtin = BuiltinPtr::dynamicCast(p->type()); if(!builtin || builtin->kind() != Builtin::KindByte) { - if(emitWarnings) - { - emitWarning(file, line, "ignoring invalid metadata `" + s + ": " + - "`protobuf' encoding must be a byte sequence"); - } + dc->warning(InvalidMetaData, file, line, "ignoring invalid metadata `" + s + ": " + + "`protobuf' encoding must be a byte sequence"); } else { @@ -3145,7 +3137,6 @@ Slice::Python::MetaDataVisitor::validateSequence(const string& file, const strin const UnitPtr unit = type->unit(); const DefinitionContextPtr dc = unit->findDefinitionContext(file); assert(dc); - bool emitWarnings = !dc->suppressWarning("invalid-metadata"); static const string prefix = "python:"; StringList newMetaData = metaData; @@ -3167,10 +3158,7 @@ Slice::Python::MetaDataVisitor::validateSequence(const string& file, const strin } } } - if(emitWarnings) - { - emitWarning(file, line, "ignoring invalid metadata `" + s + "'"); - } + dc->warning(InvalidMetaData, file, line, "ignoring invalid metadata `" + s + "'"); newMetaData.remove(s); } } @@ -3186,17 +3174,13 @@ Slice::Python::MetaDataVisitor::reject(const ContainedPtr& cont) const UnitPtr unit = cont->unit(); const DefinitionContextPtr dc = unit->findDefinitionContext(cont->file()); assert(dc); - bool emitWarnings = !dc->suppressWarning("invalid-metadata"); for(StringList::const_iterator p = localMetaData.begin(); p != localMetaData.end();) { string s = *p++; if(s.find(prefix) == 0) { - if(emitWarnings) - { - emitWarning(cont->file(), cont->line(), "ignoring invalid metadata `" + s + "'"); - } + dc->warning(InvalidMetaData, cont->file(), cont->line(), "ignoring invalid metadata `" + s + "'"); localMetaData.remove(s); } } diff --git a/cpp/src/Slice/Scanner.cpp b/cpp/src/Slice/Scanner.cpp index e43e15c66fd..b866d155494 100644 --- a/cpp/src/Slice/Scanner.cpp +++ b/cpp/src/Slice/Scanner.cpp @@ -28,8 +28,8 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 6 -#define YY_FLEX_SUBMINOR_VERSION 0 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -67,6 +67,7 @@ typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; +typedef uint64_t flex_uint64_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; @@ -74,6 +75,7 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -104,8 +106,6 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif -#endif /* ! C99 */ - #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -162,15 +162,7 @@ typedef unsigned int flex_uint32_t; /* Size of default input buffer. */ #ifndef YY_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ -#define YY_BUF_SIZE 32768 -#else #define YY_BUF_SIZE 16384 -#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -196,7 +188,6 @@ extern FILE *slice_in, *slice_out; #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) - #define YY_LINENO_REWIND_TO(ptr) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ @@ -231,7 +222,7 @@ struct yy_buffer_state /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - int yy_n_chars; + yy_size_t yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -301,7 +292,7 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* yy_hold_char holds the character lost when slice_text is formed. */ static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ +static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ yy_size_t slice_leng; /* Points to current character in buffer. */ @@ -362,7 +353,7 @@ void slice_free (void * ); /* Begin user sect3 */ -#define slice_wrap() (/*CONSTCOND*/1) +#define slice_wrap(n) 1 #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; @@ -376,17 +367,11 @@ extern int slice_lineno; int slice_lineno = 1; extern char *slice_text; -#ifdef yytext_ptr -#undef yytext_ptr -#endif #define yytext_ptr slice_text static yy_state_type yy_get_previous_state (void ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); static int yy_get_next_buffer (void ); -#if defined(__GNUC__) && __GNUC__ >= 3 -__attribute__((__noreturn__)) -#endif static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the @@ -394,7 +379,7 @@ static void yy_fatal_error (yyconst char msg[] ); */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ - slice_leng = (size_t) (yy_cp - yy_bp); \ + slice_leng = (yy_size_t) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; @@ -420,7 +405,7 @@ static yyconst flex_int16_t yy_accept[73] = 4, 0 } ; -static yyconst YY_CHAR yy_ec[256] = +static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, @@ -452,7 +437,7 @@ static yyconst YY_CHAR yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst YY_CHAR yy_meta[32] = +static yyconst flex_int32_t yy_meta[32] = { 0, 1, 2, 3, 4, 1, 1, 4, 1, 5, 5, 1, 1, 6, 6, 6, 1, 7, 7, 7, 8, @@ -460,7 +445,7 @@ static yyconst YY_CHAR yy_meta[32] = 1 } ; -static yyconst flex_uint16_t yy_base[85] = +static yyconst flex_int16_t yy_base[85] = { 0, 0, 185, 0, 26, 0, 184, 189, 192, 192, 192, 192, 22, 25, 33, 47, 35, 153, 40, 147, 0, @@ -486,7 +471,7 @@ static yyconst flex_int16_t yy_def[85] = 72, 72, 72, 72 } ; -static yyconst flex_uint16_t yy_nxt[224] = +static yyconst flex_int16_t yy_nxt[224] = { 0, 8, 9, 10, 9, 11, 8, 8, 8, 12, 12, 13, 14, 15, 16, 16, 17, 18, 18, 18, 18, @@ -642,7 +627,7 @@ int checkKeyword(string&); -#line 645 "lex.yy.c" +#line 630 "lex.yy.c" #define INITIAL 0 #define BOMSCAN 1 @@ -677,11 +662,11 @@ void slice_set_extra (YY_EXTRA_TYPE user_defined ); FILE *slice_get_in (void ); -void slice_set_in (FILE * _in_str ); +void slice_set_in (FILE * in_str ); FILE *slice_get_out (void ); -void slice_set_out (FILE * _out_str ); +void slice_set_out (FILE * out_str ); yy_size_t slice_get_leng (void ); @@ -689,7 +674,7 @@ char *slice_get_text (void ); int slice_get_lineno (void ); -void slice_set_lineno (int _line_number ); +void slice_set_lineno (int line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -703,12 +688,8 @@ extern int slice_wrap (void ); #endif #endif -#ifndef YY_NO_UNPUT - static void yyunput (int c,char *buf_ptr ); -#endif - #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ); #endif @@ -729,12 +710,7 @@ static int input (void ); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k */ -#define YY_READ_BUF_SIZE 16384 -#else #define YY_READ_BUF_SIZE 8192 -#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -742,7 +718,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( slice_text, slice_leng, 1, slice_out )) {} } while (0) +#define ECHO fwrite( slice_text, slice_leng, 1, slice_out ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -753,7 +729,7 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - size_t n; \ + yy_size_t n; \ for ( n = 0; n < max_size && \ (c = getc( slice_in )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -821,7 +797,7 @@ extern int slice_lex (void); /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK /*LINTED*/break; +#define YY_BREAK break; #endif #define YY_RULE_SETUP \ @@ -834,10 +810,15 @@ extern int slice_lex (void); */ YY_DECL { - yy_state_type yy_current_state; - char *yy_cp, *yy_bp; - int yy_act; + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; +#line 98 "src/Slice/Scanner.l" + + +#line 820 "lex.yy.c" + if ( !(yy_init) ) { (yy_init) = 1; @@ -864,13 +845,7 @@ YY_DECL slice__load_buffer_state( ); } - { -#line 98 "src/Slice/Scanner.l" - - -#line 871 "lex.yy.c" - - while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ + while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); @@ -887,7 +862,7 @@ YY_DECL yy_match: do { - YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -938,7 +913,6 @@ YY_RULE_SETUP case 2: /* rule 2 can match eol */ *yy_cp = (yy_hold_char); /* undo effects of setting up slice_text */ -YY_LINENO_REWIND_TO(yy_cp - 1); (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up slice_text again */ YY_RULE_SETUP @@ -966,7 +940,6 @@ YY_RULE_SETUP case 4: /* rule 4 can match eol */ *yy_cp = (yy_hold_char); /* undo effects of setting up slice_text */ -YY_LINENO_REWIND_TO(yy_cp - 1); (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up slice_text again */ YY_RULE_SETUP @@ -1026,7 +999,7 @@ YY_RULE_SETUP } else if(c == EOF) { - unit->warning("EOF in comment"); + unit->warning(All, "EOF in comment"); break; } else @@ -1308,7 +1281,7 @@ YY_RULE_SETUP { ostringstream os; os << "unknown escape sequence `\\" << next << "'"; - unit->warning(os.str()); + unit->warning(All, os.str()); // Escape the \ in this unknown escape sequence str->v += '\\'; @@ -1428,7 +1401,7 @@ YY_RULE_SETUP #line 526 "src/Slice/Scanner.l" ECHO; YY_BREAK -#line 1431 "lex.yy.c" +#line 1404 "lex.yy.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(BOMSCAN): case YY_STATE_EOF(MAINSCAN): @@ -1562,7 +1535,6 @@ case YY_STATE_EOF(MAINSCAN): "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ - } /* end of user's declarations */ } /* end of slice_lex */ /* yy_get_next_buffer - try to read in a new buffer @@ -1574,9 +1546,9 @@ case YY_STATE_EOF(MAINSCAN): */ static int yy_get_next_buffer (void) { - char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - char *source = (yytext_ptr); - yy_size_t number_to_move, i; + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); + register int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) @@ -1605,7 +1577,7 @@ static int yy_get_next_buffer (void) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (yy_size_t) ((yy_c_buf_p) - (yytext_ptr)) - 1; + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); @@ -1625,7 +1597,7 @@ static int yy_get_next_buffer (void) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); @@ -1687,9 +1659,9 @@ static int yy_get_next_buffer (void) else ret_val = EOB_ACT_CONTINUE_SCAN; - if ((int) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ - int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) slice_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); @@ -1708,15 +1680,15 @@ static int yy_get_next_buffer (void) static yy_state_type yy_get_previous_state (void) { - yy_state_type yy_current_state; - char *yy_cp; + register yy_state_type yy_current_state; + register char *yy_cp; yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { - YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -1741,10 +1713,10 @@ static int yy_get_next_buffer (void) */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { - int yy_is_jam; - char *yy_cp = (yy_c_buf_p); + register int yy_is_jam; + register char *yy_cp = (yy_c_buf_p); - YY_CHAR yy_c = 1; + register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -1759,14 +1731,12 @@ static int yy_get_next_buffer (void) yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 72); - return yy_is_jam ? 0 : yy_current_state; + return yy_is_jam ? 0 : yy_current_state; } -#ifndef YY_NO_UNPUT - - static void yyunput (int c, char * yy_bp ) + static void yyunput (int c, register char * yy_bp ) { - char *yy_cp; + register char *yy_cp; yy_cp = (yy_c_buf_p); @@ -1776,10 +1746,10 @@ static int yy_get_next_buffer (void) if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - yy_size_t number_to_move = (yy_n_chars) + 2; - char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + register yy_size_t number_to_move = (yy_n_chars) + 2; + register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - char *source = + register char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) @@ -1801,8 +1771,6 @@ static int yy_get_next_buffer (void) (yy_c_buf_p) = yy_cp; } -#endif - #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) @@ -1851,7 +1819,7 @@ static int yy_get_next_buffer (void) case EOB_ACT_END_OF_FILE: { if ( slice_wrap( ) ) - return EOF; + return 0; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; @@ -1954,7 +1922,7 @@ static void slice__load_buffer_state (void) if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in slice__create_buffer()" ); - b->yy_buf_size = (yy_size_t)size; + b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. @@ -2109,7 +2077,7 @@ static void slice_ensure_buffer_stack (void) * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ - num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ + num_to_alloc = 1; (yy_buffer_stack) = (struct yy_buffer_state**)slice_alloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); @@ -2126,7 +2094,7 @@ static void slice_ensure_buffer_stack (void) if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ - yy_size_t grow_size = 8 /* arbitrary grow size */; + int grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)slice_realloc @@ -2193,8 +2161,8 @@ YY_BUFFER_STATE slice__scan_string (yyconst char * yystr ) /** Setup the input buffer state to scan the given bytes. The next call to slice_lex() will * scan from a @e copy of @a bytes. - * @param yybytes the byte buffer to scan - * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ @@ -2202,8 +2170,7 @@ YY_BUFFER_STATE slice__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_ { YY_BUFFER_STATE b; char *buf; - yy_size_t n; - yy_size_t i; + yy_size_t n, i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; @@ -2234,7 +2201,7 @@ YY_BUFFER_STATE slice__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_ static void yy_fatal_error (yyconst char* msg ) { - (void) fprintf( stderr, "%s\n", msg ); + (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } @@ -2300,29 +2267,29 @@ char *slice_get_text (void) } /** Set the current line number. - * @param _line_number line number + * @param line_number * */ -void slice_set_lineno (int _line_number ) +void slice_set_lineno (int line_number ) { - slice_lineno = _line_number; + slice_lineno = line_number; } /** Set the input stream. This does not discard the current * input buffer. - * @param _in_str A readable stream. + * @param in_str A readable stream. * * @see slice__switch_to_buffer */ -void slice_set_in (FILE * _in_str ) +void slice_set_in (FILE * in_str ) { - slice_in = _in_str ; + slice_in = in_str ; } -void slice_set_out (FILE * _out_str ) +void slice_set_out (FILE * out_str ) { - slice_out = _out_str ; + slice_out = out_str ; } int slice_get_debug (void) @@ -2330,9 +2297,9 @@ int slice_get_debug (void) return slice__flex_debug; } -void slice_set_debug (int _bdebug ) +void slice_set_debug (int bdebug ) { - slice__flex_debug = _bdebug ; + slice__flex_debug = bdebug ; } static int yy_init_globals (void) @@ -2392,8 +2359,7 @@ int slice_lex_destroy (void) #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { - - int i; + register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } @@ -2402,7 +2368,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { - int n; + register int n; for ( n = 0; s[n]; ++n ) ; @@ -2412,12 +2378,11 @@ static int yy_flex_strlen (yyconst char * s ) void *slice_alloc (yy_size_t size ) { - return (void *) malloc( size ); + return (void *) malloc( size ); } void *slice_realloc (void * ptr, yy_size_t size ) { - /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter @@ -2430,7 +2395,7 @@ void *slice_realloc (void * ptr, yy_size_t size ) void slice_free (void * ptr ) { - free( (char *) ptr ); /* see slice_realloc() for (char *) cast */ + free( (char *) ptr ); /* see slice_realloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" diff --git a/cpp/src/Slice/Scanner.l b/cpp/src/Slice/Scanner.l index 3cd7d358634..e2a825c0deb 100644 --- a/cpp/src/Slice/Scanner.l +++ b/cpp/src/Slice/Scanner.l @@ -167,7 +167,7 @@ floating_literal (({fractional_constant}{exponent_part}?)|((\+|-)?[[:digit:]] } else if(c == EOF) { - unit->warning("EOF in comment"); + unit->warning(All, "EOF in comment"); break; } else @@ -424,7 +424,7 @@ floating_literal (({fractional_constant}{exponent_part}?)|((\+|-)?[[:digit:]] { ostringstream os; os << "unknown escape sequence `\\" << next << "'"; - unit->warning(os.str()); + unit->warning(All, os.str()); // Escape the \ in this unknown escape sequence str->v += '\\'; diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index beae822ec6b..7beb1fb7371 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -462,7 +462,7 @@ Slice::Gen::generate(const UnitPtr& p) { _headerExtension = headerExtension; } - + string sourceExtension = getSourceExt(file, p); if(!sourceExtension.empty()) { @@ -690,7 +690,6 @@ Slice::Gen::generate(const UnitPtr& p) DefinitionContextPtr dc = p->findDefinitionContext(file); assert(dc); StringList globalMetaData = dc->getMetaData(); - bool emitWarnings = dc->suppressWarning("invalid-metadata"); for(StringList::const_iterator q = globalMetaData.begin(); q != globalMetaData.end();) { string s = *q++; @@ -703,12 +702,9 @@ Slice::Gen::generate(const UnitPtr& p) } else { - if(emitWarnings) - { - ostringstream ostr; - ostr << "ignoring invalid global metadata `" << s << "'"; - emitWarning(file, -1, ostr.str()); - } + ostringstream ostr; + ostr << "ignoring invalid global metadata `" << s << "'"; + dc->warning(InvalidMetaData, file, -1, ostr.str()); globalMetaData.remove(s); } } @@ -4515,7 +4511,6 @@ Slice::Gen::MetaDataVisitor::visitUnitStart(const UnitPtr& p) int headerExtension = 0; int sourceExtension = 0; int dllExport = 0; - bool emitWarnings = !dc->suppressWarning("invalid-metadata"); for(StringList::const_iterator r = globalMetaData.begin(); r != globalMetaData.end();) { string s = *r++; @@ -4535,13 +4530,10 @@ Slice::Gen::MetaDataVisitor::visitUnitStart(const UnitPtr& p) headerExtension++; if(headerExtension > 1) { - if(emitWarnings) - { - ostringstream ostr; - ostr << "ignoring invalid global metadata `" << s - << "': directive can appear only once per file"; - emitWarning(file, -1, ostr.str()); - } + ostringstream ostr; + ostr << "ignoring invalid global metadata `" << s + << "': directive can appear only once per file"; + dc->warning(InvalidMetaData, file, -1, ostr.str()); globalMetaData.remove(s); } continue; @@ -4551,13 +4543,10 @@ Slice::Gen::MetaDataVisitor::visitUnitStart(const UnitPtr& p) sourceExtension++; if(sourceExtension > 1) { - if(emitWarnings) - { - ostringstream ostr; - ostr << "ignoring invalid global metadata `" << s - << "': directive can appear only once per file"; - emitWarning(file, -1, ostr.str()); - } + ostringstream ostr; + ostr << "ignoring invalid global metadata `" << s + << "': directive can appear only once per file"; + dc->warning(InvalidMetaData, file, -1, ostr.str()); globalMetaData.remove(s); } continue; @@ -4567,24 +4556,19 @@ Slice::Gen::MetaDataVisitor::visitUnitStart(const UnitPtr& p) dllExport++; if(dllExport > 1) { - if(emitWarnings) - { - ostringstream ostr; - ostr << "ignoring invalid global metadata `" << s - << "': directive can appear only once per file"; - emitWarning(file, -1, ostr.str()); - } + ostringstream ostr; + ostr << "ignoring invalid global metadata `" << s + << "': directive can appear only once per file"; + dc->warning(InvalidMetaData, file, -1, ostr.str()); + globalMetaData.remove(s); } continue; } - if(emitWarnings) - { - ostringstream ostr; - ostr << "ignoring invalid global metadata `" << s << "'"; - emitWarning(file, -1, ostr.str()); - } + ostringstream ostr; + ostr << "ignoring invalid global metadata `" << s << "'"; + dc->warning(InvalidMetaData, file, -1, ostr.str()); globalMetaData.remove(s); } @@ -4664,14 +4648,10 @@ Slice::Gen::MetaDataVisitor::visitOperation(const OperationPtr& p) const UnitPtr unit = p->unit(); const DefinitionContextPtr dc = unit->findDefinitionContext(p->file()); assert(dc); - bool emitWarnings = !dc->suppressWarning("invalid-metadata"); - if(!cl->isLocal() && p->hasMetaData("cpp:noexcept")) { - if(emitWarnings) - { - emitWarning(p->file(), p->line(), "ignoring metadata `cpp:noexcept' for non local interface"); - } + dc->warning(InvalidMetaData, p->file(), p->line(), + "ignoring metadata `cpp:noexcept' for non local interface"); metaData.remove("cpp:noexcept"); } @@ -4684,11 +4664,8 @@ Slice::Gen::MetaDataVisitor::visitOperation(const OperationPtr& p) if(s.find("cpp:type:") == 0 || s.find("cpp:view-type:") == 0 || s.find("cpp:range") == 0 || s == "cpp:array") { - if(emitWarnings) - { - emitWarning(p->file(), p->line(), "ignoring invalid metadata `" + s + - "' for operation with void return type"); - } + dc->warning(InvalidMetaData, p->file(), p->line(), + "ignoring invalid metadata `" + s + "' for operation with void return type"); metaData.remove(s); continue; } @@ -4755,8 +4732,6 @@ Slice::Gen::MetaDataVisitor::validate(const SyntaxTreeBasePtr& cont, const Strin const UnitPtr unit = cont->unit(); const DefinitionContextPtr dc = unit->findDefinitionContext(file); assert(dc); - bool emitWarnings = !dc->suppressWarning("invalid-metadata"); - StringList newMetaData = metaData; for(StringList::const_iterator p = newMetaData.begin(); p != newMetaData.end();) { @@ -4849,10 +4824,7 @@ Slice::Gen::MetaDataVisitor::validate(const SyntaxTreeBasePtr& cont, const Strin } } - if(emitWarnings) - { - emitWarning(file, line, "ignoring invalid metadata `" + s + "'"); - } + dc->warning(InvalidMetaData, file, line, "ignoring invalid metadata `" + s + "'"); newMetaData.remove(s); continue; } @@ -4865,10 +4837,7 @@ Slice::Gen::MetaDataVisitor::validate(const SyntaxTreeBasePtr& cont, const Strin continue; } - if(emitWarnings) - { - emitWarning(file, line, "ignoring invalid metadata `" + s + "'"); - } + dc->warning(InvalidMetaData, file, line, "ignoring invalid metadata `" + s + "'"); newMetaData.remove(s); continue; } @@ -5729,7 +5698,7 @@ Slice::Gen::Cpp11TypesVisitor::visitDictionary(const DictionaryPtr& p) } Slice::Gen::Cpp11ProxyVisitor::Cpp11ProxyVisitor(Output& h, Output& c, const string& dllExport) : - H(h), C(c), _dllClassExport(toDllClassExport(dllExport)), + H(h), C(c), _dllClassExport(toDllClassExport(dllExport)), _dllMemberExport(toDllMemberExport(dllExport)), _useWstring(false) { diff --git a/cpp/src/slice2cs/CsUtil.cpp b/cpp/src/slice2cs/CsUtil.cpp index dac1c6a362e..f575eb3025e 100644 --- a/cpp/src/slice2cs/CsUtil.cpp +++ b/cpp/src/slice2cs/CsUtil.cpp @@ -2355,7 +2355,6 @@ Slice::CsGenerator::MetaDataVisitor::visitUnitStart(const UnitPtr& p) assert(dc); StringList globalMetaData = dc->getMetaData(); StringList newGlobalMetaData; - bool emitWarnings = !dc->suppressWarning("invalid-metadata"); static const string csPrefix = "cs:"; static const string clrPrefix = "clr:"; @@ -2374,10 +2373,7 @@ Slice::CsGenerator::MetaDataVisitor::visitUnitStart(const UnitPtr& p) static const string csAttributePrefix = csPrefix + "attribute:"; if(s.find(csAttributePrefix) != 0 || s.size() == csAttributePrefix.size()) { - if(emitWarnings) - { - emitWarning(file, -1, "ignoring invalid global metadata `" + oldS + "'"); - } + dc->warning(InvalidMetaData, file, -1, "ignoring invalid global metadata `" + oldS + "'"); continue; } } @@ -2502,7 +2498,6 @@ Slice::CsGenerator::MetaDataVisitor::validate(const ContainedPtr& cont) const UnitPtr unit = cont->unit(); const DefinitionContextPtr dc = unit->findDefinitionContext(cont->file()); assert(dc); - bool emitWarnings = !dc->suppressWarning("invalid-metadata"); for(StringList::iterator p = localMetaData.begin(); p != localMetaData.end(); ++p) { @@ -2547,11 +2542,8 @@ Slice::CsGenerator::MetaDataVisitor::validate(const ContainedPtr& cont) string meta; if(cont->findMetaData(csPrefix + "generic:", meta)) { - if(emitWarnings) - { - emitWarning(cont->file(), cont->line(), msg + " `" + meta + "':\n" + - "serialization can only be used with the array mapping for byte sequences"); - } + dc->warning(InvalidMetaData, cont->file(), cont->line(), msg + " `" + meta + "':\n" + + "serialization can only be used with the array mapping for byte sequences"); continue; } string type = s.substr(csSerializablePrefix.size()); @@ -2623,10 +2615,7 @@ Slice::CsGenerator::MetaDataVisitor::validate(const ContainedPtr& cont) continue; } - if(emitWarnings) - { - emitWarning(cont->file(), cont->line(), msg + " `" + oldS + "'"); - } + dc->warning(InvalidMetaData, cont->file(), cont->line(), msg + " `" + oldS + "'"); continue; } else if(s == "delegate") @@ -2638,10 +2627,7 @@ Slice::CsGenerator::MetaDataVisitor::validate(const ContainedPtr& cont) continue; } - if(emitWarnings) - { - emitWarning(cont->file(), cont->line(), msg + " `" + s + "'"); - } + dc->warning(InvalidMetaData, cont->file(), cont->line(), msg + " `" + s + "'"); continue; } newLocalMetaData.push_back(s); diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp index f33a44286cd..f79dc1fead6 100644 --- a/cpp/src/slice2java/Gen.cpp +++ b/cpp/src/slice2java/Gen.cpp @@ -2760,17 +2760,13 @@ Slice::Gen::TypesVisitor::visitClassDefEnd(const ClassDefPtr& p) const UnitPtr unit = p->unit(); const DefinitionContextPtr dc = unit->findDefinitionContext(p->file()); assert(dc); - bool emitWarnings = !dc->suppressWarning("invalid-metadata"); string::size_type pos = serialVersionUID.rfind(":") + 1; if(pos == string::npos) { - if(emitWarnings) - { - ostringstream os; - os << "ignoring invalid serialVersionUID for class `" << p->scoped() << "'; generating default value"; - emitWarning("", "", os.str()); - } + ostringstream os; + os << "ignoring invalid serialVersionUID for class `" << p->scoped() << "'; generating default value"; + dc->warning(InvalidMetaData, "", "", os.str()); out << computeSerialVersionUUID(p); } else @@ -2781,13 +2777,10 @@ Slice::Gen::TypesVisitor::visitClassDefEnd(const ClassDefPtr& p) { if(!stringToInt64(serialVersionUID, v)) // conversion error { - if(emitWarnings) - { - ostringstream os; - os << "ignoring invalid serialVersionUID for class `" << p->scoped() - << "'; generating default value"; - emitWarning("", "", os.str()); - } + ostringstream os; + os << "ignoring invalid serialVersionUID for class `" << p->scoped() + << "'; generating default value"; + dc->warning(InvalidMetaData, "", "", os.str()); out << computeSerialVersionUUID(p); } } @@ -3296,17 +3289,13 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) const UnitPtr unit = p->unit(); const DefinitionContextPtr dc = unit->findDefinitionContext(p->file()); assert(dc); - bool emitWarnings = !dc->suppressWarning("invalid-metadata"); string::size_type pos = serialVersionUID.rfind(":") + 1; if(pos == string::npos) { - if(emitWarnings) - { - ostringstream os; - os << "ignoring invalid serialVersionUID for exception `" << p->scoped() << "'; generating default value"; - emitWarning("", "", os.str()); - } + ostringstream os; + os << "ignoring invalid serialVersionUID for exception `" << p->scoped() << "'; generating default value"; + dc->warning(InvalidMetaData, "", "", os.str()); out << computeSerialVersionUUID(p); } else @@ -3317,13 +3306,10 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) { if(!stringToInt64(serialVersionUID, v)) // conversion error { - if(emitWarnings) - { - ostringstream os; - os << "ignoring invalid serialVersionUID for exception `" << p->scoped() - << "'; generating default value"; - emitWarning("", "", os.str()); - } + ostringstream os; + os << "ignoring invalid serialVersionUID for exception `" << p->scoped() + << "'; generating default value"; + dc->warning(InvalidMetaData, "", "", os.str()); out << computeSerialVersionUUID(p); } } @@ -3620,16 +3606,12 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) const UnitPtr unit = p->unit(); const DefinitionContextPtr dc = unit->findDefinitionContext(p->file()); assert(dc); - bool emitWarnings = !dc->suppressWarning("invalid-metadata"); string::size_type pos = serialVersionUID.rfind(":") + 1; if(pos == string::npos) { - if(emitWarnings) - { - ostringstream os; - os << "ignoring invalid serialVersionUID for struct `" << p->scoped() << "'; generating default value"; - emitWarning("", "", os.str()); - } + ostringstream os; + os << "ignoring invalid serialVersionUID for struct `" << p->scoped() << "'; generating default value"; + dc->warning(InvalidMetaData, "", "", os.str()); out << computeSerialVersionUUID(p); } else @@ -3640,13 +3622,10 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) { if(!stringToInt64(serialVersionUID, v)) // conversion error { - if(emitWarnings) - { - ostringstream os; - os << "ignoring invalid serialVersionUID for struct `" << p->scoped() - << "'; generating default value"; - emitWarning("", "", os.str()); - } + ostringstream os; + os << "ignoring invalid serialVersionUID for struct `" << p->scoped() + << "'; generating default value"; + dc->warning(InvalidMetaData, "", "", os.str()); out << computeSerialVersionUUID(p); } } diff --git a/cpp/src/slice2java/GenCompat.cpp b/cpp/src/slice2java/GenCompat.cpp index a3f4179ed8f..e407f34745e 100644 --- a/cpp/src/slice2java/GenCompat.cpp +++ b/cpp/src/slice2java/GenCompat.cpp @@ -2278,7 +2278,7 @@ Slice::JavaCompatVisitor::writeDocCommentParam(Output& out, const OperationPtr& } } -Slice::GenCompat::GenCompat(const string& /*name*/, const string& base, const vector<string>& includePaths, +Slice::GenCompat::GenCompat(const string& /*name*/, const string& base, const vector<string>& includePaths, const string& dir, bool tie) : _base(base), _includePaths(includePaths), @@ -3015,16 +3015,12 @@ Slice::GenCompat::TypesVisitor::visitClassDefEnd(const ClassDefPtr& p) const UnitPtr unit = p->unit(); const DefinitionContextPtr dc = unit->findDefinitionContext(p->file()); assert(dc); - bool emitWarnings = !dc->suppressWarning("invalid-metadata"); string::size_type pos = serialVersionUID.rfind(":") + 1; if(pos == string::npos) { - if(emitWarnings) - { - ostringstream os; - os << "ignoring invalid serialVersionUID for class `" << p->scoped() << "'; generating default value"; - emitWarning("", "", os.str()); - } + ostringstream os; + os << "ignoring invalid serialVersionUID for class `" << p->scoped() << "'; generating default value"; + dc->warning(InvalidMetaData, "", "", os.str()); out << computeSerialVersionUUID(p); } else @@ -3035,13 +3031,10 @@ Slice::GenCompat::TypesVisitor::visitClassDefEnd(const ClassDefPtr& p) { if(!stringToInt64(serialVersionUID, v)) // conversion error { - if(emitWarnings) - { - ostringstream os; - os << "ignoring invalid serialVersionUID for class `" << p->scoped() - << "'; generating default value"; - emitWarning("", "", os.str()); - } + ostringstream os; + os << "ignoring invalid serialVersionUID for class `" << p->scoped() + << "'; generating default value"; + dc->warning(InvalidMetaData, "", "", os.str()); out << computeSerialVersionUUID(p); } } @@ -3445,16 +3438,12 @@ Slice::GenCompat::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) const UnitPtr unit = p->unit(); const DefinitionContextPtr dc = unit->findDefinitionContext(p->file()); assert(dc); - bool emitWarnings = !dc->suppressWarning("invalid-metadata"); string::size_type pos = serialVersionUID.rfind(":") + 1; if(pos == string::npos) { - if(emitWarnings) - { - ostringstream os; - os << "ignoring invalid serialVersionUID for exception `" << p->scoped() << "'; generating default value"; - emitWarning("", "", os.str()); - } + ostringstream os; + os << "ignoring invalid serialVersionUID for exception `" << p->scoped() << "'; generating default value"; + dc->warning(InvalidMetaData, "", "", os.str()); out << computeSerialVersionUUID(p); } else @@ -3465,13 +3454,10 @@ Slice::GenCompat::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) { if(!stringToInt64(serialVersionUID, v)) // conversion error { - if(emitWarnings) - { - ostringstream os; - os << "ignoring invalid serialVersionUID for exception `" << p->scoped() - << "'; generating default value"; - emitWarning("", "", os.str()); - } + ostringstream os; + os << "ignoring invalid serialVersionUID for exception `" << p->scoped() + << "'; generating default value"; + dc->warning(InvalidMetaData, "", "", os.str()); out << computeSerialVersionUUID(p); } } @@ -3771,16 +3757,12 @@ Slice::GenCompat::TypesVisitor::visitStructEnd(const StructPtr& p) const UnitPtr unit = p->unit(); const DefinitionContextPtr dc = unit->findDefinitionContext(p->file()); assert(dc); - bool emitWarnings = !dc->suppressWarning("invalid-metadata"); string::size_type pos = serialVersionUID.rfind(":") + 1; if(pos == string::npos) { - if(emitWarnings) - { - ostringstream os; - os << "ignoring invalid serialVersionUID for struct `" << p->scoped() << "'; generating default value"; - emitWarning("", "", os.str()); - } + ostringstream os; + os << "ignoring invalid serialVersionUID for struct `" << p->scoped() << "'; generating default value"; + dc->warning(InvalidMetaData, "", "", os.str()); out << computeSerialVersionUUID(p); } else @@ -3791,13 +3773,10 @@ Slice::GenCompat::TypesVisitor::visitStructEnd(const StructPtr& p) { if(!stringToInt64(serialVersionUID, v)) // conversion error { - if(emitWarnings) - { - ostringstream os; - os << "ignoring invalid serialVersionUID for struct `" << p->scoped() - << "'; generating default value"; - emitWarning("", "", os.str()); - } + ostringstream os; + os << "ignoring invalid serialVersionUID for struct `" << p->scoped() + << "'; generating default value"; + dc->warning(InvalidMetaData, "", "", os.str()); out << computeSerialVersionUUID(p); } } @@ -5856,16 +5835,12 @@ Slice::GenCompat::DispatcherVisitor::visitClassDefStart(const ClassDefPtr& p) const UnitPtr unit = p->unit(); const DefinitionContextPtr dc = unit->findDefinitionContext(p->file()); assert(dc); - bool emitWarnings = !dc->suppressWarning("invalid-metadata"); string::size_type pos = serialVersionUID.rfind(":") + 1; if(pos == string::npos) { - if(emitWarnings) - { - ostringstream os; - os << "ignoring invalid serialVersionUID for class `" << p->scoped() << "'; generating default value"; - emitWarning("", "", os.str()); - } + ostringstream os; + os << "ignoring invalid serialVersionUID for class `" << p->scoped() << "'; generating default value"; + dc->warning(InvalidMetaData, "", "", os.str()); out << computeSerialVersionUUID(p); } else @@ -5876,13 +5851,10 @@ Slice::GenCompat::DispatcherVisitor::visitClassDefStart(const ClassDefPtr& p) { if(!stringToInt64(serialVersionUID, v)) // conversion error { - if(emitWarnings) - { - ostringstream os; - os << "ignoring invalid serialVersionUID for class `" << p->scoped() - << "'; generating default value"; - emitWarning("", "", os.str()); - } + ostringstream os; + os << "ignoring invalid serialVersionUID for class `" << p->scoped() + << "'; generating default value"; + dc->warning(InvalidMetaData, "", "", os.str()); out << computeSerialVersionUUID(p); } } diff --git a/cpp/src/slice2objc/ObjCUtil.cpp b/cpp/src/slice2objc/ObjCUtil.cpp index e86290b8db3..6cd8afd835a 100644 --- a/cpp/src/slice2objc/ObjCUtil.cpp +++ b/cpp/src/slice2objc/ObjCUtil.cpp @@ -1066,7 +1066,6 @@ Slice::ObjCGenerator::MetaDataVisitor::visitUnitStart(const UnitPtr& p) DefinitionContextPtr dc = p->findDefinitionContext(file); assert(dc); StringList globalMetaData = dc->getMetaData(); - bool emitWarnings = dc->suppressWarning("invalid-metadata"); int headerDir = 0; int dllExport = 0; for(StringList::const_iterator r = globalMetaData.begin(); r != globalMetaData.end();) @@ -1082,13 +1081,10 @@ Slice::ObjCGenerator::MetaDataVisitor::visitUnitStart(const UnitPtr& p) headerDir++; if(headerDir > 1) { - if(emitWarnings) - { - ostringstream ostr; - ostr << "ignoring invalid global metadata `" << s - << "': directive can appear only once per file"; - emitWarning(file, -1, ostr.str()); - } + ostringstream ostr; + ostr << "ignoring invalid global metadata `" << s + << "': directive can appear only once per file"; + dc->warning(InvalidMetaData, file, -1, ostr.str()); globalMetaData.remove(s); } continue; @@ -1098,23 +1094,19 @@ Slice::ObjCGenerator::MetaDataVisitor::visitUnitStart(const UnitPtr& p) dllExport++; if(dllExport > 1) { - if(emitWarnings) - { - ostringstream ostr; - ostr << "ignoring invalid global metadata `" << s - << "': directive can appear only once per file"; - emitWarning(file, -1, ostr.str()); - } + ostringstream ostr; + ostr << "ignoring invalid global metadata `" << s + << "': directive can appear only once per file"; + dc->warning(InvalidMetaData, file, -1, ostr.str()); globalMetaData.remove(s); } continue; } - if(emitWarnings) - { - ostringstream ostr; - ostr << "ignoring invalid global metadata `" << s << "'"; - emitWarning(file, -1, ostr.str()); - } + + ostringstream ostr; + ostr << "ignoring invalid global metadata `" << s << "'"; + dc->warning(InvalidMetaData, file, -1, ostr.str()); + globalMetaData.remove(s); } } diff --git a/cpp/src/slice2php/Main.cpp b/cpp/src/slice2php/Main.cpp index aace7d638ec..b0167d6a150 100644 --- a/cpp/src/slice2php/Main.cpp +++ b/cpp/src/slice2php/Main.cpp @@ -160,8 +160,8 @@ CodeVisitor::visitClassDecl(const ClassDeclPtr& p) string type = getTypeVar(p); _out << sp << nl << "global " << type << ';'; - - bool isInterface = p->isInterface(); + + bool isInterface = p->isInterface(); if(!p->isLocal() && (isInterface || p->definition()->allOperations().size() > 0)) { _out << nl << "global " << type << "Prx;"; @@ -432,8 +432,8 @@ CodeVisitor::visitClassDefStart(const ClassDefPtr& p) // const bool preserved = p->hasMetaData("preserve-slice") || p->inheritsMetaData("preserve-slice"); _out << sp << nl << type << " = IcePHP_defineClass('" << scoped << "', '" << escapeName(abs) << "', " - << p->compactId() << ", " << (preserved ? "true" : "false") << ", " - << (isInterface ? "true" : "false") << ", "; + << p->compactId() << ", " << (preserved ? "true" : "false") << ", " + << (isInterface ? "true" : "false") << ", "; if(!base || (isInterface && !p->isLocal())) { _out << "$Ice__t_Value"; @@ -578,7 +578,7 @@ CodeVisitor::visitClassDefStart(const ClassDefPtr& p) if((*t)->optional()) { _out << ", " << (*t)->tag(); - } + } _out << ')'; ++count; } @@ -763,7 +763,7 @@ CodeVisitor::visitExceptionStart(const ExceptionPtr& p) } else { - _out << getTypeVar(base); + _out << getTypeVar(base); } _out << ", "; // @@ -946,48 +946,41 @@ CodeVisitor::visitDictionary(const DictionaryPtr& p) TypePtr keyType = p->keyType(); BuiltinPtr b = BuiltinPtr::dynamicCast(keyType); - const UnitPtr unit = p->unit(); - const DefinitionContextPtr dc = unit->findDefinitionContext(p->file()); - assert(dc); - bool emitWarnings = !dc->suppressWarning("invalid-metadata"); + const UnitPtr unit = p->unit(); + const DefinitionContextPtr dc = unit->findDefinitionContext(p->file()); + assert(dc); if(b) { switch(b->kind()) { - case Slice::Builtin::KindBool: - case Slice::Builtin::KindByte: - case Slice::Builtin::KindShort: - case Slice::Builtin::KindInt: - case Slice::Builtin::KindLong: - case Slice::Builtin::KindString: - // - // These types are acceptable as dictionary keys. - // - break; + case Slice::Builtin::KindBool: + case Slice::Builtin::KindByte: + case Slice::Builtin::KindShort: + case Slice::Builtin::KindInt: + case Slice::Builtin::KindLong: + case Slice::Builtin::KindString: + // + // These types are acceptable as dictionary keys. + // + break; - case Slice::Builtin::KindFloat: - case Slice::Builtin::KindDouble: - { - if(emitWarnings) + case Slice::Builtin::KindFloat: + case Slice::Builtin::KindDouble: { - emitWarning(p->file(), p->line(), "dictionary key type not supported in PHP"); + dc->warning(InvalidMetaData, p->file(), p->line(), "dictionary key type not supported in PHP"); + break; } - break; - } - case Slice::Builtin::KindObject: - case Slice::Builtin::KindObjectProxy: - case Slice::Builtin::KindLocalObject: - case Slice::Builtin::KindValue: - assert(false); + case Slice::Builtin::KindObject: + case Slice::Builtin::KindObjectProxy: + case Slice::Builtin::KindLocalObject: + case Slice::Builtin::KindValue: + assert(false); } } else if(!EnumPtr::dynamicCast(keyType)) { - if(emitWarnings) - { - emitWarning(p->file(), p->line(), "dictionary key type not supported in PHP"); - } + dc->warning(InvalidMetaData, p->file(), p->line(), "dictionary key type not supported in PHP"); } string type = getTypeVar(p); @@ -1331,47 +1324,47 @@ CodeVisitor::writeConstantValue(const TypePtr& type, const SyntaxTreeBasePtr& va { switch(b->kind()) { - case Slice::Builtin::KindBool: - case Slice::Builtin::KindByte: - case Slice::Builtin::KindShort: - case Slice::Builtin::KindInt: - case Slice::Builtin::KindFloat: - case Slice::Builtin::KindDouble: - { - _out << value; - break; - } - case Slice::Builtin::KindLong: - { - IceUtil::Int64 l; - IceUtilInternal::stringToInt64(value, l); - // - // The platform's 'long' type may not be 64 bits, so we store 64-bit - // values as a string. - // - if(sizeof(IceUtil::Int64) > sizeof(long) && (l < LONG_MIN || l > LONG_MAX)) + case Slice::Builtin::KindBool: + case Slice::Builtin::KindByte: + case Slice::Builtin::KindShort: + case Slice::Builtin::KindInt: + case Slice::Builtin::KindFloat: + case Slice::Builtin::KindDouble: { - _out << "'" << value << "'"; + _out << value; + break; } - else + case Slice::Builtin::KindLong: { - _out << value; + IceUtil::Int64 l; + IceUtilInternal::stringToInt64(value, l); + // + // The platform's 'long' type may not be 64 bits, so we store 64-bit + // values as a string. + // + if(sizeof(IceUtil::Int64) > sizeof(long) && (l < LONG_MIN || l > LONG_MAX)) + { + _out << "'" << value << "'"; + } + else + { + _out << value; + } + break; } - break; - } - case Slice::Builtin::KindString: - { - // PHP 7.x also supports an EC6UCN-like notation, see: - // https://wiki.php.net/rfc/unicode_escape - // - _out << "\"" << toStringLiteral(value, "\f\n\r\t\v\x1b", "$", Octal, 0) << "\""; - break; - } - case Slice::Builtin::KindObject: - case Slice::Builtin::KindObjectProxy: - case Slice::Builtin::KindLocalObject: - case Slice::Builtin::KindValue: - assert(false); + case Slice::Builtin::KindString: + { + // PHP 7.x also supports an EC6UCN-like notation, see: + // https://wiki.php.net/rfc/unicode_escape + // + _out << "\"" << toStringLiteral(value, "\f\n\r\t\v\x1b", "$", Octal, 0) << "\""; + break; + } + case Slice::Builtin::KindObject: + case Slice::Builtin::KindObjectProxy: + case Slice::Builtin::KindLocalObject: + case Slice::Builtin::KindValue: + assert(false); } } else if(en) @@ -1548,14 +1541,14 @@ static void printHeader(IceUtilInternal::Output& out) { static const char* header = -"// **********************************************************************\n" -"//\n" -"// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.\n" -"//\n" -"// This copy of Ice is licensed to you under the terms described in the\n" -"// ICE_LICENSE file included in this distribution.\n" -"//\n" -"// **********************************************************************\n" + "// **********************************************************************\n" + "//\n" + "// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.\n" + "//\n" + "// This copy of Ice is licensed to you under the terms described in the\n" + "// ICE_LICENSE file included in this distribution.\n" + "//\n" + "// **********************************************************************\n" ; out << header; diff --git a/cpp/test/Ice/ami/Test.ice b/cpp/test/Ice/ami/Test.ice index c82910e4620..1e889d89149 100644 --- a/cpp/test/Ice/ami/Test.ice +++ b/cpp/test/Ice/ami/Test.ice @@ -10,7 +10,6 @@ #pragma once #include <Ice/BuiltinSequences.ice> -#include <Ice/Endpoint.ice> module Test { diff --git a/cpp/test/Ice/background/Test.ice b/cpp/test/Ice/background/Test.ice index 116f0af72f6..7751a81b12b 100644 --- a/cpp/test/Ice/background/Test.ice +++ b/cpp/test/Ice/background/Test.ice @@ -10,7 +10,6 @@ #pragma once #include <Ice/BuiltinSequences.ice> -#include <Ice/Endpoint.ice> module Test { diff --git a/cpp/test/Ice/dispatcher/Test.ice b/cpp/test/Ice/dispatcher/Test.ice index 517a190c82a..dc1d8587dde 100644 --- a/cpp/test/Ice/dispatcher/Test.ice +++ b/cpp/test/Ice/dispatcher/Test.ice @@ -10,7 +10,6 @@ #pragma once #include <Ice/BuiltinSequences.ice> -#include <Ice/Endpoint.ice> module Test { diff --git a/cpp/test/Slice/errorDetection/CaseInsensitive.err b/cpp/test/Slice/errorDetection/CaseInsensitive.err index e998a02816f..3d38ddea03f 100644 --- a/cpp/test/Slice/errorDetection/CaseInsensitive.err +++ b/cpp/test/Slice/errorDetection/CaseInsensitive.err @@ -16,10 +16,12 @@ CaseInsensitive.ice:73: operation `op' is already defined as an operation in a b CaseInsensitive.ice:78: operation `OP' differs only in capitalization from operation `op', which is defined in a base interface or class CaseInsensitive.ice:88: operation `l' is already defined as a data member in a base interface or class CaseInsensitive.ice:93: operation `L' differs only in capitalization from data member `l', which is defined in a base interface or class +CaseInsensitive.ice:93: warning: classes with operations are deprecated CaseInsensitive.ice:99: operation `L' differs only in capitalization from data member `l' CaseInsensitive.ice:99: redefinition of data member `l' as operation `L' CaseInsensitive.ice:104: data member `l' is already defined as a data member in a base interface or class CaseInsensitive.ice:109: data member `L' differs only in capitalization from data member `l', which is defined in a base interface or class +CaseInsensitive.ice:114: warning: classes with operations are deprecated CaseInsensitive.ice:115: data member `l' differs only in capitalization from operation `L' CaseInsensitive.ice:121: redefinition of exception member `l' CaseInsensitive.ice:127: exception member `L' differs only in capitalization from exception member `l' @@ -60,6 +62,7 @@ CaseInsensitive.ice:255: exception name `Test::xxx::xx::E1' is capitalized incon CaseInsensitive.ice:256: exception name `Test::xxx::XX::e1' is capitalized inconsistently with its previous name: `::Test::xxx::xx::e1' CaseInsensitive.ice:257: exception name `Test::XXX::xx::e1' is capitalized inconsistently with its previous name: `::Test::xxx::xx::e1' CaseInsensitive.ice:275: ambiguous multiple inheritance: `derived' inherits operations `op' and `OP', which differ only in capitalization, from unrelated base interfaces +CaseInsensitive.ice:290: warning: classes with operations are deprecated CaseInsensitive.ice:292: parameter `BASE1' differs only in capitalization from parameter `base1' CaseInsensitive.ice:292: `BASE1' has changed meaning CaseInsensitive.ice:322: data member `x' differs only in capitalization from data member `X', which is defined in a base interface or class diff --git a/cpp/test/Slice/errorDetection/ChangedMeaning.ice b/cpp/test/Slice/errorDetection/ChangedMeaning.ice index 13948e5c778..857ac8faf9e 100644 --- a/cpp/test/Slice/errorDetection/ChangedMeaning.ice +++ b/cpp/test/Slice/errorDetection/ChangedMeaning.ice @@ -7,7 +7,7 @@ // // ********************************************************************** - +[["suppress-warning:deprecated"]] // for classes with operations module Test { @@ -184,7 +184,7 @@ const ::Test::M1::M2::C MyConstant2 = Test::M1::M2::C2; // OK const Test::M1::M2::C MyConstant3 = ::Test::M1::M2::C2; // OK const ::Test::M1::M2::C MyConstant4 = ::Test::M1::M2::C2; // OK -class smnpTest1Class +interface smnpTest1Class { M1::smnpStruct smnpTest1Op1() throws M1::smnpException; // OK }; diff --git a/cpp/test/Slice/errorDetection/DataMemberRedefinition.ice b/cpp/test/Slice/errorDetection/DataMemberRedefinition.ice index 2cc44ea8efc..ee2d1039af5 100644 --- a/cpp/test/Slice/errorDetection/DataMemberRedefinition.ice +++ b/cpp/test/Slice/errorDetection/DataMemberRedefinition.ice @@ -7,7 +7,7 @@ // // ********************************************************************** - +[["suppress-warning:deprecated"]] // for classes with operations module Test { diff --git a/cpp/test/Slice/errorDetection/DuplicateParameter.ice b/cpp/test/Slice/errorDetection/DuplicateParameter.ice index 1419d041cb9..04eb8265c97 100644 --- a/cpp/test/Slice/errorDetection/DuplicateParameter.ice +++ b/cpp/test/Slice/errorDetection/DuplicateParameter.ice @@ -7,7 +7,7 @@ // // ********************************************************************** - +[["suppress-warning:deprecated"]] // for classes with operations module Test { diff --git a/cpp/test/Slice/errorDetection/IllegalUseOfKeyword.ice b/cpp/test/Slice/errorDetection/IllegalUseOfKeyword.ice index 39b1245dec0..eeaf2d92e69 100644 --- a/cpp/test/Slice/errorDetection/IllegalUseOfKeyword.ice +++ b/cpp/test/Slice/errorDetection/IllegalUseOfKeyword.ice @@ -7,7 +7,7 @@ // // ********************************************************************** - +[["suppress-warning:deprecated"]] // for classes with operations module Test { diff --git a/cpp/test/Slice/errorDetection/OperationRedefinition.ice b/cpp/test/Slice/errorDetection/OperationRedefinition.ice index 65e6b744e1a..168de0b6d8d 100644 --- a/cpp/test/Slice/errorDetection/OperationRedefinition.ice +++ b/cpp/test/Slice/errorDetection/OperationRedefinition.ice @@ -7,7 +7,7 @@ // // ********************************************************************** - +[["suppress-warning:deprecated"]] // for classes with operations module Test { diff --git a/cpp/test/Slice/errorDetection/RedefinitionAsDataMember.ice b/cpp/test/Slice/errorDetection/RedefinitionAsDataMember.ice index 6285b0ef494..6c9d7a69429 100644 --- a/cpp/test/Slice/errorDetection/RedefinitionAsDataMember.ice +++ b/cpp/test/Slice/errorDetection/RedefinitionAsDataMember.ice @@ -7,7 +7,7 @@ // // ********************************************************************** - +[["suppress-warning:deprecated"]] // for classes with operations module Test { diff --git a/csharp/test/Ice/background/Test.ice b/csharp/test/Ice/background/Test.ice index a765b9434d3..5ac71d127f4 100644 --- a/csharp/test/Ice/background/Test.ice +++ b/csharp/test/Ice/background/Test.ice @@ -10,7 +10,6 @@ #pragma once #include <Ice/BuiltinSequences.ice> -#include <Ice/Endpoint.ice> module Test { diff --git a/java-compat/test/src/main/java/test/Ice/ami/Test.ice b/java-compat/test/src/main/java/test/Ice/ami/Test.ice index bbc4d908d65..c6a72decd11 100644 --- a/java-compat/test/src/main/java/test/Ice/ami/Test.ice +++ b/java-compat/test/src/main/java/test/Ice/ami/Test.ice @@ -10,7 +10,6 @@ #pragma once #include <Ice/BuiltinSequences.ice> -#include <Ice/Endpoint.ice> [["java:package:test.Ice.ami"]] module Test diff --git a/java-compat/test/src/main/java/test/Ice/background/Test.ice b/java-compat/test/src/main/java/test/Ice/background/Test.ice index 5239c5b7075..753f2d959c4 100644 --- a/java-compat/test/src/main/java/test/Ice/background/Test.ice +++ b/java-compat/test/src/main/java/test/Ice/background/Test.ice @@ -10,7 +10,6 @@ #pragma once #include <Ice/BuiltinSequences.ice> -#include <Ice/Endpoint.ice> [["java:package:test.Ice.background"]] module Test diff --git a/java/test/src/main/java/test/Ice/ami/Test.ice b/java/test/src/main/java/test/Ice/ami/Test.ice index bbc4d908d65..c6a72decd11 100644 --- a/java/test/src/main/java/test/Ice/ami/Test.ice +++ b/java/test/src/main/java/test/Ice/ami/Test.ice @@ -10,7 +10,6 @@ #pragma once #include <Ice/BuiltinSequences.ice> -#include <Ice/Endpoint.ice> [["java:package:test.Ice.ami"]] module Test diff --git a/java/test/src/main/java/test/Ice/background/Test.ice b/java/test/src/main/java/test/Ice/background/Test.ice index 5239c5b7075..753f2d959c4 100644 --- a/java/test/src/main/java/test/Ice/background/Test.ice +++ b/java/test/src/main/java/test/Ice/background/Test.ice @@ -10,7 +10,6 @@ #pragma once #include <Ice/BuiltinSequences.ice> -#include <Ice/Endpoint.ice> [["java:package:test.Ice.background"]] module Test diff --git a/js/test/Ice/ami/Test.ice b/js/test/Ice/ami/Test.ice index 67a480378d8..a9c4ffb88bc 100644 --- a/js/test/Ice/ami/Test.ice +++ b/js/test/Ice/ami/Test.ice @@ -10,7 +10,6 @@ #pragma once #include <Ice/BuiltinSequences.ice> -#include <Ice/Endpoint.ice> module Test { diff --git a/python/test/Ice/ami/Test.ice b/python/test/Ice/ami/Test.ice index 9787dd9a1fc..a1d4367d5f1 100644 --- a/python/test/Ice/ami/Test.ice +++ b/python/test/Ice/ami/Test.ice @@ -10,7 +10,6 @@ #pragma once #include <Ice/BuiltinSequences.ice> -#include <Ice/Endpoint.ice> module Test { |