# Building PHP. Clean builds. Noisy redefines.

- Thread: https://externals.io/message/37160
- Original archive: https://news-web.php.net/php.internals/37160
- Started by Richard Quadling on 2008-04-22T11:01:05+00:00
- Messages: 12
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #37160 — Richard Quadling — 2008-04-22T11:01:05+00:00

URL: https://externals.io/message/37160#37160

Hi.

Probably much to all your annoyance, I've finally managed to compile
PHP on windows and I have a few questions.I'm very much just learning.


I notice that there are a LOT of warnings when I'm compiling. The huge
majority are benign.

But, is there a reason to not fix the issue and make the code unambiguous?

Things like (just grabbed from screen) ...

main\streams\userspace.c(823) : warning C4244: '=' : conversion from
'long' to '_ino_t', possible loss of data
main\streams\userspace.c(824) : warning C4244: '=' : conversion from
'long' to 'unsigned short', possible loss of data
main\streams\userspace.c(825) : warning C4244: '=' : conversion from
'long' to 'short', possible loss of data

The way I look at this, is that a long was used for some reason, so,
theoretically, it could hold a value which cannot be converted to the
destination type without a problem.


Another warning is that some of the constants are redefined to a
different value from the ones that are part of the compiler. The
/TRSM/readdir.h, _WIN32_WINNT is redefined from 0x0600 in C:\Program
Files\Microsoft SDKs\Windows\v6.1\include\sdkddkver.h(186).

This 1 #define causes a LOT of noise during compilation. I know I
could suppress all the warnings, but with so much noise, how does
anyone see the true warnings in the noise?

By adding a #undef _WIN32_WINNT before #define _WIN32_WINNT 0x0400,
this removes the warning.  It is more or less every .c compile.

Regards,

Richard Quadling.

-- 
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"

---

## #37162 — Elizabeth M Smith — 2008-04-22T11:53:09+00:00

URL: https://externals.io/message/37160#37162 · In reply to: #37160

Richard Quadling wrote:
> Hi.
> 
> Probably much to all your annoyance, I've finally managed to compile
> PHP on windows and I have a few questions.I'm very much just learning.
> 
> 
> I notice that there are a LOT of warnings when I'm compiling. The huge
> majority are benign.
> 
> But, is there a reason to not fix the issue and make the code unambiguous?
> 
> Things like (just grabbed from screen) ...
> 
> main\streams\userspace.c(823) : warning C4244: '=' : conversion from
> 'long' to '_ino_t', possible loss of data
> main\streams\userspace.c(824) : warning C4244: '=' : conversion from
> 'long' to 'unsigned short', possible loss of data
> main\streams\userspace.c(825) : warning C4244: '=' : conversion from
> 'long' to 'short', possible loss of data
> 
> The way I look at this, is that a long was used for some reason, so,
> theoretically, it could hold a value which cannot be converted to the
> destination type without a problem.
> 
> 
> Another warning is that some of the constants are redefined to a
> different value from the ones that are part of the compiler. The
> /TRSM/readdir.h, _WIN32_WINNT is redefined from 0x0600 in C:\Program
> Files\Microsoft SDKs\Windows\v6.1\include\sdkddkver.h(186).
> 
> This 1 #define causes a LOT of noise during compilation. I know I
> could suppress all the warnings, but with so much noise, how does
> anyone see the true warnings in the noise?
> 
> By adding a #undef _WIN32_WINNT before #define _WIN32_WINNT 0x0400,
> this removes the warning.  It is more or less every .c compile.
> 
> Regards,
> 
> Richard Quadling.
> 
Hmmm - I don't get the first set of long to short warnings - what
compiler/sdk are you using?  Second set of (highly annoying) warnings is
due to a file in TSRM - in readdir.h - and I'd love to have fixed but
there is a very small set of people with karma there and even fewer who
care about windows compiler warnings.

Thanks,
Elizabeth Smith

---

