gnupg fails to build with gcc9
Closed, ResolvedPublic

Description

When building gnupg-2.2.13 with gcc9 in openSUSE Tumbleweed, we get this error:

[   83s] In file included from dns-stuff.c:57:
[   83s] dns-stuff.c: In function 'libdns_res_open':
[   83s] dns.h:1058:24: error: lvalue required as unary '&' operand
[   83s]  1058 | #define dns_opts(...) (&dns_quietinit((struct dns_options)DNS_OPTS_INIT(__VA_ARGS__)))
[   83s]       |                        ^
[   83s] dns-stuff.c:719:23: note: in expansion of macro 'dns_opts'
[   83s]   719 |                       dns_opts (.socks_host     = &libdns.socks_host,
[   83s]       |                       ^~~~~~~~

It looks like it complains about overriding the initializer list in dns_opt, see bugs in openSUSE [0] and gcc [1] bugzillas. Builds fine with the patch in [0] but it would be better to fix it instead of skipping some diagnostic pragmas.

[0] https://bugzilla.suse.com/show_bug.cgi?id=1121223
[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88766

Details

pmgdeb created this task.Feb 15 2019, 3:55 PM
werner triaged this task as Normal priority.Feb 18 2019, 8:38 AM
werner edited projects, added gnupg (gpg23); removed gnupg (gpg22).
werner added a subscriber: werner.

Libdns is not our own code and our intention was to keep it in sync with upstream. However, after some initial success the upstream author lost interest. We now consider to rework the code to remove a bit of the more creative use of C99 and maybe even get rid of some of the used C99 features (gnupg is mainly C90 with some exceptions).

Whether such changes will be backported to 2.2 needs to be decided later.

gniibe claimed this task.Feb 26 2019, 4:36 AM
gniibe added a project: Testing.
gniibe added a subscriber: gniibe.

Fixed in master, by removing use of compound literals. Compound literals are not portable feature (even for C99 code), so, it's good to avoid when we can.
Still dns.c uses C99 features of struct initializer with name.

Builds fine now with GCC 9. Thanks for looking into this so quickly.

werner added a comment.Mar 7 2019, 1:05 PM

Changes backported to 2.2

werner closed this task as Resolved.Mar 7 2019, 1:05 PM
werner edited projects, added gnupg (gpg22); removed Testing, gnupg (gpg23).