Mailing List Archive

compiler warnings
Hi,

I was coming back to an issue I saw in the past but didn't anything. I
think it is related to all qmail derivates. At least qmail-1.03 and
netqmail-1.06 are affected as s/qmail-3.01 too.

During make several times gcc creates a warning for .c files which uses
the SUBSTDIO_FDBUF macro, defined in substdio.h. This example reproduces
it:

# gcc -fsyntax-only subfderr.c
subfderr.c:8:1: warning: initialization from incompatible pointer type
static substdio it = SUBSTDIO_FDBUF(write,2,subfd_errbuf,256);
^
subfderr.c:8:1: warning: (near initialization for ‘it.op’)


With my rudimental C expierience I would expect that a cast have to be
done, but maybe I'm wrong. So the questions are

1. Does anybody have had the same issue and did solve it? What is the
solution?
2. Could anybody provide a solution or point me in the right direction?
3. In case a pointer cast is needed, where have it be done?

System is an up-to-date Gentoo with gcc-4.9.3.

Any help is appreciated.

thanks and regards
Kai

--
-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠
Dyn@mic IP'ing: http://dyndn.es
!!! DynDN.eS is NOT dyn.com !!!
Re: compiler warnings [ In reply to ]
Do you have glibc on your machine ?
On 14 Jan 2016 20:27, "K. Peter" <kp@dyndn.es> wrote:

> Hi,
>
> I was coming back to an issue I saw in the past but didn't anything. I
> think it is related to all qmail derivates. At least qmail-1.03 and
> netqmail-1.06 are affected as s/qmail-3.01 too.
>
> During make several times gcc creates a warning for .c files which uses
> the SUBSTDIO_FDBUF macro, defined in substdio.h. This example reproduces it:
>
> # gcc -fsyntax-only subfderr.c
> subfderr.c:8:1: warning: initialization from incompatible pointer type
> static substdio it = SUBSTDIO_FDBUF(write,2,subfd_errbuf,256);
> ^
> subfderr.c:8:1: warning: (near initialization for ‘it.op’)
>
>
> With my rudimental C expierience I would expect that a cast have to be
> done, but maybe I'm wrong. So the questions are
>
> 1. Does anybody have had the same issue and did solve it? What is the
> solution?
> 2. Could anybody provide a solution or point me in the right direction?
> 3. In case a pointer cast is needed, where have it be done?
>
> System is an up-to-date Gentoo with gcc-4.9.3.
>
> Any help is appreciated.
>
> thanks and regards
> Kai
>
> --
> -⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠
> Dyn@mic IP'ing: http://dyndn.es
> !!! DynDN.eS is NOT dyn.com !!!
>
>
Re: compiler warnings [ In reply to ]
On 2016-01-14 19:51, Shepherd Nhongo wrote:
> Do you have glibc on your machine ?

It is glibc-2.21.

> On 14 Jan 2016 20:27, "K. Peter" <kp@dyndn.es> wrote:
>
>> Hi,
>>
>> I was coming back to an issue I saw in the past but didn't
>> anything. I think it is related to all qmail derivates. At least
>> qmail-1.03 and netqmail-1.06 are affected as s/qmail-3.01 too.
>>
>> During make several times gcc creates a warning for .c files which
>> uses the SUBSTDIO_FDBUF macro, defined in substdio.h. This example
>> reproduces it:
>>
>> # gcc -fsyntax-only subfderr.c
>> subfderr.c:8:1: warning: initialization from incompatible pointer
>> type
>> static substdio it = SUBSTDIO_FDBUF(write,2,subfd_errbuf,256);
>> ^
>> subfderr.c:8:1: warning: (near initialization for ‘it.op’)
>>
>> With my rudimental C expierience I would expect that a cast have to
>> be done, but maybe I'm wrong. So the questions are
>>
>> 1. Does anybody have had the same issue and did solve it? What is
>> the solution?
>> 2. Could anybody provide a solution or point me in the right
>> direction?
>> 3. In case a pointer cast is needed, where have it be done?
>>
>> System is an up-to-date Gentoo with gcc-4.9.3.
>>
>> Any help is appreciated.
>>
>> thanks and regards
>> Kai
>>
>> --
>>
> -⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠
>> Dyn@mic IP'ing: http://dyndn.es [1]
>> !!! DynDN.eS is NOT dyn.com [2] !!!
>
>
> Links:
> ------
> [1] http://dyndn.es
> [2] http://dyn.com

--
-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠
Dyn@mic IP'ing: http://dyndn.es
!!! DynDN.eS is NOT dyn.com !!!
Re: compiler warnings [ In reply to ]
On Thu, 14 Jan 2016 at 23:56 K. Peter <kp@dyndn.es> wrote:

