2016-01-15 109 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都能正常工作,但我认为我应该关注构建过程的每个细节。再次感谢。 –