add deprecated support for VC
[email protected] ("Pierre Joye")
| Newsgroups | php.internals.win |
|---|---|
| Message-ID | <[email protected]> |
hi,
Please find a patch to add the deprecated attribute to windows (VC2003
or later only). If you like to see the warnings (and tons of other),
remove the "/wd4996" option in the generated Makefile on line 46.
VC requires the tag to be placed at the beginning of the declaration
PHPAPI ZEND_ATTRIBUTE_DEPRECATED void my_old_function(int flag TSRMLS_DC);
It should work with GCC as well but I don't have one at hand here, can
someone confirm it please?
The patch uses __declspec(deprecated), we also have an option to add a
text in the warning:
__declspec(deprecated("** my_old_function is deprecated, please use
my_new_function instead **"))
which will be displayed with the C4996 warning.
I wonder if we should not "fix" our code base to remove the deprecated
warnings for the CRT (_open, etc.). It may help us to use a more noisy
mode to catch possible issues or improvements.
Cheers,
--
Pierre
http://blog.thepimp.net | http://www.libgd.org
Zend_deprecated.patch.txt
(text/plain, 943 B)
Index: zend.h =================================================================== RCS file: /repository/ZendEngine2/zend.h,v retrieving revision 1.293.2.11.2.9.2.22 diff -u -r1.293.2.11.2.9.2.22 zend.h --- zend.h 27 Jun 2008 00:01:25 -0000 1.293.2.11.2.9.2.22 +++ zend.h 27 Jun 2008 00:59:13 -0000 @@ -176,10 +176,18 @@ # define ZEND_ATTRIBUTE_PTR_FORMAT(type, idx, first) #endif -#if ZEND_GCC_VERSION >= 3001 -# define ZEND_ATTRIBUTE_DEPRECATED __attribute__((deprecated)) +#ifdef ZEND_WIN32 +# if _MSC_VER >= 1300 +# define ZEND_ATTRIBUTE_DEPRECATED __declspec(deprecated) +# else +# define ZEND_ATTRIBUTE_DEPRECATED +# endif #else -# define ZEND_ATTRIBUTE_DEPRECATED +# if ZEND_GCC_VERSION >= 3001 +# define ZEND_ATTRIBUTE_DEPRECATED __attribute__((deprecated)) +# else +# define ZEND_ATTRIBUTE_DEPRECATED +# endif #endif #if defined(__GNUC__) && ZEND_GCC_VERSION >= 3400 && defined(__i386__)