summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlly Betts <olly@survex.com>2019-01-31 11:46:29 +1300
committerOlly Betts <olly@survex.com>2019-02-01 12:57:00 +1300
commitec72026285729f5b73f85505a1fd44263816d739 (patch)
treebb53e73b77a4394f53cb1c644a6d9938fbb2e872
parent50a80e6ee35fb0a45c17bf63afbbe450c9783174 (diff)
downloadswig-ec72026285729f5b73f85505a1fd44263816d739.tar.gz
Stop defaulting to Tcl
SWIG now requires a target language to be specified instead of defaulting to wrapping for Tcl. Specifying swig --help without a target language now just shows the generic help. The -nolang option has been removed.
-rw-r--r--CHANGES.current6
-rw-r--r--Source/Modules/main.cxx13
-rw-r--r--Source/Modules/swigmain.cxx13
-rw-r--r--configure.ac3
4 files changed, 16 insertions, 19 deletions
diff --git a/CHANGES.current b/CHANGES.current
index 80c467a17..8965355de 100644
--- a/CHANGES.current
+++ b/CHANGES.current
@@ -7,6 +7,12 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
Version 4.0.0 (in progress)
===========================
+2019-01-31: olly
+ SWIG now requires a target language to be specified instead of
+ defaulting to wrapping for Tcl. Specifying swig --help without
+ a target language now just shows the generic help. The -nolang
+ option has been removed.
+
2019-01-28: ZackerySpytz
[OCaml] #1429 Remove support for OCaml versions < 3.12.0.
diff --git a/Source/Modules/main.cxx b/Source/Modules/main.cxx
index 063275e3b..e94e36cac 100644
--- a/Source/Modules/main.cxx
+++ b/Source/Modules/main.cxx
@@ -890,7 +890,9 @@ int SWIG_main(int argc, char *argv[], Language *l) {
// Initialize the preprocessor
Preprocessor_init();
- lang = l;
+ // Set lang to a dummy value if no target language was specified so we
+ // can process options enough to handle -version, etc.
+ lang = l ? l : new Language;
// Set up some default symbols (available in both SWIG interface files
// and C files)
@@ -923,9 +925,9 @@ int SWIG_main(int argc, char *argv[], Language *l) {
Wrapper_director_protected_mode_set(1);
// Inform the parser if the nested classes should be ignored unless explicitly told otherwise via feature:flatnested
- ignore_nested_classes = l->nestedClassesSupport() == Language::NCS_Unknown ? 1 : 0;
+ ignore_nested_classes = lang->nestedClassesSupport() == Language::NCS_Unknown ? 1 : 0;
- kwargs_supported = l->kwargsSupport() ? 1 : 0;
+ kwargs_supported = lang->kwargsSupport() ? 1 : 0;
// Create Library search directories
@@ -960,6 +962,11 @@ int SWIG_main(int argc, char *argv[], Language *l) {
if (CPlusPlus)
Preprocessor_define((DOH *) "__cplusplus __cplusplus", 0);
+ if (!l) {
+ Printf(stderr, "No target language specified\n");
+ return 1;
+ }
+
// Parse language dependent options
lang->main(argc, argv);
diff --git a/Source/Modules/swigmain.cxx b/Source/Modules/swigmain.cxx
index 0f5f07b4e..aaf6de7a8 100644
--- a/Source/Modules/swigmain.cxx
+++ b/Source/Modules/swigmain.cxx
@@ -106,10 +106,6 @@ static swig_module modules[] = {
#include <SIOUX.h>
#endif
-#ifndef SWIG_LANG
-#define SWIG_LANG "-python"
-#endif
-
//-----------------------------------------------------------------
// main()
//
@@ -262,9 +258,6 @@ int main(int margc, char **margv) {
if (fac) {
dl = (fac) ();
Swig_mark_arg(i);
- } else if (strcmp(argv[i], "-nolang") == 0) {
- dl = new Language;
- Swig_mark_arg(i);
} else if ((strcmp(argv[i], "-help") == 0) || (strcmp(argv[i], "--help") == 0)) {
if (strcmp(argv[i], "--help") == 0)
strcpy(argv[i], "-help");
@@ -278,12 +271,6 @@ int main(int margc, char **margv) {
}
}
}
- if (!dl) {
- fac = Swig_find_module(SWIG_LANG);
- if (fac) {
- dl = (fac) ();
- }
- }
int res = SWIG_main(argc, argv, dl);
diff --git a/configure.ac b/configure.ac
index deb537e81..b2644762a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,9 +16,6 @@ AM_INIT_AUTOMAKE
dnl Some extra defines for the config file
AH_BOTTOM([
-/* Default language */
-#define SWIG_LANG "-tcl"
-
/* Deal with attempt by Microsoft to deprecate C standard runtime functions */
#if defined(_MSC_VER)
# define _CRT_SECURE_NO_DEPRECATE