Skip to content

Commit bdbcc76

Browse files
committed
debug.h: Avoid cyclic include dependency
The "lwip/opt.h" header file includes "lwip/debug.h". Do not include "lwip/opt.h" in "lwip/debug.h". Produce an error if "lwip/debug.h" is included before "lwip/opt.h".
1 parent 56b29f8 commit bdbcc76

File tree

6 files changed

+9
-2
lines changed

6 files changed

+9
-2
lines changed

contrib/ports/freertos/sys_arch.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
*/
3232

3333
/* lwIP includes. */
34+
#include "lwip/opt.h"
3435
#include "lwip/debug.h"
3536
#include "lwip/def.h"
3637
#include "lwip/sys.h"

contrib/ports/unix/port/netif/fifo.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
/* ---------------------------------------------- */
44
/* --- fifo 4 unix ------------------------------ */
55
/* ---------------------------------------------- */
6+
#include "lwip/opt.h"
67
#include "lwip/err.h"
78
#include "netif/fifo.h"
89
#include "lwip/debug.h"

contrib/ports/unix/port/netif/pcapif.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
#ifndef linux /* Apparently, this doesn't work under Linux. */
3434

35+
#include "lwip/opt.h"
3536
#include "lwip/debug.h"
3637

3738
#include <fcntl.h>

contrib/ports/unix/port/netif/sio.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#include "netif/sio.h"
1919
#include "netif/fifo.h"
20+
#include "lwip/opt.h"
2021
#include "lwip/debug.h"
2122
#include "lwip/def.h"
2223
#include "lwip/sys.h"

contrib/ports/unix/port/sys_arch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
*/
4747
#define _GNU_SOURCE /* pull in pthread_setname_np() on Linux */
4848

49+
#include "lwip/opt.h"
4950
#include "lwip/debug.h"
5051

5152
#include <string.h>
@@ -64,7 +65,6 @@
6465
#endif
6566

6667
#include "lwip/sys.h"
67-
#include "lwip/opt.h"
6868
#include "lwip/stats.h"
6969
#include "lwip/tcpip.h"
7070

src/include/lwip/debug.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@
3838
#define LWIP_HDR_DEBUG_H
3939

4040
#include "lwip/arch.h"
41-
#include "lwip/opt.h"
41+
42+
#ifndef LWIP_HDR_OPT_H
43+
#error "lwip/opt.h must be included before this header file"
44+
#endif
4245

4346
/**
4447
* @defgroup debugging_levels LWIP_DBG_MIN_LEVEL and LWIP_DBG_TYPES_ON values

0 commit comments

Comments
 (0)