[gnutls-devel] GnuTLS | MSVC problem with gen-getopt.py (#1337)
Read-only notification of GnuTLS library development activities
gnutls-devel at lists.gnutls.org
Tue Mar 15 14:48:00 CET 2022
Gisle Vanem created an issue: https://gitlab.com/gnutls/gnutls/-/issues/1337
Two of generated .h-files in `./src` does not work with MSVC;
`certtool-options.h` and `psktool-options.h`:
```
psktool-options.h(55): error C2016: C requires that a struct or union have at least one member
```
I.e. for this code:
```c
/* Option enablement status */
struct
{
} enabled;
```
A fix for was to modify `gen-getopt.py` to insert some `int dummy;` statements for such empty lists:
```
--- a/src/gen-getopt.py 2022-03-15 14:39:36
+++ b/src/gen-getopt.py 2022-03-13 16:34:15
@@ -501,7 +501,7 @@
global_name = f'{mangle(prog_name)}Options'
list_struct_name = f'{mangle(prog_name)}_list'
- for i, option in enumerate(options):
+ for option in options:
long_opt = option['long-option']
arg_type = option.get('arg-type')
lower_opt = mangle(long_opt)
@@ -528,8 +528,6 @@
f'{global_name}.list.{lower_opt}.args\n'
))
else:
- if i == 0:
- struct_members_list.write (f'{INDENT*2}int dummy;\n')
struct_members_arg.write(
f'{INDENT*2}const char *{lower_opt};\n'
)
@@ -546,8 +544,6 @@
f'#define ENABLED_OPT_{upper_opt} '
f'{global_name}.enabled.{lower_opt}\n'
))
- elif i == 0:
- struct_members_enabled.write (f'{INDENT*2}int dummy;\n')
have_opts.write((
f'#define HAVE_OPT_{upper_opt} '
```
But I'm not sure how a proper fix would look like.
--
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/issues/1337
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20220315/1877848b/attachment.html>
More information about the Gnutls-devel
mailing list