gnupg isn't LTO ready
Closed, WontfixPublic

Description

It emits several warnings about types mismatch

In below compile warnings most important are [-Wlto-type-mismatch] however it would be good to clean the code to calm down all other warnings as well

dotlock.c: In function 'use_hardlinks_p':
dotlock.c:624:10: warning: ignoring return value of 'link', declared with attribute warn_unused_result [-Wunused-result]
  624 |   (void) link (tname, lname);
      |          ^~~~~~~~~~~~~~~~~~~
dotlock.c: In function 'dotlock_take_unix':
dotlock.c:1071:14: warning: ignoring return value of 'link', declared with attribute warn_unused_result [-Wunused-result]
 1071 |       (void) link (h->tname, h->lockname);
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
signal.c: In function 'got_fatal_signal':
signal.c:111:9: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
  111 |   (void)write (2, "\n", 1 );
      |         ^~~~~~~~~~~~~~~~~~~
signal.c:114:11: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
  114 |     (void)write(2, s, strlen (s));
      |           ^~~~~~~~~~~~~~~~~~~~~~~
signal.c:115:9: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
  115 |   (void)write (2, ": signal ", 9 );
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
signal.c:118:12: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
  118 |     (void) write (2, s, strlen(s) );
      |            ^~~~~~~~~~~~~~~~~~~~~~~~
signal.c:128:15: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
  128 |         (void)write (2, "?", 1);
      |               ^~~~~~~~~~~~~~~~~
signal.c:137:25: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
  137 |                   (void)write (2, &"0123456789"[value/i], 1);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
signal.c:145:9: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
  145 |   (void)write (2, " caught ... exiting\n", 20);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dotlock.c: In function 'use_hardlinks_p':
dotlock.c:624:10: warning: ignoring return value of 'link', declared with attribute warn_unused_result [-Wunused-result]
  624 |   (void) link (tname, lname);
      |          ^~~~~~~~~~~~~~~~~~~
dotlock.c: In function 'dotlock_take_unix':
dotlock.c:1071:14: warning: ignoring return value of 'link', declared with attribute warn_unused_result [-Wunused-result]
 1071 |       (void) link (h->tname, h->lockname);
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
signal.c: In function 'got_fatal_signal':
signal.c:111:9: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
  111 |   (void)write (2, "\n", 1 );
      |         ^~~~~~~~~~~~~~~~~~~
signal.c:114:11: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
  114 |     (void)write(2, s, strlen (s));
      |           ^~~~~~~~~~~~~~~~~~~~~~~
signal.c:115:9: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
  115 |   (void)write (2, ": signal ", 9 );
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
signal.c:118:12: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
  118 |     (void) write (2, s, strlen(s) );
      |            ^~~~~~~~~~~~~~~~~~~~~~~~
signal.c:128:15: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
  128 |         (void)write (2, "?", 1);
      |               ^~~~~~~~~~~~~~~~~
signal.c:137:25: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
  137 |                   (void)write (2, &"0123456789"[value/i], 1);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
signal.c:145:9: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
  145 |   (void)write (2, " caught ... exiting\n", 20);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
t-exechelp.c: In function 'test_close_all_fds':
t-exechelp.c:96:3: warning: ignoring return value of 'dup', declared with attribute warn_unused_result [-Wunused-result]
   96 |   dup (1);
      |   ^~~~~~~
t-exechelp.c:97:3: warning: ignoring return value of 'dup', declared with attribute warn_unused_result [-Wunused-result]
   97 |   dup (1);
      |   ^~~~~~~
t-exechelp.c:99:3: warning: ignoring return value of 'dup', declared with attribute warn_unused_result [-Wunused-result]
   99 |   dup (1);
      |   ^~~~~~~
t-exechelp.c:140:9: warning: ignoring return value of 'dup', declared with attribute warn_unused_result [-Wunused-result]
  140 |         dup (1);
      |         ^~~~~~~
t-exechelp.c:147:11: warning: ignoring return value of 'dup', declared with attribute warn_unused_result [-Wunused-result]
  147 |           dup (1);
      |           ^~~~~~~
