Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove --ice/--underscore compiler options #1631

Merged
merged 4 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 3 additions & 19 deletions cpp/src/Slice/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5934,10 +5934,9 @@ Slice::DataMember::DataMember(const ContainerPtr& container, const string& name,
// ----------------------------------------------------------------------

UnitPtr
Slice::Unit::createUnit(bool ignRedefs, bool all, bool allowIcePrefix, bool allowUnderscore,
const StringList& defaultGlobalMetadata)
Slice::Unit::createUnit(bool ignRedefs, bool all, const StringList& defaultGlobalMetadata)
{
return new Unit(ignRedefs, all, allowIcePrefix, allowUnderscore, defaultGlobalMetadata);
return new Unit(ignRedefs, all, defaultGlobalMetadata);
}

bool
Expand All @@ -5946,18 +5945,6 @@ Slice::Unit::ignRedefs() const
return _ignRedefs;
}

bool
Slice::Unit::allowIcePrefix() const
{
return _allowIcePrefix;
}

bool
Slice::Unit::allowUnderscore() const
{
return _allowUnderscore;
}

void
Slice::Unit::setComment(const string& comment)
{
Expand Down Expand Up @@ -6544,14 +6531,11 @@ Slice::Unit::getTopLevelModules(const string& file) const
}
}

Slice::Unit::Unit(bool ignRedefs, bool all, bool allowIcePrefix, bool allowUnderscore,
const StringList& defaultGlobalMetadata) :
Slice::Unit::Unit(bool ignRedefs, bool all, const StringList& defaultGlobalMetadata) :
SyntaxTreeBase(0),
Container(0),
_ignRedefs(ignRedefs),
_all(all),
_allowIcePrefix(allowIcePrefix),
_allowUnderscore(allowUnderscore),
_defaultGlobalMetaData(defaultGlobalMetadata),
_errors(0),
_currentIncludeLevel(0)
Expand Down
8 changes: 2 additions & 6 deletions cpp/src/Slice/Parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -1085,11 +1085,9 @@ class Unit : public virtual Container
{
public:

static UnitPtr createUnit(bool, bool, bool, bool, const StringList& = StringList());
static UnitPtr createUnit(bool, bool, const StringList& = StringList());

bool ignRedefs() const;
bool allowIcePrefix() const;
bool allowUnderscore() const;

void setComment(const std::string&);
void addToComment(const std::string&);
Expand Down Expand Up @@ -1153,13 +1151,11 @@ class Unit : public virtual Container

private:

Unit(bool, bool, bool, bool, const StringList&);
Unit(bool, bool, const StringList&);
static void eraseWhiteSpace(::std::string&);

bool _ignRedefs;
bool _all;
bool _allowIcePrefix;
bool _allowUnderscore;
StringList _defaultGlobalMetaData;
int _errors;
std::string _currentComment;
Expand Down
10 changes: 2 additions & 8 deletions cpp/src/Slice/Python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,6 @@ Slice::Python::compile(const vector<string>& argv)
opts.addOpt("", "depend-xml");
opts.addOpt("", "depend-file", IceUtilInternal::Options::NeedArg, "");
opts.addOpt("d", "debug");
opts.addOpt("", "ice");
opts.addOpt("", "underscore");
opts.addOpt("", "all");
opts.addOpt("", "no-package");
opts.addOpt("", "build-package");
Expand Down Expand Up @@ -534,10 +532,6 @@ Slice::Python::compile(const vector<string>& argv)

bool debug = opts.isSet("debug");

bool ice = opts.isSet("ice");

bool underscore = opts.isSet("underscore");

bool all = opts.isSet("all");

bool noPackage = opts.isSet("no-package");
Expand Down Expand Up @@ -607,7 +601,7 @@ Slice::Python::compile(const vector<string>& argv)
return EXIT_FAILURE;
}

UnitPtr u = Unit::createUnit(false, false, ice, underscore);
UnitPtr u = Unit::createUnit(false, false);
int parseStatus = u->parse(*i, cppHandle, debug);
u->destroy();

Expand Down Expand Up @@ -654,7 +648,7 @@ Slice::Python::compile(const vector<string>& argv)
}
else
{
UnitPtr u = Unit::createUnit(false, all, ice, underscore);
UnitPtr u = Unit::createUnit(false, all);
int parseStatus = u->parse(*i, cppHandle, debug);

if(!icecpp->close())
Expand Down
14 changes: 2 additions & 12 deletions cpp/src/Slice/Ruby.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ usage(const string& n)
"--depend-xml Generate dependencies in XML format.\n"
"--depend-file FILE Write dependencies to FILE instead of standard output.\n"
"--all Generate code for Slice definitions in included files.\n"
"--ice Allow reserved Ice prefix in Slice identifiers\n"
" deprecated: use instead [[\"ice-prefix\"]] metadata.\n"
"--underscore Allow underscores in Slice identifiers\n"
" deprecated: use instead [[\"underscore\"]] metadata.\n"
;
}

