2016-01-15 140 views
3

當我建立php 7.0.1時,我有一些警告,我希望這可以在新版本的php中修復,但是今天我有7.0.2的更多警告。PHP7和Apache編譯警告

PHP 通過 php_date.c文件由 interval.c

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

和1警告生成

/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警告生成

6警告被並行線程生成

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

Apache

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

你認爲問題是什麼?我如何解決這個警告?

+1

還有一些問題嗎? –

+0

顯然問題是,我該如何解決這個警告? –

+0

你想改變/修復代碼(並可能返回到PHP源代碼庫)? – VolkerK

回答

2

「我只想知道這些警告的原因。」
好了,不知道這是否會真正幫助你,但在這裏我們去.... ;-)

關於/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是一個簡短的很長很長。
而且編譯器會抱怨傳遞給一個需要int的函數(這在你的情況下比「long」更小)。

與interval.c:警告類似的事情。

我從php.net下載的檔案文件並沒有包含目錄EXT /並行線程,但警告消息意味着有人已經把像

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

評論在文件和編譯器抱怨嵌套的評論塊。

關於mod_authnz_ldap.c:554:50: warning: 'ldap_err2string' is deprecated:蘋果希望開發者現在使用另一個功能。現在I don't know什麼替代將是。
以下兩條消息(包含expanded from macro的消息)只是暗示來源;因爲它處於宏觀擴張之中,否則可能很難找到它。 (由於這看起來決然像CLANG警告我看着它,是的:From Xcode 4.2, Clang is the default compiler for Mac OS X. - 所以我學到了一些東西,從這個安韋;-))


*編輯和BTW:
下一行是

abs((utc_offset % 60))) 

爲此我沒有得到警告;編譯器足夠聰明,可以識別模60的值在int的值範圍內。

+0

謝謝你的時間,試圖理解這個過程,但我真正感興趣的是這個警告的原因,我的意思是說,這些是由我的機器引起的錯誤或東西..但這個答案值得「投票」。 –

+0

雖然可能,但在這種情況下,它與您的機器,配置或設置無關。而那些你發佈的內容現在看起來並不重要。 – VolkerK

+0

是的,儘管警告php和apache都能正常工作,但我認爲我應該關注構建過程的每個細節。再次感謝。 –