Re: Compiler Warnings from gcc 4.2.0
| From: | Tony | Date: | Thu, 01 May 2008 21:19:24 +0000 |
| Subject: | Re: Compiler Warnings from gcc 4.2.0 | ||
| References: | 1 2 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-5435@lists.php.net to get a copy of this message | ||
I guess I'll use the flag to bypass warning for now until 5.3 is available.
Thanks!
""M." "Karpelès"" <karpeles@ookoo.org> wrote in message
news:1209626773.25875.122.camel@localhost...
> Hello,
>
> This happens if you use C++ compiler. This warning is not generated by
> gcc, but by g++.
>
> Sample code (both my gcc and g++ are 4.2.3):
>
> magicaltux@Memol ~/test $ cat test.c
> #include <stdio.h>
>
> int main(int argc, char *argv[]) {
> char *foo = "Hello world!\n"; /* bad line */
> printf(foo);
> return 0;
> }
> magicaltux@Memol ~/test $ gcc -Wall -o test test.c
> magicaltux@Memol ~/test $ ./test
> Hello world!
> magicaltux@Memol ~/test $ g++ -Wall -o test test.c
> test.c: In function 'int main(int, char**)':
> test.c:4: attention : deprecated conversion from string constant to
> 'char*'
> magicaltux@Memol ~/test $ ./test
> Hello world!
>
> You can avoid displaying this warning by adding -Wno-write-strings to
> CXXFLAGS
>
> magicaltux@Memol ~/test $ g++ -Wall -Wno-write-strings -o test test.c
> magicaltux@Memol ~/test $ ./test
> Hello world!
>
>
>
> Anyway, tests to reproduce this warning should be done with g++. Testing
> with gcc will not produce any warning.
>
>
> Mark
>
> Le mercredi 30 avril 2008 à 08:18 -0700, Tony Ser a écrit :
>> Using gcc 4.2 and later to compile a php extension will generate quite a
>> few warnings.
>>
>> A typical zend_function_entry
>>
>> zend_function_entry xxx_functions[] =
>> {
>> ZEND_FE(Function1, NULL)
>> {NULL, NULL, NULL}
>> };
>>
>>
>> Will generate
>>
>> warning: deprecated conversion from string constant to 'char*'
>>
>>
>>
>> Just wonder will these warning be fixed in newer version of php headers ?
>>
>> Thanks!
>> Tony
>>
>