## #37165 — Hannes Magnusson — 2008-04-22T11:57:43+00:00

URL: https://externals.io/message/37160#37165 · In reply to: #37162

On Tue, Apr 22, 2008 at 1:53 PM, Elizabeth M Smith
<auroraeosrose@gmail.com> wrote:
>  Hmmm - I don't get the first set of long to short warnings - what
>  compiler/sdk are you using?  Second set of (highly annoying) warnings is
>  due to a file in TSRM - in readdir.h - and I'd love to have fixed but
>  there is a very small set of people with karma there and even fewer who
>  care about windows compiler warnings.

...but many read patches sent to internals@ (especially people with
karma) and could commit them after reviewing :)
-Hannes

---

## #37166 — Antony Dovgal — 2008-04-22T12:00:44+00:00

URL: https://externals.io/message/37160#37166 · In reply to: #37160

> Another warning is that some of the constants are redefined to a
> different value from the ones that are part of the compiler. The
> /TRSM/readdir.h, _WIN32_WINNT is redefined from 0x0600 in C:\Program
> Files\Microsoft SDKs\Windows\v6.1\include\sdkddkver.h(186).
> 
> This 1 #define causes a LOT of noise during compilation. I know I
> could suppress all the warnings, but with so much noise, how does
> anyone see the true warnings in the noise?
> 
> By adding a #undef _WIN32_WINNT before #define _WIN32_WINNT 0x0400,
> this removes the warning.  It is more or less every .c compile.

http://dev.daylessday.org/diff/readdir_winnt.diff
Did I get you right ?

-- 
Wbr, 
Antony Dovgal

---

## #37167 — Richard Quadling — 2008-04-22T12:23:34+00:00

URL: https://externals.io/message/37160#37167 · In reply to: #37166

> 
>
> > […]
> SDKs\Windows\v6.1\include\sdkddkver.h(186).
> > […]
>
>  http://dev.daylessday.org/diff/readdir_winnt.diff
>  Did I get you right ?
>
>  --
>  Wbr, Antony Dovgal
>

Yes on the patch. There are a few more like this. It is just a cosmetic issue.

I am using Microsoft Visual C++ 2008 Express Edition with the Windows
Server 2008 and .NET 3.4 SDK.

I'm NOT running Apache (so runtime version issues there don't apply),
and I am only playing/learning - this is going nowhere near my
live/dev servers. Just learning.


My next goal is to get a version of Linux so I can build and test my
suggestions on 2 platforms. Hopefully, my patches/suggestions will
have more support!

Thank you.

Richard.


-- 
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"

---

## #37168 — Scott MacVicar — 2008-04-22T12:27:33+00:00

URL: https://externals.io/message/37160#37168 · In reply to: #37167

Richard Quadling wrote:
> 
> > […]
> 
> Yes on the patch. There are a few more like this. It is just a cosmetic issue.
> 
> I am using Microsoft Visual C++ 2008 Express Edition with the Windows
> Server 2008 and .NET 3.4 SDK.
> 
> I'm NOT running Apache (so runtime version issues there don't apply),
> and I am only playing/learning - this is going nowhere near my
> live/dev servers. Just learning.
> 
> 
> My next goal is to get a version of Linux so I can build and test my
> suggestions on 2 platforms. Hopefully, my patches/suggestions will
> have more support!
> 
> Thank you.
> 
> Richard.
> 
> 

I applied something slightly different, the define is only needed for 
old versions of Windows that lack it.

Scott

---

## #37169 — Antony Dovgal — 2008-04-22T12:28:28+00:00

URL: https://externals.io/message/37160#37169 · In reply to: #37167

> Yes on the patch. There are a few more like this. It is just a cosmetic issue.

Scott was faster than me and committed slightly different patch =)

-- 
Wbr, 
Antony Dovgal

---

## #37170 — johannes@php.net — 2008-04-22T12:51:11+00:00