Expand All @@ -95,8 +91,6 @@ Slice::Ruby::compile(const vector<string>& argv)
opts.addOpt("", "depend-xml");
opts.addOpt("", "depend-file", IceUtilInternal::Options::NeedArg, "");
opts.addOpt("d", "debug");
opts.addOpt("", "ice");
opts.addOpt("", "underscore");
opts.addOpt("", "all");

vector<string> args;
Expand Down Expand Up @@ -154,10 +148,6 @@ Slice::Ruby::compile(const vector<string>& argv)

bool debug = opts.isSet("debug");

bool ice = opts.isSet("ice");

bool underscore = opts.isSet("underscore");

bool all = opts.isSet("all");

if(args.empty())
Expand Down Expand Up @@ -206,7 +196,7 @@ Slice::Ruby::compile(const vector<string>& argv)
return EXIT_FAILURE;
}

UnitPtr u = Unit::createUnit(false, false, ice, underscore);
UnitPtr u = Unit::createUnit(false, false);
int parseStatus = u->parse(*i, cppHandle, debug);
u->destroy();

Expand Down Expand Up @@ -253,7 +243,7 @@ Slice::Ruby::compile(const vector<string>& argv)
}
else
{
UnitPtr u = Unit::createUnit(false, all, ice, underscore);
UnitPtr u = Unit::createUnit(false, all);
int parseStatus = u->parse(*i, cppHandle, debug);

if(!icecpp->close())
Expand Down
27 changes: 0 additions & 27 deletions cpp/src/Slice/Scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3223,33 +3223,6 @@ int checkIdentifier(const string& id)
{
unit->error("illegal double underscore in identifier `" + name + "'");
}
else if(index != string::npos && unit->currentIncludeLevel() == 0 && !unit->allowUnderscore())
{
DefinitionContextPtr dc = unit->currentDefinitionContext();
assert(dc);
if(dc->findMetaData("underscore") != "underscore") // no 'underscore' file metadata
{
unit->error("illegal underscore in identifier `" + name + "'");
}
}

// Check the identifier for illegal ice prefixes
if(unit->currentIncludeLevel() == 0 && !unit->allowIcePrefix() && name.size() > 2)
{
DefinitionContextPtr dc = unit->currentDefinitionContext();
assert(dc);
if(dc->findMetaData("ice-prefix") != "ice-prefix") // no 'ice-prefix' metadata
{
string prefix3;
prefix3 += ::tolower(static_cast<unsigned char>(name[0]));
prefix3 += ::tolower(static_cast<unsigned char>(name[1]));
prefix3 += ::tolower(static_cast<unsigned char>(name[2]));
if(prefix3 == "ice")
{
unit->error("illegal identifier `" + name + "': `" + name.substr(0, 3) + "' prefix is reserved");
}
}
}

return isScoped ? ICE_SCOPED_IDENTIFIER : ICE_IDENTIFIER;
}
Expand Down
28 changes: 0 additions & 28 deletions cpp/src/Slice/Scanner.l
Original file line number Diff line number Diff line change
Expand Up @@ -618,34 +618,6 @@ int checkIdentifier(const string& id)
{
unit->error("illegal double underscore in identifier `" + name + "'");
}
else if(index != string::npos && unit->currentIncludeLevel() == 0 && !unit->allowUnderscore())
{
DefinitionContextPtr dc = unit->currentDefinitionContext();
assert(dc);
if(dc->findMetaData("underscore") != "underscore") // no 'underscore' file metadata
{
unit->error("illegal underscore in identifier `" + name + "'");
}
}

// Check the identifier for illegal ice prefixes
if(unit->currentIncludeLevel() == 0 && !unit->allowIcePrefix() && name.size() > 2)
{
DefinitionContextPtr dc = unit->currentDefinitionContext();
assert(dc);
if(dc->findMetaData("ice-prefix") != "ice-prefix") // no 'ice-prefix' metadata
{
string prefix3;
prefix3 += ::tolower(static_cast<unsigned char>(name[0]));
prefix3 += ::tolower(static_cast<unsigned char>(name[1]));
prefix3 += ::tolower(static_cast<unsigned char>(name[2]));
if(prefix3 == "ice")
{
unit->error("illegal identifier `" + name + "': `" + name.substr(0, 3) + "' prefix is reserved");
}
}
}

return isScoped ? ICE_SCOPED_IDENTIFIER : ICE_IDENTIFIER;
}

Expand Down
12 changes: 1 addition & 11 deletions cpp/src/ice2slice/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ usage(const string& n)
"--output-dir DIR Create files in the directory DIR.\n"
"-d, --debug Print debug messages.\n"
"--validate Validate command line options.\n"
"--ice Allow reserved Ice prefix in Slice identifiers\n"
" deprecated: use instead [[\"ice-prefix\"]] metadata.\n"
"--underscore Allow underscores in Slice identifiers\n"
" deprecated: use instead [[\"underscore\"]] metadata.\n"
;
}

