Commit Graph

142 Commits

Author SHA1 Message Date
William S Fulton 22a8088a98 Fix -Wunused-variable warning in Lua and Octave wrappers
Add bool output parameter to Swig_overload_dispatch to say when it has
generated code that will use the typecheck typemap code to help Lua and
Octave to not emit unused argv[] arrays.

Alas, resorted to warning suppression for deficient cpp11_initializer_list
typecheck typemap in cpp11_std_initializer_list testcase.
2025-06-23 21:39:49 +01:00
William S Fulton 86498e46c6 Remove -xmllang option used with -xml
which had no effect on the output.
2024-10-15 08:59:51 +01:00
Olly Betts 7a8c9fdfa8 Straighten out handling of char and string constants
Fixes #904
Fixes #1907
Fixes #2579
Fixes #2990
2024-08-17 16:12:45 +12:00
William S Fulton 2c70a912a6 Add $isvoid special variable
The $isvoid special variable expands to 1 if the
wrapped function has a void return, otherwise expands to 0.

In the implementation, use a consistent variable name, returntype,
for a node's "type" attribute.

Issue #2907
2024-06-15 23:13:12 +01:00
William S Fulton c0b36721a3 Replace Language::is_assignable with Language::is_immutable
Avoids confusion with newly created Allocate::is_assignable.
Language::is_immutable is just a wrapper around the
"feature:immutable" flag since previous commit.

is_mutable rename wip
2023-09-07 07:01:37 +01:00
Olly Betts a43602cfc5 Use non-Doh-prefixed symbols outside of DOH itself
Fix a few uses of DohDelete, DohLen, DohNone and DohSetInt.
2023-06-15 14:48:41 +12:00
Olly Betts 2860e28bd5 Fix typo: "temporal" which should be "temporary" 2023-04-27 10:35:22 +12:00
William S Fulton 46f2778412 Consolidate name mangling functions
Swig_string_mangle      => Swig_name_mangle_string
Swig_name_mangle        => Swig_name_mangle_string
Swig_string_mangle_type => Swig_name_mangle_type
2022-11-12 09:18:19 +00:00
Olly Betts 9ab9c71623 [lua] Run destructors of local C++ objects on SWIG_fail
Arrange that destructors of local C++ objects in the wrapper function
get run on SWIG_fail (which calls lua_error() which calls longjmp()).

We achieve this by putting almost everything in the function in its
own block, and end that right before lua_error() at which point those
destructors will get called.
2022-10-14 14:44:19 +13:00
William S Fulton 46f7501d94 Cleanup SWIG_VERSION definition
Add Swig_obligatory_macros which must be called by each
target language to define SWIG_VERSION correctly
in the generated code, as well as the language specific
macro SWIGXXX where XXX is the target language name.

Drop the #ifdef SWIGXXX that was previously generated -
I can't see the point of this and if users are defining
this macro somehow, then users will need to change this

Closes #1050
2022-10-13 19:47:43 +01:00
Olly Betts 631b41ae7b Use https for swig.org links 2022-10-06 13:16:39 +13:00
Olly Betts f5e2d044df Remove set but not used variables
Highlighted by clang-15 warnings such as:

warning: variable 'index' set but not used [-Wunused-but-set-variable]
2022-06-30 12:52:37 +12:00
Olly Betts b2c58115d7 Fix previous commit
Revert changes inadvertently included, and fix `=` to `==`.
2022-03-20 19:44:23 +13:00
Olly Betts 029ddab8b5 [ci] Try to fix failing appveyor python builds 2022-03-20 18:42:50 +13:00
Olly Betts 55377bdc08 Add DOH Exit() and SetExitHandler()
Exit() is a wrapper for exit() by default, but SetExitHandler() allows
specifying a function to call instead.

This means that failures within DOH (e.g. Malloc() failing due to lack
of memory) will now perform cleanup such as removing output files.

This commit also cleans up exit statuses so SWIG should now reliably
exit with status 0 if the run was successful and status 1 if there was
an error (or a warning and -Werror was in effect).

Previously in some situations SWIG would try to exit with the status set
to the number of errors encountered, but that's problematic - for
example if there were 256 errors this would result in exit status 0 on
most platforms.  Also some error statuses have special meanings e.g.
those defined by <sysexits.h>.

Also SWIG/Javascript tried to exit with status -1 in a few places (which
typically results in exit status 255).
2022-03-06 12:33:54 +13:00
Olly Betts b127e11f1e Fix typos in docs and comments 2022-02-27 18:15:46 +13:00
Olly Betts abfd630c6d Remove comment on how to add new target lang
This information really doesn't belong in lua.cxx, and is covered better
in Doc/Manual/Extending.html already.
2022-02-15 10:35:17 +13:00
Olly Betts 9ddc9dceb7 Remove support for $source and $target
These were officially deprecated in 2001, and attempts to use them have
resulted in a warning (including a pointer to what to update them to)
for most if not all of that time.

