Skip to content

Commit

Permalink
Do not mix system and bdwgc headers in same include group
Browse files Browse the repository at this point in the history
Issue #364 (bdwgc).

This is needed to prevent clang-format to change the order of included
header files where the order is important.

* cord/tests/de.c [WIN32]: Move include de_win.h down to be in
a separate include group (from that of windows.h).
* extra/AmigaOS.c: Place a blank line after include gc_priv.h.
* include/private/gc_priv.h [ANY_MSWIN]: Place a blank line between
include windows.h and winbase.h (and add a comment).
* pthread_stop_world.c [GC_ENABLE_SUSPEND_THREAD]: Place a blank line
between include sys/time.h and javaxfc.h; reformat comment.
* tests/gctest.c: Place a blank line between include gc.h and
javaxfc.h.
* tests/weakmap.c [GC_PTHREADS]: Move include errno.h and pthread.h
upper (to be in a separate include group).
  • Loading branch information
ivmai committed Sep 26, 2024
1 parent 5b58447 commit 561e9b8
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 4 deletions.
5 changes: 4 additions & 1 deletion cord/tests/de.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
# endif
# define NOSERVICE
# include <windows.h>
# include "de_win.h"
#elif defined(MACINTOSH)
# include <console.h>
/* curses emulation. */
Expand All @@ -73,6 +72,10 @@
# define de_error(s) { fprintf(stderr, s); sleep(2); }
#endif

#ifdef WIN32
# include "de_win.h"
#endif

#include "de_cmds.h"

#if defined(CPPCHECK)
Expand Down
1 change: 1 addition & 0 deletions extra/AmigaOS.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#if !defined(GC_AMIGA_DEF) && !defined(GC_AMIGA_SB) && !defined(GC_AMIGA_DS) && !defined(GC_AMIGA_AM)
# include "private/gc_priv.h"

# include <stdio.h>
# include <signal.h>
# define GC_AMIGA_DEF
Expand Down
2 changes: 2 additions & 0 deletions include/private/gc_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ typedef struct hblkhdr hdr;
# endif
# define NOSERVICE
# include <windows.h>

/* This is included strictly after windows.h. */
# include <winbase.h>
#endif /* ANY_MSWIN */

Expand Down
4 changes: 3 additions & 1 deletion pthread_stop_world.c
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,9 @@ STATIC void GC_restart_handler(int sig)

# ifdef GC_ENABLE_SUSPEND_THREAD
# include <sys/time.h>
# include "gc/javaxfc.h" /* to get the prototypes as extern "C" */

/* This is to get the prototypes as extern "C". */
# include "gc/javaxfc.h"

STATIC void GC_brief_async_signal_safe_sleep(void)
{
Expand Down
1 change: 1 addition & 0 deletions tests/gctest.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
# undef GC_NO_THREAD_REDIRECTS
#endif
#include "gc.h"

#include "gc/javaxfc.h"

/* Number of additional threads to fork. */
Expand Down
7 changes: 5 additions & 2 deletions tests/weakmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@

#include <string.h>

#ifdef GC_PTHREADS
# include <errno.h> /* for EAGAIN, EBUSY */
# include <pthread.h>
#endif

#undef rand
/* Note: concurrent update of seed does not hurt the test. */
static GC_RAND_STATE_T seed;
Expand All @@ -41,8 +46,6 @@ static GC_RAND_STATE_T seed;
/* This excludes the main thread, which also runs a test. */
# define NTHREADS 5
# endif
# include <errno.h> /* for EAGAIN, EBUSY */
# include <pthread.h>
# include "private/gc_atomic_ops.h" /* for AO_t and AO_fetch_and_add1 */
#else
# undef NTHREADS
Expand Down

0 comments on commit 561e9b8

Please sign in to comment.