buglwIP - A Lightweight TCP/IP stack - Bugs: bug #57885, Conflicting types for ssizet


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

bug #57885: Conflicting types for ssizet

Submitted by:  Ashley Duncan <ashesman>
Submitted on:  Sun 23 Feb 2020 09:19:37 PM UTC  
Category:  Platform ports Severity:  3 - Normal
Item Group:  Change Request Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open Planned Release:  None
lwIP version:  2.1.0

Sun 23 Feb 2020 09:19:37 PM UTC, original submission:  

I have recently tried to compile lwip on gcc 9, clang 9 and gcc-arm 9 and have run into the same error "conflicting types for ssize_t".  In each case SSIZE_MAX was not defined so ssize_t type was declared as int, see code sample below.

Unfortunately I am not experienced enough with all the different possible platforms to know the ideal solution for this (if there is even one), but some suggestions are:

1 - Use #include <stddef.h>
2 - Allow the user to define ssize_t in lwipopts.h
3 - Use _SIZE_TYPE_ or _SSIZE_T_DECLARED instead of SSIZE_MAX (this is declared in types.h"

Another important point is that defining ssize_t as int may be incorrect as it is may need to be defined as a long int (e.g. 64 bit systems).  If it is necessary to declare it as int, use _INT_MAX_ to decide if it should be int or long int (as per _types.h shown below).  In most cases this would probably remove the compiler warning as it would be defined as the same type from types.h.  This is what I have done for now.

#if defined(_INT_MAX_) && _INT_MAX_ == 2147483647
typedef int _ssize_t;
typedef long _ssize_t;

Current code from line 118 of arch.h

#ifdef SSIZE_MAX
/* If SSIZE_MAX is defined, unistd.h should provide the type as well */
#define LWIP_NO_UNISTD_H 0
#include <unistd.h>
#else /* SSIZE_MAX */
typedef long int ssize_t;
#endif /* SSIZE_MAX */

Ashley Duncan <ashesman>


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 ashesman (Submitted the item)

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

    Only logged-in users can vote.




    No changes have been made to this item

    Back to the top

    Powered by Savane 3.5