photoid.h:31:6: warning: type of 'show_photos' does not match original declaration [-Wlto-type-mismatch]
   31 | void show_photos (ctrl_t ctrl, const struct user_attribute *attrs, int count,
      |      ^
test-stubs.c:355:1: note: type mismatch in parameter 2
  355 | show_photos (const struct user_attribute *attrs, int count, PKT_public_key *pk)
      | ^
test-stubs.c:355:1: note: 'show_photos' was previously declared here
keyserver-internal.h:31:24: warning: type of 'parse_keyserver_uri' does not match original declaration [-Wlto-type-mismatch]
   31 | struct keyserver_spec *parse_keyserver_uri (const char *string,
      |                        ^
test-stubs.c:337:1: note: type mismatch in parameter 3
  337 | parse_keyserver_uri (const char *uri, int require_scheme,
      | ^
test-stubs.c:337:1: note: 'parse_keyserver_uri' was previously declared here
keyserver-internal.h:53:5: warning: type of 'keyserver_import_ldap' does not match original declaration [-Wlto-type-mismatch]
   53 | int keyserver_import_ldap (ctrl_t ctrl, const char *name,
      |     ^
test-stubs.c:237:1: note: type mismatch in parameter 2
  237 | keyserver_import_ldap (const char *name)
      | ^
test-stubs.c:237:1: note: 'keyserver_import_ldap' was previously declared here
keyserver-internal.h:50:5: warning: type of 'keyserver_import_name' does not match original declaration [-Wlto-type-mismatch]
   50 | int keyserver_import_name (ctrl_t ctrl,
      |     ^
test-stubs.c:229:1: note: type mismatch in parameter 3
  229 | keyserver_import_name (const char *name,struct keyserver_spec *spec)
      | ^
test-stubs.c:229:1: note: 'keyserver_import_name' was previously declared here
keyserver-internal.h:46:13: warning: type of 'keyserver_import_pka' does not match original declaration [-Wlto-type-mismatch]
   46 | gpg_error_t keyserver_import_pka (ctrl_t ctrl, const char *name,
      |             ^
test-stubs.c:209:1: note: return value type mismatch
  209 | keyserver_import_pka (const char *name,unsigned char *fpr)
      | ^
test-stubs.c:209:1: note: type 'int' should match type 'gpg_error_t'
test-stubs.c:209:1: note: 'keyserver_import_pka' was previously declared here
keyserver-internal.h:44:5: warning: type of 'keyserver_import_cert' does not match original declaration [-Wlto-type-mismatch]
   44 | int keyserver_import_cert (ctrl_t ctrl, const char *name, int dane_mode,
      |     ^
test-stubs.c:202:1: note: type mismatch in parameter 2
  202 | keyserver_import_cert (const char *name)
      | ^
test-stubs.c:202:1: note: 'keyserver_import_cert' was previously declared here
keyserver-internal.h:39:5: warning: type of 'keyserver_import_keyid' does not match original declaration [-Wlto-type-mismatch]
   39 | int keyserver_import_keyid (ctrl_t ctrl, u32 *keyid,
      |     ^
test-stubs.c:181:1: note: type mismatch in parameter 3
  181 | keyserver_import_keyid (u32 *keyid, void *dummy, int quick)
      | ^
test-stubs.c:181:1: note: 'keyserver_import_keyid' was previously declared here
photoid.h:31:6: warning: type of 'show_photos' does not match original declaration [-Wlto-type-mismatch]
   31 | void show_photos (ctrl_t ctrl, const struct user_attribute *attrs, int count,
      |      ^
test-stubs.c:355:1: note: type mismatch in parameter 2
  355 | show_photos (const struct user_attribute *attrs, int count, PKT_public_key *pk)
      | ^
test-stubs.c:355:1: note: 'show_photos' was previously declared here
keyserver-internal.h:31:24: warning: type of 'parse_keyserver_uri' does not match original declaration [-Wlto-type-mismatch]
   31 | struct keyserver_spec *parse_keyserver_uri (const char *string,
      |                        ^
test-stubs.c:337:1: note: type mismatch in parameter 3
  337 | parse_keyserver_uri (const char *uri, int require_scheme,
      | ^
test-stubs.c:337:1: note: 'parse_keyserver_uri' was previously declared here
keyserver-internal.h:53:5: warning: type of 'keyserver_import_ldap' does not match original declaration [-Wlto-type-mismatch]
   53 | int keyserver_import_ldap (ctrl_t ctrl, const char *name,
      |     ^
test-stubs.c:237:1: note: type mismatch in parameter 2
  237 | keyserver_import_ldap (const char *name)
      | ^
test-stubs.c:237:1: note: 'keyserver_import_ldap' was previously declared here
keyserver-internal.h:50:5: warning: type of 'keyserver_import_name' does not match original declaration [-Wlto-type-mismatch]
   50 | int keyserver_import_name (ctrl_t ctrl,
      |     ^
test-stubs.c:229:1: note: type mismatch in parameter 3
  229 | keyserver_import_name (const char *name,struct keyserver_spec *spec)
      | ^
test-stubs.c:229:1: note: 'keyserver_import_name' was previously declared here
keyserver-internal.h:46:13: warning: type of 'keyserver_import_pka' does not match original declaration [-Wlto-type-mismatch]
   46 | gpg_error_t keyserver_import_pka (ctrl_t ctrl, const char *name,
      |             ^
test-stubs.c:209:1: note: return value type mismatch
  209 | keyserver_import_pka (const char *name,unsigned char *fpr)
      | ^
test-stubs.c:209:1: note: type 'int' should match type 'gpg_error_t'
test-stubs.c:209:1: note: 'keyserver_import_pka' was previously declared here
keyserver-internal.h:44:5: warning: type of 'keyserver_import_cert' does not match original declaration [-Wlto-type-mismatch]
   44 | int keyserver_import_cert (ctrl_t ctrl, const char *name, int dane_mode,
      |     ^
test-stubs.c:202:1: note: type mismatch in parameter 2
  202 | keyserver_import_cert (const char *name)
      | ^
test-stubs.c:202:1: note: 'keyserver_import_cert' was previously declared here
keyserver-internal.h:39:5: warning: type of 'keyserver_import_keyid' does not match original declaration [-Wlto-type-mismatch]
   39 | int keyserver_import_keyid (ctrl_t ctrl, u32 *keyid,
      |     ^
test-stubs.c:181:1: note: type mismatch in parameter 3
  181 | keyserver_import_keyid (u32 *keyid, void *dummy, int quick)
      | ^
test-stubs.c:181:1: note: 'keyserver_import_keyid' was previously declared here
photoid.h:31:6: warning: type of 'show_photos' does not match original declaration [-Wlto-type-mismatch]
   31 | void show_photos (ctrl_t ctrl, const struct user_attribute *attrs, int count,
      |      ^
test-stubs.c:355:1: note: type mismatch in parameter 2
  355 | show_photos (const struct user_attribute *attrs, int count, PKT_public_key *pk)
      | ^
test-stubs.c:355:1: note: 'show_photos' was previously declared here
keyserver-internal.h:31:24: warning: type of 'parse_keyserver_uri' does not match original declaration [-Wlto-type-mismatch]
   31 | struct keyserver_spec *parse_keyserver_uri (const char *string,
      |                        ^
test-stubs.c:337:1: note: type mismatch in parameter 3
  337 | parse_keyserver_uri (const char *uri, int require_scheme,
      | ^
test-stubs.c:337:1: note: 'parse_keyserver_uri' was previously declared here
keyserver-internal.h:53:5: warning: type of 'keyserver_import_ldap' does not match original declaration [-Wlto-type-mismatch]
   53 | int keyserver_import_ldap (ctrl_t ctrl, const char *name,
      |     ^
test-stubs.c:237:1: note: type mismatch in parameter 2
  237 | keyserver_import_ldap (const char *name)
      | ^
test-stubs.c:237:1: note: 'keyserver_import_ldap' was previously declared here
keyserver-internal.h:50:5: warning: type of 'keyserver_import_name' does not match original declaration [-Wlto-type-mismatch]
   50 | int keyserver_import_name (ctrl_t ctrl,
      |     ^
test-stubs.c:229:1: note: type mismatch in parameter 3
  229 | keyserver_import_name (const char *name,struct keyserver_spec *spec)
      | ^
test-stubs.c:229:1: note: 'keyserver_import_name' was previously declared here
keyserver-internal.h:46:13: warning: type of 'keyserver_import_pka' does not match original declaration [-Wlto-type-mismatch]
   46 | gpg_error_t keyserver_import_pka (ctrl_t ctrl, const char *name,
      |             ^
test-stubs.c:209:1: note: return value type mismatch
  209 | keyserver_import_pka (const char *name,unsigned char *fpr)
      | ^
test-stubs.c:209:1: note: type 'int' should match type 'gpg_error_t'
test-stubs.c:209:1: note: 'keyserver_import_pka' was previously declared here
keyserver-internal.h:44:5: warning: type of 'keyserver_import_cert' does not match original declaration [-Wlto-type-mismatch]
   44 | int keyserver_import_cert (ctrl_t ctrl, const char *name, int dane_mode,
      |     ^
test-stubs.c:202:1: note: type mismatch in parameter 2
  202 | keyserver_import_cert (const char *name)
      | ^
test-stubs.c:202:1: note: 'keyserver_import_cert' was previously declared here
keyserver-internal.h:39:5: warning: type of 'keyserver_import_keyid' does not match original declaration [-Wlto-type-mismatch]
   39 | int keyserver_import_keyid (ctrl_t ctrl, u32 *keyid,
      |     ^
test-stubs.c:181:1: note: type mismatch in parameter 3
  181 | keyserver_import_keyid (u32 *keyid, void *dummy, int quick)
      | ^
test-stubs.c:181:1: note: 'keyserver_import_keyid' was previously declared here
photoid.h:31:6: warning: type of 'show_photos' does not match original declaration [-Wlto-type-mismatch]
   31 | void show_photos (ctrl_t ctrl, const struct user_attribute *attrs, int count,
      |      ^
gpgv.c:592:1: note: type mismatch in parameter 2
  592 | show_photos (const struct user_attribute *attrs, int count, PKT_public_key *pk)
      | ^
gpgv.c:592:1: note: 'show_photos' was previously declared here
keyserver-internal.h:31:24: warning: type of 'parse_keyserver_uri' does not match original declaration [-Wlto-type-mismatch]
   31 | struct keyserver_spec *parse_keyserver_uri (const char *string,
      |                        ^
gpgv.c:574:1: note: type mismatch in parameter 3
  574 | parse_keyserver_uri (const char *uri, int require_scheme,
      | ^
gpgv.c:574:1: note: 'parse_keyserver_uri' was previously declared here
keyserver-internal.h:53:5: warning: type of 'keyserver_import_ldap' does not match original declaration [-Wlto-type-mismatch]
   53 | int keyserver_import_ldap (ctrl_t ctrl, const char *name,
      |     ^
gpgv.c:472:1: note: type mismatch in parameter 2
  472 | keyserver_import_ldap (const char *name)
      | ^
gpgv.c:472:1: note: 'keyserver_import_ldap' was previously declared here
keyserver-internal.h:50:5: warning: type of 'keyserver_import_name' does not match original declaration [-Wlto-type-mismatch]
   50 | int keyserver_import_name (ctrl_t ctrl,
      |     ^
gpgv.c:464:1: note: type mismatch in parameter 3
  464 | keyserver_import_name (const char *name,struct keyserver_spec *spec)
      | ^
gpgv.c:464:1: note: 'keyserver_import_name' was previously declared here
keyserver-internal.h:46:13: warning: type of 'keyserver_import_pka' does not match original declaration [-Wlto-type-mismatch]
   46 | gpg_error_t keyserver_import_pka (ctrl_t ctrl, const char *name,
      |             ^
gpgv.c:444:1: note: return value type mismatch
  444 | keyserver_import_pka (const char *name,unsigned char *fpr)
      | ^
gpgv.c:444:1: note: type 'int' should match type 'gpg_error_t'
gpgv.c:444:1: note: 'keyserver_import_pka' was previously declared here
keyserver-internal.h:44:5: warning: type of 'keyserver_import_cert' does not match original declaration [-Wlto-type-mismatch]
   44 | int keyserver_import_cert (ctrl_t ctrl, const char *name, int dane_mode,
      |     ^
gpgv.c:437:1: note: type mismatch in parameter 2
  437 | keyserver_import_cert (const char *name)
      | ^
gpgv.c:437:1: note: 'keyserver_import_cert' was previously declared here
keyserver-internal.h:39:5: warning: type of 'keyserver_import_keyid' does not match original declaration [-Wlto-type-mismatch]
   39 | int keyserver_import_keyid (ctrl_t ctrl, u32 *keyid,
      |     ^
gpgv.c:416:1: note: type mismatch in parameter 3
  416 | keyserver_import_keyid (u32 *keyid, void *dummy, int quick)
      | ^
gpgv.c:416:1: note: 'keyserver_import_keyid' was previously declared here
cvt-openpgp.h:27:13: warning: type of 'convert_from_openpgp_native' does not match original declaration [-Wlto-type-mismatch]
   27 | gpg_error_t convert_from_openpgp_native (ctrl_t ctrl,
      |             ^
t-protect.c:343:1: note: type mismatch in parameter 4
  343 | convert_from_openpgp_native (gcry_sexp_t s_pgp, const char *passphrase,
      | ^
t-protect.c:343:1: note: 'convert_from_openpgp_native' was previously declared here
scdaemon.c: In function 'handle_connections':
scdaemon.c:1391:11: warning: ignoring return value of 'read', declared with attribute warn_unused_result [-Wunused-result]
 1391 |           read (pipe_fd[0], buf, sizeof buf);
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
scdaemon.c: In function 'scd_kick_the_loop':
scdaemon.c:1232:3: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
 1232 |   write (notify_fd, "", 1);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~
dns.c:4282:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '#pragma'
 4282 | #pragma GCC   diagnostic ignored "-Wstrict-prototypes"
      |         ^~~
dns.c:4310:15: error: expected ';' before 'static'
 4310 | DNS_PRAGMA_POP  /*(-Wstrict-prototypes)*/
      |               ^
      |               ;
......
 4314 | static const struct dns_rrtype *dns_rrtype(enum dns_type type) {
      | ~~~~~~         
dns.c:6038:1: error: unknown type name 'DNS_PRAGMA_PUSH'
 6038 | DNS_PRAGMA_PUSH
      | ^~~~~~~~~~~~~~~
dns.c:6039:17: error: expected ';' before 'static'
 6039 | DNS_PRAGMA_QUIET
      |                 ^
      |                 ;
 6040 | 
 6041 | static int dns_nssconf_k2c(int k) {
      | ~~~~~~           
dns.c:6073:15: error: expected ';' before 'int'
 6073 | DNS_PRAGMA_POP
      |               ^
      |               ;
......
 6076 | int dns_nssconf_loadfile(struct dns_resolv_conf *resconf, FILE *fp) {
      | ~~~            
make[2]: *** [Makefile:994: dns.o] Error 1
make[2]: *** Waiting for unfinished jobs....
dns.c:4282:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '#pragma'
 4282 | #pragma GCC   diagnostic ignored "-Wstrict-prototypes"
      |         ^~~
dns.c:4310:15: error: expected ';' before 'static'
 4310 | DNS_PRAGMA_POP  /*(-Wstrict-prototypes)*/
      |               ^
      |               ;
......
 4314 | static const struct dns_rrtype *dns_rrtype(enum dns_type type) {
      | ~~~~~~         
dns.c:6038:1: error: unknown type name 'DNS_PRAGMA_PUSH'
 6038 | DNS_PRAGMA_PUSH
      | ^~~~~~~~~~~~~~~
dns.c:6039:17: error: expected ';' before 'static'
 6039 | DNS_PRAGMA_QUIET
      |                 ^
      |                 ;
 6040 | 
 6041 | static int dns_nssconf_k2c(int k) {
      | ~~~~~~           
dns.c:6073:15: error: expected ';' before 'int'
 6073 | DNS_PRAGMA_POP
      |               ^
      |               ;
......
 6076 | int dns_nssconf_loadfile(struct dns_resolv_conf *resconf, FILE *fp) {
      | ~~~
kloczek created this task.Mar 20 2019, 10:04 AM
kloczek created this object in space S1 Public.
kloczek updated the task description. (Show Details)Mar 20 2019, 10:16 AM
werner closed this task as Wontfix.Mar 20 2019, 10:24 AM
werner claimed this task.
werner added a subscriber: werner.

There are reasons why we sometimes don't consult the return code. That is even declared in the code with a cast to void. Further we use gpg_error_t and int interchangeable under the assumption that an unsigned int and an int value have the same bit pattern.