[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-devel] [bug #47625] Error in compilation of C++ source using netif
From: |
Freddie Chopin |
Subject: |
[lwip-devel] [bug #47625] Error in compilation of C++ source using netifapi macros |
Date: |
Tue, 05 Apr 2016 08:55:57 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36 |
URL:
<http://savannah.nongnu.org/bugs/?47625>
Summary: Error in compilation of C++ source using netifapi
macros
Project: lwIP - A Lightweight TCP/IP stack
Submitted by: freddie_chopin
Submitted on: Tue 05 Apr 2016 08:55:56 GMT
Category: None
Severity: 3 - Normal
Item Group: Faulty Behaviour
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Planned Release:
lwIP version: git head
_______________________________________________________
Details:
If you try to call any macro which uses netifapi_netif_common(), so for
example netifapi_netif_set_default(), in some cases the compilation will fail
in if the source file is in C++ doesn't include "NULL" definition (from
<cstddef>). For example in this trivial case:
--- >8 --- >8 --- >8 --- >8 --- >8 --- >8 ---
#include "lwip/netifapi.h"
void f(void)
{
struct netif netif;
netifapi_netif_set_default(&netif);
}
--- >8 --- >8 --- >8 --- >8 --- >8 --- >8 ---
Compilation fails with error message like this:
--- >8 --- >8 --- >8 --- >8 --- >8 --- >8 ---
arm-none-eabi-g++ -Wall -Wextra -Wshadow -std=gnu++11 -g -ggdb3
-mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -O2
-ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -MD -MP
-IlwIP-integration/include -Iexternal/lwIP/src/include -Ioutput/include
-Iexternal/distortos/include -Wno-shadow -c test.cpp -o output/./test.o
In file included from test.cpp:1:0:
test.cpp: In function 'void f()':
external/lwIP/src/include/lwip/netifapi.h:93:87: error: invalid conversion
from 'void*' to 'netifapi_errt_fn {aka signed char (*)(netif*)}'
[-fpermissive]
#define netifapi_netif_set_default(n) netifapi_netif_common(n,
netif_set_default, NULL)
^
test.cpp:6:2: note: in expansion of macro 'netifapi_netif_set_default'
netifapi_netif_set_default(&netif);
^
external/distortos/Makefile:238: recipe for target 'output/./test.o' failed
external/lwIP/src/include/lwip/netifapi.h:87:7: note: initializing argument
3 of 'err_t netifapi_netif_common(netif*, netifapi_void_fn,
netifapi_errt_fn)'
err_t netifapi_netif_common(struct netif *netif, netifapi_void_fn voidfunc,
^
make: *** [output/./test.o] Error 1
--- >8 --- >8 --- >8 --- >8 --- >8 --- >8 ---
Including <cstddef> in the source file helps, as well as including <stddef.h>
in netifapi.h, so I think that lwIP should include this system header in all
headers where NULL is used.
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/bugs/?47625>
_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/
- [lwip-devel] [bug #47625] Error in compilation of C++ source using netifapi macros,
Freddie Chopin <=
- [lwip-devel] [bug #47625] Error in compilation of C++ source using netifapi macros, Freddie Chopin, 2016/04/05
- [lwip-devel] [bug #47625] Error in compilation of C++ source using netifapi macros, Simon Goldschmidt, 2016/04/05
- [lwip-devel] [bug #47625] Error in compilation of C++ source using netifapi macros, Freddie Chopin, 2016/04/05
- [lwip-devel] [bug #47625] Error in compilation of C++ source using netifapi macros, Simon Goldschmidt, 2016/04/05
- [lwip-devel] [bug #47625] Error in compilation of C++ source using netifapi macros, Freddie Chopin, 2016/04/05
- [lwip-devel] [bug #47625] Error in compilation of C++ source using netifapi macros, Simon Goldschmidt, 2016/04/05
- [lwip-devel] [bug #47625] Error in compilation of C++ source using netifapi macros, Simon Goldschmidt, 2016/04/05