[英]PHP7 and Apache compilation warnings
当我构建php 7.0.1时,我有一些警告,我希望这可以在更新版本的php中修复,但今天我有更多的警告7.0.2。
6 php_date.c
文件生成了警告
/Users/username/folder/php/ext/date/php_date.c:2196:6: warning: absolute value function 'abs' given an argument of type 'long long' but has parameter of type 'int' which may cause truncation of value [-Wabsolute-value] abs(utc_offset / 60),
^
/Users/username/folder/php/ext/date/php_date.c:2196:6: note: use function 'llabs' instead abs(utc_offset / 60), ^~~ llabs
6 warnings generated.
interval.c
生成1个警告
/Users/javidgajievi/Ovlee/php/ext/date/lib/interval.c:73:13: warning: using integer absolute value function 'abs' when argument is of
floating point type [-Wabsolute-value]
rt->days = abs(floor((one->sse - two->sse - (dst_h_corr * 3600) - (dst_m_corr * 60)) / 86400));
^
/Users/javidgajievi/Ovlee/php/ext/date/lib/interval.c:73:13: note: use function 'fabs' instead
rt->days = abs(floor((one->sse - two->sse - (dst_h_corr * 3600) - (dst_m_corr * 60)) / 86400));
^~~
fabs
1 warning generated.
pthreads生成了1个警告
ext/pthreads/src/object.h:41:1: warning: '/*' within block comment [-Wcomment]
/* {{{ */
^
Apache已经生成了更多警告,因此我将仅列出其中的一些警告,以便让您了解警告。
mod_authnz_ldap.c:554:50: warning: 'ldap_err2string' is deprecated: first deprecated in OS X 10.11 - use OpenDirectory Framework
[-Wdeprecated-declarations]
user, r->uri, ldc->reason, ldap_err2string(result));
^
/Users/username/folder/apache/include/http_log.h:448:44: note: expanded from macro 'ap_log_rerror'
#define ap_log_rerror(...) ap_log_rerror__(__VA_ARGS__)
^
/Users/username/ovlee/apache/include/http_log.h:451:63: note: expanded from macro 'ap_log_rerror__'
ap_log_rerror_(file, line, mi, level, status, r, __VA_ARGS__); \
我的构建配置
PHP
./configure \
--prefix=/Users/username/fodler/php \
--exec-prefix=/Users/username/folder/php \
--with-apxs2=/Users/username/folder/apache/bin/apxs \
--with-config-file-scan-dir=/Users/username/folder/php/lib \
--with-config-file-path=/Users/username/folder/php/lib \
--disable-all \
--enable-maintainer-zts \
--enable-pthreads
阿帕奇
./configure \
--prefix=/Users/username/fodler/apache \
--exec-prefix=/Users/username/folder/apache \
--with-pcre=/Users/username/folder/apache/pcre \
--enable-module=so \
--with-mpm=worker
因此我不打算列出所有警告,因为我认为问题可能是由我的环境引起的,即Mac OSX 10.11.2,xCode 7.2,PHP 7.0.2,APAHCE(Httpd)2.4.18
您认为问题是什么? 我该如何修复此警告?
“我只想知道这些警告的原因。”
好的,不确定这是否真的会对你有所帮助,但我们在这里...... ;-)
关于/Users/username/folder/php/ext/date/php_date.c:2196:6
:
代码行是
abs(utc_offset / 60)
其中utc_offset
声明为timelib_sll utc_offset
。
timelib_sll
定义为
#if defined(_MSC_VER)
typedef uint64_t timelib_ull;
typedef int64_t timelib_sll;
# define TIMELIB_LL_CONST(n) n ## i64
#else
typedef unsigned long long timelib_ull;
typedef signed long long timelib_sll;
# define TIMELIB_LL_CONST(n) n ## ll
#endif
在timelib_structs.h中,由于你在mac上,因此不会定义_MSC_VER,因此timelib_sll是一个很短的long。
并且编译器抱怨将一个短的long long *传递给一个期望int的函数(在你的情况下,它比“long”更小)。
类似于interval.c:73的警告。
我从php.net下载的档案没有包含目录ext / pthreads,但警告信息暗示有人发表了评论
/**
lalala
/* {{{ */
*/
在该文件中,编译器抱怨嵌套的注释块。
关于mod_authnz_ldap.c:554:50: warning: 'ldap_err2string' is deprecated
:apple希望开发人员现在使用另一个函数。 现在我不知道替换会是什么。
以下两条消息(包含expanded from macro
消息)只提示源; 因为它在宏观扩张中,否则可能很难找到它。 (因为这看起来像CLANG警告我已经查了一下,是的: 从Xcode 4.2开始,Clang是Mac OS X的默认编译器。 - 所以我从这里学到了一些东西;-))
*编辑和顺便说一句:
下一行是
abs((utc_offset % 60)))
对此我没有得到警告; 编译器足够聪明,可以识别模60的某个内容完全在int的值范围内。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.