lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [bug #43235] Numerous compiler warnings in ppp_new code


From: Sylvain Rochet
Subject: [lwip-devel] [bug #43235] Numerous compiler warnings in ppp_new code
Date: Sun, 12 Oct 2014 19:20:08 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 Iceweasel/31.1.0

Update of bug #43235 (project lwip):

                Severity:              3 - Normal => 1 - Wish               

    _______________________________________________________

Follow-up Comment #4:

> I have to admit it's the first time I'm compiling the PPP code with the
win32 project with PPP enabled, but I really get many warnings.
> Is the original code really in that bad shape? Are these our changes or are
the warnings in the original code?

Both, but mostly in the original code, pppd is not compiled with -Wextra. 
This is not really in bad shape, those warnings are more boring than anything
else.


> Also the code uses tabs and spaces mixed, which makes it really hard to
read...

Yup, with mixed snake_case and CamelCase, it does not bother me anymore for
quite a while, this is several times worse on what I have to deal every day at
work, I learnt the hard way to deal with it.


> Anyway, here's a list of warnings I get on current git master (sorry, it's
german, I don't have the english VS around right now; you can get the english
version from google :):
> 
> lwip\src\netif\ppp\polarssl\md5.c(229) : warning C4013: 'memcpy'
undefiniert; Annahme: extern mit Rückgabetyp int

Looks like you forgot an #include in your lwipopts.h about the MEMCPY() macro.
Note that opt.h defaults to memcpy() without including <string.h>, this is
acceptable but wrong anyway.


> lwip\src\netif\ppp\utils.c(212) : warning C4146: Einem vorzeichenlosen Typ
wurde ein unärer Minus-Operator zugewiesen. Das Ergebnis ist weiterhin
vorzeichenlos.

I added a cast for that, I don't know if your compiler is happy now. gcc does
not warn about it, this is expected behavior.


> lwip\src\netif\ppp\utils.c(609) : warning C4100: 'buf': Unreferenzierter
formaler Parameter
> lwip\src\netif\ppp\utils.c(609) : warning C4100: 'level': Unreferenzierter
formaler Parameter
> lwip\src\netif\ppp\upap.c(454) : warning C4100: 'id': Unreferenzierter
formaler Parameter
> lwip\src\netif\ppp\upap.c(488) : warning C4100: 'id': Unreferenzierter
formaler Parameter
> lwip\src\netif\ppp\ppp.c(1932) : warning C4100: 'pcb': Unreferenzierter
formaler Parameter
> lwip\src\netif\ppp\ppp.c(2013) : warning C4100: 'mtu': Unreferenzierter
formaler Parameter
> lwip\src\netif\ppp\lcp.c(2616) : warning C4100: 'id': Unreferenzierter
formaler Parameter
> lwip\src\netif\ppp\chap-new.c(486) : warning C4100: 'id': Unreferenzierter
formaler Parameter
> lwip\src\netif\ppp\chap-md5.c(97) : warning C4100: 'private':
Unreferenzierter formaler Parameter
> lwip\src\netif\ppp\chap-md5.c(95) : warning C4100: 'our_name':
Unreferenzierter formaler Parameter
> lwip\src\netif\ppp\auth.c(548) : warning C4100: 'pcb': Unreferenzierter
formaler Parameter
> lwip\src\netif\ppp\auth.c(1083) : warning C4100: 'protocol':
Unreferenzierter formaler Parameter
> lwip\src\netif\ppp\auth.c(1161) : warning C4100: 'proto': Unreferenzierter
formaler Parameter
> lwip\src\netif\ppp\auth.c(1211) : warning C4100: 'proto': Unreferenzierter
formaler Parameter
> lwip\src\netif\ppp\auth.c(1229) : warning C4100: 'proto': Unreferenzierter
formaler Parameter 
> lwip\src\netif\ppp\ipcp.c(2043) : warning C4100: 'replacedefaultroute':
Unreferenzierter formaler Parameter

Fixed, however, I still consider it as the least useful warning on earth ;-)


> lwip\src\netif\ppp\upap.c(539) : warning C4310: Typumwandlung verkürzt
konstante Werte
> lwip\src\netif\ppp\lcp.c(841) : warning C4310: Typumwandlung verkürzt
konstante Werte
> lwip\src\netif\ppp\lcp.c(852) : warning C4310: Typumwandlung verkürzt
konstante Werte
> lwip\src\netif\ppp\lcp.c(1067) : warning C4100: 'treat_as_reject':
Unreferenzierter formaler Parameter
> lwip\src\netif\ppp\lcp.c(1918) : warning C4310: Typumwandlung verkürzt
konstante Werte
> lwip\src\netif\ppp\lcp.c(1956) : warning C4310: Typumwandlung verkürzt
konstante Werte
> lwip\src\netif\ppp\lcp.c(1972) : warning C4310: Typumwandlung verkürzt
konstante Werte
> lwip\src\netif\ppp\lcp.c(2038) : warning C4310: Typumwandlung verkürzt
konstante Werte
> lwip\src\netif\ppp\lcp.c(2045) : warning C4310: Typumwandlung verkürzt
konstante Werte
> lwip\src\netif\ppp\chap-new.c(464) : warning C4310: Typumwandlung verkürzt
konstante Werte

I don't know what to do, gcc does not warn about that. Looks like a dumb
compiler for me, the following is triggering that:

#define PPP_EAP         0xc227  /* Extensible Authentication Protocol */
#define PUTSHORT(s, cp) { \
        *(cp)++ = (u_char) ((s) >> 8); \
        *(cp)++ = (u_char) (s); \
}
PUTSHORT(PPP_EAP, nakoutp);


lwip\src\netif\ppp\fsm.c(518) : warning C4706: Zuweisung in bedingtem
Ausdruck
lwip\src\netif\ppp\fsm.c(525) : warning C4706: Zuweisung in bedingtem
Ausdruck

What is wrong with that ?  This is expected behavior where it is currently
used.


> There also seem to be some lines using '#if XYZ' checking for non-existent
preprocessor macros. This is non-standard (gcc should warn about it) and these
macros should be predefined in opt.h or ppp.h.

My fault, fixed.


Sylvain

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?43235>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]