com php-src: made Visual Studio to understand that zend_error _noreturn() will not return: Zend/zend.c Ze nd/zend.h
| From: | Anatol Belski | Date: | Mon, 08 Sep 2014 18:34:26 +0000 |
| Subject: | com php-src: made Visual Studio to understand that zend_error _noreturn() will not return: Zend/zend.c Ze nd/zend.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-81456@lists.php.net to get a copy of this message | ||
Commit: 9ee4a40f27c7c7fcd0edcd3a7420ea7cdf299f45
Author: Anatol Belski <ab@php.net> Mon, 8 Sep 2014 20:34:26 +0200
Parents: 6561d03a41772309aaff6027dced8b349eaf1458
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9ee4a40f27c7c7fcd0edcd3a7420ea7cdf299f45
Log:
made Visual Studio to understand that zend_error_noreturn() will not return
- windows only, on linux gcc would cause a warning that the function returns,
as no noreturn functions are used
- ZEND_NORETURN works on windows as well now, using __declspec(noreturn),
which is useful for the other cases
- one more function call will be needed, which is not critical for the
error reporting
- the way is open to enable the same for gcc as soon as it's not causing a warning
Changed paths:
M Zend/zend.c
M Zend/zend.h
Diff:
diff --git a/Zend/zend.c b/Zend/zend.c
index 334a8df..de13108 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -1031,11 +1031,17 @@ ZEND_API zval *zend_get_configuration_directive(zend_string *name) /* {{{ */
} \
} while (0)
+#ifndef ZEND_WIN32
ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
+#else
+static void zend_error_va_list(int type, const char *format, va_list args)
+#endif
{
char *str;
int len;
+#ifndef ZEND_WIN32
va_list args;
+#endif
va_list usr_copy;
zval params[5];
zval retval;
@@ -1138,7 +1144,9 @@ ZEND_API void zend_error(int type, const char *format, ....) /* {{{ */
}
#endif /* HAVE_DTRACE */
+#ifndef ZEND_WIN32
va_start(args, format);
+#endif
/* if we don't have a user defined error handler */
if (Z_TYPE(EG(user_error_handler)) == IS_UNDEF
@@ -1249,7 +1257,9 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
break;
}
+#ifndef ZEND_WIN32
va_end(args);
+#endif
if (type == E_PARSE) {
/* eval() errors do not affect exit_status */
@@ -1266,6 +1276,24 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
#if defined(__GNUC__) && __GNUC__ >= 3 && !defined(__INTEL_COMPILER) &&
!defined(DARWIN) && !defined(__hpux) && !defined(_AIX) && !defined(__osf__)
void zend_error_noreturn(int type, const char *format, ...) __attribute__
((alias("zend_error"),noreturn));
+#elif defined(ZEND_WIN32)
+ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
+{
+ va_list va;
+
+ va_start(va, format);
+ zend_error_va_list(type, format, va);
+ va_end(va);
+}
+
+ZEND_API ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...)
+{
+ va_list va;
+
+ va_start(va, format);
+ zend_error_va_list(type, format, va);
+ va_end(va);
+}
#endif
ZEND_API void zend_output_debug_string(zend_bool trigger_break, const char *format, ...) /* {{{ */
diff --git a/Zend/zend.h b/Zend/zend.h
index a0d8ba9..d79920f 100644
--- a/Zend/zend.h
+++ b/Zend/zend.h
@@ -309,6 +309,9 @@ typedef enum {
#if defined(__GNUC__) && __GNUC__ >= 3 && !defined(__INTEL_COMPILER) &&
!defined(DARWIN) && !defined(__hpux) && !defined(_AIX) && !defined(__osf__)
# define ZEND_NORETURN __attribute__((noreturn))
void zend_error_noreturn(int type, const char *format, ...) __attribute__ ((noreturn));
+#elif defined(ZEND_WIN32)
+# define ZEND_NORETURN __declspec(noreturn)
+ZEND_API ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...);
#else
# define ZEND_NORETURN
# define zend_error_noreturn zend_error