简体   繁体   中英

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

6 Warnings were generated by php_date.c files

/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

/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

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.

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

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

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 :
The code line is

abs(utc_offset / 60)

where utc_offset is declared as timelib_sll utc_offset .
timelib_sll is defined as

#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.
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).

Similar thing with the warning for 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

/**
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. 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; 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 ;-))


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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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