URL: https://externals.io/message/37160#37170 · In reply to: #37165

> On Tue, Apr 22, 2008 at 1:53 PM, Elizabeth M Smith
> <auroraeosrose@gmail.com> wrote:
> > […]
> 
> ...but many read patches sent to internals@ (especially people with
> karma) and could commit them after reviewing :)

And a few might even grant karma after they saw a few good patches for
that area...

johannes

---

## #37171 — Steph Fox — 2008-04-22T14:31:06+00:00

URL: https://externals.io/message/37160#37171 · In reply to: #37162

Hi Richard,

> Hmmm - I don't get the first set of long to short warnings - what
> compiler/sdk are you using?

Just a quick note to say that I'm not seeing a lot of the warnings you 
describe, either. In fact the only place I see a _lot_ of compiler warnings 
is in ext/date. So please add your compiler version to the description, 
because those fixing the problems you describe may otherwise assume all 
Windows builds are affected when they are not.

- Steph

---

## #37175 — Richard Quadling — 2008-04-22T15:37:42+00:00

URL: https://externals.io/message/37160#37175 · In reply to: #37171

> Hi Richard,
>
>
> > […]
>
>  Just a quick note to say that I'm not seeing a lot of the warnings you
> describe, either. In fact the only place I see a _lot_ of compiler warnings
> is in ext/date. So please add your compiler version to the description,
> because those fixing the problems you describe may otherwise assume all
> Windows builds are affected when they are not.
>

I am using Microsoft Visual C++ 2008 Express Edition with the Windows
Server 2008 and .NET 3.4 SDK.

Richard.

-- 
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"

---

## #37188 — Jarismar Chaves da Silva — 2008-04-22T21:27:04+00:00

URL: https://externals.io/message/37160#37188 · In reply to: #37167

Greetings,
   I'm also having some fun with php devel on windows and I just would 
like to report that along with _WIN32_WINNT there are few others macro 
redefinitions. Here is the warnings I saw on last compilation...
   I'm using the MSVC++ Express Edition, .Net 3 on XP Professional.

c:\php-compile\php-5.2.6rc5\main\win95nt.h(75) : warning C4005: 
'WINDOWS' : macro redefinition
        
c:\php-compile\zlib-1.2.3-src\src\zlib\1.2.3\zlib-1.2.3\zconf.h(69) : 
see previous definition of 'WINDOWS'
c:\php-compile\php-5.2.6rc5\ext\gd\gd.c(4746) : warning C4005: 'max' : 
macro redefinition
        c:\arquivos de programas\microsoft visual studio 
9.0\vc\include\stdlib.h(849) : see previous definition of 'max'
c:\php-compile\php-5.2.6rc5\ext\gd\gd.c(4747) : warning C4005: 'min' : 
macro redefinition
        c:\arquivos de programas\microsoft visual studio 
9.0\vc\include\stdlib.h(850) : see previous definition of 'min'
c:\php-compile\php-5.2.6rc5\ext\gd\libgd\gd.c(29) : warning C4005: 
'fabsf' : macro redefinition
        c:\arquivos de programas\microsoft visual studio 
9.0\vc\include\math.h(288) : see previous definition of 'fabsf'
c:\php-compile\php-5.2.6rc5\ext\gd\libgd\gd.c(33) : warning C4005: 
'floorf' : macro redefinition
        c:\arquivos de programas\microsoft visual studio 
9.0\vc\include\math.h(301) : see previous definition of 'floorf'
c:\php-compile\php-5.2.6rc5\main\win95nt.h(75) : warning C4005: 
'WINDOWS' : macro redefinition
        
c:\php-compile\zlib-1.2.3-src\src\zlib\1.2.3\zlib-1.2.3\zconf.h(69) : 
see previous definition of 'WINDOWS'
c:\php-compile\php-5.2.6rc5\win32\glob.c(517) : warning C4090: 
'function' : different 'const' qualifiers
c:\arquivos de programas\microsoft visual studio 
9.0\vc\include\crtdbg.h(628) : warning C4005: '_malloca' : macro 
redefinition
        c:\arquivos de programas\microsoft visual studio 
