[英]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.