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

Submitter:  Ashley Duncan <ashesman>
Submitted:  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;
#else
typedef long _ssize_t;
#endif

Current code from line 118 of arch.h

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

Ashley Duncan <ashesman>

 

(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 ashesman (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.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code