lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [bugs #9191] Compiler problem with #define's


From: anonymous
Subject: [lwip-devel] [bugs #9191] Compiler problem with #define's
Date: Wed, 02 Jun 2004 11:54:52 -0400
User-agent: Mozilla/5.0

This mail is an automated notification from the bugs tracker
 of the project: lwIP - A Lightweight TCP/IP stack.




/**************************************************************************/
[bugs #9191] Full Item Snapshot:

URL: <http://savannah.nongnu.org/bugs/?func=detailitem&item_id=9191>
Project: lwIP - A Lightweight TCP/IP stack
Submitted by: 0
On: Wed 06/02/2004 at 15:53

Category:  IPv4
Severity:  5 - Average
Item Group:  Change Request
Resolution:  None
Assigned to:  None
Status:  Open


Summary:  Compiler problem with #define's

Original Submission:  This is most likely complier bugs. But since these 
problems exist in quite many mcu compilers it is probably a good thing to make 
it clearer to the compiler what we want it to do.

in ip.h line 143

In the original macro there is no explcit cast to u16_t for the ttl argument. 
When using the NC30 compiler for the M16 mcu this results in that (ttl)<<8 -> 
0. Is _ttl_proto guaranteed to be zero before the macro is called?

#define IPH_TTL_SET(hdr, ttl) (hdr)->_ttl_proto = (htons(IPH_PROTO(hdr) | 
(((u16_t)ttl) << 8)))


in ppp.h: line 182

four macros, GETSHORT, PUTSHORT, GETLONG, PUTLONG. They look like this:

#define GETSHORT(s, cp) { 
    (s) = *(cp)++ << 8; 
    (s) |= *(cp)++; 
}

The NC30 compiler *(cp++ << 8). This can be rewritten to avoid using these 
operator priorities.
#define GETSHORT(s, cp) { 
    (s) = *(cp); (cp)++; (s) << 8; 
    (s) |= *(cp); (cp)++;
}

regards
Bjorn (address@hidden)












For detailed info, follow this link:
<http://savannah.nongnu.org/bugs/?func=detailitem&item_id=9191>

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







reply via email to

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