9.0\vc\include\malloc.h(220) : see previous definition of '_malloca'
c:\php-compile\php-5.2.6rc5\tsrm\readdir.h(10) : warning C4005: 
'_WIN32_WINNT' : macro redefinition
        c:\php-compile\php-5.2.6rc5\win32\time.c(27) : see previous 
definition of '_WIN32_WINNT'
c:\php-compile\php-5.2.6rc5\ext\curl\interface.c(1099) : warning C4098: 
'zif_curl_init' : 'void' function returning a value
c:\php-compile\php-5.2.6rc5\ext\curl\interface.c(1099) : warning C4098: 
'zif_curl_init' : 'void' function returning a value
c:\php-compile\php-5.2.6rc5\ext\curl\interface.c(1099) : warning C4098: 
'zif_curl_init' : 'void' function returning a value
c:\php-compile\php-5.2.6rc5\ext\standard\scanf.c(397) : warning C4129: 
'%' : unrecognized character escape sequence
c:\php-compile\php-5.2.6rc5\ext\standard\scanf.c(397) : warning C4129: 
'%' : unrecognized character escape sequence

Thanks,
Jaris.

Richard Quadling wrote:
> 
>   
> > […]
>
> Yes on the patch. There are a few more like this. It is just a cosmetic issue.
>
> I am using Microsoft Visual C++ 2008 Express Edition with the Windows
> Server 2008 and .NET 3.4 SDK.
>
> I'm NOT running Apache (so runtime version issues there don't apply),
> and I am only playing/learning - this is going nowhere near my
> live/dev servers. Just learning.
>
>
> My next goal is to get a version of Linux so I can build and test my
> suggestions on 2 platforms. Hopefully, my patches/suggestions will
> have more support!
>
> Thank you.
>
> Richard.
>
>
>   

-- 

*Jarismar Chaves da Silva, M.Sc.*

*ADP**Labs** Brazil**
*jarismar_silva@adplabs.com.br <mailto:jarismar_silva@adplabs.com.br>
http://www.adp.com

---

## #37197 — Richard Quadling — 2008-04-23T08:53:35+00:00

URL: https://externals.io/message/37160#37197 · In reply to: #37188

