mirror of https://github.com/swig/swig
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 fc79264a48f186f8bbd367e91fa9dbf9758aa092: "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:
parent
c0481ce99d
commit
027a38c71c
|
@ -31,7 +31,7 @@
|
|||
%as_voidptrptr(a) reinterpret_cast<void **>(a)
|
||||
|
||||
or their C unsafe versions. In C++ we use the safe version unless
|
||||
SWIG_NO_CPLUSPLUS_CAST is defined (usually via the -nocppcast swig flag).
|
||||
SWIG_NO_CPLUSPLUS_CAST is defined
|
||||
|
||||
|
||||
Memory allocation:
|
||||
|
@ -123,14 +123,7 @@ nocppval
|
|||
* Casting operators
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#if defined(SWIG_NO_CPLUSPLUS_CAST)
|
||||
/* Disable 'modern' cplusplus casting operators */
|
||||
# if defined(SWIG_CPLUSPLUS_CAST)
|
||||
# undef SWIG_CPLUSPLUS_CAST
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus) && defined(SWIG_CPLUSPLUS_CAST)
|
||||
#if defined(__cplusplus) && !defined(SWIG_NO_CPLUSPLUS_CAST)
|
||||
# define %const_cast(a,Type...) const_cast< Type >(a)
|
||||
# define %static_cast(a,Type...) static_cast< Type >(a)
|
||||
# define %reinterpret_cast(a,Type...) reinterpret_cast< Type >(a)
|
||||
|
|
|
@ -19,10 +19,8 @@ static String *op_prefix = 0;
|
|||
|
||||
static const char *usage = "\
|
||||
Octave Options (available with -octave)\n\
|
||||
-cppcast - Enable C++ casting operators (default)\n\
|
||||
-globals <name> - Set <name> used to access C global variables [default: 'cvar']\n\
|
||||
Use '.' to load C global variables into module namespace\n\
|
||||
-nocppcast - Disable C++ casting operators\n\
|
||||
-opprefix <str> - Prefix <str> for global operator functions [default: 'op_']\n\
|
||||
\n";
|
||||
|
||||
|
@ -92,8 +90,7 @@ public:
|
|||
}
|
||||
|
||||
virtual void main(int argc, char *argv[]) {
|
||||
int cppcast = 1;
|
||||
|
||||
|
||||
for (int i = 1; i < argc; i++) {
|
||||
if (argv[i]) {
|
||||
if (strcmp(argv[i], "-help") == 0) {
|
||||
|
@ -116,12 +113,13 @@ public:
|
|||
} else {
|
||||
Swig_arg_error();
|
||||
}
|
||||
} 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], "-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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -130,8 +128,6 @@ public:
|
|||
global_name = NewString("cvar");
|
||||
if (!op_prefix)
|
||||
op_prefix = NewString("op_");
|
||||
if(cppcast)
|
||||
Preprocessor_define((DOH *) "SWIG_CPLUSPLUS_CAST", 0);
|
||||
|
||||
SWIG_library_directory("octave");
|
||||
Preprocessor_define("SWIGOCTAVE 1", 0);
|
||||
|
|
|
@ -19,8 +19,6 @@ static const char *usage = "\
|
|||
Perl5 Options (available with -perl5)\n\
|
||||
-compat - Compatibility mode\n\
|
||||
-const - Wrap constants as constants and not variables (implies -proxy)\n\
|
||||
-cppcast - Enable C++ casting operators\n\
|
||||
-nocppcast - Disable C++ casting operators, useful for generating bugs\n\
|
||||
-nopm - Do not generate the .pm file\n\
|
||||
-noproxy - Don't create proxy classes\n\
|
||||
-proxy - Create proxy classes\n\
|
||||
|
@ -148,7 +146,6 @@ public:
|
|||
|
||||
virtual void main(int argc, char *argv[]) {
|
||||
int i = 1;
|
||||
int cppcast = 1;
|
||||
|
||||
SWIG_library_directory("perl5");
|
||||
|
||||
|
@ -189,25 +186,22 @@ public:
|
|||
} else if (strcmp(argv[i],"-v") == 0) {
|
||||
Swig_mark_arg(i);
|
||||
verbose++;
|
||||
} 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], "-compat") == 0) {
|
||||
compat = 1;
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i], "-help") == 0) {
|
||||
fputs(usage, stdout);
|
||||
} 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) {
|
||||
Preprocessor_define((DOH *) "SWIG_CPLUSPLUS_CAST", 0);
|
||||
}
|
||||
|
||||
Preprocessor_define("SWIGPERL 1", 0);
|
||||
// SWIGPERL5 is deprecated, and no longer documented.
|
||||
Preprocessor_define("SWIGPERL5 1", 0);
|
||||
|
|
|
@ -110,7 +110,6 @@ static const char *usage1 = "\
|
|||
Python Options (available with -python)\n\
|
||||
-builtin - Create new python built-in types, rather than proxy classes, for better performance\n\
|
||||
-castmode - Enable the casting mode, which allows implicit cast between types in python\n\
|
||||
-cppcast - Enable C++ casting operators (default) \n\
|
||||
-dirvtable - Generate a pseudo virtual table for directors for faster dispatch \n\
|
||||
-doxygen - Convert C++ doxygen comments to pydoc comments in proxy classes \n\
|
||||
-debug-doxygen-parser - Display doxygen parser module debugging information\n\
|
||||
|
@ -123,7 +122,6 @@ Python Options (available with -python)\n\
|
|||
static const char *usage2 = "\
|
||||
-newvwm - New value wrapper mode, use only when everything else fails \n\
|
||||
-nocastmode - Disable the casting mode (default)\n\
|
||||
-nocppcast - Disable C++ casting operators, useful for generating bugs\n\
|
||||
-nodirvtable - Don't use the virtual table feature, resolve the python method each time (default)\n\
|
||||
-noexcept - No automatic exception handling\n\
|
||||
-noextranative - Don't use extra native C++ wraps for std containers when possible (default) \n\
|
||||
|
@ -310,7 +308,6 @@ public:
|
|||
* ------------------------------------------------------------ */
|
||||
|
||||
virtual void main(int argc, char *argv[]) {
|
||||
int cppcast = 1;
|
||||
|
||||
SWIG_library_directory("python");
|
||||
|
||||
|
@ -350,12 +347,6 @@ public:
|
|||
use_kw = 1;
|
||||
SWIG_cparse_set_compact_default_args(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], "-outputtuple") == 0) {
|
||||
outputtuple = 1;
|
||||
Swig_mark_arg(i);
|
||||
|
@ -443,7 +434,8 @@ public:
|
|||
} else if (strcmp(argv[i], "-relativeimport") == 0) {
|
||||
relativeimport = 1;
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i], "-fastinit") == 0 ||
|
||||
} else if (strcmp(argv[i], "-cppcast") == 0 ||
|
||||
strcmp(argv[i], "-fastinit") == 0 ||
|
||||
strcmp(argv[i], "-fastquery") == 0 ||
|
||||
strcmp(argv[i], "-fastunpack") == 0 ||
|
||||
strcmp(argv[i], "-modern") == 0 ||
|
||||
|
@ -451,8 +443,9 @@ public:
|
|||
strcmp(argv[i], "-noproxydel") == 0 ||
|
||||
strcmp(argv[i], "-safecstrings") == 0) {
|
||||
Printf(stderr, "Deprecated command line option: %s. This option is now always on.\n", argv[i]);
|
||||
} else if (strcmp(argv[i], "-buildnone") == 0 ||
|
||||
strcmp(argv[i], "-aliasobj0") == 0 ||
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i], "-aliasobj0") == 0 ||
|
||||
strcmp(argv[i], "-buildnone") == 0 ||
|
||||
strcmp(argv[i], "-classic") == 0 ||
|
||||
strcmp(argv[i], "-classptr") == 0 ||
|
||||
strcmp(argv[i], "-new_repr") == 0 ||
|
||||
|
@ -460,6 +453,7 @@ public:
|
|||
strcmp(argv[i], "-newrepr") == 0 ||
|
||||
strcmp(argv[i], "-noaliasobj0") == 0 ||
|
||||
strcmp(argv[i], "-nobuildnone") == 0 ||
|
||||
strcmp(argv[i], "-nocppcast") == 0 ||
|
||||
strcmp(argv[i], "-nofastinit") == 0 ||
|
||||
strcmp(argv[i], "-nofastquery") == 0 ||
|
||||
strcmp(argv[i], "-nomodern") == 0 ||
|
||||
|
@ -469,16 +463,13 @@ public:
|
|||
strcmp(argv[i], "-oldrepr") == 0 ||
|
||||
strcmp(argv[i], "-proxydel") == 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) {
|
||||
Preprocessor_define((DOH *) "SWIG_CPLUSPLUS_CAST", 0);
|
||||
}
|
||||
|
||||
if (doxygen)
|
||||
doxygenTranslator = new PyDocConverter(doxygen_translator_flags);
|
||||
|
||||
|
|
|
@ -208,7 +208,6 @@ static void writeListByLine(List *l, File *out, bool quote = 0) {
|
|||
static const char *usage = "\
|
||||
R Options (available with -r)\n\
|
||||
-copystruct - Emit R code to copy C structs (on by default)\n\
|
||||
-cppcast - Enable C++ casting operators (default) \n\
|
||||
-debug - Output debug\n\
|
||||
-dll <name> - Name of the DLL (without the .dll or .so suffix).\n\
|
||||
Default is the module name.\n\
|
||||
|
@ -2695,7 +2694,6 @@ String * R::runtimeCode() {
|
|||
Use Swig_mark_arg() to tell SWIG that it is understood and not to throw an error.
|
||||
**/
|
||||
void R::main(int argc, char *argv[]) {
|
||||
bool cppcast = true;
|
||||
init();
|
||||
Preprocessor_define("SWIGR 1", 0);
|
||||
SWIG_library_directory("r");
|
||||
|
@ -2739,12 +2737,6 @@ void R::main(int argc, char *argv[]) {
|
|||
} else if(!strcmp(argv[i], "-debug")) {
|
||||
debugMode = true;
|
||||
Swig_mark_arg(i);
|
||||
} else if (!strcmp(argv[i],"-cppcast")) {
|
||||
cppcast = true;
|
||||
Swig_mark_arg(i);
|
||||
} else if (!strcmp(argv[i],"-nocppcast")) {
|
||||
cppcast = false;
|
||||
Swig_mark_arg(i);
|
||||
} else if (!strcmp(argv[i],"-copystruct")) {
|
||||
copyStruct = true;
|
||||
Swig_mark_arg(i);
|
||||
|
@ -2763,10 +2755,13 @@ void R::main(int argc, char *argv[]) {
|
|||
} else if (!strcmp(argv[i], "-noaggressivegc")) {
|
||||
aggressiveGc = false;
|
||||
Swig_mark_arg(i);
|
||||
}
|
||||
|
||||
if (cppcast) {
|
||||
Preprocessor_define((DOH *) "SWIG_CPLUSPLUS_CAST", 0);
|
||||
} 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 (debugMode) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -76,7 +76,6 @@ public:
|
|||
* ------------------------------------------------------------ */
|
||||
|
||||
virtual void main(int argc, char *argv[]) {
|
||||
int cppcast = 1;
|
||||
|
||||
SWIG_library_directory("tcl");
|
||||
|
||||
|
@ -106,22 +105,19 @@ public:
|
|||
} else if (strcmp(argv[i], "-nosafe") == 0) {
|
||||
nosafe = 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], "-help") == 0) {
|
||||
fputs(usage, stdout);
|
||||
} 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) {
|
||||
Preprocessor_define((DOH *) "SWIG_CPLUSPLUS_CAST", 0);
|
||||
}
|
||||
|
||||
Preprocessor_define("SWIGTCL 1", 0);
|
||||
// SWIGTCL8 is deprecated, and no longer documented.
|
||||
Preprocessor_define("SWIGTCL8 1", 0);
|
||||
|
|
Loading…
Reference in New Issue