Expand All @@ -86,8 +82,6 @@ compile(const vector<string>& argv)
opts.addOpt("E");
opts.addOpt("", "output-dir", IceUtilInternal::Options::NeedArg);
opts.addOpt("d", "debug");
opts.addOpt("", "ice");
opts.addOpt("", "underscore");

bool validate = find(argv.begin(), argv.end(), "--validate") != argv.end();

Expand Down Expand Up @@ -143,10 +137,6 @@ compile(const vector<string>& argv)

bool debug = opts.isSet("debug");

bool ice = opts.isSet("ice");

bool underscore = opts.isSet("underscore");

if(args.empty())
{
consoleErr << argv[0] << ": error: no input file" << endl;
Expand Down Expand Up @@ -207,7 +197,7 @@ compile(const vector<string>& argv)
}
else
{
UnitPtr p = Unit::createUnit(false, false, ice, underscore);
UnitPtr p = Unit::createUnit(false, false);
int parseStatus = p->parse(*i, cppHandle, debug);

if(!icecpp->close())
Expand Down
5 changes: 2 additions & 3 deletions cpp/src/slice2cpp/Gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ emitOpNameResult(IceUtilInternal::Output& H, const OperationPtr& p, int useWstri
Slice::Gen::Gen(const string& base, const string& headerExtension, const string& sourceExtension,
const vector<string>& extraHeaders, const string& include,
const vector<string>& includePaths, const string& dllExport, const string& dir,
bool implCpp98, bool implCpp11, bool ice) :
bool implCpp98, bool implCpp11) :
_base(base),
_headerExtension(headerExtension),
_implHeaderExtension(headerExtension),
Expand All @@ -671,8 +671,7 @@ Slice::Gen::Gen(const string& base, const string& headerExtension, const string&
_dllExport(dllExport),
_dir(dir),
_implCpp98(implCpp98),
_implCpp11(implCpp11),
_ice(ice)
_implCpp11(implCpp11)
{
for(vector<string>::iterator p = _includePaths.begin(); p != _includePaths.end(); ++p)
{
Expand Down
2 changes: 0 additions & 2 deletions cpp/src/slice2cpp/Gen.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class Gen : private ::IceUtil::noncopyable
const std::string&,
const std::string&,
bool,
bool,
bool);
~Gen();

Expand Down Expand Up @@ -67,7 +66,6 @@ class Gen : private ::IceUtil::noncopyable
std::string _dir;
bool _implCpp98;
bool _implCpp11;
bool _ice;

class TypesVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
Expand Down
16 changes: 3 additions & 13 deletions cpp/src/slice2cpp/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@ usage(const string& n)
"--impl-c++98 Generate sample implementations for C++98 mapping.\n"
"--dll-export SYMBOL Use SYMBOL for DLL exports\n"
" deprecated: use instead [[\"cpp:dll-export:SYMBOL\"]] metadata.\n"
"--ice Allow reserved Ice prefix in Slice identifiers\n"
" deprecated: use instead [[\"ice-prefix\"]] metadata.\n"
"--underscore Allow underscores in Slice identifiers\n"
" deprecated: use instead [[\"underscore\"]] metadata.\n"
;
}

Expand All @@ -108,8 +104,6 @@ compile(const vector<string>& argv)
opts.addOpt("", "depend-xml");
opts.addOpt("", "depend-file", IceUtilInternal::Options::NeedArg, "");
opts.addOpt("d", "debug");
opts.addOpt("", "ice");
opts.addOpt("", "underscore");

bool validate = find(argv.begin(), argv.end(), "--validate") != argv.end();
vector<string> args;
Expand Down Expand Up @@ -184,10 +178,6 @@ compile(const vector<string>& argv)

bool debug = opts.isSet("debug");

bool ice = opts.isSet("ice");

bool underscore = opts.isSet("underscore");

if(args.empty())
{
consoleErr << argv[0] << ": error: no input file" << endl;
Expand Down Expand Up @@ -255,7 +245,7 @@ compile(const vector<string>& argv)
return EXIT_FAILURE;
}

UnitPtr u = Unit::createUnit(false, false, ice, underscore);
UnitPtr u = Unit::createUnit(false, false);
int parseStatus = u->parse(*i, cppHandle, debug);

string ext = headerExtension;
Expand Down Expand Up @@ -313,7 +303,7 @@ compile(const vector<string>& argv)
}
else
{
UnitPtr u = Unit::createUnit(false, false, ice, underscore);
UnitPtr u = Unit::createUnit(false, false);
int parseStatus = u->parse(*i, cppHandle, debug);

if(!icecpp->close())
Expand All @@ -331,7 +321,7 @@ compile(const vector<string>& argv)
try
{
Gen gen(icecpp->getBaseName(), headerExtension, sourceExtension, extraHeaders, include,
includePaths, dllExport, output, implCpp98, implCpp11, ice);
includePaths, dllExport, output, implCpp98, implCpp11);
gen.generate(u);
}
catch(const Slice::FileException& ex)
Expand Down
Loading