patchlwIP - A Lightweight TCP/IP stack - Patches: patch #6481, sio.h minor fix

 
 

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

patch #6481: sio.h minor fix

Submitter:  Iordan Neshev <iordan_neshev>
Submitted:  Wed 26 Mar 2008 02:56:49 PM UTC
   
 
Category:  None Priority:  3 - Low
Status:  Done Privacy:  Public
Assigned to:  goldsimon Open/Closed:  Closed
Planned Release:  None

Jump to the original submission

Thu 27 Mar 2008 06:39:38 PM UTC, comment #6: 

No problem !

Frédéric Bernon <fbernon>
Group Member
Thu 27 Mar 2008 06:13:01 PM UTC, comment #5: 

I checked in the #ifndef _SIO_H_.

Frédéric, I'm sorry but I just discovered it was assigned to you. I'll close it anyway...

Simon Goldschmidt <goldsimon>
Group administrator
Thu 27 Mar 2008 05:57:12 PM UTC, comment #4: 


> Follow-up Comment #3, patch #6481 (project lwip):
>
>> What is missing is a global #ifndef SIO_H.
>
> Yes. This is definetely right. After I added it I no
> longer need the missing "#define __sio_fd_t_defined"
>
> It would be good if this was possible:
>
> #ifndef  sio_fd_t /* instead of __sio_fd_t_defined  */
> typedef void * sio_fd_t;
> #endif
>
> Unfortunately my compiler does not understand it.


That doesn't work: the typedef can't be checked with a preprocessor directive. Thus you can't test it like this.

>> ...the function prototypes also don't define the macro...
>
> For the functions in sio.h I do not need to define anywhere anything. I just
> write (for example) this in sio.c :
>
> void sio_send(u8_t ch, sio_fd_t psio)
> {
>   WriteRS1(ch); /* send char over UART1 */
> }


Of course, that's what it's meant like. The #ifndef's around the function prototypes are included to be able to include a define in cc.h that defines them to some other function. That way, sio_send can be a define or a function. But if it is a function, it must have the signature like defined in sio.h. Also, sio_fd_t is the only problem here because functions can be prototyped more than once while a second typedef gives an error.

But the global #ifndef _SIO_H_ is the cleaner solution anyway. It just happened that (as far as I know) no current developer is using this file: slipif is currently not very much used.

>
> If I understand you right, anyone who has this type already defined by the
> system  should add this:
> #define __sio_fd_t_defined
> in his cc.h. Right?


Exactly.

Simon Goldschmidt <goldsimon>
Group administrator
Thu 27 Mar 2008 08:04:34 AM UTC, comment #3: 


> What is missing is a global #ifndef SIO_H.


Yes. This is definetely right. After I added it I no
longer need the missing "#define __sio_fd_t_defined"

It would be good if this was possible:

#ifndef  sio_fd_t /* instead of __sio_fd_t_defined  */
typedef void * sio_fd_t;
#endif

Unfortunately my compiler does not understand it.



> ...the function prototypes also don't define the macro...


For the functions in sio.h I do not need to define anywhere anything. I just write (for example) this in sio.c :

void sio_send(u8_t ch, sio_fd_t psio)
{
  WriteRS1(ch); /* send char over UART1 */
}

>... their #ifdef statement. I think the #ifdef is included...


Did you mean #ifNdef ?

If I understand you right, anyone who has this type already defined by the system  should add this:
#define __sio_fd_t_defined
in his cc.h. Right?

Iordan Neshev <iordan_neshev>
Wed 26 Mar 2008 06:40:21 PM UTC, comment #2: 

I have one objection: the function prototypes also don't define the macro that is used in their #ifdef statement. I think the #ifdef is included so that you can put a define into your cc.h if the type is already defined by your system.

What is missing is a global #ifndef _SIO_H_.

Simon Goldschmidt <goldsimon>
Group administrator
Wed 26 Mar 2008 06:34:34 PM UTC, comment #1: 

no objections ?

Frédéric Bernon <fbernon>
Group Member
Wed 26 Mar 2008 02:56:49 PM UTC, original submission:  


in file sio.h, line 42

#ifndef __sio_fd_t_defined
#define __sio_fd_t_defined   <-- this is missing
typedef void * sio_fd_t;
#endif

Sorry for not submitting this before the official release:

Iordan Neshev <iordan_neshev>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by fbernon (Posted a comment)
  • -email is unavailable- added by iordan_neshev (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2008-03-27 fbernon Assigned tofbernon goldsimon
    2008-03-27 goldsimon StatusNone Done
        Open/ClosedOpen Closed
    2008-03-26 fbernon Assigned toNone fbernon

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code