<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<meta content="text/html; charset=US-ASCII" http-equiv="Content-Type">
<title>
GitLab
</title>
<style>img {
max-width: 100%; height: auto;
}
</style>
</head>
<body>
<div class="content">
<p class="details" style="font-style: italic; color: #666;">
<a href="https://gitlab.com/gvanem">Gisle Vanem</a> created an issue: <a href="https://gitlab.com/gnutls/gnutls/-/issues/1337">#1337</a>
</p>
<div></div>
<p dir="auto">Two of generated .h-files in <code>./src</code> does not work with MSVC;
<code>certtool-options.h</code> and <code>psktool-options.h</code>:</p>
<div class="gl-relative markdown-code-block js-markdown-code">
<pre class="code highlight js-syntax-highlight language-plaintext" lang="plaintext" v-pre="true" style="border-radius: 2px; margin: 0 0 8px; padding: 8px 12px; border: 1px solid #dbdbdb;"><code><span id="LC1" class="line" lang="plaintext">psktool-options.h(55): error C2016: C requires that a struct or union have at least one member</span></code></pre>
<copy-code></copy-code>
</div>
<p dir="auto">I.e. for this code:</p>
<div class="gl-relative markdown-code-block js-markdown-code">
<pre class="code highlight js-syntax-highlight language-c" lang="c" v-pre="true" style="border-radius: 2px; margin: 0 0 8px; padding: 8px 12px; border: 1px solid #dbdbdb;"><code><span id="LC1" class="line" lang="c"> <span class="cm">/* Option enablement status */</span></span>
<span id="LC2" class="line" lang="c"> <span class="k">struct</span></span>
<span id="LC3" class="line" lang="c"> <span class="p">{</span></span>
<span id="LC4" class="line" lang="c"></span>
<span id="LC5" class="line" lang="c"> <span class="p">}</span> <span class="n">enabled</span><span class="p">;</span></span></code></pre>
<copy-code></copy-code>
</div>
<p dir="auto">A fix for was to modify <code>gen-getopt.py</code> to insert some <code>int dummy;</code> statements for such empty lists:</p>
<div class="gl-relative markdown-code-block js-markdown-code">
<pre class="code highlight js-syntax-highlight language-plaintext" lang="plaintext" v-pre="true" style="border-radius: 2px; margin: 0 0 8px; padding: 8px 12px; border: 1px solid #dbdbdb;"><code><span id="LC1" class="line" lang="plaintext">--- a/src/gen-getopt.py 2022-03-15 14:39:36</span>
<span id="LC2" class="line" lang="plaintext">+++ b/src/gen-getopt.py 2022-03-13 16:34:15</span>
<span id="LC3" class="line" lang="plaintext">@@ -501,7 +501,7 @@</span>
<span id="LC4" class="line" lang="plaintext"> global_name = f'{mangle(prog_name)}Options'</span>
<span id="LC5" class="line" lang="plaintext"> list_struct_name = f'{mangle(prog_name)}_list'</span>
<span id="LC6" class="line" lang="plaintext"></span>
<span id="LC7" class="line" lang="plaintext">- for i, option in enumerate(options):</span>
<span id="LC8" class="line" lang="plaintext">+ for option in options:</span>
<span id="LC9" class="line" lang="plaintext"> long_opt = option['long-option']</span>
<span id="LC10" class="line" lang="plaintext"> arg_type = option.get('arg-type')</span>
<span id="LC11" class="line" lang="plaintext"> lower_opt = mangle(long_opt)</span>
<span id="LC12" class="line" lang="plaintext">@@ -528,8 +528,6 @@</span>
<span id="LC13" class="line" lang="plaintext"> f'{global_name}.list.{lower_opt}.args\n'</span>
<span id="LC14" class="line" lang="plaintext"> ))</span>
<span id="LC15" class="line" lang="plaintext"> else:</span>
<span id="LC16" class="line" lang="plaintext">- if i == 0:</span>
<span id="LC17" class="line" lang="plaintext">- struct_members_list.write (f'{INDENT*2}int dummy;\n')</span>
<span id="LC18" class="line" lang="plaintext"> struct_members_arg.write(</span>
<span id="LC19" class="line" lang="plaintext"> f'{INDENT*2}const char *{lower_opt};\n'</span>
<span id="LC20" class="line" lang="plaintext"> )</span>
<span id="LC21" class="line" lang="plaintext">@@ -546,8 +544,6 @@</span>
<span id="LC22" class="line" lang="plaintext"> f'#define ENABLED_OPT_{upper_opt} '</span>
<span id="LC23" class="line" lang="plaintext"> f'{global_name}.enabled.{lower_opt}\n'</span>
<span id="LC24" class="line" lang="plaintext"> ))</span>
<span id="LC25" class="line" lang="plaintext">- elif i == 0:</span>
<span id="LC26" class="line" lang="plaintext">- struct_members_enabled.write (f'{INDENT*2}int dummy;\n')</span>
<span id="LC27" class="line" lang="plaintext"></span>
<span id="LC28" class="line" lang="plaintext"> have_opts.write((</span>
<span id="LC29" class="line" lang="plaintext"> f'#define HAVE_OPT_{upper_opt} '</span></code></pre>
<copy-code></copy-code>
</div>
<p dir="auto">But I'm not sure how a proper fix would look like.</p>
</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #666;">
—
<br>
Reply to this email directly or <a href="https://gitlab.com/gnutls/gnutls/-/issues/1337">view it on GitLab</a>.
<br>
You're receiving this email because of your account on gitlab.com.
If you'd like to receive fewer emails, you can
<a href="https://gitlab.com/-/sent_notifications/7c986e83c40f34830fee06020e0676ea/unsubscribe">unsubscribe</a>
from this thread or
adjust your notification settings.
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Issue","url":"https://gitlab.com/gnutls/gnutls/-/issues/1337"}}</script>
</p>
</div>
</body>
</html>