implement compatibility shim for __warn_references

This will allow us to warn about deprecated function references at link-time.
This commit is contained in:
Brent Cook
2015-07-17 16:54:23 -05:00
parent fafc3e47f2
commit a1a0f2c6e2
3 changed files with 44 additions and 0 deletions

View File

@@ -21,6 +21,7 @@ noinst_HEADERS += machine/endian.h
noinst_HEADERS += netinet/in.h
noinst_HEADERS += netinet/tcp.h
noinst_HEADERS += sys/cdefs.h
noinst_HEADERS += sys/ioctl.h
noinst_HEADERS += sys/mman.h
noinst_HEADERS += sys/select.h

31
include/sys/cdefs.h Normal file
View File

@@ -0,0 +1,31 @@
/*
* Public domain
* sys/cdefs.h compatibility shim
*/
#ifndef LIBCRYPTOCOMPAT_SYS_CDEFS_H
#define LIBCRYPTOCOMPAT_SYS_CDEFS_H
#ifdef _WIN32
#define __warn_references(sym,msg)
#else
#include_next <sys/cdefs.h>
#ifndef __warn_references
#if defined(__GNUC__) && defined (HAS_GNU_WARNING_LONG)
#define __warn_references(sym,msg) \
__asm__(".section .gnu.warning." __STRING(sym) \
" ; .ascii \"" msg "\" ; .text");
#else
#define __warn_references(sym,msg)
#endif
#endif /* __warn_references */
#endif /* _WIN32 */
#endif /* LIBCRYPTOCOMPAT_SYS_CDEFS_H */