From: George Peter Banyard Date: Tue, 12 May 2020 16:04:24 +0000 (+0200) Subject: Fix [-Wundef] warning in Tidy extension X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bc9497695e8d3a9fbb0a3d806598bab91926b3aa;p=php Fix [-Wundef] warning in Tidy extension --- diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c index b9f9c3502a..7084883ecf 100644 --- a/ext/tidy/tidy.c +++ b/ext/tidy/tidy.c @@ -21,18 +21,18 @@ #include "php.h" #include "php_tidy.h" -#if HAVE_TIDY +#ifdef HAVE_TIDY #include "php_ini.h" #include "ext/standard/info.h" -#if HAVE_TIDY_H +#ifdef HAVE_TIDY_H #include "tidy.h" -#elif HAVE_TIDYP_H +#elif defined(HAVE_TIDYP_H) #include "tidyp.h" #endif -#if HAVE_TIDYBUFFIO_H +#ifdef HAVE_TIDYBUFFIO_H #include "tidybuffio.h" #else #include "buffio.h" @@ -865,12 +865,12 @@ static PHP_MINFO_FUNCTION(tidy) { php_info_print_table_start(); php_info_print_table_row(2, "Tidy support", "enabled"); -#if HAVE_TIDYBUFFIO_H +#ifdef HAVE_TIDYBUFFIO_H php_info_print_table_row(2, "libTidy Version", (char *)tidyLibraryVersion()); -#elif HAVE_TIDYP_H +#elif defined(HAVE_TIDYP_H) php_info_print_table_row(2, "libtidyp Version", (char *)tidyVersion()); #endif -#if HAVE_TIDYRELEASEDATE +#ifdef HAVE_TIDYRELEASEDATE php_info_print_table_row(2, "libTidy Release", (char *)tidyReleaseDate()); #endif php_info_print_table_end(); @@ -1139,7 +1139,7 @@ PHP_FUNCTION(tidy_get_release) RETURN_THROWS(); } -#if HAVE_TIDYRELEASEDATE +#ifdef HAVE_TIDYRELEASEDATE RETURN_STRING((char *)tidyReleaseDate()); #else RETURN_STRING((char *)"unknown"); @@ -1148,7 +1148,7 @@ PHP_FUNCTION(tidy_get_release) /* }}} */ -#if HAVE_TIDYOPTGETDOC +#ifdef HAVE_TIDYOPTGETDOC /* {{{ proto string tidy_get_opt_doc(tidy resource, string optname) Returns the documentation for the given option name */ PHP_FUNCTION(tidy_get_opt_doc) @@ -1775,7 +1775,7 @@ static void _php_tidy_register_tags(INIT_FUNC_ARGS) TIDY_TAG_CONST(VAR); TIDY_TAG_CONST(WBR); TIDY_TAG_CONST(XMP); -# if HAVE_TIDYBUFFIO_H +# ifdef HAVE_TIDYBUFFIO_H TIDY_TAG_CONST(ARTICLE); TIDY_TAG_CONST(ASIDE); TIDY_TAG_CONST(AUDIO); diff --git a/ext/tidy/tidy.stub.php b/ext/tidy/tidy.stub.php index 528fe425c9..fbb11adb93 100644 --- a/ext/tidy/tidy.stub.php +++ b/ext/tidy/tidy.stub.php @@ -24,7 +24,7 @@ function tidy_diagnose(tidy $object): bool {} function tidy_get_release(): string {} -#if HAVE_TIDYOPTGETDOC +#ifdef HAVE_TIDYOPTGETDOC function tidy_get_opt_doc(tidy $object, string $optname): string|false {} #endif @@ -129,7 +129,7 @@ class tidy */ public function getHtmlVer() {} -#if HAVE_TIDYOPTGETDOC +#ifdef HAVE_TIDYOPTGETDOC /** * @return string|false * @alias tidy_get_opt_doc diff --git a/ext/tidy/tidy_arginfo.h b/ext/tidy/tidy_arginfo.h index fca663d5a4..84ecbb07d8 100644 --- a/ext/tidy/tidy_arginfo.h +++ b/ext/tidy/tidy_arginfo.h @@ -43,7 +43,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tidy_get_release, 0, 0, IS_STRING, 0) ZEND_END_ARG_INFO() -#if HAVE_TIDYOPTGETDOC +#if defined(HAVE_TIDYOPTGETDOC) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_tidy_get_opt_doc, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_OBJ_INFO(0, object, tidy, 0) ZEND_ARG_TYPE_INFO(0, optname, IS_STRING, 0) @@ -139,7 +139,7 @@ ZEND_END_ARG_INFO() #define arginfo_class_tidy_getHtmlVer arginfo_class_tidy_cleanRepair -#if HAVE_TIDYOPTGETDOC +#if defined(HAVE_TIDYOPTGETDOC) ZEND_BEGIN_ARG_INFO_EX(arginfo_class_tidy_getOptDoc, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, optname, IS_STRING, 0) ZEND_END_ARG_INFO() @@ -189,7 +189,7 @@ ZEND_FUNCTION(tidy_repair_string); ZEND_FUNCTION(tidy_repair_file); ZEND_FUNCTION(tidy_diagnose); ZEND_FUNCTION(tidy_get_release); -#if HAVE_TIDYOPTGETDOC +#if defined(HAVE_TIDYOPTGETDOC) ZEND_FUNCTION(tidy_get_opt_doc); #endif ZEND_FUNCTION(tidy_get_config); @@ -231,7 +231,7 @@ static const zend_function_entry ext_functions[] = { ZEND_FE(tidy_repair_file, arginfo_tidy_repair_file) ZEND_FE(tidy_diagnose, arginfo_tidy_diagnose) ZEND_FE(tidy_get_release, arginfo_tidy_get_release) -#if HAVE_TIDYOPTGETDOC +#if defined(HAVE_TIDYOPTGETDOC) ZEND_FE(tidy_get_opt_doc, arginfo_tidy_get_opt_doc) #endif ZEND_FE(tidy_get_config, arginfo_tidy_get_config) @@ -265,7 +265,7 @@ static const zend_function_entry class_tidy_methods[] = { ZEND_ME_MAPPING(getConfig, tidy_get_config, arginfo_class_tidy_getConfig, ZEND_ACC_PUBLIC) ZEND_ME_MAPPING(getStatus, tidy_get_status, arginfo_class_tidy_getStatus, ZEND_ACC_PUBLIC) ZEND_ME_MAPPING(getHtmlVer, tidy_get_html_ver, arginfo_class_tidy_getHtmlVer, ZEND_ACC_PUBLIC) -#if HAVE_TIDYOPTGETDOC +#if defined(HAVE_TIDYOPTGETDOC) ZEND_ME_MAPPING(getOptDoc, tidy_get_opt_doc, arginfo_class_tidy_getOptDoc, ZEND_ACC_PUBLIC) #endif ZEND_ME_MAPPING(isXhtml, tidy_is_xhtml, arginfo_class_tidy_isXhtml, ZEND_ACC_PUBLIC)