>
>  Greetings,
>     I'm also having some fun with php devel on windows and I just would like
> to report that along with _WIN32_WINNT there are few others macro
> redefinitions. Here is the warnings I saw on last compilation...
>     I'm using the MSVC++ Express Edition, .Net 3 on XP Professional.
>
>  c:\php-compile\php-5.2.6rc5\main\win95nt.h(75) : warning
> C4005: 'WINDOWS' : macro redefinition
>
> c:\php-compile\zlib-1.2.3-src\src\zlib\1.2.3\zlib-1.2.3\zconf.h(69)
> : see previous definition of 'WINDOWS'
>  c:\php-compile\php-5.2.6rc5\ext\gd\gd.c(4746) : warning
> C4005: 'max' : macro redefinition
>          c:\arquivos de programas\microsoft visual studio
> 9.0\vc\include\stdlib.h(849) : see previous definition of 'max'
>  c:\php-compile\php-5.2.6rc5\ext\gd\gd.c(4747) : warning
> C4005: 'min' : macro redefinition
>          c:\arquivos de programas\microsoft visual studio
> 9.0\vc\include\stdlib.h(850) : see previous definition of 'min'
>  c:\php-compile\php-5.2.6rc5\ext\gd\libgd\gd.c(29) :
> warning C4005: 'fabsf' : macro redefinition
>          c:\arquivos de programas\microsoft visual studio
> 9.0\vc\include\math.h(288) : see previous definition of 'fabsf'
>  c:\php-compile\php-5.2.6rc5\ext\gd\libgd\gd.c(33) :
> warning C4005: 'floorf' : macro redefinition
>          c:\arquivos de programas\microsoft visual studio
> 9.0\vc\include\math.h(301) : see previous definition of 'floorf'
>  c:\php-compile\php-5.2.6rc5\main\win95nt.h(75) : warning
> C4005: 'WINDOWS' : macro redefinition
>
> c:\php-compile\zlib-1.2.3-src\src\zlib\1.2.3\zlib-1.2.3\zconf.h(69)
> : see previous definition of 'WINDOWS'
>  c:\php-compile\php-5.2.6rc5\win32\glob.c(517) : warning
> C4090: 'function' : different 'const' qualifiers
>  c:\arquivos de programas\microsoft visual studio
> 9.0\vc\include\crtdbg.h(628) : warning C4005: '_malloca' : macro
> redefinition
>          c:\arquivos de programas\microsoft visual studio
> 9.0\vc\include\malloc.h(220) : see previous definition of '_malloca'
>  c:\php-compile\php-5.2.6rc5\tsrm\readdir.h(10) : warning
> C4005: '_WIN32_WINNT' : macro redefinition
>          c:\php-compile\php-5.2.6rc5\win32\time.c(27) : see
> previous definition of '_WIN32_WINNT'
>  c:\php-compile\php-5.2.6rc5\ext\curl\interface.c(1099) :
> warning C4098: 'zif_curl_init' : 'void' function returning a value
>  c:\php-compile\php-5.2.6rc5\ext\curl\interface.c(1099) :
> warning C4098: 'zif_curl_init' : 'void' function returning a value
>  c:\php-compile\php-5.2.6rc5\ext\curl\interface.c(1099) :
> warning C4098: 'zif_curl_init' : 'void' function returning a value
>  c:\php-compile\php-5.2.6rc5\ext\standard\scanf.c(397) :
> warning C4129: '%' : unrecognized character escape sequence
>  c:\php-compile\php-5.2.6rc5\ext\standard\scanf.c(397) :
> warning C4129: '%' : unrecognized character escape sequence
>
>  Thanks,
>  Jaris.
>
>
>  Richard Quadling wrote:
>  
>
>
>  
>
>
>
>  Another warning is that some of the constants are redefined to a
> different value from the ones that are part of the compiler. The
> /TRSM/readdir.h, _WIN32_WINNT is redefined from 0x0600 in C:\Program
> Files\Microsoft
>
>  SDKs\Windows\v6.1\include\sdkddkver.h(186).
>
>
>  This 1 #define causes a LOT of noise during compilation. I know I
> could suppress all the warnings, but with so much noise, how does
> anyone see the true warnings in the noise?
>
> By adding a #undef _WIN32_WINNT before #define _WIN32_WINNT 0x0400,
> this removes the warning. It is more or less every .c compile.
>
>
>  http://dev.daylessday.org/diff/readdir_winnt.diff
>  Did I get you right ?
>
>  --
>  Wbr, Antony Dovgal
>
>
>  Yes on the patch. There are a few more like this. It is just a cosmetic
> issue.
>
> I am using Microsoft Visual C++ 2008 Express Edition with the Windows
> Server 2008 and .NET 3.4 SDK.
>
> I'm NOT running Apache (so runtime version issues there don't apply),
> and I am only playing/learning - this is going nowhere near my
> live/dev servers. Just learning.
>
>
> My next goal is to get a version of Linux so I can build and test my
> suggestions on 2 platforms. Hopefully, my patches/suggestions will
> have more support!
>
> Thank you.
>
> Richard.
>
>
>
>
>
> --
>
>
>
> Jarismar Chaves da Silva, M.Sc.
>
> ADPLabs Brazil
>  jarismar_silva@adplabs.com.br
>  http://www.adp.com
>
>

I suppose my question is how much noise do you get on a unix build?
Assume the defaults for error/warning reporting during compilation.


-- 
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"
