简体   繁体   English

PHP7和Apache编译警告

[英]PHP7 and Apache compilation warnings

When I build php 7.0.1 I had some warnings, I hoped this to be fixed in newer version of php but today I had more warnings with 7.0.2. 当我构建php 7.0.1时,我有一些警告,我希望这可以在更新版本的php中修复,但今天我有更多的警告7.0.2。

php PHP

6 Warnings were generated by php_date.c files 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.

1 warning generated by interval.c 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.

and 1 warning was generated by pthreads pthreads生成了1个警告

ext/pthreads/src/object.h:41:1: warning: '/*' within block comment [-Wcomment]
/* {{{ */
^

Apache 阿帕奇

Apache has generated more warnings so I am going to list only a few of them to give you an idea about the warnings. 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__); \

My build configuration 我的构建配置

php 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

Apache 阿帕奇

./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

So I am not going to list all warning since I think the problem might be causing from my environment which is Mac OSX 10.11.2, xCode 7.2, PHP 7.0.2, APAHCE(Httpd) 2.4.18 因此我不打算列出所有警告,因为我认为问题可能是由我的环境引起的,即Mac OSX 10.11.2,xCode 7.2,PHP 7.0.2,APAHCE(Httpd)2.4.18

What do you think the problem is? 您认为问题是什么? how do I fix this warnings? 我该如何修复此警告?

"I only wish to know the reason of these warnings." “我只想知道这些警告的原因。”
Ok, not sure if this will really help you, but here we go .... ;-) 好的,不确定这是否真的会对你有所帮助,但我们在这里...... ;-)

Concerning /Users/username/folder/php/ext/date/php_date.c:2196:6 : 关于/Users/username/folder/php/ext/date/php_date.c:2196:6
The code line is 代码行是

abs(utc_offset / 60)

where utc_offset is declared as timelib_sll utc_offset . 其中utc_offset声明为timelib_sll utc_offset
timelib_sll is defined as 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

in timelib_structs.h and since you're on a mac, _MSC_VER won't be defined and hence timelib_sll is a short long long. 在timelib_structs.h中,由于你在mac上,因此不会定义_MSC_VER,因此timelib_sll是一个很短的long。
And the compiler complains about a short long long* being passed to a function that expects an int (which is in your case way "smaller" than a long long). 并且编译器抱怨将一个短的long long *传递给一个期望int的函数(在你的情况下,它比“long”更小)。

Similar thing with the warning for interval.c:73. 类似于interval.c:73的警告。

The archive I've downloaded from php.net didn't include a directory ext/pthreads, but the warning message implies that someone has put a comment like 我从php.net下载的档案没有包含目录ext / pthreads,但警告信息暗示有人发表了评论

/**
lalala
  /* {{{ */
*/

in that file and the compiler is complaing about the nested comment block. 在该文件中,编译器抱怨嵌套的注释块。

Concerning mod_authnz_ldap.c:554:50: warning: 'ldap_err2string' is deprecated : apple wants the developers to use another function now. 关于mod_authnz_ldap.c:554:50: warning: 'ldap_err2string' is deprecated :apple希望开发人员现在使用另一个函数。 Right now I don't know what the replacement would be. 现在我不知道替换会是什么。
The following two messages (those containing expanded from macro ) just hint to the source; 以下两条消息(包含expanded from macro消息)只提示源; since it's in a macro expansion it might be difficult to find it otherwise. 因为它在宏观扩张中,否则可能很难找到它。 (Since this looked decidedly like a CLANG warning I've looked it up and, yes: From Xcode 4.2, Clang is the default compiler for Mac OS X. - so I learned something from this anway ;-)) (因为这看起来像CLANG警告我已经查了一下,是的: 从Xcode 4.2开始,Clang是Mac OS X的默认编译器。 - 所以我从这里学到了一些东西;-))


*edit and btw: *编辑和顺便说一句:
the next line is 下一行是

abs((utc_offset % 60)))

for which I didn't get a warning; 对此我没有得到警告; the compiler is smart enough to recognize that something modulo 60 is well within the value range of an int. 编译器足够聪明,可以识别模60的某个内容完全在int的值范围内。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM