buglwIP - A Lightweight TCP/IP stack - Bugs: bug #37552, [ppp-new] IAR EWARM won't compile...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #37552: [ppp-new] IAR EWARM won't compile ppp-new due to keyword clash

Submitted by:  Mark Lakata <lakata>
Submitted on:  Thu 11 Oct 2012 10:42:48 PM UTC  
 
Category: NoneSeverity: 2 - Minor
Item Group: Change RequestStatus: Fixed
Privacy: PublicAssigned to: Sylvain Rochet <gradator>
Open/Closed: ClosedPlanned Release: None
lwIP version: CVS Head

Fri 12 Oct 2012 06:24:15 PM UTC, comment #4:

Applied Mark proposed changes. Fixed!

Sylvain Rochet <gradator>
Project MemberIn charge of this item.
Fri 12 Oct 2012 09:49:05 AM UTC, comment #3:

>> Is 'class' used in the original PPP code as well?
> Yes, it is.


That's sad...

> Maybe enclosing it with extern "C" { } is enough.


a) No, it's not.
b) Even if it would then work at struct declaration, surrounding the code that accesses this member with extern "C" is not a good solution (and might not even work).

Simon Goldschmidt <goldsimon>
Project Administrator
Fri 12 Oct 2012 08:13:34 AM UTC, comment #2:

> Is 'class' used in the original PPP code as well?

Yes, it is. Maybe enclosing it with extern "C" { } is enough.

Sylvain Rochet <gradator>
Project MemberIn charge of this item.
Fri 12 Oct 2012 06:15:43 AM UTC, comment #1:

> Arguably it is a bug in the compiler


I'd very strongly vote to not use keywords as variable names, even if it should work.

Is 'class' used in the original PPP code as well?

Simon Goldschmidt <goldsimon>
Project Administrator
Thu 11 Oct 2012 10:42:48 PM UTC, original submission:

The word "class" is reserved in IAR's EWARM compiler since it looks like c++. This causes a failure to compile in the lcp code.

Arguably it is a bug in the compiler, but it is easy to work around with a name change in the lcp.[ch] code. I fixed it by changing "class" to "class_".

diff --git a/src/include/netif/ppp/lcp.h b/src/include/netif/ppp/lcp.h
index ec5e9a6..182af13 100644
--- a/src/include/netif/ppp/lcp.h
+++ b/src/include/netif/ppp/lcp.h
@@ -97,7 +97,7 @@
/* An endpoint discriminator, used with multilink. */
#define MAX_ENDP_LEN 20 /* maximum length of discriminator value */
struct epdisc {
- unsigned char class;
+ unsigned char class_;
unsigned char length;
unsigned char value[MAX_ENDP_LEN];
};
diff --git a/src/netif/ppp/lcp.c b/src/netif/ppp/lcp.c
index cb44e68..2d01831 100644
--- a/src/netif/ppp/lcp.c
+++ b/src/netif/ppp/lcp.c
@@ -866,7 +866,7 @@ static void lcp_addci(fsm f, u_char ucp, int *lenp) {
ADDCISHORT(CI_MRRU, go->neg_mrru, go->mrru);
#endif
ADDCIVOID(CI_SSNHF, go->neg_ssnhf);
- ADDCIENDP(CI_EPDISC, go->neg_endpoint, go->endpoint.class,
+ ADDCIENDP(CI_EPDISC, go->neg_endpoint, go->endpoint.class_,
go->endpoint.value, go->endpoint.length);

if (ucp - start_ucp != *lenp) {
@@ -1040,7 +1040,7 @@ static int lcp_ackci(fsm f, u_char p, int len) {
ACKCISHORT(CI_MRRU, go->neg_mrru, go->mrru);
#endif /* HAVE_MULTILINK */
ACKCIVOID(CI_SSNHF, go->neg_ssnhf);
- ACKCIENDP(CI_EPDISC, go->neg_endpoint, go->endpoint.class,
+ ACKCIENDP(CI_EPDISC, go->neg_endpoint, go->endpoint.class_,
go->endpoint.value, go->endpoint.length);

/*
@@ -1722,7 +1722,7 @@ static int lcp_rejci(fsm f, u_char p, int len) {
REJCISHORT(CI_MRRU, neg_mrru, go->mrru);
#endif /* HAVE_MULTILINK */
REJCIVOID(CI_SSNHF, neg_ssnhf);
- REJCIENDP(CI_EPDISC, neg_endpoint, go->endpoint.class,
+ REJCIENDP(CI_EPDISC, neg_endpoint, go->endpoint.class_,
go->endpoint.value, go->endpoint.length);

/*
@@ -2154,7 +2154,7 @@ static int lcp_reqci(fsm f, u_char inp, int *lenp, int reject_if_disagree) {
GETCHAR(cichar, p);
cilen -= CILEN_CHAR;
ho->neg_endpoint = 1;
- ho->endpoint.class = cichar;
+ ho->endpoint.class_ = cichar;
ho->endpoint.length = cilen;
MEMCPY(ho->endpoint.value, p, cilen);
INCPTR(cilen, p);

Mark Lakata <lakata>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by gradator (Posted a comment)
  • -unavailable- added by goldsimon (Posted a comment)
  • -unavailable- added by lakata (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 12 Oct 2012 06:24:15 PM UTCgradatorCategoryContrib=>None
      Severity3 - Normal=>2 - Minor
      StatusNone=>Fixed
      Assigned toNone=>gradator
      Open/ClosedOpen=>Closed
    Fri 12 Oct 2012 08:38:19 AM UTCgradatorSummaryIAR EWARM won\'t compile ppp-new due to keyword clash=>[ppp-new] IAR EWARM won't compile ppp-new due to keyword clash

    Back to the top


    Powered by Savane 3.1-cleanup1