When I compile a sample program with GCRYPT_NO_DEPRECATED defined, I get the following 6 warnings:

/usr/local/Cellar/libgcrypt/1.5.0/include/gcrypt.h:1336: warning: ‘gcry_ac_io_mode_t’ is deprecated
/usr/local/Cellar/libgcrypt/1.5.0/include/gcrypt.h:1337: warning: ‘gcry_ac_io_type_t’ is deprecated
/usr/local/Cellar/libgcrypt/1.5.0/include/gcrypt.h:1344: warning: ‘gcry_ac_data_read_cb_t’ is deprecated
/usr/local/Cellar/libgcrypt/1.5.0/include/gcrypt.h:1358: warning: ‘gcry_ac_data_write_cb_t’ is deprecated
/usr/local/Cellar/libgcrypt/1.5.0/include/gcrypt.h:1393: warning: ‘gcry_md_algo_t’ is deprecated
/usr/local/Cellar/libgcrypt/1.5.0/include/gcrypt.h:1401: warning: ‘gcry_md_algo_t’ is deprecated

Manually defining _GCRYPT_IN_LIBGCRYPT resolves the 6 warnings, but the manual is fairly strict in its exhortation:

name prefixes with one prepended underscore are reserved for internal use and should never be used by an application.

So how is one supposed to compile the gcrypt header without warnings?

有帮助吗?

解决方案

gcrypt author says, "This is a bug in some compilers"

Suggested work around is

#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
before the include, and
#pragma GCC diagnostic warning "-Wdeprecated-declarations"

http://lists.gnupg.org/pipermail/gcrypt-devel/2011-July/001829.html

http://lists.gnupg.org/pipermail/gcrypt-devel/2011-July/001830.html

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top