[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-devel] [bug #57885] Conflicting types for ssizet
From: |
Ashley Duncan |
Subject: |
[lwip-devel] [bug #57885] Conflicting types for ssizet |
Date: |
Sun, 23 Feb 2020 16:19:39 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:73.0) Gecko/20100101 Firefox/73.0 |
URL:
<https://savannah.nongnu.org/bugs/?57885>
Summary: Conflicting types for ssizet
Project: lwIP - A Lightweight TCP/IP stack
Submitted by: 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
Discussion Lock: Any
Planned Release: None
lwIP version: 2.1.0
_______________________________________________________
Details:
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 */
_______________________________________________________
Reply to this item at:
<https://savannah.nongnu.org/bugs/?57885>
_______________________________________________
Message sent via Savannah
https://savannah.nongnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lwip-devel] [bug #57885] Conflicting types for ssizet,
Ashley Duncan <=