> # gcc -fsyntax-only subfderr.c
> subfderr.c:8:1: warning: initialization from incompatible pointer type
> static substdio it = SUBSTDIO_FDBUF(write,2,subfd_errbuf,256);
> ^
> subfderr.c:8:1: warning: (near initialization for ‘it.op’)
>
>
> With my rudimental C expierience I would expect that a cast have to be
> done, but maybe I'm wrong. So the questions are
>
>
include unistd.h for the prototype for write() system call and abracadabra,
your warning will dissappear.
Re: compiler warnings [ In reply to ]
On 2016-01-15 04:38, Manvendra Bhangui wrote:
> On Thu, 14 Jan 2016 at 23:56 K. Peter <kp@dyndn.es> wrote:
>
>> # gcc -fsyntax-only subfderr.c
>> subfderr.c:8:1: warning: initialization from incompatible pointer
>> type
>> static substdio it = SUBSTDIO_FDBUF(write,2,subfd_errbuf,256);
>> ^
>> subfderr.c:8:1: warning: (near initialization for ‘it.op’)
>>
>> With my rudimental C expierience I would expect that a cast have to
>> be
>> done, but maybe I'm wrong. So the questions are
>
> include unistd.h for the prototype for write() system call and
> abracadabra, your warning will dissappear.

Hi Manvendra,

thanks for the response, it puts me to the right direction.

I solved the issue by creating a readwrite2.h files:

# cat readwrite.h
#ifndef READWRITE_H
#define READWRITE_H

#include <unistd.h>

#endif
----
# cat readwrite2.h
#ifndef READWRITE2_H
#define READWRITE2_H

extern int read();
extern int write();

#endif

Now I included one of these in the needed .c files. It is IMHO a bit
quick and dirty, maybe I will investigate to find a better solution.

For those who interested in the background: the "extern" declarations of
the original readwrite.h are conflicting with the declarations in
unistd.h. This (may be) affects other files too, e.g. timeoutconn.c -
using unistd.h here will result in a warning of unused results by gcc.

I have to appologize that I gave an incorrect information initially. The
netqmail-1.06 source code is absolutely ok related to this case (didn't
check it but assume qmail-1.03 too). It was a mistake from my side - I
did put unistd.h in the source code before. It looks like sqmail-3.01
still have this issue (@Erwin?).

Btw, thanks for help.
Kai

--
-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠
Dyn@mic IP'ing: http://dyndn.es
!!! DynDN.eS is NOT dyn.com !!!
Re: compiler warnings [ In reply to ]
Hi,

this problem has been solved within s/qmail (code refactoring).


http://fehcom.de/sqmail/doxygen/readwrite_8h_source.html



> Am 15.01.2016 um 12:06 schrieb K. Peter <kp@dyndn.es>:
>
> On 2016-01-15 04:38, Manvendra Bhangui wrote:
>> On Thu, 14 Jan 2016 at 23:56 K. Peter <kp@dyndn.es> wrote:
>>> # gcc -fsyntax-only subfderr.c
>>> subfderr.c:8:1: warning: initialization from incompatible pointer
>>> type
>>> static substdio it = SUBSTDIO_FDBUF(write,2,subfd_errbuf,256);
>>> ^
>>> subfderr.c:8:1: warning: (near initialization for ‘it.op’)
>>> With my rudimental C expierience I would expect that a cast have to
>>> be
>>> done, but maybe I'm wrong. So the questions are
>> include unistd.h for the prototype for write() system call and
>> abracadabra, your warning will dissappear.
>
> Hi Manvendra,
>
> thanks for the response, it puts me to the right direction.
>
> I solved the issue by creating a readwrite2.h files:
>
> # cat readwrite.h
> #ifndef READWRITE_H
> #define READWRITE_H
>
> #include <unistd.h>
>
> #endif
> ----
> # cat readwrite2.h
> #ifndef READWRITE2_H
> #define READWRITE2_H
>
> extern int read();
> extern int write();
>
> #endif
>
> Now I included one of these in the needed .c files. It is IMHO a bit quick and dirty, maybe I will investigate to find a better solution.
>
> For those who interested in the background: the "extern" declarations of the original readwrite.h are conflicting with the declarations in unistd.h. This (may be) affects other files too, e.g. timeoutconn.c - using unistd.h here will result in a warning of unused results by gcc.
>
> I have to appologize that I gave an incorrect information initially. The netqmail-1.06 source code is absolutely ok related to this case (didn't check it but assume qmail-1.03 too). It was a mistake from my side - I did put unistd.h in the source code before. It looks like sqmail-3.01 still have this issue (@Erwin?).
>
> Btw, thanks for help.
> Kai
>
>

Best regards.
--eh.

Dr. Erwin Hoffmann | FEHCom | http://www.fehcom.de <http://www.fehcom.de/> | PGP Key-Id: EE00CF6