swig -DSWIG_ALLKW was too ugly. Use -Wallkw instead. Reverting swig.swg
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5545 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
beb5d78df2
commit
0c01d1edcc
4 changed files with 98 additions and 78 deletions
|
|
@ -2,31 +2,55 @@ Version 1.3.20 (In progress)
|
||||||
============================
|
============================
|
||||||
12/11/2003: mmatus (Marcelo Matus)
|
12/11/2003: mmatus (Marcelo Matus)
|
||||||
|
|
||||||
"All keywords" warning support, through the -DSWIG_ALLKW
|
This fix some recurring reports about keywords not been
|
||||||
option.
|
properly identified and warned, and it solves the problem
|
||||||
|
of how to add a test file to the test-suite such that it
|
||||||
|
doesn't use any keyword of all the supported languages
|
||||||
|
(and doing it without compiling the test for all the
|
||||||
|
supported languages, thing that is not always possible,
|
||||||
|
and without requiring you to know all the supported
|
||||||
|
language keywords, thing that is always impossible).
|
||||||
|
|
||||||
This option allows you to include all the known keywords
|
So these are the changes globally speaking:
|
||||||
for all the supported languages, and can be used as:
|
|
||||||
|
|
||||||
swig -DSWIG_ALLKW ....
|
- Uniform the definition of the keyword warnings through
|
||||||
|
the supported languages: all the languages has now a
|
||||||
|
separate file that defines the keywords or bad names:
|
||||||
|
|
||||||
This will help to the process of adding a test-suite file
|
python/pythonkw.swg
|
||||||
that can be compiled in all the swig supported languages,
|
chicken/chickenkw.swg
|
||||||
and it will be also helpful for users who want to create
|
....
|
||||||
multi-language libraries.
|
|
||||||
|
|
||||||
These are the changes (mostly addition of files):
|
- Added keyword list for most of the languages that didn't
|
||||||
|
have one (using the new separated file).
|
||||||
|
|
||||||
- For the language that already has some sort of keyword
|
- Added the "All keywords" warning support: -Wallkw option.
|
||||||
list warning, move them to an external file kw.swg file:
|
|
||||||
|
|
||||||
move keywords from python.swg -> pythonkw.swg
|
This option allows you to include all the known keywords
|
||||||
move keywords from chicken.swg -> chickenkw.swg
|
for all the supported languages, and can be used as:
|
||||||
|
|
||||||
and include pythonkw.swg from python.swg, and etc.
|
swig -Wallkw ....
|
||||||
|
|
||||||
- For the language that has no keyword list, and for the
|
This will help to the process of adding a test-suite
|
||||||
ones that I could find a list, add the kw.swg file, ie:
|
file that can be compiled in all the swig supported
|
||||||
|
languages, and it will be also helpful for users who
|
||||||
|
want to create multi-language libraries.
|
||||||
|
|
||||||
|
And these are the detailed changes (mostly file addition):
|
||||||
|
|
||||||
|
- For the languages that already have some sort of keyword
|
||||||
|
warning list, move it to an external languagekw.swg
|
||||||
|
file, ie:
|
||||||
|
|
||||||
|
move keywords from python.swg -> pythonkw.swg
|
||||||
|
move keywords from chicken.swg -> chickenkw.swg
|
||||||
|
move keywords from tcl8.swg -> tclkw.swg
|
||||||
|
|
||||||
|
and re-include languagekw.swg from language.swg.
|
||||||
|
|
||||||
|
- For the language that didn't have a keyword list, and
|
||||||
|
for the ones that I could find a list, add the
|
||||||
|
languagekw.swg file, ie:
|
||||||
|
|
||||||
csharp/csharpkw.swg
|
csharp/csharpkw.swg
|
||||||
java/javakw.swg
|
java/javakw.swg
|
||||||
|
|
@ -35,58 +59,64 @@ Version 1.3.20 (In progress)
|
||||||
ruby/rubykw.swg
|
ruby/rubykw.swg
|
||||||
|
|
||||||
|
|
||||||
add a line in java.swg to include javakw.swg, and so on
|
also add a line in language.swg to include
|
||||||
for all the other languages, but now it is commented!!!,
|
languagekw.swg, but now it is commented!!!, like in
|
||||||
like in java.swg:
|
java.swg:
|
||||||
|
|
||||||
/* java keywords */
|
/* java keywords */
|
||||||
/* please test and activate */
|
/* please test and activate */
|
||||||
//%include "javakw.swg"
|
//%include "javakw.swg"
|
||||||
|
|
||||||
ie, there will be no change in how swig runs normally
|
ie, there will be no change in how swig runs normally
|
||||||
until the language mantainer test and uncomment that line.
|
until the language maintainer test and uncomment that
|
||||||
|
line.
|
||||||
|
|
||||||
So, please check each kw.swg file (I left the link
|
So, please check each languagekw.swg file (I left the
|
||||||
source of the keyword list), and after testing, allow
|
link to the keyword list source for checking), and after
|
||||||
its inclusion.
|
testing, uncomment the %include line.
|
||||||
|
|
||||||
- Added the file allkw.swg, which includes all the kw.swg
|
- Added the file allkw.swg, which includes all the
|
||||||
files.
|
languagekw.swg files.
|
||||||
|
|
||||||
For the languages that has no kw.swg file right now, and
|
For the languages that has no languagekw.swg file right
|
||||||
if they need one, add it into the language directory,
|
now, and if they need one, add the file into the
|
||||||
and add a line into allkw.swg to include it from here.
|
language directory, and add the corresponding include
|
||||||
|
line into the allkw.swg file.
|
||||||
|
|
||||||
- Includes allkw.swg at the end of swig.swg if the option
|
- Added the -Wallkw that includes the allkw.swg file.
|
||||||
SWIG_ALLKW is defined. The old -lallkw.swg option
|
Note that the old -lallkw.swg option couldn't be used
|
||||||
couldn't be used since it include the file after it
|
since it include the file after it would be needed.
|
||||||
would be needed.
|
|
||||||
|
|
||||||
|
|
||||||
Maybe there is a better name for the option, and been a
|
Hopefully, the -Wallkw option will be added to the default
|
||||||
defined, it looks kind of ugly. Maybe is better to
|
rules in the related test-suite Makefiles, so, when
|
||||||
translate it into a command line option... any ideas?.
|
creating a new test, or adding a new swig library file
|
||||||
|
(like _std_deque.i), swig will warn you if you are using a
|
||||||
In any way, the ideal situation will be that this option
|
bad name, considering all the language where it needs to
|
||||||
is added to the default rules in the related test-suite
|
run.
|
||||||
Makefiles, so, when creating a new test, swig will always
|
|
||||||
warn you if you are using a bad name, considering all
|
|
||||||
the language where it needs to run.
|
|
||||||
|
|
||||||
Right now you can test it by using:
|
Right now you can test it by using:
|
||||||
|
|
||||||
make check-python-test-suite SWIG="swig -DSWIG_ALLKW"
|
make check-python-test-suite SWIG="swig -Wallkw"
|
||||||
|
|
||||||
or using your favorite target language.
|
or using your favorite target language, it doesn't matter.
|
||||||
|
|
||||||
And yes, there are several examples that are using some
|
And yes, there are several examples that are using
|
||||||
reserved keyword, specially from csharp.
|
reserved keywords, specially from csharp.
|
||||||
|
|
||||||
Remember: the keyword warnings are not included by default
|
*** Remember ****: the new keyword warning lists are not
|
||||||
in any of language that before didn't define its own
|
included by default in any of language that before didn't
|
||||||
keyword list. To enable them as the default behaviour,
|
have one. To enable the keyword warnings as the default
|
||||||
the inclusion of the kw.swg file has to be uncommented at
|
behavior, the inclusion of the languagekw.swg file has to
|
||||||
each language.swg file.
|
be uncommented at each language.swg file.
|
||||||
|
|
||||||
|
So, all the language maintainers, please check the
|
||||||
|
keywords list, and remember that you can also add bad
|
||||||
|
member names too, like *::clone or *::cget (see an example
|
||||||
|
in the tcl8/tclkw.swg file).
|
||||||
|
|
||||||
|
**** And don't add any new test file without checking it
|
||||||
|
with the -Wallkw option!! (that includes me) *****.
|
||||||
|
|
||||||
|
|
||||||
12/11/2003: cheetah (William Fulton)
|
12/11/2003: cheetah (William Fulton)
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,9 @@
|
||||||
|
|
||||||
Use as
|
Use as
|
||||||
|
|
||||||
swig -DSWIG_ALLKW ...
|
swig -Wallkw ...
|
||||||
|
|
||||||
If you add a new language, remember to create a separete kw.swg
|
If you add a new language, remember to create a separete languagekw.swg
|
||||||
file, and add it here.
|
file, and add it here.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
@ -19,11 +19,11 @@
|
||||||
%include "chicken/chickenkw.swg"
|
%include "chicken/chickenkw.swg"
|
||||||
%include "csharp/csharpkw.swg"
|
%include "csharp/csharpkw.swg"
|
||||||
%include "java/javakw.swg"
|
%include "java/javakw.swg"
|
||||||
%include "php4/phpkw.swg"
|
%include "php4/php4kw.swg"
|
||||||
%include "pike/pikekw.swg"
|
%include "pike/pikekw.swg"
|
||||||
%include "python/pythonkw.swg"
|
%include "python/pythonkw.swg"
|
||||||
%include "ruby/rubykw.swg"
|
%include "ruby/rubykw.swg"
|
||||||
%include "tcl/tclkw.swg"
|
%include "tcl/tcl8kw.swg"
|
||||||
|
|
||||||
|
|
||||||
#endif //__Lib_allkw_swg__
|
#endif //__Lib_allkw_swg__
|
||||||
|
|
|
||||||
|
|
@ -396,22 +396,3 @@ static int NAME(TYPE x) {
|
||||||
%enddef
|
%enddef
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
Include all the known keyword warnings. Very useful for adding test
|
|
||||||
files to the test-suite, or check if your own library is OK for all
|
|
||||||
the swig supported languages.
|
|
||||||
|
|
||||||
Use as
|
|
||||||
|
|
||||||
swig -DSWIG_ALLKW ...
|
|
||||||
|
|
||||||
Note that this is not equivalent to
|
|
||||||
|
|
||||||
swig -lallkw.swg
|
|
||||||
|
|
||||||
the last form will have no effect since allkw.swg will be included
|
|
||||||
to late.
|
|
||||||
*/
|
|
||||||
#ifdef SWIG_ALLKW
|
|
||||||
%include "allkw.swg"
|
|
||||||
#endif
|
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,8 @@ static char *usage = (char*)"\
|
||||||
-v - Run in verbose mode\n\
|
-v - Run in verbose mode\n\
|
||||||
-version - Print SWIG version number\n\
|
-version - Print SWIG version number\n\
|
||||||
-Wall - Enable all warning messages\n\
|
-Wall - Enable all warning messages\n\
|
||||||
|
-Wallkw - Enable warning messages for all the languages keywords\n\
|
||||||
|
-Werror - Force to treat the warnings as errors\n\
|
||||||
-w<n> - Suppress warning number <n>\n\
|
-w<n> - Suppress warning number <n>\n\
|
||||||
\n";
|
\n";
|
||||||
|
|
||||||
|
|
@ -229,6 +231,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
||||||
int werror = 0;
|
int werror = 0;
|
||||||
int depend = 0;
|
int depend = 0;
|
||||||
int memory_debug = 0;
|
int memory_debug = 0;
|
||||||
|
int allkw = 0;
|
||||||
|
|
||||||
DOH *libfiles = 0;
|
DOH *libfiles = 0;
|
||||||
DOH *cpps = 0 ;
|
DOH *cpps = 0 ;
|
||||||
|
|
@ -473,6 +476,9 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
||||||
} else if (strcmp(argv[i],"-Wall") == 0) {
|
} else if (strcmp(argv[i],"-Wall") == 0) {
|
||||||
Swig_mark_arg(i);
|
Swig_mark_arg(i);
|
||||||
Swig_warnall();
|
Swig_warnall();
|
||||||
|
} else if (strcmp(argv[i],"-Wallkw") == 0) {
|
||||||
|
allkw = 1;
|
||||||
|
Swig_mark_arg(i);
|
||||||
} else if (strcmp(argv[i],"-Werror") == 0) {
|
} else if (strcmp(argv[i],"-Werror") == 0) {
|
||||||
werror = 1;
|
werror = 1;
|
||||||
Swig_mark_arg(i);
|
Swig_mark_arg(i);
|
||||||
|
|
@ -607,6 +613,9 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
||||||
}
|
}
|
||||||
fclose(df);
|
fclose(df);
|
||||||
Printf(fs,"%%include \"swig.swg\"\n");
|
Printf(fs,"%%include \"swig.swg\"\n");
|
||||||
|
if (allkw) {
|
||||||
|
Printf(fs,"%%include \"allkw.swg\"\n");
|
||||||
|
}
|
||||||
if (lang_config) {
|
if (lang_config) {
|
||||||
Printf(fs,"\n%%include \"%s\"\n", lang_config);
|
Printf(fs,"\n%%include \"%s\"\n", lang_config);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue