aboutsummaryrefslogtreecommitdiff
path: root/Source/Modules/main.cxx
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2013-12-12 20:44:08 +0000
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2013-12-12 20:52:44 +0000
commit2121e1217eae19a0a3e852fc52c89f55faf7e20a (patch)
tree2ec3b78d0b5252b5ce76b048336afe3920608b20 /Source/Modules/main.cxx
parent3b4d33131096949e5dc3800a96760e096555db6b (diff)
downloadswig-2121e1217eae19a0a3e852fc52c89f55faf7e20a.tar.gz
Ensure -c++out is not used with -c++
Error checking for this combination implemented as well as correcting Octave Also refactor, replacing CPlusPlusOut variable with cparse_cplusplusout for an implementation which more closely resembles cparse_cplusplus which is also required in both .c and .cxx files.
Diffstat (limited to 'Source/Modules/main.cxx')
-rw-r--r--Source/Modules/main.cxx12
1 files changed, 7 insertions, 5 deletions
diff --git a/Source/Modules/main.cxx b/Source/Modules/main.cxx
index aa7e83ef8..f3aff2349 100644
--- a/Source/Modules/main.cxx
+++ b/Source/Modules/main.cxx
@@ -29,10 +29,6 @@
static Language *lang = 0; // Language method
int CPlusPlus = 0;
-extern "C"
-{
- int CPlusPlusOut = 0; // Generate C++ compatible code when wrapping C code
-}
int Extend = 0; // Extend flag
int ForceExtern = 0; // Force extern mode
int GenerateDefault = 1; // Generate default constructors
@@ -488,7 +484,8 @@ void SWIG_getoptions(int argc, char *argv[]) {
Swig_cparse_cplusplus(1);
Swig_mark_arg(i);
} else if (strcmp(argv[i], "-c++out") == 0) {
- CPlusPlusOut = 1;
+ // Undocumented
+ Swig_cparse_cplusplusout(1);
Swig_mark_arg(i);
} else if (strcmp(argv[i], "-fcompact") == 0) {
Wrapper_compact_print_mode_set(1);
@@ -955,6 +952,11 @@ int SWIG_main(int argc, char *argv[], Language *l) {
// Don't check for an input file if -external-runtime is passed
Swig_check_options(external_runtime ? 0 : 1);
+ if (CPlusPlus && cparse_cplusplusout) {
+ Printf(stderr, "The -c++out option is for C input but C++ input has been requested via -c++\n");
+ SWIG_exit(EXIT_FAILURE);
+ }
+
install_opts(argc, argv);
// Add language dependent directory to the search path