Fixes #1984
2021-04-30 10:20:14 +12:00
Michel Zou ee8d47cec4 Fix few unused variable warnings 2021-03-07 11:20:31 +00:00
luz.paz 6f69830321 follow-up typos 2018-05-17 10:26:00 -04:00
luz.paz 60dfa31a67 Misc. typos
found via `codespell` and `grep`
2018-05-17 10:04:23 -04:00
Olly Betts 90f9117e10 Fix various comment and documentation typos 2017-08-13 18:04:33 +12:00
Amarnath Valluri 08d5e19e6e Lua: Fix possible memory leaks
Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
2016-06-16 15:51:50 +03:00
William S Fulton 1d62790928 Fix assertion for some languages when wrapping a C++11 enum class that is private in a class.
Also don't wrap private enums for a few languages that attempted to do so.

Closes #594.
2016-03-31 20:27:36 +01:00
Petre Eftime 0a07cd4c30 Prevent redefinition warnings when compiling with SWIG<module> defined
Signed-off-by: Petre Eftime <petre.p.eftime@intel.com>
2015-12-22 14:33:21 +02:00
William S Fulton be272ff8cd Add c++11 strongly typed enum support for Lua 2014-11-28 07:47:45 +00:00
Olly Betts 36be36d618 Eliminate needless casting away const from string constants 2014-04-30 12:00:23 +12:00
Olly Betts 618868ce3d Fix typos 2014-04-29 11:31:29 +12:00
Artem Serebriyskiy c1ca144ed2 Fixed errors from previous commit.
Also in previous commit also fixed warning with unsigned vs signed
comparison
2014-04-23 01:48:10 +04:00
Artem Serebriyskiy 8512bad8c2 Fixing unused variable warnings
* Fixing unused variable warning. Generated code should compile
  with -Wall -Werror flags

* Fixing forgotten __Module -> SwigModule renaming
2014-04-16 03:37:27 +04:00
Olly Betts 559128e14e Fix typo in -lua -help output 2014-04-07 23:00:49 +12:00
William S Fulton 45256e0e9e Lua code refactor
Remove the internal api code for -no-old-metatable-bindings.
The code needs to be properly based on features, not api levels.
The code/variable names now reflect the command line option controlling
it.
2014-03-20 19:51:30 +00:00
William S Fulton 703d5b96fe Fix extern "C" 2014-03-15 02:20:38 +00:00
William S Fulton d2dc7df061 Compiler fixes for Sun Workshop compiler 2014-03-15 02:02:40 +00:00
Artem Serebriyskiy ddbf439db9 Working around some of the SWIG internal issues with enums 2014-03-12 18:00:15 +04:00
Artem Serebriyskiy 3028b16cee Partially disabling old names generation for classes with nspace 2014-03-06 15:24:17 +04:00
Artem Serebriyskiy 869de3e761 Getattribute->GetFlag 2014-03-04 14:33:41 +04:00
Artem Serebriyskiy e48dee81ea Disable old-names generation for enums in class in namespace 2014-03-04 13:54:38 +04:00
Artem Serebriyskiy 1da65de2b7 Removing all TODO:REMOVE 2014-03-03 11:29:04 +04:00
Artem Serebriyskiy 1898099620 Fixing enums 2014-03-03 09:54:13 +04:00
Artem Serebriyskiy cad7f86112 __Static -> SwigStatig, __Module -> SwigModule 2014-03-03 09:27:16 +04:00
Artem Serebriyskiy 23f0df2c0e Setattr -> SetFlag 2014-03-02 20:15:09 +04:00
William S Fulton aaa71288b1 Cosmetic changes to lua.cxx after recent changes 2014-02-28 23:15:29 +00:00
William S Fulton d957d37636 Minor code improvements after Lua changes. 2014-02-28 19:49:53 +00:00
Artem Serebriyskiy c6dd6b0726 Fixing registerClass. No more wrap: unnecessary attributes 2014-02-25 14:36:03 +04:00
Artem Serebriyskiy fadc9c8f31 Fixed registerMethod to work like registerVariable 2014-02-25 14:11:53 +04:00
Artem Serebriyskiy 4a94345c9a Switched to Swig_name_* functions 2014-02-25 12:51:28 +04:00
Artem Serebriyskiy dac0e989e3 Options in alphabetical order 2014-02-22 19:01:48 +04:00
Artem Serebriyskiy 166b19e860 Members renaming 2014-02-22 18:26:46 +04:00
Artem Serebriyskiy f12d8aa174 target_name -> lua_name 2014-02-22 18:06:47 +04:00