Remove -cppcast and -nocppcast command line options

The -cppcast option is still turned on by default. The -nocppcast option
to turn off the use of c++ casts (const_cast, static_cast etc) has been
removed. However, defining SWIG_NO_CPLUSPLUS_CAST will still generate C casts
instead of C++ casts for C++ wrappers.

This a revert of commit fc79264a48:
"Revert "Remove -cppcast and -nocppcast command line options""

The Scilab and Javascript casting problems are now fixed, so -cppcast
is now switched on as default.
This commit is contained in:
William S Fulton 2018-11-13 07:36:09 +00:00
commit 027a38c71c
7 changed files with 45 additions and 87 deletions

View file

@ -131,12 +131,10 @@ enum autodoc_t {
static const char *usage = "\
Ruby Options (available with -ruby)\n\
-autorename - Enable renaming of classes and methods to follow Ruby coding standards\n\
-cppcast - Enable C++ casting operators (default)\n\
-globalmodule - Wrap everything into the global module\n\
-initname <name>- Set entry function to Init_<name> (used by `require')\n\
-minherit - Attempt to support multiple inheritance\n\
-noautorename - Disable renaming of classes and methods (default)\n\
-nocppcast - Disable C++ casting operators, useful for generating bugs\n\
-prefix <name> - Set a prefix <name> to be prepended to all names\n\
";
@ -844,7 +842,6 @@ public:
virtual void main(int argc, char *argv[]) {
int cppcast = 1;
int autorename = 0;
/* Set location of SWIG library */
@ -883,12 +880,6 @@ public:
multipleInheritance = true;
director_multiple_inheritance = 1;
Swig_mark_arg(i);
} else if (strcmp(argv[i], "-cppcast") == 0) {
cppcast = 1;
Swig_mark_arg(i);
} else if (strcmp(argv[i], "-nocppcast") == 0) {
cppcast = 0;
Swig_mark_arg(i);
} else if (strcmp(argv[i], "-autorename") == 0) {
autorename = 1;
Swig_mark_arg(i);
@ -907,15 +898,17 @@ public:
}
} else if (strcmp(argv[i], "-help") == 0) {
Printf(stdout, "%s\n", usage);
} else if (strcmp(argv[i], "-cppcast") == 0) {
Printf(stderr, "Deprecated command line option: %s. This option is now always on.\n", argv[i]);
Swig_mark_arg(i);
} else if (strcmp(argv[i], "-nocppcast") == 0) {
Printf(stderr, "Deprecated command line option: %s. This option is no longer supported.\n", argv[i]);
Swig_mark_arg(i);
SWIG_exit(EXIT_FAILURE);
}
}
}
if (cppcast) {
/* Turn on cppcast mode */
Preprocessor_define((DOH *) "SWIG_CPLUSPLUS_CAST", 0);
}
if (autorename) {
/* Turn on the autorename mode */
Preprocessor_define((DOH *) "SWIG_RUBY_AUTORENAME", 0);